generate_initializesystem(sys, op = ...) returns the system of
nonlinear equations that determines consistent initial values of a
time dependent system. Its unknowns are the unknowns of sys, the
derivatives of its differential variables (named xˍt) and its solvable
parameters (those bound to NA). Its equations are
Arguments
- sys
A complete
System.- op
Operating point: initial conditions and parameter values.
- initialization_eqs
Further initialization equations.
- guesses
Further guesses, as a variable map.
- default_dd_guess
Guess for the derivative variables.
- algebraic_only
Ignore the initialization equations of the system (those in
initialization_eqsare still used).- time_dependent_init
Build the time dependent initialization.
- name
Name of the initialization system.
- ...
Unused.
Details
the algebraic equations of
sys, andxˍt ~ ffor each differential equationD(x) ~ f, with observed variables substituted;the bindings of variables;
one equation per initial condition in
opor in the system: a constantx ~ 1becomesx ~ Initial(x)with the parameterInitial(x)set to 1, an expression is used as it is; conditions on observed variables and on derivatives (D(x) ~ 0) are allowed;the initialization equations of
sysand those ininitialization_eqs.
Guesses become the guesses of the returned system, and the parameter
values and Initial values its initial conditions, so it can be passed to
mtkcompile() with fully_determined = FALSE and then to
NonlinearProblem(). InitializationProblem() does all of this.
For a time independent system (or time_dependent_init = FALSE) the
initialization system solves only for the solvable parameters; the
unknowns enter through Initial(x).
A value of NULL in op (as the pair list(x, NULL)) removes the
initial condition of x, and NA makes a parameter solvable.
Examples
t <- t_nounits; D <- D_nounits
x <- Variable("x", t); y <- Variable("y", t)
sys <- mtkcompile(System(list(D(x) ~ -x + y, 0 ~ x^2 + y^2 - 1), t, name = "dae"))
isys <- generate_initializesystem(sys, op = list(x ~ 0.6), guesses = list(y ~ 1))
equations(isys)
#> [[1]]
#> xˍt(t) ~ -x(t) + y(t)
#>
#> [[2]]
#> 0 ~ x(t)^2 + y(t)^2 - 1
#>
#> [[3]]
#> x(t) ~ Initial(x(t))
#>
unknowns(isys)
#> [[1]]
#> x(t)
#>
#> [[2]]
#> y(t)
#>
#> [[3]]
#> xˍt(t)
#>