NonlinearSystem

System Constructors

ModelingToolkit.NonlinearSystemType
struct NonlinearSystem <: AbstractTimeIndependentSystem

A 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.

  • unknowns: Unknown variables.

  • ps: Parameters.

  • var_to_name: Array variables.

  • observed: Observed variables.

  • jac: Jacobian matrix. Note: this field will not be defined until calculate_jacobian is 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 in ODEProblem.
  • connector_type: Type of the system.
  • parameter_dependencies: A mapping from dependent parameters to expressions describing how they are calculated from other parameters.
  • 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 model sys is complete, then sys.x no longer performs namespacing.
  • index_cache: Cached data for fast symbolic indexing.
  • 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],[σ,ρ,β])
source

Composition and Accessor Functions

  • get_eqs(sys) or equations(sys): The equations that define the nonlinear system.
  • get_unknowns(sys) or unknowns(sys): The set of unknowns in the nonlinear system.
  • get_ps(sys) or parameters(sys): The parameters of the nonlinear system.
  • get_u0_p(sys, u0map, parammap) Numeric arrays for the initial condition and parameters given var => value maps.

Transformations

ModelingToolkit.structural_simplifyFunction
structural_simplify(sys; ...)
structural_simplify(sys, io; simplify, split, 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_unknowns = n_equations - n_inputs.

source
Missing docstring.

Missing docstring for alias_elimination. Check Documenter's build log for details.

Analyses

Missing docstring.

Missing docstring for ModelingToolkit.isaffine. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ModelingToolkit.islinear. Check Documenter's build log for details.

Applicable Calculation and Generation Functions

ModelingToolkit.calculate_jacobianFunction
calculate_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.

source
ModelingToolkit.generate_jacobianFunction
generate_jacobian(sys::AbstractSystem, dvs = unknowns(sys), ps = full_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.

source
Missing docstring.

Missing docstring for jacobian_sparsity. Check Documenter's build log for details.

Problem Constructors

SciMLBase.NonlinearFunctionMethod
SciMLBase.NonlinearFunction{iip}(sys::NonlinearSystem, dvs = unknowns(sys),
                                 ps = full_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.

source
SciMLBase.NonlinearProblemMethod
DiffEqBase.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.

source

Torn Problem Constructors

Missing docstring.

Missing docstring for BlockNonlinearProblem. Check Documenter's build log for details.

Expression Constructors

ModelingToolkit.NonlinearFunctionExprType
SciMLBase.NonlinearFunctionExpr{iip}(sys::NonlinearSystem, dvs = unknowns(sys),
                                     ps = full_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.

source
ModelingToolkit.NonlinearProblemExprType
DiffEqBase.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.

source