-
-
Notifications
You must be signed in to change notification settings - Fork 215
/
Copy pathindex.html
43 lines (37 loc) · 21.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>The AbstractSystem Interface · ModelingToolkit.jl</title><link href="https://mtk.sciml.ai/stable/systems/AbstractSystem/" rel="canonical"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/><link class="docs-theme-link" data-theme-name="documenter-dark" href="../../assets/themes/documenter-dark.css" rel="stylesheet" type="text/css"/><link class="docs-theme-link" data-theme-name="documenter-light" data-theme-primary="" href="../../assets/themes/documenter-light.css" rel="stylesheet" type="text/css"/><script src="../../assets/themeswap.js"></script><script data-outdated-warner="">function maybeAddWarning () {
const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img alt="ModelingToolkit.jl logo" src="../../assets/logo.png"/></a><div class="docs-package-name"><span class="docs-autofit">ModelingToolkit.jl</span></div><form action="../../search/" class="docs-search"><input class="docs-search-query" id="documenter-search-query" name="q" placeholder="Search docs" type="text"/></form><ul class="docs-menu"><li><a class="tocitem" href="../../">Home</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/ode_modeling/">Component-Based Modeling with Ordinary Differential Equations</a></li><li><a class="tocitem" href="../../tutorials/higher_order/">Automatic Transformation of Nth Order ODEs to 1st Order ODEs</a></li><li><a class="tocitem" href="../../tutorials/nonlinear/">Solving Nonlinear Systems with NLsolve</a></li><li><a class="tocitem" href="../../tutorials/modelingtoolkitize/">Symbolic Extensions to ODEProblem via Modelingtoolkize</a></li><li><a class="tocitem" href="../../tutorials/auto_parallel/">Automated Sparse Parallelism of ODEs via Tracing</a></li></ul></li><li><span class="tocitem">Systems</span><ul><li class="is-active"><a class="tocitem" href="">The AbstractSystem Interface</a><ul class="internal"><li><a class="tocitem" href="#Overview-1"><span>Overview</span></a></li><li><a class="tocitem" href="#Composition-and-Accessor-Functions-1"><span>Composition and Accessor Functions</span></a></li><li><a class="tocitem" href="#Transformations-1"><span>Transformations</span></a></li><li><a class="tocitem" href="#Function-Calculation-and-Generation-1"><span>Function Calculation and Generation</span></a></li><li><a class="tocitem" href="#Problem-Constructors-1"><span>Problem Constructors</span></a></li></ul></li><li><a class="tocitem" href="../ODESystem/">ODESystem</a></li><li><a class="tocitem" href="../SDESystem/">SDESystem</a></li><li><a class="tocitem" href="../JumpSystem/">JumpSystem</a></li><li><a class="tocitem" href="../NonlinearSystem/">NonlinearSystem</a></li><li><a class="tocitem" href="../OptimizationSystem/">OptimizationSystem</a></li><li><a class="tocitem" href="../ReactionSystem/">ReactionSystem</a></li><li><a class="tocitem" href="../PDESystem/">PDESystem</a></li><li><a class="tocitem" href="../DependencyGraphs/">Dependency Graphs</a></li></ul></li><li><a class="tocitem" href="../../highlevel/">High Level API</a></li><li><a class="tocitem" href="../../IR/">ModelingToolkit IR</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Systems</a></li><li class="is-active"><a href="">The AbstractSystem Interface</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="">The AbstractSystem Interface</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/SciML/ModelingToolkit.jl/blob/master/docs/src/systems/AbstractSystem.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" href="#" id="documenter-settings-button" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" href="#" id="documenter-sidebar-button"></a></div></header><article class="content" id="documenter-page"><h1 id="The-AbstractSystem-Interface-1"><a class="docs-heading-anchor" href="#The-AbstractSystem-Interface-1">The AbstractSystem Interface</a><a class="docs-heading-anchor-permalink" href="#The-AbstractSystem-Interface-1" title="Permalink"></a></h1><h2 id="Overview-1"><a class="docs-heading-anchor" href="#Overview-1">Overview</a><a class="docs-heading-anchor-permalink" href="#Overview-1" title="Permalink"></a></h2><p>The <code>AbstractSystem</code> interface is the core of the system level of ModelingToolkit.jl. It establishes a common set of functionality that is used between systems from ODEs and chemical reactions, allowing users to have a common framework for model manipulation and compilation.</p><h2 id="Composition-and-Accessor-Functions-1"><a class="docs-heading-anchor" href="#Composition-and-Accessor-Functions-1">Composition and Accessor Functions</a><a class="docs-heading-anchor-permalink" href="#Composition-and-Accessor-Functions-1" title="Permalink"></a></h2><p>Each <code>AbstractSystem</code> has lists of variables in context, such as distinguishing parameters vs states. In addition, an <code>AbstractSystem</code> also can hold other <code>AbstractSystem</code> types. Direct accessing of the values, such as <code>sys.states</code>, gives the immediate list, while the accessor functions <code>states(sys)</code> gives the total set, which includes that of all systems held inside.</p><p>The values which are common to all <code>AbstractSystem</code>s are:</p><ul><li><code>sys.eqs</code> or <code>equations(sys)</code>: The equations that define the system.</li><li><code>sys.states</code> or <code>states(sys)</code>: The set of states in the system.</li><li><code>sys.parameters</code> or <code>parameters(sys)</code>: The parameters of the system.</li><li><code>sys.systems</code>: The subsystems of the system.</li></ul><h2 id="Transformations-1"><a class="docs-heading-anchor" href="#Transformations-1">Transformations</a><a class="docs-heading-anchor-permalink" href="#Transformations-1" title="Permalink"></a></h2><p>Transformations are functions which send a valid <code>AbstractSystem</code> definition to another <code>AbstractSystem</code>. These are passes, like optimizations (e.g., Block-Lower Triangle transformations), or changes to the representation, which allow for alternative numerical methods to be utilized on the model (e.g., DAE index reduction).</p><h2 id="Function-Calculation-and-Generation-1"><a class="docs-heading-anchor" href="#Function-Calculation-and-Generation-1">Function Calculation and Generation</a><a class="docs-heading-anchor-permalink" href="#Function-Calculation-and-Generation-1" title="Permalink"></a></h2><p>The calculation and generation functions allow for calculating additional quantities to enhance the numerical methods applied to the resulting system. The calculations, like <code>calculate_jacobian</code>, generate ModelingToolkit IR for the Jacobian of the system, while the generations, like <code>generate_jacobian</code>, generate compiled output for the numerical solvers by applying <code>build_function</code> to the generated code. Additionally, many systems have function-type outputs, which cobble together the generation functionality for a system, for example, <code>ODEFunction</code> can be used to generate a DifferentialEquations-based <code>ODEFunction</code> with compiled version of the ODE itself, the Jacobian, the mass matrix, etc.</p><p>Below are the possible calculation and generation functions:</p><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.calculate_tgrad" id="ModelingToolkit.calculate_tgrad"><code>ModelingToolkit.calculate_tgrad</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">calculate_tgrad(sys::AbstractSystem)</code></pre><p>Calculate the time gradient of a system.</p><p>Returns a vector of <a href="../../IR/#ModelingToolkit.Expression"><code>Expression</code></a> instances. The result from the first call will be cached in the system object.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L1-L10" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.calculate_gradient" id="ModelingToolkit.calculate_gradient"><code>ModelingToolkit.calculate_gradient</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">calculate_gradient(sys::AbstractSystem)</code></pre><p>Calculate the gradient of a scalar system.</p><p>Returns a vector of <a href="../../IR/#ModelingToolkit.Expression"><code>Expression</code></a> instances. The result from the first call will be cached in the system object.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L13-L22" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.calculate_jacobian" id="ModelingToolkit.calculate_jacobian"><code>ModelingToolkit.calculate_jacobian</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">calculate_jacobian(sys::AbstractSystem)</code></pre><p>Calculate the jacobian matrix of a system.</p><p>Returns a matrix of <a href="../../IR/#ModelingToolkit.Expression"><code>Expression</code></a> instances. The result from the first call will be cached in the system object.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L25-L34" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.calculate_factorized_W" id="ModelingToolkit.calculate_factorized_W"><code>ModelingToolkit.calculate_factorized_W</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">calculate_factorized_W(sys::AbstractSystem)</code></pre><p>Calculate the factorized W-matrix of a system.</p><p>Returns a matrix of <a href="../../IR/#ModelingToolkit.Expression"><code>Expression</code></a> instances. The result from the first call will be cached in the system object.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L37-L46" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.calculate_hessian" id="ModelingToolkit.calculate_hessian"><code>ModelingToolkit.calculate_hessian</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">calculate_hessian(sys::AbstractSystem)</code></pre><p>Calculate the hessian matrix of a scalar system.</p><p>Returns a matrix of <a href="../../IR/#ModelingToolkit.Expression"><code>Expression</code></a> instances. The result from the first call will be cached in the system object.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L49-L58" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.generate_tgrad" id="ModelingToolkit.generate_tgrad"><code>ModelingToolkit.generate_tgrad</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">generate_tgrad(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys), expression = Val{true}; kwargs...)</code></pre><p>Generates a function for the time gradient of a system. Extra arguments control the arguments to the internal <a href="../../IR/#ModelingToolkit.build_function"><code>build_function</code></a> call.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L61-L68" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.generate_gradient" id="ModelingToolkit.generate_gradient"><code>ModelingToolkit.generate_gradient</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">generate_gradient(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys), expression = Val{true}; kwargs...)</code></pre><p>Generates a function for the gradient of a system. Extra arguments control the arguments to the internal <a href="../../IR/#ModelingToolkit.build_function"><code>build_function</code></a> call.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L71-L78" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.generate_jacobian" id="ModelingToolkit.generate_jacobian"><code>ModelingToolkit.generate_jacobian</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">generate_jacobian(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys), expression = Val{true}; sparse = false, kwargs...)</code></pre><p>Generates a function for the jacobian matrix matrix of a system. Extra arguments control the arguments to the internal <a href="../../IR/#ModelingToolkit.build_function"><code>build_function</code></a> call.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L81-L88" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.generate_factorized_W" id="ModelingToolkit.generate_factorized_W"><code>ModelingToolkit.generate_factorized_W</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">generate_factorized_W(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys), expression = Val{true}; sparse = false, kwargs...)</code></pre><p>Generates a function for the factorized W-matrix matrix of a system. Extra arguments control the arguments to the internal <a href="../../IR/#ModelingToolkit.build_function"><code>build_function</code></a> call.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L91-L98" target="_blank">source</a></section></article><article class="docstring"><header><a class="docstring-binding" href="#ModelingToolkit.generate_hessian" id="ModelingToolkit.generate_hessian"><code>ModelingToolkit.generate_hessian</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">generate_hessian(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys), expression = Val{true}; sparse = false, kwargs...)</code></pre><p>Generates a function for the hessian matrix matrix of a system. Extra arguments control the arguments to the internal <a href="../../IR/#ModelingToolkit.build_function"><code>build_function</code></a> call.</p></div><a class="docs-sourcelink" href="https://github.com/SciML/ModelingToolkit.jl/blob/419e6c27c9f42e62a0126acac641dd3edf4b7656/src/systems/abstractsystem.jl#L101-L108" target="_blank">source</a></section></article><h2 id="Problem-Constructors-1"><a class="docs-heading-anchor" href="#Problem-Constructors-1">Problem Constructors</a><a class="docs-heading-anchor-permalink" href="#Problem-Constructors-1" title="Permalink"></a></h2><p>At the end, the system types have <code>DEProblem</code> constructors, like <code>ODEProblem</code>, which allow for directly generating the problem types required for numerical methods. The first argument is always the <code>AbstractSystem</code>, and the proceeding arguments match the argument order of their original constructors. Whenever an array would normally be provided, such as <code>u0</code> the initial condition of an <code>ODEProblem</code>, it is instead replaced with a variable map, i.e., an array of pairs <code>var=>value</code>, which allows the user to designate the values without having to know the order that ModelingToolkit is internally using.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorials/auto_parallel/">« Automated Sparse Parallelism of ODEs via Tracing</a><a class="docs-footer-nextpage" href="../ODESystem/">ODESystem »</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label></p><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div><p></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Sunday 5 July 2020 20:14">Sunday 5 July 2020</span>. Using Julia version 1.4.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></HTML>