# Modelling & Simulations

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

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

**Page:** 20

---

## [Running EBM model in a function](https://discourse.julialang.org/t/running-ebm-model-in-a-function/117512)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [July 29, 2024, 9:28am UTC](https://discourse.julialang.org/t/running-ebm-model-in-a-function/117512 "2024-07-29T09:28:25Z")

</div>

Hello everyone, Im running EBM model inside a function which is causing issue with calling model properties values. Is there a way to extract them inside function? General Idea of my function: model = model\_initiate()…

---

## [Simple Algebra in MTK](https://discourse.julialang.org/t/simple-algebra-in-mtk/117327)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 5\
**Last updated:** [July 29, 2024, 7:16am UTC](https://discourse.julialang.org/t/simple-algebra-in-mtk/117327 "2024-07-29T07:16:10Z")

</div>

Another beginner question… To what extent can I solve equations in MTK? using ModelingToolKit @mtkmodel Scratch begin @variables begin x(t) y(t) end @equations begin x ~ 3y + 10 y ~ 2x - 5 end e…

---

## [Fitting system of ODEs to already normalized data](https://discourse.julialang.org/t/fitting-system-of-odes-to-already-normalized-data/117400)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 1\
**Last updated:** [July 26, 2024, 1:34pm UTC](https://discourse.julialang.org/t/fitting-system-of-odes-to-already-normalized-data/117400 "2024-07-26T13:34:27Z")

</div>

I have a system of ODEs as a model and want to calibrate it. I have data for multiple outputs of the model but they are already normalized. Since I am unfamiliar with the related packages in Julia, what would you recomme…

---

## [MTK: looping through variables in plot?](https://discourse.julialang.org/t/mtk-looping-through-variables-in-plot/117339)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 6\
**Last updated:** [July 24, 2024, 11:03am UTC](https://discourse.julialang.org/t/mtk-looping-through-variables-in-plot/117339 "2024-07-24T11:03:26Z")

</div>

I’m struggling to figure out how to loop through numbered variables in ModelingToolkit \[MTK\]. As a simple, yet concrete example, consider a model of a telegraph line, which consists in a telegraph line module component …

---

## [Compose SDESystems in ModelingToolkit](https://discourse.julialang.org/t/compose-sdesystems-in-modelingtoolkit/117054)

<div class="topic-metadata">

**Author:** [@VincentW](https://discourse.julialang.org/u/VincentW)\
**Replies:** 2\
**Last updated:** [July 24, 2024, 8:54am UTC](https://discourse.julialang.org/t/compose-sdesystems-in-modelingtoolkit/117054 "2024-07-24T08:54:10Z")

</div>

Hey folks, I am trying to build a compartmental model, where some parameters are supposed to follow a SDE. But somehow can’t get the composition right. I build the following example to illustrate the problem. First usi…

---

## [Causal modeling in MTK?](https://discourse.julialang.org/t/causal-modeling-in-mtk/117161)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 10\
**Last updated:** [July 23, 2024, 9:33pm UTC](https://discourse.julialang.org/t/causal-modeling-in-mtk/117161 "2024-07-23T21:33:09Z")

</div>

After seeing @ChrisRackauckas slides from JuliaCon 2024, I found out that (it seems) ModelingToolkit supports causal models, through passing input and outputs around. Is this really possible? I ask because Causal.jl stru…

---

## [Bode plotting a damped LC filter](https://discourse.julialang.org/t/bode-plotting-a-damped-lc-filter/117324)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 5\
**Last updated:** [July 23, 2024, 7:50am UTC](https://discourse.julialang.org/t/bode-plotting-a-damped-lc-filter/117324 "2024-07-23T07:50:56Z")

</div>

I want to make a bode plot of this LC filter: plotting something like the right graph: I know how to connect resistor, inductor and capacitor using ModelingToolkitStandardLibrary.jl , and how to plot bode plots us…

---

## [Reverse mode AD for SDEs](https://discourse.julialang.org/t/reverse-mode-ad-for-sdes/117353)

<div class="topic-metadata">

**Author:** [@agelgazzar](https://discourse.julialang.org/u/agelgazzar)\
**Replies:** 0\
**Last updated:** [July 22, 2024, 5:09pm UTC](https://discourse.julialang.org/t/reverse-mode-ad-for-sdes/117353 "2024-07-22T17:09:44Z")

</div>

Training Large (e.g, Neural) SDEs on GPUs fails. The only way to obtain adjoints is via TrackerAdjoint() and this only currently works on CPU. None of the continuous adjoints methods, e.g. InterpolatingAdjoint() or Back…

---

## [ModelingToolKit: Cannot \`convert\` an object of type SymbolicUtils.BasicSymbolic{Float64}](https://discourse.julialang.org/t/modelingtoolkit-cannot-convert-an-object-of-type-symbolicutils-basicsymbolic-float64/117213)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 4\
**Last updated:** [July 22, 2024, 1:50pm UTC](https://discourse.julialang.org/t/modelingtoolkit-cannot-convert-an-object-of-type-symbolicutils-basicsymbolic-float64/117213 "2024-07-22T13:50:23Z")

</div>

using ModelingToolkit using ModelingToolkit: t\_nounits as t, D\_nounits as D using DifferentialEquations: solve f(t) = t @register\_symbolic f(t) @mtkmodel FOL begin @variables begin y(t) z(t) end…

---

## [Understanding @connector in MTK](https://discourse.julialang.org/t/understanding-connector-in-mtk/117223)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 2\
**Last updated:** [July 22, 2024, 8:09am UTC](https://discourse.julialang.org/t/understanding-connector-in-mtk/117223 "2024-07-22T08:09:38Z")

</div>

Hello, I have trouble understanding the modeling scheme of modern MTK with pins /connectors and so on. As a toy example, I try to implement this simple system of two coupled oscillators: I tried to model it using th…

---

## [UDE pre-fitting with collocation](https://discourse.julialang.org/t/ude-pre-fitting-with-collocation/117326)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 0\
**Last updated:** [July 22, 2024, 7:58am UTC](https://discourse.julialang.org/t/ude-pre-fitting-with-collocation/117326 "2024-07-22T07:58:08Z")

</div>

Hi, I’d like to pre-train a UDE model using the collocation method from DiffEqFlux.jl: Smoothed Collocation · DiffEqFlux.jl My dataset is 10 days worth of temperature measurements and has around 45,000 points which are …

---

## [Reducing Numerical Diffusion in advection model using ModelingToolkit.jl and MethodOfLines.jl](https://discourse.julialang.org/t/reducing-numerical-diffusion-in-advection-model-using-modelingtoolkit-jl-and-methodoflines-jl/117135)

<div class="topic-metadata">

**Author:** [@el\_desesperado](https://discourse.julialang.org/u/el_desesperado)\
**Replies:** 7\
**Last updated:** [July 18, 2024, 8:21am UTC](https://discourse.julialang.org/t/reducing-numerical-diffusion-in-advection-model-using-modelingtoolkit-jl-and-methodoflines-jl/117135 "2024-07-18T08:21:04Z")

</div>

Hello, I have been trying to model the advection equation( du(x,t)/dt + du(x,t)/dx = 0) using ModelingToolkit.jl and MethodOfLines.jl. import OrdinaryDiffEq, ModelingToolkit, MethodOfLines, DomainSets ModelingToolkit.…

---

## [Functions of variables in @mtkmodel](https://discourse.julialang.org/t/functions-of-variables-in-mtkmodel/117159)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 1\
**Last updated:** [July 17, 2024, 8:31pm UTC](https://discourse.julialang.org/t/functions-of-variables-in-mtkmodel/117159 "2024-07-17T20:31:17Z")

</div>

I’m playing with the new (at least to me) @mtkmodel syntax. Here’s my standard SIR model. using Symbolics using ModelingToolkit: t\_nounits as t, D\_nounits as D using OrdinaryDiffEq using Plots @mtkmodel SIR begin …

---

## [Progress bar in Agents](https://discourse.julialang.org/t/progress-bar-in-agents/117127)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 0\
**Last updated:** [July 17, 2024, 7:28am UTC](https://discourse.julialang.org/t/progress-bar-in-agents/117127 "2024-07-17T07:28:21Z")

</div>

Hello everyone, Im working on an ABM model. Model in itself contains alot of conditions and operations based on that, it also has integration of differential equations. At the moment model is taking too much time to run…

---

## [How to get subtree from symbolic expression? in ModelingToolkit.jl](https://discourse.julialang.org/t/how-to-get-subtree-from-symbolic-expression-in-modelingtoolkit-jl/117070)

<div class="topic-metadata">

**Author:** [@jogama](https://discourse.julialang.org/u/jogama)\
**Replies:** 2\
**Last updated:** [July 16, 2024, 9:42pm UTC](https://discourse.julialang.org/t/how-to-get-subtree-from-symbolic-expression-in-modelingtoolkit-jl/117070 "2024-07-16T21:42:07Z")

</div>

My apologies if this has already been addressed. Let’s say we have using ModelingToolkit @variables t x(t) y(t) z(t) ex = x \* y + z How should I extract the sub-expression x \* y from ex? It’s not clear to me how I’d …

---

## [Tracking population vs agent level attributes in Agents.jl](https://discourse.julialang.org/t/tracking-population-vs-agent-level-attributes-in-agents-jl/117050)

<div class="topic-metadata">

**Author:** [@amynang](https://discourse.julialang.org/u/amynang)\
**Replies:** 3\
**Last updated:** [July 15, 2024, 7:23pm UTC](https://discourse.julialang.org/t/tracking-population-vs-agent-level-attributes-in-agents-jl/117050 "2024-07-15T19:23:55Z")

</div>

I am translating an ABM model from NetLogo to Julia (i.e. Agents.jl). The model, “particle world” is described in Paul Smaldino’s Modeling Social Behavior, where it is used to introduce basic NetLogo functionality. Agen…

---

## [Brute force bifurcation diagram - need help with stiff solver](https://discourse.julialang.org/t/brute-force-bifurcation-diagram-need-help-with-stiff-solver/94387)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 15\
**Last updated:** [July 13, 2024, 1:33pm UTC](https://discourse.julialang.org/t/brute-force-bifurcation-diagram-need-help-with-stiff-solver/94387 "2024-07-13T13:33:46Z")

</div>

Hi All, I’m trying to reproduce a bifurcation diagram (brute force) computed using XPP-AUT. My code is here and the original XPP code from Krylova and Earn (2013) is here. The XPP code seems to give a nice bifurcation …

---

## [Time-varying parameter specification in DiscreteProblem?](https://discourse.julialang.org/t/time-varying-parameter-specification-in-discreteproblem/116975)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 3\
**Last updated:** [July 13, 2024, 1:33pm UTC](https://discourse.julialang.org/t/time-varying-parameter-specification-in-discreteproblem/116975 "2024-07-13T13:33:41Z")

</div>

I have a simple DiscreteProblem, based on the SIR epidemic model. I’d like to pass a time-varying parameter to the model, to reduce \\beta by a factor v(t). As this is a discrete-time map, I’d like to define v as a vector…

---

## [Original until() function](https://discourse.julialang.org/t/original-until-function/116903)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 2\
**Last updated:** [July 11, 2024, 12:33pm UTC](https://discourse.julialang.org/t/original-until-function/116903 "2024-07-11T12:33:38Z")

</div>

Hello everyone, Can someone point me to location of this function until() which is used as follow while until(s, t0, n, model) ....something.... end in agents.jl. I want to check the original function. I was lookin…

---

## [ModelingToolkit: linearization failure](https://discourse.julialang.org/t/modelingtoolkit-linearization-failure/116899)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 1\
**Last updated:** [July 11, 2024, 12:33pm UTC](https://discourse.julialang.org/t/modelingtoolkit-linearization-failure/116899 "2024-07-11T12:33:08Z")

</div>

I’m trying to linearize a “complex” (for me) ModelingToolkit \[MTK\] model consisting of several layers of components that I have written. My components do not use ports (I’m in the process of learning this), and I try to …

---

## [Using latest TermInterface for custom types in MetaTheory](https://discourse.julialang.org/t/using-latest-terminterface-for-custom-types-in-metatheory/116885)

<div class="topic-metadata">

**Author:** [@wgm](https://discourse.julialang.org/u/wgm)\
**Replies:** 2\
**Last updated:** [July 10, 2024, 10:50pm UTC](https://discourse.julialang.org/t/using-latest-terminterface-for-custom-types-in-metatheory/116885 "2024-07-10T22:50:10Z")

</div>

Is there an example of using TermInterface v2.0 with the ale/3.0 branch of MetaTheory for working with custom types? I’m looking for something like Interfacing with Metatheory.jl · Metatheory.jl that works with the lates…

---

## [Use ControlSystemIdentification.jl for a ModelingToolkit.jl model](https://discourse.julialang.org/t/use-controlsystemidentification-jl-for-a-modelingtoolkit-jl-model/116588)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 7\
**Last updated:** [July 10, 2024, 4:21am UTC](https://discourse.julialang.org/t/use-controlsystemidentification-jl-for-a-modelingtoolkit-jl-model/116588 "2024-07-10T04:21:05Z")

</div>

Hi, I have an LTI model defined in ModelingToolkit.jl: @named T\_a\_out = TimeVaryingFunction(input\_funcs\[:T\_a\]) @named Φ\_hp\_out = TimeVaryingFunction(input\_funcs\[:Φ\_hp\]) @named Φ\_cv\_out = TimeVaryingFunction(input\_funcs…

---

## [Question about DataDrivenDiffEq / UDE / Symbolic Regression failing for very sparse settings](https://discourse.julialang.org/t/question-about-datadrivendiffeq-ude-symbolic-regression-failing-for-very-sparse-settings/114320)

<div class="topic-metadata">

**Author:** [@Brian\_Hartley](https://discourse.julialang.org/u/Brian_Hartley)\
**Replies:** 2\
**Last updated:** [July 9, 2024, 11:23pm UTC](https://discourse.julialang.org/t/question-about-datadrivendiffeq-ude-symbolic-regression-failing-for-very-sparse-settings/114320 "2024-07-09T23:23:31Z")

</div>

Hello, I’m playing around with symbolic regression and UDEs for a larger problem and have run into some difficulties. It seems that for various methods, the symbolic regression simply fails with zeros method errors and …

---

## [Macros for compositional modeling in Catalyst not working](https://discourse.julialang.org/t/macros-for-compositional-modeling-in-catalyst-not-working/116568)

<div class="topic-metadata">

**Author:** [@VincentW](https://discourse.julialang.org/u/VincentW)\
**Replies:** 6\
**Last updated:** [July 8, 2024, 9:11pm UTC](https://discourse.julialang.org/t/macros-for-compositional-modeling-in-catalyst-not-working/116568 "2024-07-08T21:11:45Z")

</div>

Dear all, I try to get into compositional modeling of reaction systems using the Catalyst.jl package. However, when I want to execute just their tutorial from the documentation, using Catalyst degradation\_component = …

---

## [MTK MethodError with SymbolicUtils.BasicSymbolic{Real} - how to debug?](https://discourse.julialang.org/t/mtk-methoderror-with-symbolicutils-basicsymbolic-real-how-to-debug/116735)

<div class="topic-metadata">

**Author:** [@Bumlebi](https://discourse.julialang.org/u/Bumlebi)\
**Replies:** 2\
**Last updated:** [July 8, 2024, 9:06am UTC](https://discourse.julialang.org/t/mtk-methoderror-with-symbolicutils-basicsymbolic-real-how-to-debug/116735 "2024-07-08T09:06:55Z")

</div>

I’m in the process of building a set of modeling blocks for a gas system, and I’m currently on working on orifices. Despite having registered my functions and symbolics, I get MethodError for what I can only assume to be…

---

## [Ensuring certain outputs in an ODE problem reach steady state](https://discourse.julialang.org/t/ensuring-certain-outputs-in-an-ode-problem-reach-steady-state/116610)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 4\
**Last updated:** [July 7, 2024, 11:31pm UTC](https://discourse.julialang.org/t/ensuring-certain-outputs-in-an-ode-problem-reach-steady-state/116610 "2024-07-07T23:31:19Z")

</div>

I am interested in ensuring that certain outputs in an ODE problem reach a steady state except for a few because they follow an oscillatory behavior. I am familiar with the SteadyStateProblem but in my case does not work…

---

## [Nonlinear Least Squares Problems with ModelingToolkit](https://discourse.julialang.org/t/nonlinear-least-squares-problems-with-modelingtoolkit/116680)

<div class="topic-metadata">

**Author:** [@Dreycen\_Foiles](https://discourse.julialang.org/u/Dreycen_Foiles)\
**Replies:** 4\
**Last updated:** [July 6, 2024, 9:40pm UTC](https://discourse.julialang.org/t/nonlinear-least-squares-problems-with-modelingtoolkit/116680 "2024-07-06T21:40:25Z")

</div>

I’m trying set up a nonlinear least squares problem with variables and parameters defined by ModelingToolkit.jl. However, I’m getting an error because I have more equations than variables. Here is an example: using Nonl…

---

## [Registering Finite Difference Derivatives with Symbolics.jl](https://discourse.julialang.org/t/registering-finite-difference-derivatives-with-symbolics-jl/116636)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 2\
**Last updated:** [July 6, 2024, 4:31pm UTC](https://discourse.julialang.org/t/registering-finite-difference-derivatives-with-symbolics-jl/116636 "2024-07-06T16:31:18Z")

</div>

I’m trying to take the gradient of the Power Law Cutoff Potential using Symbolics and ModelingToolkit. My end goal is to define an ODESystem with this gradient. The Power Law Cutoff Potential equation is shown below. Her…

---

## [MTK acausal modeling not working with @discrete\_events](https://discourse.julialang.org/t/mtk-acausal-modeling-not-working-with-discrete-events/116683)

<div class="topic-metadata">

**Author:** [@JosephChoi](https://discourse.julialang.org/u/JosephChoi)\
**Replies:** 1\
**Last updated:** [July 5, 2024, 11:35pm UTC](https://discourse.julialang.org/t/mtk-acausal-modeling-not-working-with-discrete-events/116683 "2024-07-05T23:35:23Z")

</div>

I’m trying to model an unsteady-state CSTR with discrete-event PI controller updates using MTK’s acausal component-based modeling framework, but I’m having trouble with @discrete\_events (or @continuous\_events) not being …

---

## [ODE solver trying to access index \[0\] when running Graph NODEs](https://discourse.julialang.org/t/ode-solver-trying-to-access-index-0-when-running-graph-nodes/115764)

<div class="topic-metadata">

**Author:** [@jarroyoe](https://discourse.julialang.org/u/jarroyoe)\
**Replies:** 6\
**Last updated:** [July 5, 2024, 6:53pm UTC](https://discourse.julialang.org/t/ode-solver-trying-to-access-index-0-when-running-graph-nodes/115764 "2024-07-05T18:53:40Z")

</div>

I’m trying to model Graph NODEs integrating GraphNeuralNetworks.jl and OrdinaryDiffEq.jl. I am trying to learn both the neural network parameters as well as the weights of the edges, so I have to manually modify the Flux …

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

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