# Modelling & Simulations

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

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

**Page:** 41

---

## [ControlSystems + PlotlyJS](https://discourse.julialang.org/t/controlsystems-plotlyjs/91898)

<div class="topic-metadata">

**Author:** [@stephans3](https://discourse.julialang.org/u/stephans3)\
**Replies:** 1\
**Last updated:** [December 20, 2022, 4:44pm UTC](https://discourse.julialang.org/t/controlsystems-plotlyjs/91898 "2022-12-20T16:44:42Z")

</div>

I just read in this post Implementation of matlab function in julia (Root locus plot) that it is possible to use ControlSystems together with PlotlyJS. To use plotlyjs() the package PlotlyJShas to be installed. using…

---

## [Dirac delta in boundary conditions for MethodOfLines.jl](https://discourse.julialang.org/t/dirac-delta-in-boundary-conditions-for-methodoflines-jl/80567)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 15\
**Last updated:** [December 19, 2022, 8:28pm UTC](https://discourse.julialang.org/t/dirac-delta-in-boundary-conditions-for-methodoflines-jl/80567 "2022-12-19T20:28:49Z")

</div>

As a basis for more complex models, I’m trying to get a simplified version of the Von Foerster equation - Wikipedia discretized and running in MethodOfLines.jl. Here’s my model: using ModelingToolkit using MethodOfLine…

---

## [Implementation of matlab function in julia (Root locus plot)](https://discourse.julialang.org/t/implementation-of-matlab-function-in-julia-root-locus-plot/91662)

<div class="topic-metadata">

**Author:** [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Replies:** 10\
**Last updated:** [December 16, 2022, 4:50am UTC](https://discourse.julialang.org/t/implementation-of-matlab-function-in-julia-root-locus-plot/91662 "2022-12-16T04:50:57Z")

</div>

As the title, I can’t reproduce the functionality of the rlocus function in Matlab. i use ControlSystems.jl 1. sys = tf(\[3 1\],\[9 7 5 6\]); \[r,k\] = rlocus(sys) ERROR: syntax: invalid assignment location “\[r, k\]” 2. …

---

## [MethodOfLines.jl now supports Integral Equations and PIDEs](https://discourse.julialang.org/t/methodoflines-jl-now-supports-integral-equations-and-pides/91645)

<div class="topic-metadata">

**Author:** [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Replies:** 0\
**Last updated:** [December 14, 2022, 4:24pm UTC](https://discourse.julialang.org/t/methodoflines-jl-now-supports-integral-equations-and-pides/91645 "2022-12-14T16:24:06Z")

</div>

I’m developing MethodOfLines.jl, an automatic PDE discretizer built on top of Symbolics.jl and ModelingToolkit.jl, and I’m happy to announce that we now support integrals! Currently allowed limits are (xmin…x) (for any …

---

## [Does MethodOfLines replace DiffEqOperators?](https://discourse.julialang.org/t/does-methodoflines-replace-diffeqoperators/91648)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 5:58pm UTC](https://discourse.julialang.org/t/does-methodoflines-replace-diffeqoperators/91648 "2022-12-14T17:58:33Z")

</div>

My understanding is that DiffEqOperators is being replaced by the combination of SciMLOperators and MethodOfLines. My use case is exactly what DiffEqOperators served: all I want to do is define a matrix-free derivative o…

---

## [Wrong interpolated value in \`SavingCallback\` output](https://discourse.julialang.org/t/wrong-interpolated-value-in-savingcallback-output/91405)

<div class="topic-metadata">

**Author:** [@cuihantao](https://discourse.julialang.org/u/cuihantao)\
**Replies:** 13\
**Last updated:** [December 12, 2022, 12:31am UTC](https://discourse.julialang.org/t/wrong-interpolated-value-in-savingcallback-output/91405 "2022-12-12T00:31:54Z")

</div>

This is a follow-up question on DiffEq skips over event in the first \`solve\` but works after \`reinit!\` - #16 by ChrisRackauckas. The code simulates a circuit in which an AC power source is supplying an RL load through a …

---

## [Decent QP solver?](https://discourse.julialang.org/t/decent-qp-solver/89939)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [December 11, 2022, 7:58pm UTC](https://discourse.julialang.org/t/decent-qp-solver/89939 "2022-12-11T19:58:44Z")

</div>

I’m looking for a QP solver to do a “quick-and-dirty” Optimal Control/MPC implementation for a linear-quadratic system. Does GalacticOptim or Optim support a pure QP solver? A year ago, someone suggested COSMO.jl. Any …

---

## [Selecting specific group in a multiagent simulation with agents.jl](https://discourse.julialang.org/t/selecting-specific-group-in-a-multiagent-simulation-with-agents-jl/91421)

<div class="topic-metadata">

**Author:** [@indymnv](https://discourse.julialang.org/u/indymnv)\
**Replies:** 2\
**Last updated:** [December 8, 2022, 11:32am UTC](https://discourse.julialang.org/t/selecting-specific-group-in-a-multiagent-simulation-with-agents-jl/91421 "2022-12-08T11:32:11Z")

</div>

Hello people! I am building a simulation model with agents.jl of a city where any moment, there is an area that can be affected by an emergency with a specific probability, so if this is the case, I want to move an ambul…

---

## [Agents.jl: subset object returned from nearby\_positions](https://discourse.julialang.org/t/agents-jl-subset-object-returned-from-nearby-positions/91399)

<div class="topic-metadata">

**Author:** [@sea\_slug](https://discourse.julialang.org/u/sea_slug)\
**Replies:** 1\
**Last updated:** [December 8, 2022, 11:10am UTC](https://discourse.julialang.org/t/agents-jl-subset-object-returned-from-nearby-positions/91399 "2022-12-08T11:10:57Z")

</div>

I am making a predator-prey model, following the wolf-sheep example using Agents.jl. Following on from this question, instead of sheep moving to a random cell I am trying to make the sheep move to a cell that contains g…

---

## [Variable time-stepping and discontinuous gradients](https://discourse.julialang.org/t/variable-time-stepping-and-discontinuous-gradients/91382)

<div class="topic-metadata">

**Author:** [@nrontsis](https://discourse.julialang.org/u/nrontsis)\
**Replies:** 4\
**Last updated:** [December 8, 2022, 8:39am UTC](https://discourse.julialang.org/t/variable-time-stepping-and-discontinuous-gradients/91382 "2022-12-08T08:39:07Z")

</div>

I read here that in the context of “trajectory optimisation” or “optimal control”: One very important idea in numerical integration of differential equations is the use of variable-step integration … We typically avoid…

---

## [Agents.jl: Equivalent of nearby\_agents for grid cells?](https://discourse.julialang.org/t/agents-jl-equivalent-of-nearby-agents-for-grid-cells/91290)

<div class="topic-metadata">

**Author:** [@sea\_slug](https://discourse.julialang.org/u/sea_slug)\
**Replies:** 3\
**Last updated:** [December 6, 2022, 10:20am UTC](https://discourse.julialang.org/t/agents-jl-equivalent-of-nearby-agents-for-grid-cells/91290 "2022-12-06T10:20:32Z")

</div>

Mandatory I’m brand new to Julia and Agents.jl so apologies if this is obvious. I am making a predator-prey model, following the wolf-sheep example. My GridSpace has a property “grass”. In the example predator-prey mod…

---

## [Automatic differentiation and optimization with respect to callback times](https://discourse.julialang.org/t/automatic-differentiation-and-optimization-with-respect-to-callback-times/91024)

<div class="topic-metadata">

**Author:** [@pbryde](https://discourse.julialang.org/u/pbryde)\
**Replies:** 2\
**Last updated:** [December 5, 2022, 4:30am UTC](https://discourse.julialang.org/t/automatic-differentiation-and-optimization-with-respect-to-callback-times/91024 "2022-12-05T04:30:50Z")

</div>

From the Training Neural Networks in Hybrid Differential Equations example, I know that SciMLSensitivity is compatible with PresetTimeCallback. I was wondering whether it is possible to compute derivatives (and then opti…

---

## [Preconditioners quite slow in PDE system with DifferentialEquations.jl](https://discourse.julialang.org/t/preconditioners-quite-slow-in-pde-system-with-differentialequations-jl/74926)

<div class="topic-metadata">

**Author:** [@Iddingsite](https://discourse.julialang.org/u/Iddingsite)\
**Replies:** 6\
**Last updated:** [December 4, 2022, 9:55pm UTC](https://discourse.julialang.org/t/preconditioners-quite-slow-in-pde-system-with-differentialequations-jl/74926 "2022-12-04T21:55:18Z")

</div>

Hi everyone, I am using DifferentialEquations.jl to solve 2 couple non-linear PDEs used to model a two-phase flow in a porous media: \\begin{align} \\frac{\\partial \\phi}{\\partial t} = \\nabla \\cdot \[\\phi^n(\\nabla P + u\_z)…

---

## [Problem with HamiltonianProblem in Differential](https://discourse.julialang.org/t/problem-with-hamiltonianproblem-in-differential/91161)

<div class="topic-metadata">

**Author:** [@mpirke](https://discourse.julialang.org/u/mpirke)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 9:58am UTC](https://discourse.julialang.org/t/problem-with-hamiltonianproblem-in-differential/91161 "2022-12-03T09:58:48Z")

</div>

Hi there! Im playing around with some easy physics problems. Here I tried to simulate a simple pendulum. I wanted to solve it via the HamiltonianProblem functionality from DifferentialEquations.jl. Im not sure what’s t…

---

## [PID with Mass Spring Dramper using ModelingToolkit.jl](https://discourse.julialang.org/t/pid-with-mass-spring-dramper-using-modelingtoolkit-jl/59063)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 12\
**Last updated:** [December 3, 2022, 7:51am UTC](https://discourse.julialang.org/t/pid-with-mass-spring-dramper-using-modelingtoolkit-jl/59063 "2022-12-03T07:51:16Z")

</div>

I’m attempting to using ModelingToolkit (for the first time) to solve a simple PID controller with mass/spring/damper. The PID output is y which I’m converting directly to a force driving the position x of the mass m wi…

---

## [DiffEq skips over event in the first \`solve\` but works after \`reinit!\`](https://discourse.julialang.org/t/diffeq-skips-over-event-in-the-first-solve-but-works-after-reinit/90935)

<div class="topic-metadata">

**Author:** [@cuihantao](https://discourse.julialang.org/u/cuihantao)\
**Replies:** 16\
**Last updated:** [December 3, 2022, 3:42am UTC](https://discourse.julialang.org/t/diffeq-skips-over-event-in-the-first-solve-but-works-after-reinit/90935 "2022-12-03T03:42:06Z")

</div>

The code below simulates a series resistor and inductor supplied by an AC source through a diode. The diode turns off when the current is \<=0 and turns back on when the voltage across the diode is \>=1. Skipping over eve…

---

## [Symbolics.jl: How to preevaluate a computationally expensive expression in build\_function()](https://discourse.julialang.org/t/symbolics-jl-how-to-preevaluate-a-computationally-expensive-expression-in-build-function/91147)

<div class="topic-metadata">

**Author:** [@davidschlegel](https://discourse.julialang.org/u/davidschlegel)\
**Replies:** 6\
**Last updated:** [December 2, 2022, 6:23pm UTC](https://discourse.julialang.org/t/symbolics-jl-how-to-preevaluate-a-computationally-expensive-expression-in-build-function/91147 "2022-12-02T18:23:30Z")

</div>

I like the build\_function() method of Symbolics.jl which basically bakes symbolic expressions into compiled code. However, it does so by compiling the full expression which might be numerically highly inefficient. Supp…

---

## [Solving wave PDE with ModelingToolkit.jl and method of lines](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750)

<div class="topic-metadata">

**Author:** [@fabiopierella](https://discourse.julialang.org/u/fabiopierella)\
**Replies:** 21\
**Last updated:** [December 2, 2022, 3:13pm UTC](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750 "2022-12-02T15:13:09Z")

</div>

Hi everyone, I am trying to reproduce a standing wave in a 2D fluid domain. I am having troubles to go past the discretization step with the ModelingToolkit.jl - hereafter you find a detailed description of the problem …

---

## [Stochastic PDE with conservative noise](https://discourse.julialang.org/t/stochastic-pde-with-conservative-noise/90316)

<div class="topic-metadata">

**Author:** [@LuDc](https://discourse.julialang.org/u/LuDc)\
**Replies:** 6\
**Last updated:** [December 2, 2022, 9:55am UTC](https://discourse.julialang.org/t/stochastic-pde-with-conservative-noise/90316 "2022-12-02T09:55:29Z")

</div>

I am trying to simulate a simple stochastic pde using the DifferentialEquations package, the equation I want to simulate is a simple conservation equation with conservative noise in 2 dimensions, i.e. \\partial\_t \\rho = …

---

## [Plotting Multiple Bode diagrams](https://discourse.julialang.org/t/plotting-multiple-bode-diagrams/90929)

<div class="topic-metadata">

**Author:** [@emone](https://discourse.julialang.org/u/emone)\
**Replies:** 6\
**Last updated:** [December 1, 2022, 4:34pm UTC](https://discourse.julialang.org/t/plotting-multiple-bode-diagrams/90929 "2022-12-01T16:34:49Z")

</div>

Bode plots are significant in the design and visualization of control systems. Since I move on Julia for everything, I wonder how to plot multiple responses of bode diagrams, for example, in this code, I got four plots t…

---

## [DomainError while solving ODE](https://discourse.julialang.org/t/domainerror-while-solving-ode/53199)

<div class="topic-metadata">

**Author:** [@zamk](https://discourse.julialang.org/u/zamk)\
**Replies:** 10\
**Last updated:** [November 23, 2022, 12:14pm UTC](https://discourse.julialang.org/t/domainerror-while-solving-ode/53199 "2022-11-23T12:14:26Z")

</div>

I have been trying to estimate the parameters of the model included in the code below. When I run the code below, it solves for random parameters it generates. However, sometimes I get this: ERROR: DomainError with -0.11…

---

## [Trajectory DynamicalSystems.jl, DifferentialEquations.jl](https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 1\
**Last updated:** [November 22, 2022, 5:26pm UTC](https://discourse.julialang.org/t/trajectory-dynamicalsystems-jl-differentialequations-jl/90659 "2022-11-22T17:26:09Z")

</div>

Hello, i calculate trajectory of system by ODEProblem and solve from DifferentialEquations.jl and trajectory from DynamicalSystems.jl. With the same integrator parameters, they have different results, why is this? U(y) …

---

## [Passing in a matrix as initial conditions versus ensemble parallel simulation in DifferentialEquations](https://discourse.julialang.org/t/passing-in-a-matrix-as-initial-conditions-versus-ensemble-parallel-simulation-in-differentialequations/90484)

<div class="topic-metadata">

**Author:** [@kcqpo](https://discourse.julialang.org/u/kcqpo)\
**Replies:** 1\
**Last updated:** [November 19, 2022, 7:15pm UTC](https://discourse.julialang.org/t/passing-in-a-matrix-as-initial-conditions-versus-ensemble-parallel-simulation-in-differentialequations/90484 "2022-11-19T19:15:09Z")

</div>

What’s the difference between passing in a matrix of NxM (N is the number of states, and M is the number of conditions) initial conditions and using the ensemble method?

---

## [Read Alembic .abc data](https://discourse.julialang.org/t/read-alembic-abc-data/90488)

<div class="topic-metadata">

**Author:** [@davide445](https://discourse.julialang.org/u/davide445)\
**Replies:** 0\
**Last updated:** [November 19, 2022, 7:29am UTC](https://discourse.julialang.org/t/read-alembic-abc-data/90488 "2022-11-19T07:29:45Z")

</div>

As output of a sim tool for soft body simulation I will get an Alembic file, containing in an open source optimized format all the data regarding the evolution of the simulated mesh. Want to ask if there is any package …

---

## [\[ModelingToolkit\] \[Symbolics\] Symbolic parameter metadata is erased if parameter is of type Term](https://discourse.julialang.org/t/modelingtoolkit-symbolics-symbolic-parameter-metadata-is-erased-if-parameter-is-of-type-term/90437)

<div class="topic-metadata">

**Author:** [@lxsilva](https://discourse.julialang.org/u/lxsilva)\
**Replies:** 0\
**Last updated:** [November 18, 2022, 11:37am UTC](https://discourse.julialang.org/t/modelingtoolkit-symbolics-symbolic-parameter-metadata-is-erased-if-parameter-is-of-type-term/90437 "2022-11-18T11:37:13Z")

</div>

Hey guys, not sure if the title was clear enough but I’ll try to illustrate the issue with code. The code: @parameters p\[1:2\] u u = GlobalScope(u) #so parameter u will not be namescoped when one uses 'compose' p = …

---

## [Debugging computer crash during ODE solve](https://discourse.julialang.org/t/debugging-computer-crash-during-ode-solve/90009)

<div class="topic-metadata">

**Author:** [@johnb](https://discourse.julialang.org/u/johnb)\
**Replies:** 25\
**Last updated:** [November 17, 2022, 2:43pm UTC](https://discourse.julialang.org/t/debugging-computer-crash-during-ode-solve/90009 "2022-11-17T14:43:26Z")

</div>

My desktop solves a set of ODEs without issue, but my laptop consistently bluescreens while solving. What is the best way to find the cause of this behavior? Thanks!

---

## [Parameter estimation with norm vs. norm-squared loss](https://discourse.julialang.org/t/parameter-estimation-with-norm-vs-norm-squared-loss/90394)

<div class="topic-metadata">

**Author:** [@fhchl](https://discourse.julialang.org/u/fhchl)\
**Replies:** 0\
**Last updated:** [November 17, 2022, 10:06am UTC](https://discourse.julialang.org/t/parameter-estimation-with-norm-vs-norm-squared-loss/90394 "2022-11-17T10:06:17Z")

</div>

In the SciML book, parameter estimation problems are defined with a loss function that uses the norm of the residual, not the norm-squared as typical in least-squares formulations (see here). Is this a typo or is there m…

---

## [Resources on Modelling SDE with Parameter Switches](https://discourse.julialang.org/t/resources-on-modelling-sde-with-parameter-switches/90137)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 5\
**Last updated:** [November 16, 2022, 6:09pm UTC](https://discourse.julialang.org/t/resources-on-modelling-sde-with-parameter-switches/90137 "2022-11-16T18:09:26Z")

</div>

I’m exploring the SciMl ecosystem for the possibility of modelling something like an OU process where the drift, autoregressive, and volatility parameters are subject to discrete switches governed by a continuous-time Ma…

---

## [Using integrator time derivative for implementing residual viscosity with DiffEq.jl](https://discourse.julialang.org/t/using-integrator-time-derivative-for-implementing-residual-viscosity-with-diffeq-jl/90216)

<div class="topic-metadata">

**Author:** [@jarias9](https://discourse.julialang.org/u/jarias9)\
**Replies:** 2\
**Last updated:** [November 15, 2022, 3:39pm UTC](https://discourse.julialang.org/t/using-integrator-time-derivative-for-implementing-residual-viscosity-with-diffeq-jl/90216 "2022-11-15T15:39:38Z")

</div>

Hello all, I have been trying to implement a concept known as residual viscosity to stabilize a fluid simulation inside of DiffEq.jl. In general, I would need access to the derivative of the integrator in order to do t…

---

## [How to tell ModelingToolkit that two variables have the same initial conditions without computing them](https://discourse.julialang.org/t/how-to-tell-modelingtoolkit-that-two-variables-have-the-same-initial-conditions-without-computing-them/87999)

<div class="topic-metadata">

**Author:** [@natema](https://discourse.julialang.org/u/natema)\
**Replies:** 6\
**Last updated:** [November 12, 2022, 2:46pm UTC](https://discourse.julialang.org/t/how-to-tell-modelingtoolkit-that-two-variables-have-the-same-initial-conditions-without-computing-them/87999 "2022-11-12T14:46:48Z")

</div>

Suppose that we have a differential-algebraic system of equations, with two variables f(t) and g(t) such that f(0) = g(0). Suppose moreover that g(t) is algebraic and g(0) could be explicitly calculated. Is it possible …

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

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