# Modelling & Simulations

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

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

**Page:** 61

---

## [Callbacks for parameters in a stiff system of ODEs?](https://discourse.julialang.org/t/callbacks-for-parameters-in-a-stiff-system-of-odes/41580)

<div class="topic-metadata">

**Author:** [@dynova](https://discourse.julialang.org/u/dynova)\
**Replies:** 8\
**Last updated:** [June 18, 2020, 3:46pm UTC](https://discourse.julialang.org/t/callbacks-for-parameters-in-a-stiff-system-of-odes/41580 "2020-06-18T15:46:18Z")

</div>

I have a stiff system of 21 ODEs, for which I want to use callback functions on some time-dependent parameters. Looking for some help on this, as I’m running into some error messages and I’m new to callbacks. Not entire…

---

## [Different result with PeriodicCallback](https://discourse.julialang.org/t/different-result-with-periodiccallback/41273)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 13\
**Last updated:** [June 14, 2020, 4:47pm UTC](https://discourse.julialang.org/t/different-result-with-periodiccallback/41273 "2020-06-14T16:47:34Z")

</div>

I am trieing to understand the PeriodicCallback method and noticed something weird. using DifferentialEquations, PyPlot mutable struct SimType{T} \<: DEDataVector{T} x::Vector{T} a::T end f1(du, u, p, t) = du\[1…

---

## [ModelingToolkit: using it with parallel ensemble simulations](https://discourse.julialang.org/t/modelingtoolkit-using-it-with-parallel-ensemble-simulations/40963)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 4\
**Last updated:** [June 8, 2020, 3:07pm UTC](https://discourse.julialang.org/t/modelingtoolkit-using-it-with-parallel-ensemble-simulations/40963 "2020-06-08T15:07:04Z")

</div>

I’m testing out ModelingToolkit to see if I can get a performance improvement. I’ve converted my prob using modelingtoolkitize(prob). I’m wondering if the ModelingToolkit prob is compatible with EnsembleProblem, and what…

---

## [Parameter substitutions in ModelingToolkit.jl](https://discourse.julialang.org/t/parameter-substitutions-in-modelingtoolkit-jl/34527)

<div class="topic-metadata">

**Author:** [@DR59](https://discourse.julialang.org/u/DR59)\
**Replies:** 8\
**Last updated:** [May 30, 2020, 7:18am UTC](https://discourse.julialang.org/t/parameter-substitutions-in-modelingtoolkit-jl/34527 "2020-05-30T07:18:57Z")

</div>

Hi, I’m getting to grips with ModelingToolkit.jl. Let’s take the ODE building example in the tutorial: @parameters t σ ρ β @variables x(t) y(t) z(t) @derivatives D'~t eqs = \[D(x) ~ σ\*(y-x), D(y) ~ x\*(ρ-z)-y, …

---

## [DiffEqParamEstim.jl on Ensemble problems: autodiff doesn't work](https://discourse.julialang.org/t/diffeqparamestim-jl-on-ensemble-problems-autodiff-doesnt-work/40004)

<div class="topic-metadata">

**Author:** [@DR59](https://discourse.julialang.org/u/DR59)\
**Replies:** 2\
**Last updated:** [May 23, 2020, 8:24pm UTC](https://discourse.julialang.org/t/diffeqparamestim-jl-on-ensemble-problems-autodiff-doesnt-work/40004 "2020-05-23T20:24:42Z")

</div>

Hi! Hi! I’m not sure if what I have highlighted below is a bug/missing design feature/necessary evil. Could anyone enlighten me? Thanks! I’m using the excellent build\_loss\_objective() function from DiffEqParamEstim.jl,…

---

## [ModelingToolkit: using intermediate calculation results multiple times](https://discourse.julialang.org/t/modelingtoolkit-using-intermediate-calculation-results-multiple-times/39738)

<div class="topic-metadata">

**Author:** [@caryan](https://discourse.julialang.org/u/caryan)\
**Replies:** 7\
**Last updated:** [May 20, 2020, 10:42pm UTC](https://discourse.julialang.org/t/modelingtoolkit-using-intermediate-calculation-results-multiple-times/39738 "2020-05-20T22:42:03Z")

</div>

Let’s say I have an expensive scalar that shows up multiple times in my set of differential equations. Is there a way to tell ModelingToolkit to hoist that calculation out and only do it once? If I use an intermediate ca…

---

## [Du\[i\] not the same as integrator(t,Val{1})? DifferentialEquations.jl](https://discourse.julialang.org/t/du-i-not-the-same-as-integrator-t-val-1-differentialequations-jl/39616)

<div class="topic-metadata">

**Author:** [@ANasc](https://discourse.julialang.org/u/ANasc)\
**Replies:** 2\
**Last updated:** [May 17, 2020, 12:49pm UTC](https://discourse.julialang.org/t/du-i-not-the-same-as-integrator-t-val-1-differentialequations-jl/39616 "2020-05-17T12:49:59Z")

</div>

Hi All, I am playing with a basic SIR disease model and would like to make the transmission rate (Beta) depend on the rate at which the number of disease-related deaths changes. (e.g., when few deaths are occurring tr…

---

## [JuAFEM difference between apply! and apply\_zero!](https://discourse.julialang.org/t/juafem-difference-between-apply-and-apply-zero/39072)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 1\
**Last updated:** [May 8, 2020, 12:01pm UTC](https://discourse.julialang.org/t/juafem-difference-between-apply-and-apply-zero/39072 "2020-05-08T12:01:07Z")

</div>

In some examples for JuAFEM I often see people using either “apply!()” or “apply\_zero!()” to apply the boundary conditions. Can someone explain me the difference: apply!(K, f, dbc) apply\_zero!(K, f, dbc…

---

## [Solver hang when using certain combination of callbacks in DiffEq](https://discourse.julialang.org/t/solver-hang-when-using-certain-combination-of-callbacks-in-diffeq/38846)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 3\
**Last updated:** [May 6, 2020, 5:30am UTC](https://discourse.julialang.org/t/solver-hang-when-using-certain-combination-of-callbacks-in-diffeq/38846 "2020-05-06T05:30:07Z")

</div>

Hi, I’m trying to use a PeriodicCallback and two ContinuousCallbacks and I’m running into an issue. Here’s the MWE: using DifferentialEquations function usode!(du,u,p,t) C1 = 1.63e-9 RS = 790.0 C2 = 3.3e-…

---

## [How to debug memory issues (when using DifferentialEquations)](https://discourse.julialang.org/t/how-to-debug-memory-issues-when-using-differentialequations/38775)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 14\
**Last updated:** [May 6, 2020, 5:13am UTC](https://discourse.julialang.org/t/how-to-debug-memory-issues-when-using-differentialequations/38775 "2020-05-06T05:13:30Z")

</div>

I’m trying to understand an apparent memory issue regarding a simulation I’m doing. Here’s a simplified version of what I’m running: using DifferentialEquations, Plots function usode!(du,u,p,t) C1 = 1.63e-9 R…

---

## [JuAFEM shape gradient as a matrix](https://discourse.julialang.org/t/juafem-shape-gradient-as-a-matrix/38825)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 4\
**Last updated:** [May 5, 2020, 8:49pm UTC](https://discourse.julialang.org/t/juafem-shape-gradient-as-a-matrix/38825 "2020-05-05T20:49:25Z")

</div>

Hello everybody, I hope I am asking the question in a correct way. I am working with JuAFEM and I have a example code given, which calculates the stiffness matrix elementwise. @inbounds for q\_point in 1:getnquadpoints(…

---

## [Avoiding memory allocations when simulating combinations of parameter sets in ParallelEnsemble](https://discourse.julialang.org/t/avoiding-memory-allocations-when-simulating-combinations-of-parameter-sets-in-parallelensemble/38583)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 3\
**Last updated:** [May 2, 2020, 3:58am UTC](https://discourse.julialang.org/t/avoiding-memory-allocations-when-simulating-combinations-of-parameter-sets-in-parallelensemble/38583 "2020-05-02T03:58:28Z")

</div>

I have an array of arrays p = \[a, b\] for p in ode\_model!(du, u, p, t). I am running a ParallelEnsemble where I want to simulate all combinations of a in A and b in B where A and B are arrays of arrays. I noticed that usi…

---

## [Unexpected memory allocation inside ODE function with EnsembleProblem](https://discourse.julialang.org/t/unexpected-memory-allocation-inside-ode-function-with-ensembleproblem/38492)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 6\
**Last updated:** [April 30, 2020, 7:07pm UTC](https://discourse.julialang.org/t/unexpected-memory-allocation-inside-ode-function-with-ensembleproblem/38492 "2020-04-30T19:07:06Z")

</div>

I am unsure if this is an issue or I just don’t understand how memory allocation works with ensemble problems. I start Julia with --track-allocation=user and run the following small script using DifferentialEquations u…

---

## [Combining pmap with EnsembleProblem](https://discourse.julialang.org/t/combining-pmap-with-ensembleproblem/38383)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 5\
**Last updated:** [April 28, 2020, 8:40pm UTC](https://discourse.julialang.org/t/combining-pmap-with-ensembleproblem/38383 "2020-04-28T20:40:59Z")

</div>

I have an EnsembleProblem defined that calculates outputs for a range of different start times. I need to repeat the the whole EnsembleProblem many times for different parameter values and save the output of each Ensembl…

---

## [Passing along data from one time step to the next using DifferentialEquations.jl](https://discourse.julialang.org/t/passing-along-data-from-one-time-step-to-the-next-using-differentialequations-jl/38335)

<div class="topic-metadata">

**Author:** [@bielim](https://discourse.julialang.org/u/bielim)\
**Replies:** 5\
**Last updated:** [April 28, 2020, 2:28am UTC](https://discourse.julialang.org/t/passing-along-data-from-one-time-step-to-the-next-using-differentialequations-jl/38335 "2020-04-28T02:28:20Z")

</div>

I am using DifferentialEquations.jl to solve an ODE of the form \\frac{d\\boldsymbol{M}}{dt} = \\boldsymbol{f}(\\boldsymbol{M}), where \\boldsymbol{M} = \[M\_1, ..., M\_k\]^T, and \\boldsymbol{f} = \[f\_1(\\boldsymbol{M}), ..., f\_k(\\…

---

## [Fast implementations of integrodifference equations?](https://discourse.julialang.org/t/fast-implementations-of-integrodifference-equations/38265)

<div class="topic-metadata">

**Author:** [@peterj](https://discourse.julialang.org/u/peterj)\
**Replies:** 0\
**Last updated:** [April 26, 2020, 9:50pm UTC](https://discourse.julialang.org/t/fast-implementations-of-integrodifference-equations/38265 "2020-04-26T21:50:37Z")

</div>

Are there any libraries which have fast implementations of integrodifference equations? These are discrete time, continuous space dynamical systems used a lot in mathematical ecology where diffusion is replaced by integ…

---

## [Simplifying simulation by clusters](https://discourse.julialang.org/t/simplifying-simulation-by-clusters/35870)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 18\
**Last updated:** [April 26, 2020, 3:10pm UTC](https://discourse.julialang.org/t/simplifying-simulation-by-clusters/35870 "2020-04-26T15:10:01Z")

</div>

This is partly a question asking for recommendations on an algorithm, ideally something that is implemented some Julia package, or can be done simply using one. I am simulating a process in \\mathbb{R}^3 (I can constrai…

---

## [ParameterizedFunctions.jl @ode\_def programmatically generate model](https://discourse.julialang.org/t/parameterizedfunctions-jl-ode-def-programmatically-generate-model/37733)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 3\
**Last updated:** [April 20, 2020, 7:30pm UTC](https://discourse.julialang.org/t/parameterizedfunctions-jl-ode-def-programmatically-generate-model/37733 "2020-04-20T19:30:41Z")

</div>

Is there a way to pass variables into @ode\_def that would be treated as constants in the ODE problem? For example, something like function create\_model\_def(male) h = male ? 2.0 : 7.0 f = @ode\_def begin …

---

## [Help with Puzzle Solver Program](https://discourse.julialang.org/t/help-with-puzzle-solver-program/37412)

<div class="topic-metadata">

**Author:** [@peterfarrell66](https://discourse.julialang.org/u/peterfarrell66)\
**Replies:** 5\
**Last updated:** [April 12, 2020, 4:30am UTC](https://discourse.julialang.org/t/help-with-puzzle-solver-program/37412 "2020-04-12T04:30:08Z")

</div>

Hi! I’m new to Julia but I’ve had years of experience using Python and some Javascript too. I wrote a puzzle solving program in Python and got a big speedup when I translated it to Javascript. I’ve taken a bash at a Jul…

---

## [Using ForwardDiff to differentiate an ODE with respect to some of its parameters](https://discourse.julialang.org/t/using-forwarddiff-to-differentiate-an-ode-with-respect-to-some-of-its-parameters/37353)

<div class="topic-metadata">

**Author:** [@peterj](https://discourse.julialang.org/u/peterj)\
**Replies:** 5\
**Last updated:** [April 10, 2020, 6:38pm UTC](https://discourse.julialang.org/t/using-forwarddiff-to-differentiate-an-ode-with-respect-to-some-of-its-parameters/37353 "2020-04-10T18:38:35Z")

</div>

So far, I have this using DifferentialEquations using LabelledArrays const n = 10 struct params p\_to\_optimize\_array::AbstractArray{\<:Real,1} p\_constant\_array::AbstractArray{\<:Real,1} end function f1(du,u…

---

## [What is the best molecular dynamics analysis library in Julia?](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865)

<div class="topic-metadata">

**Author:** [@dkonstan](https://discourse.julialang.org/u/dkonstan)\
**Replies:** 6\
**Last updated:** [April 8, 2020, 8:18am UTC](https://discourse.julialang.org/t/what-is-the-best-molecular-dynamics-analysis-library-in-julia/36865 "2020-04-08T08:18:55Z")

</div>

So far, I have only seen Chemfiles, which has Julia bindings but is missing important features like a powerful atom selection language. For example, Chemfiles cannot easily select the set of atoms X far away from another…

---

## [Is ParameterizedFunctions.jl still deprecated in favor of ModelingToolkit. jl?](https://discourse.julialang.org/t/is-parameterizedfunctions-jl-still-deprecated-in-favor-of-modelingtoolkit-jl/37210)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 2\
**Last updated:** [April 8, 2020, 3:45am UTC](https://discourse.julialang.org/t/is-parameterizedfunctions-jl-still-deprecated-in-favor-of-modelingtoolkit-jl/37210 "2020-04-08T03:45:27Z")

</div>

Title says it all: Is ParameterizedFunctions.jl still deprecated in favor of ModelingToolkit.jl? The disclaimer in the ParameterizedFunctions Git, “Note that this library is deprecated in favor of ModelingToolkit.jl,” i…

---

## [Looking for findfirst or similar for sol objects of DifferentialEquations](https://discourse.julialang.org/t/looking-for-findfirst-or-similar-for-sol-objects-of-differentialequations/37134)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 6\
**Last updated:** [April 7, 2020, 6:21pm UTC](https://discourse.julialang.org/t/looking-for-findfirst-or-similar-for-sol-objects-of-differentialequations/37134 "2020-04-07T18:21:52Z")

</div>

Hello! I’m doing some control systems work and wanting to find things like risetime of responses, so I want to find where a simulation variable crosses some value. findfirst works but it searches among the simulation po…

---

## [Extracting derivatives (du/dt) from an ODE problem](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514)

<div class="topic-metadata">

**Author:** [@Hossein\_Haghi](https://discourse.julialang.org/u/Hossein_Haghi)\
**Replies:** 24\
**Last updated:** [April 6, 2020, 11:28pm UTC](https://discourse.julialang.org/t/extracting-derivatives-du-dt-from-an-ode-problem/26514 "2020-04-06T23:28:28Z")

</div>

I have multiple ODE problems that I am solving. where I need the solutions (u) and derivative of the solutions (du). For smaller ODEs it is practical for me to do the following using DifferentialEquations function SB(d…

---

## [Interpolations: boundary conditions for the second and first derivative](https://discourse.julialang.org/t/interpolations-boundary-conditions-for-the-second-and-first-derivative/37036)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 4\
**Last updated:** [April 6, 2020, 10:19am UTC](https://discourse.julialang.org/t/interpolations-boundary-conditions-for-the-second-and-first-derivative/37036 "2020-04-06T10:19:53Z")

</div>

Is there a way to have a cubic interpolation with boundary conditions for the 2nd and 1st derivative? I am using Interpolations.jl Here is an example using Interpolations, Plots x = 1:10 y = rand(10) y\[1\] = 0 y\[10\] = …

---

## [Yet another virus sim, but this time combing Actors.jl and agents](https://discourse.julialang.org/t/yet-another-virus-sim-but-this-time-combing-actors-jl-and-agents/37039)

<div class="topic-metadata">

**Author:** [@richiejp](https://discourse.julialang.org/u/richiejp)\
**Replies:** 6\
**Last updated:** [April 5, 2020, 6:32pm UTC](https://discourse.julialang.org/t/yet-another-virus-sim-but-this-time-combing-actors-jl-and-agents/37039 "2020-04-05T18:32:51Z")

</div>

I have implemented a toy agent based model using Actors.jl. Somehow I missed the existence of Agents.jl, but it is probably good to have a few different options. At any rate it is possible to implement the agent model w…

---

## [COVID-19 - Model and ODE delay equations](https://discourse.julialang.org/t/covid-19-model-and-ode-delay-equations/36632)

<div class="topic-metadata">

**Author:** [@Emmanuel-R8](https://discourse.julialang.org/u/Emmanuel-R8)\
**Replies:** 19\
**Last updated:** [April 3, 2020, 1:53pm UTC](https://discourse.julialang.org/t/covid-19-model-and-ode-delay-equations/36632 "2020-04-03T13:53:38Z")

</div>

I have a working model and parameter optimiser for the COVID-19 epidemy (Emmanuel-R8/COVID-19-Julia\](\[GitHub - Emmanuel-R8/COVID-19-Julia: A re-implementation of the Neherlab.org model in Julia). The model is inspired (b…

---

## [Multiple variable assignment and ODE solution extracting](https://discourse.julialang.org/t/multiple-variable-assignment-and-ode-solution-extracting/36647)

<div class="topic-metadata">

**Author:** [@jmaffi](https://discourse.julialang.org/u/jmaffi)\
**Replies:** 4\
**Last updated:** [March 30, 2020, 12:11pm UTC](https://discourse.julialang.org/t/multiple-variable-assignment-and-ode-solution-extracting/36647 "2020-03-30T12:11:33Z")

</div>

Hi there! I am quite new to Julia and have read manuals, tutorials, FAQs, and almost all question threads regarding the following, but have not yet found a solution. I have a system of 17 ordinary differential equation…

---

## [Using a Voronoi tessellation to represent a density field](https://discourse.julialang.org/t/using-a-voronoi-tessellation-to-represent-a-density-field/36585)

<div class="topic-metadata">

**Author:** [@arnauqb](https://discourse.julialang.org/u/arnauqb)\
**Replies:** 0\
**Last updated:** [March 27, 2020, 7:13am UTC](https://discourse.julialang.org/t/using-a-voronoi-tessellation-to-represent-a-density-field/36585 "2020-03-27T07:13:16Z")

</div>

Hi all, I have a set of 2D points (x,y) with a density value associated to them. I want to create a 2D density field from that, using a Voronoi tessellation. I am then interested to be able to query the density value fo…

---

## [ChaosTools lyapunovs with stiff solvers](https://discourse.julialang.org/t/chaostools-lyapunovs-with-stiff-solvers/35961)

<div class="topic-metadata">

**Author:** [@rusandris](https://discourse.julialang.org/u/rusandris)\
**Replies:** 3\
**Last updated:** [March 24, 2020, 9:25pm UTC](https://discourse.julialang.org/t/chaostools-lyapunovs-with-stiff-solvers/35961 "2020-03-24T21:25:54Z")

</div>

I’ve come across a problem regarding using lyapunovs() with stiff diffeq solvers. It is very similar to this one: Problem with tangent\_integrator: Chaostools tangent\_integrator stiff solvers tangent\_integrator not comp…

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

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