# Modelling & Simulations

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

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

**Page:** 47

---

## [Using optimization parameters in ModelingToolkit](https://discourse.julialang.org/t/using-optimization-parameters-in-modelingtoolkit/82099)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 12\
**Last updated:** [June 11, 2022, 12:00pm UTC](https://discourse.julialang.org/t/using-optimization-parameters-in-modelingtoolkit/82099 "2022-06-11T12:00:02Z")

</div>

Hi All, I want to be able to pass optimization parameters to the model. I took the RC circuit from the docs and created 2 parameters (param\_r1 param\_c1) https://mtk.sciml.ai/stable/tutorials/acausal\_components/#Connec…

---

## [DiffEqs: Hybrid (continuous+discrete) system / periodic callback](https://discourse.julialang.org/t/diffeqs-hybrid-continuous-discrete-system-periodic-callback/23791)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 43\
**Last updated:** [June 11, 2022, 5:10am UTC](https://discourse.julialang.org/t/diffeqs-hybrid-continuous-discrete-system-periodic-callback/23791 "2022-06-11T05:10:12Z")

</div>

I want to model the combination of a physical (and thus continuous-time) system with a (discrete-time) controller. The controller algorithm is executed, say, every second. The output of the controller (that thus changes …

---

## [Solving an analytical ODE \*slower\* than numerical?](https://discourse.julialang.org/t/solving-an-analytical-ode-slower-than-numerical/82499)

<div class="topic-metadata">

**Author:** [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Replies:** 1\
**Last updated:** [June 9, 2022, 2:51pm UTC](https://discourse.julialang.org/t/solving-an-analytical-ode-slower-than-numerical/82499 "2022-06-09T14:51:17Z")

</div>

The documentation (Composing Ordinary Differential Equations · ModelingToolkit.jl) gives the following example to show symbolic derivatives result in higher performance vs. numerical approximation: using BenchmarkTools …

---

## [Non-Diagonal SDE with matrix variables](https://discourse.julialang.org/t/non-diagonal-sde-with-matrix-variables/82351)

<div class="topic-metadata">

**Author:** [@thobili](https://discourse.julialang.org/u/thobili)\
**Replies:** 1\
**Last updated:** [June 7, 2022, 11:07am UTC](https://discourse.julialang.org/t/non-diagonal-sde-with-matrix-variables/82351 "2022-06-07T11:07:57Z")

</div>

I was trying to apply the method described at https://diffeq.sciml.ai/stable/tutorials/sde\_example/#Example-4:-Systems-of-SDEs-with-Non-Diagonal-Noise for a matrix valued variable, e.g. f(du,u,p,t) = du .= 1.01u funct…

---

## [ModelingToolkit.jl performance for large models with similar components](https://discourse.julialang.org/t/modelingtoolkit-jl-performance-for-large-models-with-similar-components/82442)

<div class="topic-metadata">

**Author:** [@Sciemon](https://discourse.julialang.org/u/Sciemon)\
**Replies:** 4\
**Last updated:** [June 8, 2022, 8:59pm UTC](https://discourse.julialang.org/t/modelingtoolkit-jl-performance-for-large-models-with-similar-components/82442 "2022-06-08T20:59:37Z")

</div>

I cannot make sense of conflicting information about the performance of ModelingToolkit.jl for very large models. On the one hand, it seems to be performant according to the workshop at JuliaCon for example. On the other…

---

## [Large number of @variables in ModelingToolkit](https://discourse.julialang.org/t/large-number-of-variables-in-modelingtoolkit/82399)

<div class="topic-metadata">

**Author:** [@QuantumWorm](https://discourse.julialang.org/u/QuantumWorm)\
**Replies:** 1\
**Last updated:** [June 8, 2022, 10:01am UTC](https://discourse.julialang.org/t/large-number-of-variables-in-modelingtoolkit/82399 "2022-06-08T10:01:38Z")

</div>

https://neuralpde.sciml.ai/stable/pinn/system/ When I need several variables I can write @parameters t, x @variables u1(…), u2(…), u3(…) and in solver use @named pde\_system = PDESystem(eqs,bcs,domains,\[t,x\],\[u1(t, x…

---

## [Ability to move past unstable points in parameter space](https://discourse.julialang.org/t/ability-to-move-past-unstable-points-in-parameter-space/82272)

<div class="topic-metadata">

**Author:** [@xztt](https://discourse.julialang.org/u/xztt)\
**Replies:** 8\
**Last updated:** [June 8, 2022, 8:54am UTC](https://discourse.julialang.org/t/ability-to-move-past-unstable-points-in-parameter-space/82272 "2022-06-08T08:54:50Z")

</div>

Hi, This is a fairly general question but I can provide some more concrete code if needed. Say I have 100 samples in a n dimensional parameter space between upper and lower bounds these bounds say 30% away from a “trut…

---

## [SDE \`EnsembleProblem\` unhappy with \`trajectories\>=2\`?](https://discourse.julialang.org/t/sde-ensembleproblem-unhappy-with-trajectories-2/82098)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 4\
**Last updated:** [June 7, 2022, 4:21am UTC](https://discourse.julialang.org/t/sde-ensembleproblem-unhappy-with-trajectories-2/82098 "2022-06-07T04:21:22Z")

</div>

The title is a bit generic, but I have trouble seeing a more specific version of my SDE problem. Consider the following problem: using DifferentialEquations using LinearAlgebra function make\_problem\_2() m1 = rand(C…

---

## [Mass constraints for ApproxFun BVP system solver](https://discourse.julialang.org/t/mass-constraints-for-approxfun-bvp-system-solver/82257)

<div class="topic-metadata">

**Author:** [@Jack\_hues](https://discourse.julialang.org/u/Jack_hues)\
**Replies:** 0\
**Last updated:** [June 5, 2022, 3:29am UTC](https://discourse.julialang.org/t/mass-constraints-for-approxfun-bvp-system-solver/82257 "2022-06-05T03:29:22Z")

</div>

Does ApproxFun currently have a way to solve BVPs with mass conservation? For example 0=u''+f(u,v) and 0=v''-f(u,v) with homogeneous Neumann boundary conditions or periodic boundary conditions. Namely, can I tell ApproxF…

---

## [Parameter Types in DiffEqFlux.jl versus DifferentialEquations.jl](https://discourse.julialang.org/t/parameter-types-in-diffeqflux-jl-versus-differentialequations-jl/79635)

<div class="topic-metadata">

**Author:** [@jbu](https://discourse.julialang.org/u/jbu)\
**Replies:** 6\
**Last updated:** [June 4, 2022, 3:38pm UTC](https://discourse.julialang.org/t/parameter-types-in-diffeqflux-jl-versus-differentialequations-jl/79635 "2022-06-04T15:38:16Z")

</div>

What are the differences between allowed parameter types in DiffEqFlux.jl versus DifferentialEquations.jl? The documentation for DifferentialEquations states the following: Note that the type for the parameters p can …

---

## [Symbolic Geometry definition for PINN](https://discourse.julialang.org/t/symbolic-geometry-definition-for-pinn/80058)

<div class="topic-metadata">

**Author:** [@LeoCott](https://discourse.julialang.org/u/LeoCott)\
**Replies:** 6\
**Last updated:** [June 4, 2022, 12:01pm UTC](https://discourse.julialang.org/t/symbolic-geometry-definition-for-pinn/80058 "2022-06-04T12:01:30Z")

</div>

Dear all, I’m trying to solve the Reynolds-Averaged Navier Stokes (RANS) equations in a channel with periodic hills (see Figure below). The hill geometry is defined by a third order polynomial, here assumed to be co…

---

## [Gentle introduction to spatial modelling in Julia](https://discourse.julialang.org/t/gentle-introduction-to-spatial-modelling-in-julia/82060)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 2\
**Last updated:** [June 4, 2022, 11:56am UTC](https://discourse.julialang.org/t/gentle-introduction-to-spatial-modelling-in-julia/82060 "2022-06-04T11:56:01Z")

</div>

Hello I have a set of ODEs to model the interaction between a bacterium and a phage, which gives the following results: I would like to model how the model works on a 2D space (let’s say a section of skin). The idea…

---

## [DiffEqFlux.sciml\_train doesn't accept an adtype](https://discourse.julialang.org/t/diffeqflux-sciml-train-doesnt-accept-an-adtype/81688)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 2\
**Last updated:** [June 2, 2022, 6:43pm UTC](https://discourse.julialang.org/t/diffeqflux-sciml-train-doesnt-accept-an-adtype/81688 "2022-06-02T18:43:34Z")

</div>

This code works OK using DifferentialEquations, DiffEqFlux, GalacticOptim function lotka\_volterra!(du, u, p, t) x, y = u α, β, δ, γ = p du\[1\] = α\*x - β\*x\*y du\[2\] = -δ\*y + γ\*x\*y end u0 = \[1.0, 1.0\] tspan = (0.0…

---

## [ModelingToolkit.jl trows error: statement is ambigous](https://discourse.julialang.org/t/modelingtoolkit-jl-trows-error-statement-is-ambigous/82045)

<div class="topic-metadata">

**Author:** [@Davide\_Degavi](https://discourse.julialang.org/u/Davide_Degavi)\
**Replies:** 3\
**Last updated:** [June 1, 2022, 11:56am UTC](https://discourse.julialang.org/t/modelingtoolkit-jl-trows-error-statement-is-ambigous/82045 "2022-06-01T11:56:25Z")

</div>

Hi everyone, I’m new to Julia so maybe the problem that I’ve anecountered is preatty trivial. Basically I have two main problem with the simple symbolic equation expressing the kinetic energy of a rigid body satellite. …

---

## [Error when trying to dynamically change \`tstops\` during \`solve\`](https://discourse.julialang.org/t/error-when-trying-to-dynamically-change-tstops-during-solve/81999)

<div class="topic-metadata">

**Author:** [@InPhyT](https://discourse.julialang.org/u/InPhyT)\
**Replies:** 2\
**Last updated:** [May 31, 2022, 3:46pm UTC](https://discourse.julialang.org/t/error-when-trying-to-dynamically-change-tstops-during-solve/81999 "2022-05-31T15:46:22Z")

</div>

Hello, I’m modeling a simple integrate and fire neuron that takes spike width into account by suspending the integration (and thus ignoring the input current) for a few milliseconds after a spike has been elicited. Let’…

---

## [Symbolics.jl: Compute determinant](https://discourse.julialang.org/t/symbolics-jl-compute-determinant/81866)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 2\
**Last updated:** [May 29, 2022, 1:28pm UTC](https://discourse.julialang.org/t/symbolics-jl-compute-determinant/81866 "2022-05-29T13:28:35Z")

</div>

I would like to compute the determinant of a matrix involving a symbolic variable: using Symbolics I = # Identity matrix A = # Some non-trivial matrix @variables z aux = I - z \* A det(aux) This webpage claims that co…

---

## [Why do we need "GalacticOptim.instantiate\_function"?](https://discourse.julialang.org/t/why-do-we-need-galacticoptim-instantiate-function/81760)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 9\
**Last updated:** [May 28, 2022, 3:58pm UTC](https://discourse.julialang.org/t/why-do-we-need-galacticoptim-instantiate-function/81760 "2022-05-28T15:58:28Z")

</div>

This example seems to work even without “instantiate\_function”. https://diffeqflux.sciml.ai/stable/examples/neural\_ode\_galacticoptim/ I can’t find any docs about “instantiate\_function”.

---

## [Save and plot parameter history with ModelingToolkit.jl](https://discourse.julialang.org/t/save-and-plot-parameter-history-with-modelingtoolkit-jl/81778)

<div class="topic-metadata">

**Author:** [@visr](https://discourse.julialang.org/u/visr)\
**Replies:** 1\
**Last updated:** [May 27, 2022, 12:11pm UTC](https://discourse.julialang.org/t/save-and-plot-parameter-history-with-modelingtoolkit-jl/81778 "2022-05-27T12:11:39Z")

</div>

Parameters are currently not saved over time in the solution, the way states are. This was previously discussed in Update parameters in ModelingToolkit using callbacks. Chris mentioned there that one option would be to…

---

## [GalacticOptim.solve ignores callback](https://discourse.julialang.org/t/galacticoptim-solve-ignores-callback/81670)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 1\
**Last updated:** [May 27, 2022, 3:09am UTC](https://discourse.julialang.org/t/galacticoptim-solve-ignores-callback/81670 "2022-05-27T03:09:35Z")

</div>

Hi All, It seems the callback doesn’t work when it is called from “GalacticOptim.solve”. using DifferentialEquations, DiffEqFlux, GalacticOptim function lotka\_volterra!(du, u, p, t) x, y = u α, β, δ, γ = p du\[1\]…

---

## [Driftless Stochastic differential equation](https://discourse.julialang.org/t/driftless-stochastic-differential-equation/81525)

<div class="topic-metadata">

**Author:** [@stochasticguy](https://discourse.julialang.org/u/stochasticguy)\
**Replies:** 5\
**Last updated:** [May 24, 2022, 5:46pm UTC](https://discourse.julialang.org/t/driftless-stochastic-differential-equation/81525 "2022-05-24T17:46:21Z")

</div>

Hi everybody, I’m using the GREAT StochasticDiffEq.jl package to define a multidimensional driftless SDE as follows: using StochasticDiffEq function f!(du, u, p, t) du .= p\[1\] return nothing end function g!(d…

---

## [Freely moving agents in a GridSpace-like environment](https://discourse.julialang.org/t/freely-moving-agents-in-a-gridspace-like-environment/81586)

<div class="topic-metadata">

**Author:** [@Demlore](https://discourse.julialang.org/u/Demlore)\
**Replies:** 1\
**Last updated:** [May 24, 2022, 1:57pm UTC](https://discourse.julialang.org/t/freely-moving-agents-in-a-gridspace-like-environment/81586 "2022-05-24T13:57:03Z")

</div>

I am currently trying to implement a model similar to the model “Predator-prey dynamics” from the Example Zoo. My current issue is that i need freely moving agents in a space made out of square patches just like the e…

---

## [Ever increasing time for garbage collection](https://discourse.julialang.org/t/ever-increasing-time-for-garbage-collection/81543)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [May 23, 2022, 11:10pm UTC](https://discourse.julialang.org/t/ever-increasing-time-for-garbage-collection/81543 "2022-05-23T23:10:55Z")

</div>

Hello, I have a simulation that is running in real-time for an undefined period of time (until you stop it). I solve my equation system every 50ms. For one solution about 800 calls to the inner residual function are ne…

---

## [Warning when using "DiffEqFlux.sciml\_train" and "ModelingToolkit.structural\_simplify"](https://discourse.julialang.org/t/warning-when-using-diffeqflux-sciml-train-and-modelingtoolkit-structural-simplify/81449)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 8\
**Last updated:** [May 23, 2022, 3:56pm UTC](https://discourse.julialang.org/t/warning-when-using-diffeqflux-sciml-train-and-modelingtoolkit-structural-simplify/81449 "2022-05-23T15:56:43Z")

</div>

Hi All, I want to use “DiffEqFlux.sciml\_train” to get parameters after using “ModelingToolkit.structural\_simplify”. I’m able to get a reasonable result but have a weird warning: Warning: Warning: Unrecognized keyword …

---

## [Declare type of @variable (e.g. complex) in ModelingToolkit.jl](https://discourse.julialang.org/t/declare-type-of-variable-e-g-complex-in-modelingtoolkit-jl/59563)

<div class="topic-metadata">

**Author:** [@Sciemon](https://discourse.julialang.org/u/Sciemon)\
**Replies:** 4\
**Last updated:** [May 23, 2022, 12:57pm UTC](https://discourse.julialang.org/t/declare-type-of-variable-e-g-complex-in-modelingtoolkit-jl/59563 "2022-05-23T12:57:27Z")

</div>

Is there a way to declare the type of a variable in ModelingToolkit.jl? For example something like @variables a(t)::complex I’m excited to start with ModelingToolkit.jl having followed its development for a while. In m…

---

## [ModelingToolkit vs plain DifferentialEquations](https://discourse.julialang.org/t/modelingtoolkit-vs-plain-differentialequations/81322)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 12\
**Last updated:** [May 20, 2022, 3:42am UTC](https://discourse.julialang.org/t/modelingtoolkit-vs-plain-differentialequations/81322 "2022-05-20T03:42:45Z")

</div>

Hi All, What is the magic that happens inside of the “ModelingToolkit.ODESystem”? When I have the DAE system in the next form: using DifferentialEquations, OrdinaryDiffEq, Sundials u0 = \[0.0, 0.0, 0.0, 0.0, 0.0, 0.0…

---

## [Access both solutions of a SecondOrderODEProblem solution](https://discourse.julialang.org/t/access-both-solutions-of-a-secondorderodeproblem-solution/81291)

<div class="topic-metadata">

**Author:** [@GHRALIMA](https://discourse.julialang.org/u/GHRALIMA)\
**Replies:** 7\
**Last updated:** [May 19, 2022, 2:10pm UTC](https://discourse.julialang.org/t/access-both-solutions-of-a-secondorderodeproblem-solution/81291 "2022-05-19T14:10:43Z")

</div>

I’m trying to use DifferentialEquations.jl to solve simple mechanical problems with SecondOrderODEProblem, something like: k=0.01 v0 = 10.0 x0 = 10.0 tspan = (0.0, 100.0) ax1(v,u,p,t) = -k\*v - g prob = SecondOrderODEPr…

---

## [differentialEquation or diffEqOperator, whose problem?](https://discourse.julialang.org/t/differentialequation-or-diffeqoperator-whose-problem/81179)

<div class="topic-metadata">

**Author:** [@Fred\_He](https://discourse.julialang.org/u/Fred_He)\
**Replies:** 5\
**Last updated:** [May 19, 2022, 12:19pm UTC](https://discourse.julialang.org/t/differentialequation-or-diffeqoperator-whose-problem/81179 "2022-05-19T12:19:33Z")

</div>

basically, I would like to simulate a gas-solid reaction. u\[:,1\] is gas reactant, u\[:,2\] is gas product, and u\[:3\] is solid product. some times the result is strange. the code is below using OrdinaryDiffEq, DiffEqOpera…

---

## [Coupling PDEs to Agents.jl](https://discourse.julialang.org/t/coupling-pdes-to-agents-jl/80977)

<div class="topic-metadata">

**Author:** [@Sahil\_Kulkarni](https://discourse.julialang.org/u/Sahil_Kulkarni)\
**Replies:** 2\
**Last updated:** [May 17, 2022, 3:09pm UTC](https://discourse.julialang.org/t/coupling-pdes-to-agents-jl/80977 "2022-05-17T15:09:41Z")

</div>

I want to couple PDEs to with ABMs, on the website of Agents.jl, there is a tutorial that explains how to integrate ODEs with Agents, I was wondering if I discretize a PDE with DiffEqOperators.jl and then solve the remai…

---

## [DiffEqCallbacks' StepSizeLimiter and Dual numbers](https://discourse.julialang.org/t/diffeqcallbacks-stepsizelimiter-and-dual-numbers/62197)

<div class="topic-metadata">

**Author:** [@vettert](https://discourse.julialang.org/u/vettert)\
**Replies:** 3\
**Last updated:** [May 17, 2022, 7:56am UTC](https://discourse.julialang.org/t/diffeqcallbacks-stepsizelimiter-and-dual-numbers/62197 "2022-05-17T07:56:00Z")

</div>

I am trying to use GalacticOptim to run an optimization and I am using GalacticOptim.AutoForwardDiff() to generate the gradients and the run an optimizer over my objective function. My objective function contains a model…

---

## [ModelingToolkit systems from the XML file](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 6\
**Last updated:** [May 16, 2022, 7:36pm UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991 "2022-05-16T19:36:19Z")

</div>

Hi All, From this link https://help.juliahub.com/JuliaSim/Tutorials/FMUs/ I can see that we can generate FMU and XML from ModelingToolkit. The question is: can we do a vice verse, get ModelingToolkit systems from the…

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

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