init
Stable function · Simulation
Tier: stable · Kind: function · Topic: Simulation
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
| not exported | outside profile | init | init | outside profile |
Julia
Julia does not export this function.
TypeScript
Not available in TypeScript. TypeScript is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.
Python
init(prob: EsmProblem, *, alg: str = DEFAULT_ALG, abstol: float | None = None, reltol: float | None = None, callback: Any = None, maxiters: int | None = None) -> Integrator
Build a stepping Integrator
over prob (esm-libraries-spec §2.5.6).
abstol / reltol resolve on the esm-spec §2.2.2 chain, exactly as
solve
’s do: None (the default) means “not given”, so the
document’s solver.abstol / solver.reltol are used, falling through
per field to the binding defaults (abstol 1e-6, reltol 1e-4). An
explicit argument here wins outright. The chain runs wherever a document is
integrated, so stepping honours the document as solving does.
Example (integrator)
integ = earthsci_ast.init(prob)
earthsci_ast.step(integ)
assert 0.0 < integ.t < 10.0
assert integ["N"] < 100.0
rest = earthsci_ast.solve_all(integ)
assert rest.retcode == earthsci_ast.ReturnCode.Success
assert rest.t[-1] == 10.0
Rust
pub fn init<'a>(prob: &'a EsmProblem, opts: &SolveOptions) -> Result<Integrator<'a>, SimulateError>
Build a stepping integrator for prob (§2.5.6).
The step grid is opts.saveat when the caller supplied one, else 100 evenly
spaced points across tspan.
The esm-spec §2.2.2 tolerance chain and the callback folding run HERE, as
at solve: the integrator carries the document’s solver.abstol /
reltol whenever the caller named none, so stepping a document honours its
declared numerics exactly as solving it does.
The initial state is built here, so an error building it (an element no
source values, an initial condition that cannot be evaluated) is reported
by init.
Go
Not available in Go. Go is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.