# Modelling & Simulations

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

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

**Page:** 12

---

## [Solving the Heat Equation, changing the boundary conditions](https://discourse.julialang.org/t/solving-the-heat-equation-changing-the-boundary-conditions/126698)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 2\
**Last updated:** [March 7, 2025, 10:08pm UTC](https://discourse.julialang.org/t/solving-the-heat-equation-changing-the-boundary-conditions/126698 "2025-03-07T22:08:24Z")

</div>

Hi, I am trying to solve the heat equation with the SciML ecosystem. I found these docs as a good starting point. Despite reading the docs and old posts I couldn’t manage to reproduce the simple case from Wikipedia. T…

---

## [Switch in equations using ContinuousCallback is handled by Rodas5() but not QNDF()](https://discourse.julialang.org/t/switch-in-equations-using-continuouscallback-is-handled-by-rodas5-but-not-qndf/126690)

<div class="topic-metadata">

**Author:** [@sass-jacob](https://discourse.julialang.org/u/sass-jacob)\
**Replies:** 5\
**Last updated:** [March 7, 2025, 9:08pm UTC](https://discourse.julialang.org/t/switch-in-equations-using-continuouscallback-is-handled-by-rodas5-but-not-qndf/126690 "2025-03-07T21:08:05Z")

</div>

Here I have a problem where I’d like a constraint equation to switch once a constraint has been met for one of the auxiliary variables. This is a buildup to a large, stiff system that benefits greatly in performance fro…

---

## [Kronrod error when using QuadGK w/ symbolic inputs](https://discourse.julialang.org/t/kronrod-error-when-using-quadgk-w-symbolic-inputs/126587)

<div class="topic-metadata">

**Author:** [@JarodMcCormick](https://discourse.julialang.org/u/JarodMcCormick)\
**Replies:** 4\
**Last updated:** [March 7, 2025, 6:30pm UTC](https://discourse.julialang.org/t/kronrod-error-when-using-quadgk-w-symbolic-inputs/126587 "2025-03-07T18:30:14Z")

</div>

I am running a script where I’m calculating some values using ModelingToolkit with some code that I’ve developed. I register my functions using the @register\_symbolic macro, and these functions work on their own through …

---

## [Catalyst.jl: pure jump process solution now has Float64 trajectories?](https://discourse.julialang.org/t/catalyst-jl-pure-jump-process-solution-now-has-float64-trajectories/126649)

<div class="topic-metadata">

**Author:** [@lmshk](https://discourse.julialang.org/u/lmshk)\
**Replies:** 2\
**Last updated:** [March 7, 2025, 8:58am UTC](https://discourse.julialang.org/t/catalyst-jl-pure-jump-process-solution-now-has-float64-trajectories/126649 "2025-03-07T08:58:58Z")

</div>

(Catalyst v14.4.1, JumpProcesses v9.14.2) I recently updated dependencies for the first time in a while, and I am surprised to find that the solutions for pure jump process problems with all-Int64 initial states now con…

---

## [How should the scope of variables be embedded in ModelingToolkit?](https://discourse.julialang.org/t/how-should-the-scope-of-variables-be-embedded-in-modelingtoolkit/126373)

<div class="topic-metadata">

**Author:** [@ysyecust](https://discourse.julialang.org/u/ysyecust)\
**Replies:** 2\
**Last updated:** [March 4, 2025, 5:27am UTC](https://discourse.julialang.org/t/how-should-the-scope-of-variables-be-embedded-in-modelingtoolkit/126373 "2025-03-04T05:27:23Z")

</div>

When using ModelingToolkit to model and using NonlinearSolve to solve, I find that the variable range I have set seems to be ineffective. @variables z\[1:numcomp\] \[bounds = (0,1),guess=0.2\] @variables x\[1:numcomp\] \[boun…

---

## [DifferentialEquations.jl SavingCallback but dont build the whole solution](https://discourse.julialang.org/t/differentialequations-jl-savingcallback-but-dont-build-the-whole-solution/126430)

<div class="topic-metadata">

**Author:** [@svretina](https://discourse.julialang.org/u/svretina)\
**Replies:** 2\
**Last updated:** [March 3, 2025, 10:39pm UTC](https://discourse.julialang.org/t/differentialequations-jl-savingcallback-but-dont-build-the-whole-solution/126430 "2025-03-03T22:39:43Z")

</div>

Hi all, is it possible to turn off the solution building, meaning to construct the whole object spanning (n\_timesteps, n\_statevector) ? I would like to minimize the strain on the RAM by saving the statevector at each ti…

---

## [Constructing callbacks on observed variables with symbolic indexing of an MTK model](https://discourse.julialang.org/t/constructing-callbacks-on-observed-variables-with-symbolic-indexing-of-an-mtk-model/126510)

<div class="topic-metadata">

**Author:** [@sass-jacob](https://discourse.julialang.org/u/sass-jacob)\
**Replies:** 2\
**Last updated:** [March 3, 2025, 9:22pm UTC](https://discourse.julialang.org/t/constructing-callbacks-on-observed-variables-with-symbolic-indexing-of-an-mtk-model/126510 "2025-03-03T21:22:22Z")

</div>

I am trying to figure out how to use the Symbolic indexing with callback functions. There is already the continuous events support within MTK which is quite nice and has worked for this MWE. When the variable goes to obs…

---

## [SciMLStructures Tunable includes u0 causing remake failures](https://discourse.julialang.org/t/scimlstructures-tunable-includes-u0-causing-remake-failures/126090)

<div class="topic-metadata">

**Author:** [@johnb](https://discourse.julialang.org/u/johnb)\
**Replies:** 1\
**Last updated:** [March 2, 2025, 11:13pm UTC](https://discourse.julialang.org/t/scimlstructures-tunable-includes-u0-causing-remake-failures/126090 "2025-03-02T23:13:16Z")

</div>

I’ve been trying to understand how to use the Tunable parameter tag, but it seems to include initial conditions when returning a set of parameters as from the example in the ModelingToolkit.jl FAQ page. I’ve included an …

---

## [Optimization of states and parameters with Multibody.jl and ModelingToolkit](https://discourse.julialang.org/t/optimization-of-states-and-parameters-with-multibody-jl-and-modelingtoolkit/126156)

<div class="topic-metadata">

**Author:** [@Odie](https://discourse.julialang.org/u/Odie)\
**Replies:** 1\
**Last updated:** [March 2, 2025, 10:15pm UTC](https://discourse.julialang.org/t/optimization-of-states-and-parameters-with-multibody-jl-and-modelingtoolkit/126156 "2025-03-02T22:15:20Z")

</div>

Hi all, I’m working with a large model created with Multibody.jl and would like to use it to run some optimizations. The optimization variables could be model parameters as well as model states (see a simple problem exa…

---

## [New Package: EISAnalysis.jl](https://discourse.julialang.org/t/new-package-eisanalysis-jl/126319)

<div class="topic-metadata">

**Author:** [@bdamerau](https://discourse.julialang.org/u/bdamerau)\
**Replies:** 0\
**Last updated:** [February 26, 2025, 12:58am UTC](https://discourse.julialang.org/t/new-package-eisanalysis-jl/126319 "2025-02-26T00:58:53Z")

</div>

Hi All! I’m relatively new to Julia, and I’m in the process of registering a new package, EISAnalysis.jl. The purpose is to introduce an easy syntax for generating and fitting circuit models via REPL. Specifically it is…

---

## [ModelingToolkit and Noise Processes for uniform noise definition](https://discourse.julialang.org/t/modelingtoolkit-and-noise-processes-for-uniform-noise-definition/126291)

<div class="topic-metadata">

**Author:** [@NinaOmejc](https://discourse.julialang.org/u/NinaOmejc)\
**Replies:** 8\
**Last updated:** [February 25, 2025, 3:50pm UTC](https://discourse.julialang.org/t/modelingtoolkit-and-noise-processes-for-uniform-noise-definition/126291 "2025-02-25T15:50:15Z")

</div>

Hi, I am using MTK to set up a hierarchical dynamical system. As the input to the (otherwise ODE) system can also be random uniform noise, I need to set up SDESystem (instead of ODESystem). However, I cannot find out ho…

---

## [Strang Splitting with SplitODEProblem](https://discourse.julialang.org/t/strang-splitting-with-splitodeproblem/126255)

<div class="topic-metadata">

**Author:** [@svretina](https://discourse.julialang.org/u/svretina)\
**Replies:** 2\
**Last updated:** [February 25, 2025, 3:27pm UTC](https://discourse.julialang.org/t/strang-splitting-with-splitodeproblem/126255 "2025-02-25T15:27:46Z")

</div>

Hi all, I am interested in implementing a split ODE problem, I am solving the wave equation with a Finite Volume scheme such as MUSCL with a discontinuous source term. I want to implement a fractional step method and …

---

## [Matrices and tensors with Symbolics.jl](https://discourse.julialang.org/t/matrices-and-tensors-with-symbolics-jl/119394)

<div class="topic-metadata">

**Author:** [@Damiano](https://discourse.julialang.org/u/Damiano)\
**Replies:** 6\
**Last updated:** [February 25, 2025, 1:29pm UTC](https://discourse.julialang.org/t/matrices-and-tensors-with-symbolics-jl/119394 "2025-02-25T13:29:04Z")

</div>

Hi all, three quick issues I encountered. Please correct me if I should have created different topics of if the Category is wrong. Best way to create a symmetric matrix This is the best I could come up with. A = Ar…

---

## [Re-creating MTK problems creates side effects (ModelingToolkit.jl)](https://discourse.julialang.org/t/re-creating-mtk-problems-creates-side-effects-modelingtoolkit-jl/126054)

<div class="topic-metadata">

**Author:** [@ysfoo](https://discourse.julialang.org/u/ysfoo)\
**Replies:** 3\
**Last updated:** [February 24, 2025, 11:27pm UTC](https://discourse.julialang.org/t/re-creating-mtk-problems-creates-side-effects-modelingtoolkit-jl/126054 "2025-02-24T23:27:51Z")

</div>

I am following the somewhat recent tutorial on re-creating MTK problems. In summary, the function loss is defined, which remakes an ODEProblem by replacing the tunable portion of the parameters with the input argument, a…

---

## [First solve of \`ODEProblem\` and running out of memory: compilation problems?](https://discourse.julialang.org/t/first-solve-of-odeproblem-and-running-out-of-memory-compilation-problems/126160)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 3\
**Last updated:** [February 24, 2025, 10:58am UTC](https://discourse.julialang.org/t/first-solve-of-odeproblem-and-running-out-of-memory-compilation-problems/126160 "2025-02-24T10:58:33Z")

</div>

Hey it’s me again, I keep encountering memory-related issues with the first call to solve(prob), where prob is an ODEProblem (see details below). While this is probably expected, as it is most likely related to the “tim…

---

## [Simulating SDEs with shared noise in \`DifferentialEquations.jl\`](https://discourse.julialang.org/t/simulating-sdes-with-shared-noise-in-differentialequations-jl/126139)

<div class="topic-metadata">

**Author:** [@NoFishLikeIan](https://discourse.julialang.org/u/NoFishLikeIan)\
**Replies:** 2\
**Last updated:** [February 23, 2025, 5:17pm UTC](https://discourse.julialang.org/t/simulating-sdes-with-shared-noise-in-differentialequations-jl/126139 "2025-02-23T17:17:01Z")

</div>

I have a problem with two processes X\_{1, t}, X\_{2, t} \\in \\mathbb{R} which satisfy the SDEs \\begin{align} dX\_{1, t} = f\_1(t, X\_{1, t}) \\; dt + \\sigma \\; dW\_t, \\\\ dX\_{2, t} = f\_2(t, X\_{1, t}) \\; dt + \\sigma \\; dW\_t. \\en…

---

## [Building mass and stiffness matrix for time dependent PDE with Gridap](https://discourse.julialang.org/t/building-mass-and-stiffness-matrix-for-time-dependent-pde-with-gridap/126164)

<div class="topic-metadata">

**Author:** [@Cirdans-Home](https://discourse.julialang.org/u/Cirdans-Home)\
**Replies:** 0\
**Last updated:** [February 21, 2025, 5:29pm UTC](https://discourse.julialang.org/t/building-mass-and-stiffness-matrix-for-time-dependent-pde-with-gridap/126164 "2025-02-21T17:29:58Z")

</div>

Hi, I have implemented an algorithm for the solution of system of ODEs that I want to test against a method of line discretization of a PDE. My routine needs to take as input the mass matrix (assumed to be time-indepen…

---

## [Symbolics substitute - what has changed?](https://discourse.julialang.org/t/symbolics-substitute-what-has-changed/116826)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 9\
**Last updated:** [February 21, 2025, 11:11am UTC](https://discourse.julialang.org/t/symbolics-substitute-what-has-changed/116826 "2025-02-21T11:11:51Z")

</div>

What has changed with Symbolics substitute? In the past, I could compose two substitutions, but that doesn’t seem to work any more. Concretely, I consider: Asn = substitute(As, Dict(name\_s .=\> s\_ss)) |\> x -\> substitute…

---

## [ModelingToolkit -- changes with \`remake\`?](https://discourse.julialang.org/t/modelingtoolkit-changes-with-remake/126004)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 2\
**Last updated:** [February 19, 2025, 7:07pm UTC](https://discourse.julialang.org/t/modelingtoolkit-changes-with-remake/126004 "2025-02-19T19:07:19Z")

</div>

I have a @mtkbuild model named hp\_na\_ns\_oL which uses some register\_symbolic function u\_u\_v(t) that I specify via a constant value function u\_v\_const(). I want to simulate the system to steady state, and use the steady s…

---

## [Abnormal behaviour when using callback two times in the same script](https://discourse.julialang.org/t/abnormal-behaviour-when-using-callback-two-times-in-the-same-script/126062)

<div class="topic-metadata">

**Author:** [@Sushrut\_Deshpande](https://discourse.julialang.org/u/Sushrut_Deshpande)\
**Replies:** 1\
**Last updated:** [February 19, 2025, 12:05pm UTC](https://discourse.julialang.org/t/abnormal-behaviour-when-using-callback-two-times-in-the-same-script/126062 "2025-02-19T12:05:02Z")

</div>

Hello, I have a MWE here for when I solve a ODE with callback two times in the same script , it solves the first one case expected and does not for the second one. using DifferentialEquations, Plots, OrdinaryDiffEq f…

---

## [Storing only rolling mean and variance when solving SDEProblems](https://discourse.julialang.org/t/storing-only-rolling-mean-and-variance-when-solving-sdeproblems/125900)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 5\
**Last updated:** [February 17, 2025, 1:51pm UTC](https://discourse.julialang.org/t/storing-only-rolling-mean-and-variance-when-solving-sdeproblems/125900 "2025-02-17T13:51:29Z")

</div>

Hi all, I have been trying to reduce memory overhead as I found that in my systems of interest there were a lot of unnecessary reads/writes as the state was saved at each (specified) interval dt. In fact, for my purpose…

---

## [Trouble trying to implement DifferentialEquations.jl integrator in an agent\_step() for a model in Agents.jl?](https://discourse.julialang.org/t/trouble-trying-to-implement-differentialequations-jl-integrator-in-an-agent-step-for-a-model-in-agents-jl/125920)

<div class="topic-metadata">

**Author:** [@raylv17](https://discourse.julialang.org/u/raylv17)\
**Replies:** 1\
**Last updated:** [February 14, 2025, 11:41pm UTC](https://discourse.julialang.org/t/trouble-trying-to-implement-differentialequations-jl-integrator-in-an-agent-step-for-a-model-in-agents-jl/125920 "2025-02-14T23:41:59Z")

</div>

I have created a continuous ABM model using Agents.jl, however, I wish to incorporate an Integrator from the DifferentialEquations.jl package to be used in the agent\_step!() function. Though I am having trouble in the im…

---

## [OrdinaryDiffEq vcat to make du](https://discourse.julialang.org/t/ordinarydiffeq-vcat-to-make-du/125856)

<div class="topic-metadata">

**Author:** [@Sushrut\_Deshpande](https://discourse.julialang.org/u/Sushrut_Deshpande)\
**Replies:** 1\
**Last updated:** [February 13, 2025, 1:09pm UTC](https://discourse.julialang.org/t/ordinarydiffeq-vcat-to-make-du/125856 "2025-02-13T13:09:09Z")

</div>

Hello, In OrdinaryDiffEq.jl if we define the function as follows: function f(du,u,p,t) x1 = u\[1\] x2 = u\[2\] dx1 = x2 dx2 = -x1 du = vcat(dx1,dx2) return du end the ODE solver fails to solve corr…

---

## [Minimum Working Example (MWE) showing error in Universal Differential Equation (UDE) implementation](https://discourse.julialang.org/t/minimum-working-example-mwe-showing-error-in-universal-differential-equation-ude-implementation/125366)

<div class="topic-metadata">

**Author:** [@Ashima\_Kalathingal](https://discourse.julialang.org/u/Ashima_Kalathingal)\
**Replies:** 10\
**Last updated:** [February 11, 2025, 3:04pm UTC](https://discourse.julialang.org/t/minimum-working-example-mwe-showing-error-in-universal-differential-equation-ude-implementation/125366 "2025-02-11T15:04:56Z")

</div>

The following code gives a Minimum Working Example for UDE which I wrote. But unfortunately it is showing error. When I run the code in VS Code the terminal crashes. using OrdinaryDiffEq , SciMLSensitivity ,Optimization…

---

## [How to solve an advection-reaction system](https://discourse.julialang.org/t/how-to-solve-an-advection-reaction-system/125719)

<div class="topic-metadata">

**Author:** [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Replies:** 6\
**Last updated:** [February 11, 2025, 2:02am UTC](https://discourse.julialang.org/t/how-to-solve-an-advection-reaction-system/125719 "2025-02-11T02:02:09Z")

</div>

I have a system that I would like to solve which is basically a reaction advection system. The full-size version is here, but the sake of this issue, let’s just say that we have a system state that consists of a number …

---

## [Can't I update velocity AND position of a continuous agent using a custom move\_agent! that is not based on forward euler?](https://discourse.julialang.org/t/cant-i-update-velocity-and-position-of-a-continuous-agent-using-a-custom-move-agent-that-is-not-based-on-forward-euler/125697)

<div class="topic-metadata">

**Author:** [@raylv17](https://discourse.julialang.org/u/raylv17)\
**Replies:** 1\
**Last updated:** [February 10, 2025, 11:32am UTC](https://discourse.julialang.org/t/cant-i-update-velocity-and-position-of-a-continuous-agent-using-a-custom-move-agent-that-is-not-based-on-forward-euler/125697 "2025-02-10T11:32:45Z")

</div>

I am using the latest Agents.jl (v.6.2.4) package and learning it as well. I want to implement a simple movement of different agents by trying out various differential equation solvers (besides the default forward euler …

---

## [Stuck differentiating through multidimensional, potentially large and stiff ODE solution](https://discourse.julialang.org/t/stuck-differentiating-through-multidimensional-potentially-large-and-stiff-ode-solution/125651)

<div class="topic-metadata">

**Author:** [@Vitor\_Patricio\_Canta](https://discourse.julialang.org/u/Vitor_Patricio_Canta)\
**Replies:** 0\
**Last updated:** [February 7, 2025, 11:52am UTC](https://discourse.julialang.org/t/stuck-differentiating-through-multidimensional-potentially-large-and-stiff-ode-solution/125651 "2025-02-07T11:52:36Z")

</div>

Hi, I am solving 1D advective dispersive and reactive transport models as Ordinary Differential Equations. To speed things up, I am using Symbolics to detect the sparsity pattern or modelingtoolkitize to reduce allocati…

---

## [Initialization of DAE system after PDE discretization](https://discourse.julialang.org/t/initialization-of-dae-system-after-pde-discretization/125633)

<div class="topic-metadata">

**Author:** [@oswaldo](https://discourse.julialang.org/u/oswaldo)\
**Replies:** 1\
**Last updated:** [February 6, 2025, 9:29pm UTC](https://discourse.julialang.org/t/initialization-of-dae-system-after-pde-discretization/125633 "2025-02-06T21:29:27Z")

</div>

Hi, I’m solving a PDE system using ModelingToolkit.jl, after defining variables, parameters and equations I do @named adsmodel = PDESystem(eq,bcs,domains,\[z,t\],\[cN₂(z,t),cH₂(z,t),cNH₃(z,t),qNH₃(z,t),Tg(z,t),Tw(z,t),P(t)…

---

## [Is it possible to simulate SDDE with modeling toolkit?](https://discourse.julialang.org/t/is-it-possible-to-simulate-sdde-with-modeling-toolkit/125420)

<div class="topic-metadata">

**Author:** [@NinaOmejc](https://discourse.julialang.org/u/NinaOmejc)\
**Replies:** 3\
**Last updated:** [February 6, 2025, 1:31pm UTC](https://discourse.julialang.org/t/is-it-possible-to-simulate-sdde-with-modeling-toolkit/125420 "2025-02-06T13:31:24Z")

</div>

Hi, I’ve come across Chris Rackauckas post that it is possible to simulate DDEs using Modeling Toolkit (ModelingToolkit: (Transport) delay? Example: Inflow to one water reservoir is a delayed outflow from another - #7 b…

---

## [ModelingToolkit -- if statements?](https://discourse.julialang.org/t/modelingtoolkit-if-statements/125609)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [February 6, 2025, 11:02am UTC](https://discourse.julialang.org/t/modelingtoolkit-if-statements/125609 "2025-02-06T11:02:32Z")

</div>

Silly question… I need to create a function that I call within an MTK model (computing friction force), and the friction depends on the direction of the velocity… two very different expressions if v\> 0, or whether v \<= 0…

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

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