Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

SciML/ModelingToolkit.jl

Repository files navigation

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

codecovCoverage StatusBuild Status

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

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

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

Standard Library

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

High-Level Examples

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

using OrdinaryDiffEqDefault, ModelingToolkitusing ModelingToolkit: t_nounits as t, D_nounits as D@parameters σ ρ β@variablesx(t)y(t)z(t)eqs= [D(D(x))~ σ* (y- x),D(y)~ x*- z)- y,D(z)~ x* y- β* z]@mtkbuild sys=ODESystem(eqs, t)u0= [D(x)=>2.0,    x=>1.0,    y=>0.0,    z=>0.0]p==>28.0,    ρ=>10.0,    β=>8/3]tspan= (0.0,100.0)prob=ODEProblem(sys, u0, tspan, p, jac=true)sol=solve(prob)using Plotsplot(sol, idxs= (x, y))

Lorenz2

This automatically will have generated fast Jacobian functions, makingit more optimized than directly building a function. In addition, we can thenuse ModelingToolkit to compose multiple ODE subsystems. Now, let's define twointeracting Lorenz equations and simulate the resulting Differential-AlgebraicEquation (DAE):

using DifferentialEquations, ModelingToolkitusing ModelingToolkit: t_nounits as t, D_nounits as D@parameters σ ρ β@variablesx(t)y(t)z(t)eqs= [D(x)~ σ* (y- x),D(y)~ x*- z)- y,D(z)~ x* y- β* z]@named lorenz1=ODESystem(eqs, t)@named lorenz2=ODESystem(eqs, t)@variablesa(t)@parameters γconnections= [0~ lorenz1.x+ lorenz2.y+ a* γ]@mtkbuild connected=ODESystem(connections, t, systems= [lorenz1, lorenz2])u0= [lorenz1.x=>1.0,    lorenz1.y=>0.0,    lorenz1.z=>0.0,    lorenz2.x=>0.0,    lorenz2.y=>1.0,    lorenz2.z=>0.0,    a=>2.0]p= [lorenz1.σ=>10.0,    lorenz1.ρ=>28.0,    lorenz1.β=>8/3,    lorenz2.σ=>10.0,    lorenz2.ρ=>28.0,    lorenz2.β=>8/3,    γ=>2.0]tspan= (0.0,100.0)prob=ODEProblem(connected, u0, tspan, p)sol=solve(prob)using Plotsplot(sol, idxs= (a, lorenz1.x, lorenz2.z))

Citation

If you use ModelingToolkit.jl in your research, please citethis 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}}

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp