랭킹으로 돌아가기

SciML/ModelingToolkit.jl

Juliadocs.sciml.ai/ModelingToolkit/stable/

An acausal modeling framework for automatically parallelized scientific machine learning (SciML) in Julia. A computer algebra system for integrated symbolics for physics-informed machine learning and automated transformations of differential equations

differential-equationsodedaeordinary-differential-equationspdesdeddestochastic-differential-equationsdelay-differential-equationsjuliasymbolicsymbolic-computation
스타 성장
스타
1.6k
포크
259
주간 성장
이슈
498
5001k1.5k
2018년 2월2020년 11월2023년 9월2026년 7월
README

ModelingToolkit.jl

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

codecov Coverage Status Build Status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

ModelingToolkit.jl is a modeling framework for high-performance symbolic-numeric computation in scientific computing and scientific machine learning. It allows for users to give a high-level description of a model for symbolic preprocessing to analyze and enhance the model. ModelingToolkit can automatically generate fast functions for model components like Jacobians and Hessians, along with automatically sparsifying and parallelizing the computations. Automatic transformations, such as index reduction, can be applied to the model to make it easier for numerical solvers to handle.

For information on using the package, see the stable documentation. Use the in-development documentation for the version of the documentation which contains the unreleased features.

Standard Library

For a standard library of ModelingToolkit components and blocks, check out the ModelingToolkitStandardLibrary

High-Level Examples

First, let's define a second order riff on the Lorenz equations, symbolically lower it to a first order system, symbolically generate the Jacobian function for the numerical integrator, and solve it.

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

# Defines a ModelingToolkit `System` model.
@parameters σ ρ β
@variables x(t) y(t) z(t)
eqs = [
    D(D(x)) ~ σ * (y - x),
    D(y) ~ x * (ρ - z) - y,
    D(z) ~ x * y - β * z
]
@mtkcompile sys = System(eqs, t)

# Simulate the model for a specific condition (initial condition and parameter values).
using OrdinaryDiffEqDefault
sim_cond = [
    D(x) => 2.0,
    x => 1.0,
    y => 0.0,
    z => 0.0,
    σ => 28.0,
    ρ => 10.0,
    β => 8 / 3
]
tend = 100.0
prob = ODEProblem(sys, sim_cond, tend; jac = true)
sol = solve(prob)

# Plot the solution in phase-space.
using Plots
plot(sol, idxs = (x, y))

Lorenz2

This will have automatically generated fast Jacobian functions, making it more optimized than directly building a function. In addition, we can then use ModelingToolkit to compose multiple ODE subsystems. Now, let's define two interacting Lorenz equations and simulate the resulting Differential-Algebraic Equation (DAE):

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

# Defines two lorenz system models.
eqs = [
    D(x) ~ σ * (y - x),
    D(y) ~ x * (ρ - z) - y,
    D(z) ~ x * y - β * z
]
@named lorenz1 = System(eqs, t)
@named lorenz2 = System(eqs, t)

# Connect the two models, creating a single model.
@variables a(t)
@parameters γ
connections = [0 ~ lorenz1.x + lorenz2.y + a * γ]
@mtkcompile connected_lorenz = System(connections, t; systems = [lorenz1, lorenz2])

# Simulate the model for a specific condition (initial condition and parameter values).
using OrdinaryDiffEqDefault
sim_cond = [
    lorenz1.x => 1.0,
    lorenz1.y => 0.0,
    lorenz1.z => 0.0,
    lorenz2.x => 0.0,
    lorenz2.z => 0.0,
    a => 2.0,
    lorenz1.σ => 10.0,
    lorenz1.ρ => 28.0,
    lorenz1.β => 8 / 3,
    lorenz2.σ => 10.0,
    lorenz2.ρ => 28.0,
    lorenz2.β => 8 / 3,
    γ => 2.0
]
tend = 100.0
prob = ODEProblem(connected_lorenz, sim_cond, tend)
sol = solve(prob)

# Plot the solution in phase-space.
using Plots
plot(sol, idxs = (a, lorenz1.x, lorenz2.z))

LorenzConnected

Citation

If you use ModelingToolkit.jl in your research, please cite this paper:

@misc{ma2021modelingtoolkit,
      title={ModelingToolkit: A Composable Graph Transformation System For Equation-Based Modeling},
      author={Yingbo Ma and Shashi Gowda and Ranjan Anantharaman and Chris Laughman and Viral Shah and Chris Rackauckas},
      year={2021},
      eprint={2103.05244},
      archivePrefix={arXiv},
      primaryClass={cs.MS}
}
관련 저장소
SciML/DifferentialEquations.jl

Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components. Ordinary differential equations (ODEs), stochastic differential equations (SDEs), delay differential equations (DDEs), differential-algebraic equations (DAEs), and more in Julia.

JuliaOtherdifferential-equationsdifferentialequations
docs.sciml.ai/DiffEqDocs/stable/
3.1k250
patrick-kidger/diffrax

Numerical differential equation solvers in JAX. Autodifferentiable and GPU-capable. https://docs.kidger.site/diffrax/

PythonPyPIApache License 2.0differential-equationsjax
2.1k186
SciML/SciMLBook

Parallel Computing and Scientific Machine Learning (SciML): Methods and Applications (MIT 18.337J/6.338J)

HTMLdifferential-equationsscientific-machine-learning
book.sciml.ai
2k373
cpmech/gosl

Linear algebra, eigenvalues, FFT, Bessel, elliptic, orthogonal polys, geometry, NURBS, numerical quadrature, 3D transfinite interpolation, random numbers, Mersenne twister, probability distributions, optimisation, differential equations.

GoGo ModulesBSD 3-Clause "New" or "Revised" Licensescientific-computinglinear-algebra
1.9k148
google-research/torchsde

Differentiable SDE solvers with GPU support and efficient sensitivity analysis.

PythonPyPIApache License 2.0deep-learningdeep-neural-networks
1.7k227
SciML/NeuralPDE.jl

Physics-Informed Neural Networks (PINN) Solvers of (Partial) Differential Equations for Scientific Machine Learning (SciML) accelerated simulation

JuliaOtherdifferential-equationsdifferentialequations
docs.sciml.ai/NeuralPDE/stable/
1.2k244
brian-team/brian2

Brian is a free, open source simulator for spiking neural networks.

PythonPyPIOtherpythonneuroscience
briansimulator.org
1.2k287