# Modelling & Simulations

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

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

**Page:** 10

---

## [Julia vs C++ for computational mechanics - Implicit Material Point Method](https://discourse.julialang.org/t/julia-vs-c-for-computational-mechanics-implicit-material-point-method/129180)

<div class="topic-metadata">

**Author:** [@jowsky](https://discourse.julialang.org/u/jowsky)\
**Replies:** 13\
**Last updated:** [May 24, 2025, 5:20am UTC](https://discourse.julialang.org/t/julia-vs-c-for-computational-mechanics-implicit-material-point-method/129180 "2025-05-24T05:20:30Z")

</div>

TL;DR : Writing an implicit Material Point Method solver. Would it be that much slower in Julia than C++ for a similar time-effort ? Hello, I am PhD student working on simulating creeping snow. I am currently planning …

---

## [Problems porting discretization from MethodOfLines.jl to NeuralPDE.jl](https://discourse.julialang.org/t/problems-porting-discretization-from-methodoflines-jl-to-neuralpde-jl/129288)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 1\
**Last updated:** [May 24, 2025, 12:18am UTC](https://discourse.julialang.org/t/problems-porting-discretization-from-methodoflines-jl-to-neuralpde-jl/129288 "2025-05-24T00:18:01Z")

</div>

Hi All, I’m trying to discretize a PDE with an integral term using NeuralPDE.jl. The problem discretizes fine with MethodOfLines.jl, but I get an error with NeuralPDE. The code is below - any suggestions? using Modelin…

---

## [DifferentialEquations.jl: LU factor ( M + dt \* K ) once prior to time-stepping loop](https://discourse.julialang.org/t/differentialequations-jl-lu-factor-m-dt-k-once-prior-to-time-stepping-loop/129255)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 3\
**Last updated:** [May 23, 2025, 11:38am UTC](https://discourse.julialang.org/t/differentialequations-jl-lu-factor-m-dt-k-once-prior-to-time-stepping-loop/129255 "2025-05-23T11:38:18Z")

</div>

Can once trick DifferentialEquations.jl to LU factor M + dt \* K once only prior to the time stepping loop? Thx.

---

## [Run only the algebraic part of the solver](https://discourse.julialang.org/t/run-only-the-algebraic-part-of-the-solver/128803)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 27\
**Last updated:** [May 20, 2025, 11:39am UTC](https://discourse.julialang.org/t/run-only-the-algebraic-part-of-the-solver/128803 "2025-05-20T11:39:55Z")

</div>

I’m working with a DAE system in ModelingToolkit.jl, and I’d like to run only the algebraic part of the integrator-that is, solve the algebraic constraints for given differential states, without advancing the differentia…

---

## [Best practices for flattening and reconstructing nested structs for ODEs, Solve, Kalman.jl etc](https://discourse.julialang.org/t/best-practices-for-flattening-and-reconstructing-nested-structs-for-odes-solve-kalman-jl-etc/129093)

<div class="topic-metadata">

**Author:** [@stevenhughes](https://discourse.julialang.org/u/stevenhughes)\
**Replies:** 5\
**Last updated:** [May 17, 2025, 9:24pm UTC](https://discourse.julialang.org/t/best-practices-for-flattening-and-reconstructing-nested-structs-for-odes-solve-kalman-jl-etc/129093 "2025-05-17T21:24:19Z")

</div>

Hello All, I’m prototyping a space/astrodynamics simulation and optimization framework in Julia. For the user interface, the most intuitive way to encapsulate all the data is on structs. Below is a toy example which i…

---

## [Having a component whose equations refer another component](https://discourse.julialang.org/t/having-a-component-whose-equations-refer-another-component/128952)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 2\
**Last updated:** [May 16, 2025, 8:41am UTC](https://discourse.julialang.org/t/having-a-component-whose-equations-refer-another-component/128952 "2025-05-16T08:41:33Z")

</div>

I have two components in ModelingToolkit.jl, and I want to have an equation across components, such as comp1.x ~ comp2.y. But I’d like that equation to only be there when Comp2() is used (I have an alternative GooeyComp2…

---

## [Estimating parameter and function in an ODE model](https://discourse.julialang.org/t/estimating-parameter-and-function-in-an-ode-model/126109)

<div class="topic-metadata">

**Author:** [@dg.aragones](https://discourse.julialang.org/u/dg.aragones)\
**Replies:** 11\
**Last updated:** [May 15, 2025, 9:50am UTC](https://discourse.julialang.org/t/estimating-parameter-and-function-in-an-ode-model/126109 "2025-05-15T09:50:17Z")

</div>

Hi all, I’m working on an ODE model where I want to infer a parameter μ and a function ϕ(t), and I’m looking for recommendations for tools or approaches in Julia to solve this problem. My dataset is small, with just 7 d…

---

## [ControlSystemsMTK: Easy Way to Initialize Output?](https://discourse.julialang.org/t/controlsystemsmtk-easy-way-to-initialize-output/128742)

<div class="topic-metadata">

**Author:** [@TicTac](https://discourse.julialang.org/u/TicTac)\
**Replies:** 4\
**Last updated:** [May 12, 2025, 6:27am UTC](https://discourse.julialang.org/t/controlsystemsmtk-easy-way-to-initialize-output/128742 "2025-05-12T06:27:12Z")

</div>

Is there a convenient way to the initialize the unknowns in a ODESystem created by ControlSystemsMTK based on a desired initial output? I needed a simple time delay model for something, and I figured using pade from Con…

---

## [ControlSystems.jl: Custom labels in a plot of step response of a MIMO system](https://discourse.julialang.org/t/controlsystems-jl-custom-labels-in-a-plot-of-step-response-of-a-mimo-system/128821)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 2\
**Last updated:** [May 8, 2025, 4:56am UTC](https://discourse.julialang.org/t/controlsystems-jl-custom-labels-in-a-plot-of-step-response-of-a-mimo-system/128821 "2025-05-08T04:56:28Z")

</div>

I am struggling with setting my own labels correctly in a plot of a step response of a MIMO system. Consider a generic MIMO LTI system with 2 inputs and 2 outputs, say: using ControlSystems using Plots A = \[-10 2; 3 -4…

---

## [Wave Equation Numerically Solved?](https://discourse.julialang.org/t/wave-equation-numerically-solved/128820)

<div class="topic-metadata">

**Author:** [@wbradycall](https://discourse.julialang.org/u/wbradycall)\
**Replies:** 2\
**Last updated:** [May 8, 2025, 12:12am UTC](https://discourse.julialang.org/t/wave-equation-numerically-solved/128820 "2025-05-08T00:12:34Z")

</div>

Any good example of the wave equation solved numerically? Brady Call

---

## [Logging events when running a CTMC](https://discourse.julialang.org/t/logging-events-when-running-a-ctmc/128778)

<div class="topic-metadata">

**Author:** [@julien-arino](https://discourse.julialang.org/u/julien-arino)\
**Replies:** 3\
**Last updated:** [May 7, 2025, 6:24pm UTC](https://discourse.julialang.org/t/logging-events-when-running-a-ctmc/128778 "2025-05-07T18:24:24Z")

</div>

At the bottom of this message is a sample piece of code (which should run) that illustrates the reason for my question (slash feature request in disguise): when using DifferentialEquations.jl to run a continuous time Mar…

---

## [Initial equations possible in MTK?](https://discourse.julialang.org/t/initial-equations-possible-in-mtk/128767)

<div class="topic-metadata">

**Author:** [@Matthew1](https://discourse.julialang.org/u/Matthew1)\
**Replies:** 1\
**Last updated:** [May 7, 2025, 10:56am UTC](https://discourse.julialang.org/t/initial-equations-possible-in-mtk/128767 "2025-05-07T10:56:35Z")

</div>

As mentioned here \[MTK -- how to set initial unknowns introduced by MTK?\] and here \[GitHub · Where software is built\], there are many cases where it is helpful to specify initial equations, i.e. specifying initial values…

---

## [Robust control with CRONE controllers](https://discourse.julialang.org/t/robust-control-with-crone-controllers/128733)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [May 6, 2025, 3:36pm UTC](https://discourse.julialang.org/t/robust-control-with-crone-controllers/128733 "2025-05-06T15:36:59Z")

</div>

Today I heard the first time about CRONE controllers. “The CRONE controller uses fractional-order calculus (non-integer order derivatives and integrals), offering more tuning flexibility and robustness, whereas tradition…

---

## [Indexing of Symbolic Arrays (Arr{Num,3}) not working when a guess is provided in MTK](https://discourse.julialang.org/t/indexing-of-symbolic-arrays-arr-num-3-not-working-when-a-guess-is-provided-in-mtk/128631)

<div class="topic-metadata">

**Author:** [@sass-jacob](https://discourse.julialang.org/u/sass-jacob)\
**Replies:** 2\
**Last updated:** [May 4, 2025, 4:53pm UTC](https://discourse.julialang.org/t/indexing-of-symbolic-arrays-arr-num-3-not-working-when-a-guess-is-provided-in-mtk/128631 "2025-05-04T16:53:04Z")

</div>

Hello, I have created a MWE where the indexing of symbolic arrays begins to fail when I provide an initial guess for the variables as data for MTK. If I remove the guess, the indexing works fine. Edit, more info: if th…

---

## [Acausal Modelling and Control Sytem](https://discourse.julialang.org/t/acausal-modelling-and-control-sytem/127003)

<div class="topic-metadata">

**Author:** [@AndhikaTama](https://discourse.julialang.org/u/AndhikaTama)\
**Replies:** 22\
**Last updated:** [May 4, 2025, 3:39pm UTC](https://discourse.julialang.org/t/acausal-modelling-and-control-sytem/127003 "2025-05-04T15:39:55Z")

</div>

Hello everyone, I am a new user of Julia ModelingToolkit and ControlSystem. I am currently working on a project with the topic Nonlinear Dynamic Simulation of a MicroGas Turbine Integrated with Concentrated Solar Therma…

---

## [Debugging MTK with residuals](https://discourse.julialang.org/t/debugging-mtk-with-residuals/128616)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 1\
**Last updated:** [May 2, 2025, 12:38pm UTC](https://discourse.julialang.org/t/debugging-mtk-with-residuals/128616 "2025-05-02T12:38:22Z")

</div>

I have some ModelingToolkit simulation that yields dubious results. No numerical error; just some quantity that becomes negative when it shouldn’t. I have to assume that one of my equations is wrong. Perhaps there is a c…

---

## [How to interface between functional and macro syntax in MTK](https://discourse.julialang.org/t/how-to-interface-between-functional-and-macro-syntax-in-mtk/128501)

<div class="topic-metadata">

**Author:** [@Matthew1](https://discourse.julialang.org/u/Matthew1)\
**Replies:** 4\
**Last updated:** [April 29, 2025, 12:56pm UTC](https://discourse.julialang.org/t/how-to-interface-between-functional-and-macro-syntax-in-mtk/128501 "2025-04-29T12:56:25Z")

</div>

How does one pass structural parameters from a @mtkmodel to a @component function? Is it possible to sort of convert between the positional syntax of @component function to the keyword syntax of @mtkmodel (for structural…

---

## [StackOverflow when passing dictionary to ODE solver?](https://discourse.julialang.org/t/stackoverflow-when-passing-dictionary-to-ode-solver/128363)

<div class="topic-metadata">

**Author:** [@Theodore\_Rieger](https://discourse.julialang.org/u/Theodore_Rieger)\
**Replies:** 2\
**Last updated:** [April 25, 2025, 11:21am UTC](https://discourse.julialang.org/t/stackoverflow-when-passing-dictionary-to-ode-solver/128363 "2025-04-25T11:21:17Z")

</div>

Hi, I’m getting a stackoverflow error (full error message below) when I try to pass my parameters as a dictionary. Simple example: using DifferentialEquations using Plots using StatsKit function lorenz!(du, u, p, t) …

---

## [Initial guess for array-valued variables not passed to NonlinearProblem](https://discourse.julialang.org/t/initial-guess-for-array-valued-variables-not-passed-to-nonlinearproblem/128372)

<div class="topic-metadata">

**Author:** [@sass-jacob](https://discourse.julialang.org/u/sass-jacob)\
**Replies:** 1\
**Last updated:** [April 25, 2025, 11:07am UTC](https://discourse.julialang.org/t/initial-guess-for-array-valued-variables-not-passed-to-nonlinearproblem/128372 "2025-04-25T11:07:35Z")

</div>

I have created a MWE in which it seems the initial guess for array-valued variables set as irreducible is not passed to NonlinearProblem. Please advise if there is an alternative way to do this or if an issue should be p…

---

## [Continuous callbacks checking on u works on standard ODE version but does not work in the Jump Process](https://discourse.julialang.org/t/continuous-callbacks-checking-on-u-works-on-standard-ode-version-but-does-not-work-in-the-jump-process/127390)

<div class="topic-metadata">

**Author:** [@atiyabzafar](https://discourse.julialang.org/u/atiyabzafar)\
**Replies:** 9\
**Last updated:** [April 24, 2025, 10:17am UTC](https://discourse.julialang.org/t/continuous-callbacks-checking-on-u-works-on-standard-ode-version-but-does-not-work-in-the-jump-process/127390 "2025-04-24T10:17:11Z")

</div>

I am trying to solve a system both deterministically and stochastically. The solutions match for my system in both cases without callback. But the callback does not seem to be working. function condition1(u,t,integrato…

---

## [Is it possible to pass arbitrary types into MTK?](https://discourse.julialang.org/t/is-it-possible-to-pass-arbitrary-types-into-mtk/128304)

<div class="topic-metadata">

**Author:** [@Matthew1](https://discourse.julialang.org/u/Matthew1)\
**Replies:** 9\
**Last updated:** [April 23, 2025, 8:58am UTC](https://discourse.julialang.org/t/is-it-possible-to-pass-arbitrary-types-into-mtk/128304 "2025-04-23T08:58:48Z")

</div>

Based on the following docs (https://docs.sciml.ai/ModelingToolkit/stable/comparison/), which says ‘Modelica is a declarative programming language. ModelingToolkit.jl is a declarative symbolic modeling language’, I would…

---

## [Passing a variable that isn't integrated by MTK to DiffEqParamEstim objective function](https://discourse.julialang.org/t/passing-a-variable-that-isnt-integrated-by-mtk-to-diffeqparamestim-objective-function/128308)

<div class="topic-metadata">

**Author:** [@Jarrod-Angove](https://discourse.julialang.org/u/Jarrod-Angove)\
**Replies:** 2\
**Last updated:** [April 22, 2025, 10:46pm UTC](https://discourse.julialang.org/t/passing-a-variable-that-isnt-integrated-by-mtk-to-diffeqparamestim-objective-function/128308 "2025-04-22T22:46:01Z")

</div>

I’m still a bit new to MTK, please excuse me if I’m missing something simple here. I have an ODE model that integrates over two variables, V\_a and V\_b. However, I can only measure the total volume, V\_tot, so I have cons…

---

## [Reproducibility of problems in Modelling Toolkit (MTK)](https://discourse.julialang.org/t/reproducibility-of-problems-in-modelling-toolkit-mtk/128216)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [April 22, 2025, 5:57pm UTC](https://discourse.julialang.org/t/reproducibility-of-problems-in-modelling-toolkit-mtk/128216 "2025-04-22T17:57:17Z")

</div>

We are trying to cache the simplified model of an MTK model in a file. Currently we using the serialize() function of base Julia. Observation: The serialized file is different each time we generate it, even if the origi…

---

## [Efficient Algorithms for exponential martingales generated by SDE with jumps](https://discourse.julialang.org/t/efficient-algorithms-for-exponential-martingales-generated-by-sde-with-jumps/127917)

<div class="topic-metadata">

**Author:** [@paolo-mgi](https://discourse.julialang.org/u/paolo-mgi)\
**Replies:** 2\
**Last updated:** [April 21, 2025, 11:23am UTC](https://discourse.julialang.org/t/efficient-algorithms-for-exponential-martingales-generated-by-sde-with-jumps/127917 "2025-04-21T11:23:11Z")

</div>

Hello, I am experimenting with jump processes, and in particular with stochastic diffrential equations of the form dμ(t)=μ(t) λ (dν(t)−r dt ) where dν(t)= increment of Poisson process r dt= compensator The result s…

---

## [PWM using Discrete Callbacks in Modeling Toolkit](https://discourse.julialang.org/t/pwm-using-discrete-callbacks-in-modeling-toolkit/127569)

<div class="topic-metadata">

**Author:** [@twarczi](https://discourse.julialang.org/u/twarczi)\
**Replies:** 5\
**Last updated:** [April 20, 2025, 9:46am UTC](https://discourse.julialang.org/t/pwm-using-discrete-callbacks-in-modeling-toolkit/127569 "2025-04-20T09:46:23Z")

</div>

I’m trying to create a PWM voltage source using modeling toolkit. I tried used the @discrete\_events macro within the @mtkmodel block but doing so throws an error: ERROR: KeyError: key pwm₊output₊u(t) not found when runni…

---

## [Save a simplified ModelingToolkit problem as text](https://discourse.julialang.org/t/save-a-simplified-modelingtoolkit-problem-as-text/128124)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 6\
**Last updated:** [April 19, 2025, 7:56pm UTC](https://discourse.julialang.org/t/save-a-simplified-modelingtoolkit-problem-as-text/128124 "2025-04-19T19:56:03Z")

</div>

Because structural\_simplify is slow, I want to write the simplified system to a file, from where I can load it later. Using serialize("sys.bin", sys) works, but this causes problems when switching between julia versions,…

---

## [Overdetermined ODEProblem after upgrading from MTK v8.75.0 to MTK v9.72.0](https://discourse.julialang.org/t/overdetermined-odeproblem-after-upgrading-from-mtk-v8-75-0-to-mtk-v9-72-0/128163)

<div class="topic-metadata">

**Author:** [@celia.bat](https://discourse.julialang.org/u/celia.bat)\
**Replies:** 2\
**Last updated:** [April 18, 2025, 7:25am UTC](https://discourse.julialang.org/t/overdetermined-odeproblem-after-upgrading-from-mtk-v8-75-0-to-mtk-v9-72-0/128163 "2025-04-18T07:25:03Z")

</div>

Hi all :waving\_hand: I’m currently upgrading a model from ModelingToolkit v8.75.0 (which worked fine), to v9.72.0. I’m now running into an issue where my ODEProblem fails to initialize, even though my model contains c…

---

## [Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists](https://discourse.julialang.org/t/internal-error-during-type-inference-encountered-stack-overflow-this-might-be-caused-by-recursion-over-very-long-tuples-or-argument-lists/128037)

<div class="topic-metadata">

**Author:** [@Viacol0916](https://discourse.julialang.org/u/Viacol0916)\
**Replies:** 2\
**Last updated:** [April 15, 2025, 2:15am UTC](https://discourse.julialang.org/t/internal-error-during-type-inference-encountered-stack-overflow-this-might-be-caused-by-recursion-over-very-long-tuples-or-argument-lists/128037 "2025-04-15T02:15:24Z")

</div>

Julia Version : 1.11.4+0.aarch64.apple.darwin14 Related package: ModelingToolkit, NonlinearSolve Our project is to use C++ to pass function parameter information to Julia, then use julia to implement numerical calculat…

---

## [ModelingToolkit -- can I use \`min\` and \`max\` functions?](https://discourse.julialang.org/t/modelingtoolkit-can-i-use-min-and-max-functions/127934)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 20\
**Last updated:** [April 14, 2025, 6:05am UTC](https://discourse.julialang.org/t/modelingtoolkit-can-i-use-min-and-max-functions/127934 "2025-04-14T06:05:26Z")

</div>

I have written a PID controller in ModelingToolkit (yes, I know it probably exists…). I need to clip the control output u to lie in the range \[u\_min, u\_max\]. So I try to do: # Constraining the unconstrained control sign…

---

## [How to have more examples for ModelingToolkit Standard Library?](https://discourse.julialang.org/t/how-to-have-more-examples-for-modelingtoolkit-standard-library/127879)

<div class="topic-metadata">

**Author:** [@Matthew1](https://discourse.julialang.org/u/Matthew1)\
**Replies:** 5\
**Last updated:** [April 9, 2025, 7:40pm UTC](https://discourse.julialang.org/t/how-to-have-more-examples-for-modelingtoolkit-standard-library/127879 "2025-04-09T19:40:25Z")

</div>

It would be really great if there are more examples in the MTSL docs. I see that there are already some great ‘examples’ in the tests. However, most potential users won’t navigate to the tests. Also, if the goal is to re…

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

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