# Modelling & Simulations

**URL:** https://discourse.julialang.org/c/domain/models/21.md?page=18

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 19

---

## [Noise inside an activation function in DifferentialEquations.jl](https://discourse.julialang.org/t/noise-inside-an-activation-function-in-differentialequations-jl/118219)

<div class="topic-metadata">

**Author:** [@duodenum](https://discourse.julialang.org/u/duodenum)\
**Replies:** 2\
**Last updated:** [August 18, 2024, 3:19am UTC](https://discourse.julialang.org/t/noise-inside-an-activation-function-in-differentialequations-jl/118219 "2024-08-18T03:19:13Z")

</div>

Hello, I am interested in solving Wilson - Cowan equations (or in general, a differential equation where noise is not multiplicative or additive per se, but put inside an activation function). For example: \\frac{dx}{dt…

---

## [How to make \`step!(integrator)\` overcome initial stiffness issues](https://discourse.julialang.org/t/how-to-make-step-integrator-overcome-initial-stiffness-issues/118115)

<div class="topic-metadata">

**Author:** [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Replies:** 1\
**Last updated:** [August 17, 2024, 3:45pm UTC](https://discourse.julialang.org/t/how-to-make-step-integrator-overcome-initial-stiffness-issues/118115 "2024-08-17T15:45:46Z")

</div>

Related to my previous question, I now run into an issue with the step! interface. Sorry that I didn’t manage to create a MWE, if needed I will try harder :wink: At the moment, I am in a situation where for exactly the…

---

## [Modelingtoolkit odeproblem solution vector length 1](https://discourse.julialang.org/t/modelingtoolkit-odeproblem-solution-vector-length-1/118194)

<div class="topic-metadata">

**Author:** [@aavogt](https://discourse.julialang.org/u/aavogt)\
**Replies:** 4\
**Last updated:** [August 17, 2024, 12:07pm UTC](https://discourse.julialang.org/t/modelingtoolkit-odeproblem-solution-vector-length-1/118194 "2024-08-17T12:07:51Z")

</div>

I try to solve a Modelingtoolkit ODEProblem. Apparently it runs, but I can only access the initial condition. @mtkbuild m = Setup() prob = ODEProblem(m, \[\], (0.,100.), \[\]) sol = solve(prob) print(sol\[m.c.w\]) # get: \[0.0…

---

## [SciML: optimizing a control signal](https://discourse.julialang.org/t/sciml-optimizing-a-control-signal/117504)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 7\
**Last updated:** [August 16, 2024, 1:04am UTC](https://discourse.julialang.org/t/sciml-optimizing-a-control-signal/117504 "2024-08-16T01:04:59Z")

</div>

Suppose I’ve got a differential equation that takes some forcing / control signal as input defined as a DataInterpolation.LinearInterpolation(u, t) (similar to the tutorial example). I’d like to find the u vector which m…

---

## [Spacegrid subset](https://discourse.julialang.org/t/spacegrid-subset/118066)

<div class="topic-metadata">

**Author:** [@JCaro](https://discourse.julialang.org/u/JCaro)\
**Replies:** 7\
**Last updated:** [August 15, 2024, 7:22pm UTC](https://discourse.julialang.org/t/spacegrid-subset/118066 "2024-08-15T19:22:26Z")

</div>

I need to work on a simulation and i want to make a gridspace and sub-divide it, using random points in the grid and their respectivly voronoi polygons. Can someone give some directions on how/how not do it?? a image of…

---

## [Parallelize differential equation solve with interpolated forcing function](https://discourse.julialang.org/t/parallelize-differential-equation-solve-with-interpolated-forcing-function/118207)

<div class="topic-metadata">

**Author:** [@Dima\_Tretiak](https://discourse.julialang.org/u/Dima_Tretiak)\
**Replies:** 0\
**Last updated:** [August 14, 2024, 11:51pm UTC](https://discourse.julialang.org/t/parallelize-differential-equation-solve-with-interpolated-forcing-function/118207 "2024-08-14T23:51:08Z")

</div>

I’m trying to run a parameter sweep across various different forcing functions defined by interpolations through discrete data. My discrete data U\_all is of shape N x Nu x Nt where N is the number of forcing functions I …

---

## [Numerical-Code: Warnings and Errors due to scopes](https://discourse.julialang.org/t/numerical-code-warnings-and-errors-due-to-scopes/117946)

<div class="topic-metadata">

**Author:** [@EatMyShorts](https://discourse.julialang.org/u/EatMyShorts)\
**Replies:** 5\
**Last updated:** [August 10, 2024, 8:54pm UTC](https://discourse.julialang.org/t/numerical-code-warnings-and-errors-due-to-scopes/117946 "2024-08-10T20:54:08Z")

</div>

I am a newbie in Julia an I have written the following code: using LinearAlgebra using Plots t = 0; epsilon = 0.1; ########## initial data: Sod problem (rho,u,T) ########## Prim\_l = \[1 0 1\];…

---

## [Can't get NeuralPDE Example code to run](https://discourse.julialang.org/t/cant-get-neuralpde-example-code-to-run/118196)

<div class="topic-metadata">

**Author:** [@ericchenanp](https://discourse.julialang.org/u/ericchenanp)\
**Replies:** 0\
**Last updated:** [August 14, 2024, 5:58pm UTC](https://discourse.julialang.org/t/cant-get-neuralpde-example-code-to-run/118196 "2024-08-14T17:58:37Z")

</div>

Hi folks! I’m trying to get the example code for the NeuralPDE package up and running, but copy/pasting it returns the following: ERROR: DivideError: integer division error Does anyone know what I’m doing wrong, or wh…

---

## [Using DGMulti FDSBP with parabolic terms in Trixi?](https://discourse.julialang.org/t/using-dgmulti-fdsbp-with-parabolic-terms-in-trixi/118088)

<div class="topic-metadata">

**Author:** [@Kelian\_Renoux](https://discourse.julialang.org/u/Kelian_Renoux)\
**Replies:** 4\
**Last updated:** [August 13, 2024, 2:10pm UTC](https://discourse.julialang.org/t/using-dgmulti-fdsbp-with-parabolic-terms-in-trixi/118088 "2024-08-13T14:10:37Z")

</div>

Hi, I am comparing the methods in the DGMulti Solver from Trixi with a visquous example but when I try to use the Finite difference methods periodic\_derivative\_operator(derivative\_order=1, accuracy\_order=4, xmin=0.0, xma…

---

## [Using PreallocationTools with LinearSolve](https://discourse.julialang.org/t/using-preallocationtools-with-linearsolve/98508)

<div class="topic-metadata">

**Author:** [@clm](https://discourse.julialang.org/u/clm)\
**Replies:** 3\
**Last updated:** [August 12, 2024, 8:54pm UTC](https://discourse.julialang.org/t/using-preallocationtools-with-linearsolve/98508 "2024-08-12T20:54:48Z")

</div>

I’m trying to solve a large 2D PDE using this example as a template. I’m effectively trying to solve some simplified (though still nonlinear) pseudo-Boussinesq Navier Stokes equations where I evolve u and temperature and…

---

## [Modelling simple hydraulic using MTK Library](https://discourse.julialang.org/t/modelling-simple-hydraulic-using-mtk-library/118028)

<div class="topic-metadata">

**Author:** [@romantimo](https://discourse.julialang.org/u/romantimo)\
**Replies:** 0\
**Last updated:** [August 10, 2024, 1:34pm UTC](https://discourse.julialang.org/t/modelling-simple-hydraulic-using-mtk-library/118028 "2024-08-10T13:34:04Z")

</div>

Hi everyone, I’ll appreciate an advice on how to split fluid flow using MTK Standard Library. Volume1 (pressured) connected to tube1. Tube1 connected to tube2 and tube3. tube2 and tube3 connected to empty volumes 2 and…

---

## [Tell SciML about Jacobian/VJP of ODEFunction](https://discourse.julialang.org/t/tell-sciml-about-jacobian-vjp-of-odefunction/117986)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 2\
**Last updated:** [August 10, 2024, 5:58am UTC](https://discourse.julialang.org/t/tell-sciml-about-jacobian-vjp-of-odefunction/117986 "2024-08-10T05:58:31Z")

</div>

Hello, I have a class of ODEFunctions for which I know how to exploit a lot of the internal structure for efficient calculations of Jacobians. I am a bit confused about how I may teach the SciML-universe about those. Ge…

---

## [Parallel adaptive time-stepping for ODE problems at different time-scales](https://discourse.julialang.org/t/parallel-adaptive-time-stepping-for-ode-problems-at-different-time-scales/117982)

<div class="topic-metadata">

**Author:** [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Replies:** 1\
**Last updated:** [August 9, 2024, 10:55pm UTC](https://discourse.julialang.org/t/parallel-adaptive-time-stepping-for-ode-problems-at-different-time-scales/117982 "2024-08-09T22:55:28Z")

</div>

I’m wondering if there is already a mechanism for ugly coupling of differential equations. In my application, I have one large-dimensional SDE and a reaction-diffusion PDE, which are coupled and have different time scal…

---

## [MTK error messages, change of use?](https://discourse.julialang.org/t/mtk-error-messages-change-of-use/117931)

<div class="topic-metadata">

**Author:** [@LaraSchmalenstroer](https://discourse.julialang.org/u/LaraSchmalenstroer)\
**Replies:** 6\
**Last updated:** [August 9, 2024, 5:51pm UTC](https://discourse.julialang.org/t/mtk-error-messages-change-of-use/117931 "2024-08-09T17:51:51Z")

</div>

Hi, I’m relatively new to Julia, so maybe I don’t see the problem here. I’m currently working with ModelingToolkit. To get used to the functionalities, I created a small model last week (which worked perfectly). using …

---

## [ModellingToolkit and arrays](https://discourse.julialang.org/t/modellingtoolkit-and-arrays/117722)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [August 8, 2024, 5:47pm UTC](https://discourse.julialang.org/t/modellingtoolkit-and-arrays/117722 "2024-08-08T17:47:06Z")

</div>

I have the following code: # Example one: Falling mass. using ModelingToolkit, OrdinaryDiffEq G\_EARTH::Vector{Float64} = \[0.0, 0.0, -9.81\] # gravitational acceleration \[m/s²\] # definiting the model @independent…

---

## [MTK linearization: Change of use, or bug?](https://discourse.julialang.org/t/mtk-linearization-change-of-use-or-bug/117921)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 8\
**Last updated:** [August 8, 2024, 10:07am UTC](https://discourse.julialang.org/t/mtk-linearization-change-of-use-or-bug/117921 "2024-08-08T10:07:04Z")

</div>

I recently asked about a linearization problem I had – the problem persists. However, here I raise another question: ModelingToolkit linearization fails for a simple problem that used to work. Question: What is it I do …

---

## [\[crosspost\] JuliaDynamics meetings (poll closing soon!)](https://discourse.julialang.org/t/crosspost-juliadynamics-meetings-poll-closing-soon/117909)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 0\
**Last updated:** [August 7, 2024, 7:09am UTC](https://discourse.julialang.org/t/crosspost-juliadynamics-meetings-poll-closing-soon/117909 "2024-08-07T07:09:34Z")

</div>

Hi all, cross-posting here Monthly meetups kickstart: JuliaDynamics (and beyond!) in case someone is subscribed to this particular category, which where all related discussion actually happens. I’ll close the poll at t…

---

## [Solution indexing is very slow](https://discourse.julialang.org/t/solution-indexing-is-very-slow/117896)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 8\
**Last updated:** [August 6, 2024, 9:23pm UTC](https://discourse.julialang.org/t/solution-indexing-is-very-slow/117896 "2024-08-06T21:23:05Z")

</div>

When running the following code, the last two lines do the same thing: they get decay2.f at the last point in time. sol\[decay2.f\]\[end\] is the modelingtoolkit preferred way, while sol.u\[end\]\[2\] is using normal array index…

---

## [MTK -- how to set initial unknowns introduced by MTK?](https://discourse.julialang.org/t/mtk-how-to-set-initial-unknowns-introduced-by-mtk/117832)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 6\
**Last updated:** [August 6, 2024, 9:36am UTC](https://discourse.julialang.org/t/mtk-how-to-set-initial-unknowns-introduced-by-mtk/117832 "2024-08-06T09:36:17Z")

</div>

I’m converting a model from Modelica to ModelingToolkit in Julia. Modelica is somewhat more flexible wrt. specifying initial values for unknowns, so I have to change which initial unknowns I specify. Here is the model pr…

---

## [Modeling Toolkit: Vector equations and register symbolic interaction](https://discourse.julialang.org/t/modeling-toolkit-vector-equations-and-register-symbolic-interaction/117877)

<div class="topic-metadata">

**Author:** [@HSnowden](https://discourse.julialang.org/u/HSnowden)\
**Replies:** 0\
**Last updated:** [August 6, 2024, 8:53am UTC](https://discourse.julialang.org/t/modeling-toolkit-vector-equations-and-register-symbolic-interaction/117877 "2024-08-06T08:53:36Z")

</div>

Hi, I am trying to build a model within modeling toolkit where it is built on a grid, therefore defining variables as vectors, but inside the equations is an integral over the whole vector and it doesn’t seem to be work…

---

## [Help on ForwardDiff and Zygote for ODEProblem with mass matrix](https://discourse.julialang.org/t/help-on-forwarddiff-and-zygote-for-odeproblem-with-mass-matrix/117857)

<div class="topic-metadata">

**Author:** [@ccz](https://discourse.julialang.org/u/ccz)\
**Replies:** 8\
**Last updated:** [August 6, 2024, 8:27am UTC](https://discourse.julialang.org/t/help-on-forwarddiff-and-zygote-for-odeproblem-with-mass-matrix/117857 "2024-08-06T08:27:29Z")

</div>

Hi there, I’m new to SciMLSensitivity.jl and Zygote.jl and have been playing with these two libraries for a toy ODE system with a mass matrix. However, the Jacobians produced by the two libraries are different, and I ha…

---

## [CAD files in Julia](https://discourse.julialang.org/t/cad-files-in-julia/101898)

<div class="topic-metadata">

**Author:** [@KapilKhanal](https://discourse.julialang.org/u/KapilKhanal)\
**Replies:** 6\
**Last updated:** [August 5, 2024, 6:50pm UTC](https://discourse.julialang.org/t/cad-files-in-julia/101898 "2024-08-05T18:50:57Z")

</div>

Is there a Julia package that imports CAD files or generates Spline-based mesh for higher-order elements in a numerical simulation? I see some barebones packages like BSplines.jl but they don’t have much of functionality…

---

## [How to solve a nonlinear system with redundancy with NonlinearSolve.jl](https://discourse.julialang.org/t/how-to-solve-a-nonlinear-system-with-redundancy-with-nonlinearsolve-jl/117840)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 1\
**Last updated:** [August 5, 2024, 1:11pm UTC](https://discourse.julialang.org/t/how-to-solve-a-nonlinear-system-with-redundancy-with-nonlinearsolve-jl/117840 "2024-08-05T13:11:32Z")

</div>

Hi, I have problem using NonlinearSolve.jl to solve the following nonlinear system. The reason of the problem is because of the redundancy among the last 3 equations. I wonder if it is possible for NonlinearSolve.jl to …

---

## [How to implement similar functionality as in Simulink/Simscape by ModelingToolkitStandardLibrary.jl](https://discourse.julialang.org/t/how-to-implement-similar-functionality-as-in-simulink-simscape-by-modelingtoolkitstandardlibrary-jl/106597)

<div class="topic-metadata">

**Author:** [@Jan\_Svanda](https://discourse.julialang.org/u/Jan_Svanda)\
**Replies:** 14\
**Last updated:** [August 5, 2024, 3:53am UTC](https://discourse.julialang.org/t/how-to-implement-similar-functionality-as-in-simulink-simscape-by-modelingtoolkitstandardlibrary-jl/106597 "2024-08-05T03:53:27Z")

</div>

I try the Julia Modeling Toolkit as an alternative to Simulink/Simscape. I’m struggling a bit with the connection to the “classical” Julia code. I’m looking for something like a PS-Simulink converter block. The following…

---

## [Meep FDTD and Julia](https://discourse.julialang.org/t/meep-fdtd-and-julia/109309)

<div class="topic-metadata">

**Author:** [@mike.ingold](https://discourse.julialang.org/u/mike.ingold)\
**Replies:** 17\
**Last updated:** [August 4, 2024, 4:43pm UTC](https://discourse.julialang.org/t/meep-fdtd-and-julia/109309 "2024-08-04T16:43:05Z")

</div>

Regarding the FDTD solver Meep: GitHub - NanoComp/meep: free finite-difference time-domain (FDTD) software for electromagnetic simulations. Does anyone have any interest in either a Julia package to interface with Meep, …

---

## [Help porting to @mtkmodel DSL and a structural\_simplify error](https://discourse.julialang.org/t/help-porting-to-mtkmodel-dsl-and-a-structural-simplify-error/117648)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 6\
**Last updated:** [August 1, 2024, 12:24am UTC](https://discourse.julialang.org/t/help-porting-to-mtkmodel-dsl-and-a-structural-simplify-error/117648 "2024-08-01T00:24:20Z")

</div>

I have an MTK model (ported from the epidemics R package where I build the model using a loop. How are symbolic arrays dealt with in the @mtkmodel DSL? I’ve tried a few things, but I can’t find what I need to port this m…

---

## [Agent initialization](https://discourse.julialang.org/t/agent-initialization/117682)

<div class="topic-metadata">

**Author:** [@geoffD](https://discourse.julialang.org/u/geoffD)\
**Replies:** 0\
**Last updated:** [July 31, 2024, 2:45pm UTC](https://discourse.julialang.org/t/agent-initialization/117682 "2024-07-31T14:45:10Z")

</div>

Good morning, everyone. I have a model in which the @agent struct statement contains about 25 parameters for the agent. I would like to set this up such that I can specify default values and then overwrite one or two of …

---

## [Selecting agents of a specific class in agents.jl](https://discourse.julialang.org/t/selecting-agents-of-a-specific-class-in-agents-jl/117486)

<div class="topic-metadata">

**Author:** [@geoffD](https://discourse.julialang.org/u/geoffD)\
**Replies:** 9\
**Last updated:** [July 31, 2024, 11:01am UTC](https://discourse.julialang.org/t/selecting-agents-of-a-specific-class-in-agents-jl/117486 "2024-07-31T11:01:17Z")

</div>

Hi, I have an agents.jl model that uses two classes of GridAgent: Nurse and Patient. I’d like the step function to locate an available nurse and link them to an available patient: function nursepatient\_step!(nurse::Nur…

---

## [Plotting observed of DiscreteSystem](https://discourse.julialang.org/t/plotting-observed-of-discretesystem/117620)

<div class="topic-metadata">

**Author:** [@binnisb](https://discourse.julialang.org/u/binnisb)\
**Replies:** 4\
**Last updated:** [July 30, 2024, 10:52am UTC](https://discourse.julialang.org/t/plotting-observed-of-discretesystem/117620 "2024-07-30T10:52:47Z")

</div>

Hey. I wanted to try out MTK so I am moving an Excel calculation I had set up for calculating monthly repayments of a inflation linked loan to MTK. I got the model running. My issue is how to plot the observed values, …

---

## [Why step function doesn't recognise local model initialisation inside a function?](https://discourse.julialang.org/t/why-step-function-doesnt-recognise-local-model-initialisation-inside-a-function/117586)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 3\
**Last updated:** [July 29, 2024, 9:33am UTC](https://discourse.julialang.org/t/why-step-function-doesnt-recognise-local-model-initialisation-inside-a-function/117586 "2024-07-29T09:33:45Z")

</div>

Here is my function where I try to run ABM model inside a function. Now inside this function when I initialise model it works and also prints model but while using step!() it says model is not defined. Can someone shed …

[Previous page](https://discourse.julialang.org/c/domain/models/21.md?page=17)

[Next page](https://discourse.julialang.org/c/domain/models/21.md?page=19)
