NonlinearSystem
System Constructors
ModelingToolkit.NonlinearSystem — Typestruct NonlinearSystem <: AbstractTimeIndependentSystemA nonlinear system of equations.
Fields
tag: A tag for the system. If two systems have the same tag, then they are structurally identical.
eqs: Vector of equations defining the system.states: Unknown variables.ps: Parameters.var_to_name: Array variables.observed: Observed states.jac: Jacobian matrix. Note: this field will not be defined untilcalculate_jacobianis called on the system.
name: The name of the system.
systems: The internal systems. These are required to have unique names.
defaults: The default values to use when initial conditions and/or parameters are not supplied inODEProblem.
connector_type: Type of the system.
metadata: Metadata for the system, to be used by downstream packages.
gui_metadata: Metadata for MTK GUI.
tearing_state: Cache for intermediate tearing state.
substitutions: Substitutions generated by tearing.
complete: If a modelsysis complete, thensys.xno longer performs namespacing.
parent: The hierarchical parent system before simplification.
Examples
@variables x y z
@parameters σ ρ β
eqs = [0 ~ σ*(y-x),
0 ~ x*(ρ-z)-y,
0 ~ x*y - β*z]
@named ns = NonlinearSystem(eqs, [x,y,z],[σ,ρ,β])Composition and Accessor Functions
get_eqs(sys)orequations(sys): The equations that define the nonlinear system.get_states(sys)orstates(sys): The set of states in the nonlinear system.get_ps(sys)orparameters(sys): The parameters of the nonlinear system.get_u0_p(sys, u0map, parammap)Numeric arrays for the initial condition and parameters givenvar => valuemaps.
Transformations
ModelingToolkit.structural_simplify — Functionstructural_simplify(sys; ...)
structural_simplify(sys, io; simplify, kwargs...)
Structurally simplify algebraic equations in a system and compute the topological sort of the observed equations. When simplify=true, the simplify function will be applied during the tearing process. It also takes kwargs allow_symbolic=false and allow_parameter=true which limits the coefficient types during tearing.
The optional argument io may take a tuple (inputs, outputs). This will convert all inputs to parameters and allow them to be unconnected, i.e., simplification will allow models where n_states = n_equations - n_inputs.
Missing docstring for alias_elimination. Check Documenter's build log for details.
ModelingToolkit.StructuralTransformations.tearing — Functiontearing(sys; simplify=false)Tear the nonlinear equations in system. When simplify=true, we simplify the new residual equations after tearing. End users are encouraged to call structural_simplify instead, which calls this function internally.
Analyses
Missing docstring for ModelingToolkit.isaffine. Check Documenter's build log for details.
Missing docstring for ModelingToolkit.islinear. Check Documenter's build log for details.
Applicable Calculation and Generation Functions
ModelingToolkit.calculate_jacobian — Functioncalculate_jacobian(sys::AbstractSystem)Calculate the Jacobian matrix of a system.
Returns a matrix of Num instances. The result from the first call will be cached in the system object.
ModelingToolkit.generate_jacobian — Functiongenerate_jacobian(sys::AbstractSystem, dvs = states(sys), ps = parameters(sys),
expression = Val{true}; sparse = false, kwargs...)Generates a function for the Jacobian matrix of a system. Extra arguments control the arguments to the internal build_function call.
Missing docstring for jacobian_sparsity. Check Documenter's build log for details.
Problem Constructors
SciMLBase.NonlinearFunction — MethodSciMLBase.NonlinearFunction{iip}(sys::NonlinearSystem, dvs = states(sys),
ps = parameters(sys);
version = nothing,
jac = false,
sparse = false,
kwargs...) where {iip}Create an NonlinearFunction from the NonlinearSystem. The arguments dvs and ps are used to set the order of the dependent variable and parameter vectors, respectively.
SciMLBase.NonlinearProblem — MethodDiffEqBase.NonlinearProblem{iip}(sys::NonlinearSystem, u0map,
parammap = DiffEqBase.NullParameters();
jac = false, sparse = false,
checkbounds = false,
linenumbers = true, parallel = SerialForm(),
kwargs...) where {iip}Generates an NonlinearProblem from a NonlinearSystem and allows for automatically symbolically calculating numerical enhancements.
Torn Problem Constructors
Missing docstring for BlockNonlinearProblem. Check Documenter's build log for details.
Expression Constructors
ModelingToolkit.NonlinearFunctionExpr — TypeSciMLBase.NonlinearFunctionExpr{iip}(sys::NonlinearSystem, dvs = states(sys),
ps = parameters(sys);
version = nothing,
jac = false,
sparse = false,
kwargs...) where {iip}Create a Julia expression for an ODEFunction from the ODESystem. The arguments dvs and ps are used to set the order of the dependent variable and parameter vectors, respectively.
ModelingToolkit.NonlinearProblemExpr — TypeDiffEqBase.NonlinearProblemExpr{iip}(sys::NonlinearSystem, u0map,
parammap = DiffEqBase.NullParameters();
jac = false, sparse = false,
checkbounds = false,
linenumbers = true, parallel = SerialForm(),
kwargs...) where {iip}Generates a Julia expression for a NonlinearProblem from a NonlinearSystem and allows for automatically symbolically calculating numerical enhancements.