Why Julia for engineering simulation
Traditional simulation tools each have their pain: commercial suites are expensive and hard to extend; general-purpose scripting languages (Python/MATLAB) leave you building your own plumbing for acausal multi-physics modeling — connection, initialization, structural simplification. The Julia ecosystem took a different path: ModelingToolkit.jl (MTK) implements acausal equation-based modeling in pure Julia. You describe physical topology ("voltage = resistance × current", "spring force = stiffness × displacement difference"), the symbolic engine reduces the equation system to solvable form, and OrdinaryDiffEq.jl from SciML integrates it — one language from modeling to solving, no glue, no IPC, no export-import.
That translates into three practical benefits:
- C-performance solve loops — Julia JIT-compiles the solver loop with no interpreter overhead;
MTK's
mtkcompileeliminates algebraic loops and redundant variables before compilation, which is effectively a free round of model-order reduction. - Composable and introspectable — a component is a
Systemobject returned by an ordinary Julia function; its ports, parameters and equations are readable via reflection. That is exactly why CoModel can take an uploaded.jlfile and auto-detect its ports and parameters. - AI and physics in one language — SciML stands for scientific machine learning: neural networks
(Lux/Flux), ONNX inference and physics equations can be solved jointly inside a single
System, instead of "export CSV from the simulator, read it back in the training script".
Analogy: ModelingToolkit is to Julia what Modelica is to industrial simulation — the same acausal equation-based paradigm, but MTK shares a language with its solvers, is programmable and embeddable, and the entire toolchain is open source.
What separates a Julia script from a team platform
Scripting ModelingToolkit directly is perfectly viable — until the model needs review, the parameters need sweeping, and the results need reporting. That's the checklist you'd eventually build yourself; CoModel ships it as the product:
| Roll your own | Built into CoModel |
|---|---|
| Hand-drawn Plots.jl figures, exported one by one | Interactive time-domain plots and curve-family comparison; one-click CSV / PNG / SVG export |
| Change one parameter → rerun the whole script (recompiles) | Resident solver workers reuse compiled results — parameter iteration returns in seconds |
Sweeps via for loops and hand-collected results | Parameter sweeps and sensitivity analysis configured in the UI, results tabulated automatically |
| Models are .jl files synced by Git and verbal agreement | Cloud model library with version history and link sharing — reproduction is one URL |
| FMU support means adapting FMI.jl yourself | Drop an FMU onto the canvas; ports and parameters parsed automatically (FMI 2.0 / 3.0, CS / ME) |
| Teammates install Julia, configure environments, pull dependencies | Runs in the browser; the local deployment installer bundles every runtime |
In short: the Julia engine makes it compute fast; CoModel makes the full loop — model, validate, solve, analyze, collaborate — a no-glue-code daily workflow.
What a component looks like: runnable MTK code
CoModel components are standard ModelingToolkit v11 code defined with @component function,
returning a System object. Here is a complete spring-mass-damper — you can write this in the platform's
built-in editor or upload it as a .jl file:
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using ModelingToolkitStandardLibrary.Mechanical.Translational:
Mass, Spring, Damper, Fixed, MechanicalPort
@component function MySpringMassDamper(; name, m = 10.0, k = 1500.0, d = 50.0)
@named mass = Mass(m = m)
@named spring = Spring(k = k)
@named damper = Damper(d = d)
@named fixed = Fixed()
@named flange = MechanicalPort()
pars = @parameters begin
m = m, [description = "mass"]
k = k, [description = "stiffness"]
d = d, [description = "damping"]
end
eqs = [
connect(flange, mass.flange, spring.flange_a, damper.flange_a)
connect(spring.flange_b, damper.flange_b, fixed.flange)
]
return System(eqs, t, [], pars; name, systems=[flange, mass, spring, damper, fixed])
end
After upload, the platform's two-stage parsing — an AST scan followed by MTK reflection in a real Julia
process — extracts the port (flange) and parameters (m / k / d),
generates the parameter panel and icon anchors, and the component becomes draggable and connectable like any standard
one. More patterns (electrical OnePort + extend, components with thermal ports) in
Julia Component Code Conventions.
The stack: what MTK does under the hood
One simulation request in CoModel runs through a pure Julia scientific-computing pipeline:
The canvas / text editor produces MTK Systems: standard-library components, custom @components, FMU black boxes and ONNX networks unified into one homogeneous equation system.
mtkcompile performs structural simplification: eliminating algebraic loops, selecting state variables, generating efficient ODE/DAE expressions.
OrdinaryDiffEq picks stiff or non-stiff automatically (Rodas5P, QNDF, FBDF…); resident worker processes reuse compiled artifacts so parameter iterations return in seconds.
On top of that, the platform adds the engineering layer: model validation with IDE-grade diagnostics, initialization failure root-cause hints (e.g. overdetermined InitialFailure systems), graphics↔code two-way sync, and FMI 2.0/3.0 black-box scheduling.
Multi-domain component library
146+ built-in components across electrical, mechanical (translational/rotational), thermal, hydraulic and magnetic domains, based on ModelingToolkitStandardLibrary — freely coupled across domains.
FMU / FMI co-simulation
FMUs exported from mainstream tools (Simulink, Amesim, Dymola…) drop straight onto the canvas; ports and parameters are extracted automatically and solved alongside native MTK components.
ONNX AI hybrid modeling
Upload trained networks as ONNX and they become connectable components; black-box derivatives fall back to finite differences automatically and co-solve with physics equations on the same canvas.
Graphics ↔ code sync
The canvas and Julia code convert in real time: drag a component and connect statements appear; edit the code and the canvas updates. Syntax diagnostics inline.
ModelingToolkit and Modelica — how do they relate?
Both are acausal, equation-based modeling paradigms: you write physical constraint relations instead of assignment flow, and the compiler determines computation direction during simplification — which is what makes bidirectional physical ports natural. They differ in ecosystem: Modelica is the industrial standard language with mostly commercial tooling (Dymola, SimulationX…); ModelingToolkit.jl is Julia-native, integrates seamlessly with DifferentialEquations.jl / SciML solvers, and the whole toolchain is open source, programmable and embeddable in your own services. CoModel's role is to add the "last mile" on top of MTK: graphical modeling, cloud solving, component reuse and collaboration.
If you're evaluating Julia-based simulation, the fastest test is your real model — sign up free for a 90-day license, or grab the all-in-one installer (every Julia runtime bundled, works offline) from the download page.