# Modelling & Simulations

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

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

**Page:** 33

---

## [Optional parameter assignment map for modelingtoolkit system with defaults](https://discourse.julialang.org/t/optional-parameter-assignment-map-for-modelingtoolkit-system-with-defaults/103437)

<div class="topic-metadata">

**Author:** [@Jon\_Norberg](https://discourse.julialang.org/u/Jon_Norberg)\
**Replies:** 6\
**Last updated:** [September 1, 2023, 2:27pm UTC](https://discourse.julialang.org/t/optional-parameter-assignment-map-for-modelingtoolkit-system-with-defaults/103437 "2023-09-01T14:27:55Z")

</div>

Hi, how would I make the parameter map for running a modelingtoolkit system using an optional defaults approach like fun(sys::ODEsystem; p1=1,p2=0.2,p3=0.47) # Goal: end up with an assignment map that uses the defaul…

---

## [Changing the system size over time in ModellingToolkit](https://discourse.julialang.org/t/changing-the-system-size-over-time-in-modellingtoolkit/103100)

<div class="topic-metadata">

**Author:** [@evan-wehi](https://discourse.julialang.org/u/evan-wehi)\
**Replies:** 3\
**Last updated:** [August 26, 2023, 8:06am UTC](https://discourse.julialang.org/t/changing-the-system-size-over-time-in-modellingtoolkit/103100 "2023-08-26T08:06:04Z")

</div>

I apologise if this is answered in the documentation but I couldn’t find it. I’m modelling a population of biological cells which divide and die over time. These events can be triggered by continious callbacks for examp…

---

## [Help on how to describe a Matrix used for 2D Finite Differences using BlockBandedMatrices.jl](https://discourse.julialang.org/t/help-on-how-to-describe-a-matrix-used-for-2d-finite-differences-using-blockbandedmatrices-jl/103086)

<div class="topic-metadata">

**Author:** [@Tomusz](https://discourse.julialang.org/u/Tomusz)\
**Replies:** 9\
**Last updated:** [August 25, 2023, 5:48pm UTC](https://discourse.julialang.org/t/help-on-how-to-describe-a-matrix-used-for-2d-finite-differences-using-blockbandedmatrices-jl/103086 "2023-08-25T17:48:46Z")

</div>

Some context I’m dealing with the solution of a Poisson Equation with structure: ∇ψ\[i, j\] = -ω\[i,j\] =\> (∂²ψ/∂x² + ∂²ψ/∂y²) = -ω\[i,j\] To represent the LHS, i’m using a Matrix that contains the coefficients used to calc…

---

## [Callback based PDE BC mutation](https://discourse.julialang.org/t/callback-based-pde-bc-mutation/103194)

<div class="topic-metadata">

**Author:** [@johnb](https://discourse.julialang.org/u/johnb)\
**Replies:** 1\
**Last updated:** [August 25, 2023, 4:12pm UTC](https://discourse.julialang.org/t/callback-based-pde-bc-mutation/103194 "2023-08-25T16:12:54Z")

</div>

I’ve been trying to figure out how to pass time dependent boundary conditions into MethodOfLines advection/diffusion/reaction problems so I can mutate them during parameter optimization without having to rediscretize the…

---

## [Callback for Mass-Matrix Differential-Algebraic Equations (DAEs) differentialequations.jl](https://discourse.julialang.org/t/callback-for-mass-matrix-differential-algebraic-equations-daes-differentialequations-jl/103193)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 6\
**Last updated:** [August 25, 2023, 3:44pm UTC](https://discourse.julialang.org/t/callback-for-mass-matrix-differential-algebraic-equations-daes-differentialequations-jl/103193 "2023-08-25T15:44:34Z")

</div>

Hello How can do I use callback for mass matrix DAE? I tried using callback and got the following error Without a callback, the system is considered without error (The same callback works for ODE without errors) ERRO…

---

## [MTK Easy way to get required states of observed state](https://discourse.julialang.org/t/mtk-easy-way-to-get-required-states-of-observed-state/102746)

<div class="topic-metadata">

**Author:** [@jondavis847](https://discourse.julialang.org/u/jondavis847)\
**Replies:** 5\
**Last updated:** [August 25, 2023, 1:53pm UTC](https://discourse.julialang.org/t/mtk-easy-way-to-get-required-states-of-observed-state/102746 "2023-08-25T13:53:01Z")

</div>

Hello, Say I have an MTK model with a state x that is dependent on states y and z. After structural simplification x and it’s equation are moved to observed, y and z are still present in the simplified solution. I save …

---

## [Iterative completion of PDE solutions](https://discourse.julialang.org/t/iterative-completion-of-pde-solutions/103118)

<div class="topic-metadata">

**Author:** [@Knud\_Sorensen](https://discourse.julialang.org/u/Knud_Sorensen)\
**Replies:** 2\
**Last updated:** [August 24, 2023, 2:24am UTC](https://discourse.julialang.org/t/iterative-completion-of-pde-solutions/103118 "2023-08-24T02:24:05Z")

</div>

Hi. I have been reading this article, https://papers.ssrn.com/sol3/papers.cfm?abstract\_id=3736505 Where they iteratively complete a solution symbolically. It is possible to do something similar numerical in Julia ? I…

---

## [Coupled PDEs with NeuralPDE.jl](https://discourse.julialang.org/t/coupled-pdes-with-neuralpde-jl/103064)

<div class="topic-metadata">

**Author:** [@Knud\_Sorensen](https://discourse.julialang.org/u/Knud_Sorensen)\
**Replies:** 2\
**Last updated:** [August 22, 2023, 8:08pm UTC](https://discourse.julialang.org/t/coupled-pdes-with-neuralpde-jl/103064 "2023-08-22T20:08:48Z")

</div>

Does anyone have an example on how to use NeuralPDE.jl with Coupled PDEs ? All the examples I have seen only use one function, I would like to solve 8 coupled equations with 8 functions. So, if an example with more than…

---

## [Bootstrap in Global Sensitivity Analysis (GSA)](https://discourse.julialang.org/t/bootstrap-in-global-sensitivity-analysis-gsa/103045)

<div class="topic-metadata">

**Author:** [@xztt](https://discourse.julialang.org/u/xztt)\
**Replies:** 1\
**Last updated:** [August 22, 2023, 12:46am UTC](https://discourse.julialang.org/t/bootstrap-in-global-sensitivity-analysis-gsa/103045 "2023-08-22T00:46:39Z")

</div>

Hi There, Running the basic example below the bootstrapping just returns nothing So no standard errors are returned at all. Playing with sobolsensitivity.jl package if I go in and hard code nboot I can return bootstra…

---

## [Solving a differential equation with functions that defined on a finite range causes dtmin error](https://discourse.julialang.org/t/solving-a-differential-equation-with-functions-that-defined-on-a-finite-range-causes-dtmin-error/102963)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 1\
**Last updated:** [August 18, 2023, 9:52pm UTC](https://discourse.julialang.org/t/solving-a-differential-equation-with-functions-that-defined-on-a-finite-range-causes-dtmin-error/102963 "2023-08-18T21:52:56Z")

</div>

Like all of us, I am trying to solve a differential equation. I get errors that say the model is unstable: Warning: dt(1.88079096131566001274997845956e-37) \<= dtmin(1.88079096131566001274997845956e-37) at t=0.0297491697…

---

## [Causal.jl vs ModelingToolkit.jl for causal, discrete-time, and Simulink-like systems](https://discourse.julialang.org/t/causal-jl-vs-modelingtoolkit-jl-for-causal-discrete-time-and-simulink-like-systems/82881)

<div class="topic-metadata">

**Author:** [@tapyu](https://discourse.julialang.org/u/tapyu)\
**Replies:** 36\
**Last updated:** [August 18, 2023, 8:41am UTC](https://discourse.julialang.org/t/causal-jl-vs-modelingtoolkit-jl-for-causal-discrete-time-and-simulink-like-systems/82881 "2023-08-18T08:41:27Z")

</div>

I am an experienced-Simulink user who is trying to move to Julia. My goal is to develop discrete-time(probably stochastic) systems. As a former Simulink user, I always think in terms of block diagrams and signal flows. R…

---

## [Simple approachable example highlighting the usage of a stiff ODE solver in DiffEq](https://discourse.julialang.org/t/simple-approachable-example-highlighting-the-usage-of-a-stiff-ode-solver-in-diffeq/102741)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 8\
**Last updated:** [August 12, 2023, 5:15pm UTC](https://discourse.julialang.org/t/simple-approachable-example-highlighting-the-usage-of-a-stiff-ode-solver-in-diffeq/102741 "2023-08-12T17:15:13Z")

</div>

Hi all, I will be presenting a Julia tutorial on an international PHD school, and OrdinaryDiffEq.jl will be one of the packages I will be highlighting. I want to demonstrate some of the various solvers of the ecosystem v…

---

## [ModelingToolkit KeyError](https://discourse.julialang.org/t/modelingtoolkit-keyerror/102716)

<div class="topic-metadata">

**Author:** [@sabbraxcaddabra](https://discourse.julialang.org/u/sabbraxcaddabra)\
**Replies:** 4\
**Last updated:** [August 11, 2023, 6:38pm UTC](https://discourse.julialang.org/t/modelingtoolkit-keyerror/102716 "2023-08-11T18:38:27Z")

</div>

I’m trying to model powder burning in small chamber by the following code. The problem is that I need to stop integration when there is more gas then chamber volume. I try to do it by adding callback to bal\_eqs. But I g…

---

## [Help with callbacks (to set a variable to a constant value)](https://discourse.julialang.org/t/help-with-callbacks-to-set-a-variable-to-a-constant-value/102634)

<div class="topic-metadata">

**Author:** [@aleppersico](https://discourse.julialang.org/u/aleppersico)\
**Replies:** 4\
**Last updated:** [August 9, 2023, 5:03pm UTC](https://discourse.julialang.org/t/help-with-callbacks-to-set-a-variable-to-a-constant-value/102634 "2023-08-09T17:03:09Z")

</div>

Hello! :slight\_smile: I am simulating a complex dynamical system with DifferentialEquations.jl and via callbacks I introduce perturbations of some parameters. I would like to introduce a callback which continuously sets…

---

## [Deep Bayesian Model Discovery without using NeuralODE object](https://discourse.julialang.org/t/deep-bayesian-model-discovery-without-using-neuralode-object/102403)

<div class="topic-metadata">

**Author:** [@gsh19](https://discourse.julialang.org/u/gsh19)\
**Replies:** 4\
**Last updated:** [August 3, 2023, 12:45am UTC](https://discourse.julialang.org/t/deep-bayesian-model-discovery-without-using-neuralode-object/102403 "2023-08-03T00:45:11Z")

</div>

Hi everyone. I am trying to implement the Deep Bayesian Model Discovery on the Lotka-Volterra model discussed in the Automated Discovery of Missing Physics example. The problem I am facing is that I am not able to figur…

---

## [Documentation of ImplicitRKMil - StochasticDiffEq.jl](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104)

<div class="topic-metadata">

**Author:** [@lappet](https://discourse.julialang.org/u/lappet)\
**Replies:** 3\
**Last updated:** [August 9, 2023, 9:34am UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104 "2023-08-09T09:34:52Z")

</div>

My goal is to undertsand the actual implementation of the ImplicitRKMil algorithm here. Are there any notes or book sections directly relating to the code here? The perspective of my question is this: I have a bunch of …

---

## [Intended way to learn parameters in a PDE system?](https://discourse.julialang.org/t/intended-way-to-learn-parameters-in-a-pde-system/100345)

<div class="topic-metadata">

**Author:** [@masinister](https://discourse.julialang.org/u/masinister)\
**Replies:** 9\
**Last updated:** [August 8, 2023, 6:07pm UTC](https://discourse.julialang.org/t/intended-way-to-learn-parameters-in-a-pde-system/100345 "2023-08-08T18:07:01Z")

</div>

My end goal is to train a UDE which is solved via MethodOfLines. For now, my minimal example tries to learn a single parameter \\alpha (the initial condition), but gets a warning I don’t understand: Warning: : no method…

---

## [Initialize some functions at every remake in PDEProblem](https://discourse.julialang.org/t/initialize-some-functions-at-every-remake-in-pdeproblem/102078)

<div class="topic-metadata">

**Author:** [@Qfl3x](https://discourse.julialang.org/u/Qfl3x)\
**Replies:** 4\
**Last updated:** [August 8, 2023, 6:03pm UTC](https://discourse.julialang.org/t/initialize-some-functions-at-every-remake-in-pdeproblem/102078 "2023-08-08T18:03:36Z")

</div>

Hello, Is there a way to initialize a function in MethodOfLines so that I can “compile” it once for every parameter set, here’s an example: using ModelingToolkit, MethodOfLines, LinearAlgebra, OrdinaryDiffEq, DomainSet…

---

## [Calculating equilibrium states takes too long IntervalRootFinding](https://discourse.julialang.org/t/calculating-equilibrium-states-takes-too-long-intervalrootfinding/102553)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 6\
**Last updated:** [August 7, 2023, 11:24am UTC](https://discourse.julialang.org/t/calculating-equilibrium-states-takes-too-long-intervalrootfinding/102553 "2023-08-07T11:24:19Z")

</div>

Hello, i calculate equilibriums with IntervalRootFinding.Newton The calculation time takes too long Could it be some kind of error or a problem in the method itself? I call the method of Newton using fixedpoints fro…

---

## [Nested struct as state variable in DifferentialEquations](https://discourse.julialang.org/t/nested-struct-as-state-variable-in-differentialequations/88583)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 7\
**Last updated:** [August 3, 2023, 8:53am UTC](https://discourse.julialang.org/t/nested-struct-as-state-variable-in-differentialequations/88583 "2023-08-03T08:53:41Z")

</div>

I’m learning to use the DifferentialEquations ecosystem, and my goal is to simulate dynamic systems in which the state variable is a custom struct. In the simplest case, my state variable is just the x and y coordinates…

---

## [How to take (mathematical) gradients with ModelingTookit.jl](https://discourse.julialang.org/t/how-to-take-mathematical-gradients-with-modelingtookit-jl/102161)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 2\
**Last updated:** [July 27, 2023, 8:30pm UTC](https://discourse.julialang.org/t/how-to-take-mathematical-gradients-with-modelingtookit-jl/102161 "2023-07-27T20:30:46Z")

</div>

Consider a Hamiltonian H=x^2 + y^2. I want automatically calculate Hamilton’s equation of motion by taking the partial derivatives wrt to x and y. How to do this with ModelingToolkit.jl? I cannot get calculate\_gradient t…

---

## [How to use Catlab, WiringDiagrams for my explicit purpose?](https://discourse.julialang.org/t/how-to-use-catlab-wiringdiagrams-for-my-explicit-purpose/101172)

<div class="topic-metadata">

**Author:** [@Tillmann\_Bosch](https://discourse.julialang.org/u/Tillmann_Bosch)\
**Replies:** 2\
**Last updated:** [July 27, 2023, 9:49am UTC](https://discourse.julialang.org/t/how-to-use-catlab-wiringdiagrams-for-my-explicit-purpose/101172 "2023-07-27T09:49:52Z")

</div>

Hey there! I want to build a little framework to model calculation flows. The image I appended shows an example of a renuve and costs calculation, which finally calculates some profit. Structurally this is a direct…

---

## ['update\_varmap!' Not defined in MethodOfLines](https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063)

<div class="topic-metadata">

**Author:** [@WillSimpkins](https://discourse.julialang.org/u/WillSimpkins)\
**Replies:** 1\
**Last updated:** [July 25, 2023, 11:35pm UTC](https://discourse.julialang.org/t/update-varmap-not-defined-in-methodoflines/102063 "2023-07-25T23:35:53Z")

</div>

I am modelling a PDE describing the deformations of a beam, this has the form of a second order PDE in time along with an integral condition on the beam’s strain. I am attempting to discretise this using ModelingToolkit …

---

## [How can I use @register\_symbolic inside of a function?](https://discourse.julialang.org/t/how-can-i-use-register-symbolic-inside-of-a-function/101734)

<div class="topic-metadata">

**Author:** [@retepz](https://discourse.julialang.org/u/retepz)\
**Replies:** 6\
**Last updated:** [July 24, 2023, 7:31am UTC](https://discourse.julialang.org/t/how-can-i-use-register-symbolic-inside-of-a-function/101734 "2023-07-24T07:31:00Z")

</div>

I want to solve a PDE-Problem that is a kind of an advection problem with dynamic boundary conditions. The PDE itself is solved with ModelingToolkit and Method of lines. the entire calculation should be called finally fr…

---

## [Number of times loss function is called](https://discourse.julialang.org/t/number-of-times-loss-function-is-called/101834)

<div class="topic-metadata">

**Author:** [@T\_J](https://discourse.julialang.org/u/T_J)\
**Replies:** 4\
**Last updated:** [July 20, 2023, 3:08pm UTC](https://discourse.julialang.org/t/number-of-times-loss-function-is-called/101834 "2023-07-20T15:08:32Z")

</div>

Hi, In the Lotka-Volterra system, I have placed: function loss(θ) println("loss is called") X̂ = predict(θ) mean(abs2, Xₙ .- X̂) end losses = Float64\[\] callback = function (p, l) push!(losses, l) …

---

## [Homoclinic loop accuracy DifferentialEquations.jl](https://discourse.julialang.org/t/homoclinic-loop-accuracy-differentialequations-jl/97456)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 25\
**Last updated:** [July 19, 2023, 2:19pm UTC](https://discourse.julialang.org/t/homoclinic-loop-accuracy-differentialequations-jl/97456 "2023-07-19T14:19:24Z")

</div>

Hello! I try get homoclinic loop to saddle focus for system of Rossler. With the given parameters, the homoclinic definitely exists, according to some articles. To get homoclinic loop, I integrate in backward time. Whe…

---

## [Possibility to convert SciMLBase.SplitODEProblem to SciMLBase.ODEProblem](https://discourse.julialang.org/t/possibility-to-convert-scimlbase-splitodeproblem-to-scimlbase-odeproblem/101732)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 3\
**Last updated:** [July 19, 2023, 11:00am UTC](https://discourse.julialang.org/t/possibility-to-convert-scimlbase-splitodeproblem-to-scimlbase-odeproblem/101732 "2023-07-19T11:00:47Z")

</div>

I was wondering whether there is a neat way of converting a split ODE problem of the form SplitODEProblem{isinplace}(f1,f2,u0,tspan,p=NullParameters();kwargs...) to an usual ODE problem ODEProblem{isinplace,specialize}…

---

## [Issue on how to get the ids for agents in a specific position on a 2d grid](https://discourse.julialang.org/t/issue-on-how-to-get-the-ids-for-agents-in-a-specific-position-on-a-2d-grid/101744)

<div class="topic-metadata">

**Author:** [@mantzaris](https://discourse.julialang.org/u/mantzaris)\
**Replies:** 2\
**Last updated:** [July 18, 2023, 6:34pm UTC](https://discourse.julialang.org/t/issue-on-how-to-get-the-ids-for-agents-in-a-specific-position-on-a-2d-grid/101744 "2023-07-18T18:34:30Z")

</div>

Using this line of code with Agents.jl: ids\_in\_position( (2,2) , schelling ) I get this error: MethodError: no method matching ids\_in\_position(::Tuple{Int64, Int64}, ::UnremovableABM{GridSpaceSingle{2, false}, Schelli…

---

## [Modelingtoolkit and multithreading](https://discourse.julialang.org/t/modelingtoolkit-and-multithreading/101739)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [July 18, 2023, 4:45pm UTC](https://discourse.julialang.org/t/modelingtoolkit-and-multithreading/101739 "2023-07-18T16:45:51Z")

</div>

I have model, based on Modelingtoolkit and I am solving it with DifferentialEquations. Now I try to solve n models in parallel (well, it is mostly the same model, but with different parameters). It currently gives wrong…

---

## [Produce a heatmap for agents on a 2d grid with abmplot](https://discourse.julialang.org/t/produce-a-heatmap-for-agents-on-a-2d-grid-with-abmplot/101638)

<div class="topic-metadata">

**Author:** [@mantzaris](https://discourse.julialang.org/u/mantzaris)\
**Replies:** 3\
**Last updated:** [July 17, 2023, 4:13pm UTC](https://discourse.julialang.org/t/produce-a-heatmap-for-agents-on-a-2d-grid-with-abmplot/101638 "2023-07-17T16:13:39Z")

</div>

Given a agent based model (using Agents.jl) of agents on a 2d grid with values between 0-10 (continuous) is it possible to produce a heatmap using abmplot? (each agent has a Float param) If so what is a straightforward a…

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

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