Skip to contents

SciMLBase's interface between ModelingToolkit and the solvers.

Usage

OverrideInitData(
  initializeprob,
  update_initializeprob = NULL,
  initializeprobmap = NULL,
  initializeprobpmap = NULL,
  metadata = NULL
)

get_initial_values(prob, ...)

initialize_dae(integ, initializealg = NULL)

is_overdetermined_initialization(prob)

remake_initialization_data(prob, u0 = NULL, p = NULL)

updated_u0_p(prob, u0 = NULL, p = NULL)

late_binding_update_u0_p(prob, u0 = NULL, p = NULL)

RemakeInitializationDataContext(...)

LateBindingUpdateU0PContext(...)

get_concrete_problem(prob, ...)

get_concrete_u0(prob, ...)

get_concrete_p(prob, ...)

promote_tspan(tspan)

promote_u0(u0, p = NULL, t = NULL)

prepare_initial_state(u0)

unwrap_parameters(p)

get_updated_symbolic_problem(prob, u0 = NULL, p = NULL, ...)

get_save_idxs_and_saved_subsystem(prob, save_idxs)

SavedSubsystem(indexp, t = NULL, saved_subsystem = NULL)

SavedSubsystemWithFallback(saved_subsystem, fallback = NULL)

get_saved_state_idxs(x)

get_saved_subsystem(sol)

get_saveable_values(integ, idxs = NULL)

save_discretes(integ)

save_discretes_if_enabled(integ)

save_final_discretes(integ)

create_parameter_timeseries_collection(sol)

set_ut(integ, u, t)

postamble(integ)

get_sol(integ)

split_callbacks(cb)

getindepsym(x)

getindepsym_defaultt(x)

get_root_indp(x)

plottable_indices(x)

symbolic_interpolation(sol, idxs, t)

ImmutableODEProblem(...)

ImmutableNonlinearProblem(...)

StandardODEProblem()

StandardDAEProblem()

StandardDDEProblem()

StandardNonlinearProblem()

StandardBVProblem()

StandardSecondOrderBVProblem()

DefaultOptimizationCache(...)

ODENLStepData(prob)

SymbolicLinearInterface(update_A, update_b, sys = NULL, ...)

get_new_A_b(prob, p = prob$p)

check_prob_alg_pairing(prob, alg)

detect_cycles(map)

Arguments

initializeprob, update_initializeprob, initializeprobmap, initializeprobpmap, metadata

Fields of the initialization data.

prob

A problem.

...

Further fields or arguments.

integ

An integrator.

initializealg

A DAE initialization algorithm.

u0, p, t

New values.

tspan

A time span.

save_idxs

Indices or variables.

indexp, saved_subsystem, fallback

Fields of a saved subsystem.

x

A problem, solution or system.

sol

A solution.

idxs

Indices.

u

A state.

cb

Callbacks.

update_A, update_b

Functions of the parameters.

sys

A system.

alg

An algorithm.

map

A list of formulas or equations var ~ expr.

Value

Values as described above.

Details

  • OverrideInitData(initializeprob, update_initializeprob, initializeprobmap, initializeprobpmap) attaches an initialization problem to a problem built from R functions (ODEProblem(..., initialization_data = )): get_initial_values(prob) solves it and maps its solution to the initial values (initializeprobmap(sol)) and parameters (initializeprobpmap(prob, sol)); for problems of a System it returns the values ModelingToolkit's initialization found. initialize_dae(integ) (Julia's initialize_dae!) makes the algebraic values of an integrator consistent again. is_overdetermined_initialization(prob) tells whether the initialization system has more equations than unknowns.

  • remake_initialization_data(prob, u0, p), updated_u0_p(prob, u0, p) and late_binding_update_u0_p(prob, u0, p) give the initialization data or the numeric initial values and parameters of a problem with new values; RemakeInitializationDataContext() and LateBindingUpdateU0PContext() hold their arguments. get_concrete_problem(prob), get_concrete_u0(prob) and get_concrete_p(prob) return the problem, initial values and parameters as the solver sees them; promote_tspan(), promote_u0(), prepare_initial_state() and unwrap_parameters() normalize them, and get_updated_symbolic_problem(prob, u0, p) is the problem with new values.

  • solve(prob, alg, save_idxs = ) saves only some components (indices or variables) in sol$u; symbolic indexing still sees all of them. get_save_idxs_and_saved_subsystem(prob, save_idxs) resolves them, and SavedSubsystem(), SavedSubsystemWithFallback(), get_saved_state_idxs(), get_saved_subsystem() and get_saveable_values(integ, idxs) describe what is saved.

  • save_discretes(integ) (save_discretes!) records the current parameters (the discrete variables) in the solution's parameter history; save_discretes_if_enabled() and save_final_discretes() do so when they changed, and create_parameter_timeseries_collection(sol) returns the history (t and a matrix p).

  • set_ut(integ, u, t) (set_ut!) sets state and time, postamble(integ) (postamble!) finishes the integration, get_sol(integ) is its solution so far, and split_callbacks(cb) separates continuous and discrete callbacks.

  • getindepsym(sys) and getindepsym_defaultt(sys) give the independent variable, get_root_indp(x) the system behind a problem or solution, plottable_indices(x) the indices that are plotted and symbolic_interpolation(sol, idxs, t) interpolates expressions.

  • ImmutableODEProblem() and ImmutableNonlinearProblem() are ODEProblem() and NonlinearProblem() (R problems are values); StandardODEProblem(), StandardDAEProblem(), StandardDDEProblem(), StandardNonlinearProblem(), StandardBVProblem() and StandardSecondOrderBVProblem() are the problem_type tags. DefaultOptimizationCache() is OptimizationCache().

  • ODENLStepData(prob) is the implicit stage system of ODEProblem(..., nlstep = TRUE); SymbolicLinearInterface(update_A, update_b, sys) and get_new_A_b(prob, p) rebuild the matrix and vector of a symbolic linear problem.

  • check_prob_alg_pairing(prob, alg) signals an error when the algorithm does not solve that kind of problem, and detect_cycles(map) tells whether a map of variables to expressions refers to itself through a chain of entries.

Examples

prob <- ODEProblem(function(u, p, t) -u, c(1, 2), c(0, 1))
sol <- solve(prob, Tsit5(), save_idxs = 2)
sol$u[[1]]
#> [1] 2
detect_cycles(list(c("a", "b"), c("b", "a")))
#> [1] TRUE