Skip to main content

SimulateError

Enum SimulateError 

Source
pub enum SimulateError {
Show 18 variants Compile(CompileError), DiffsolError { details: String, }, ToleranceNotMet, NotDynamic { details: String, }, CompilerUnavailable { compiler: &'static str, details: String, }, RangeRestriction { code: &'static str, message: String, }, DataSourceUnbound { parameter: String, data_source: String, }, Cancelled { details: String, }, UnsubstitutableBinding { name: String, class: String, }, InvalidTimeSpan { start: f64, end: f64, }, InvalidParameter { name: String, }, AmbiguousParameter { name: String, candidates: Vec<String>, }, CollidingParameterKeys { name: String, keys: Vec<String>, }, InvalidInitialCondition { name: String, }, AmbiguousInitialCondition { name: String, candidates: Vec<String>, }, CollidingInitialConditionKeys { name: String, keys: Vec<String>, }, InvalidFieldInitialCondition { name: String, details: String, }, ProviderError { name: String, details: String, },
}
Expand description

Errors raised building an crate::problem::EsmProblem or running crate::problem::solve.

Variants§

§

Compile(CompileError)

Wraps a CompileError raised by crate::problem::esm_problem before solving even starts.

§

DiffsolError

diffsol returned a solver-internal error (build failure, step failure, etc.).

Fields

§details: String

The underlying diffsol error message.

§

ToleranceNotMet

The integrator could not satisfy the requested tolerances.

§

NotDynamic

crate::problem::solve was called on a EsmProblem whose document declares no differential equations, so there is nothing to integrate. Its build-time products are still readable with crate::problem::observed_field.

Fields

§details: String

Why the EsmProblem carries no integrable right-hand side.

§

CompilerUnavailable

crate::problem::ProblemOptions::compiler named a value that is in API_SPEC §5.8’s closed vocabulary but that this binding, this build or this process cannot provide (esm-spec §9.6.6 compiler_unavailable).

Never answered by building with a different compiler: the whole point of naming one is that the caller knows which ran. details names what would have to be loaded or built.

Fields

§compiler: &'static str

The vocabulary spelling the caller asked for.

§details: String

What would have to be loaded or built to provide it.

§

RangeRestriction

A range-restricted or operator-restricted right-hand side (API_SPEC §5.8: select, halo, tile, lanes) was refused. code is one of range_halo_insufficient, range_global_locality, range_selection_writes_incomplete or range_box_invalid, and message names the rule, variable and axis involved.

Fields

§code: &'static str

The diagnostic code.

§message: String

What was refused, naming the rule, variable and axis.

§

DataSourceUnbound

A DATA-FED parameter — one whose update is kind: "data" (esm-spec §5.4, §8.5) — reached a build with NOTHING bound to it: no provider, no loaded array, and no caller-supplied p value (esm-spec §9.6.6 data_source_unbound, CONFORMANCE_SPEC §5.46).

Raised at CONSTRUCTION, before any right-hand side is built, so the answer does not depend on the compiler: this asks whether the DOCUMENT’s inputs are bound, not what a compiler can lower. A compiler that additionally cannot lower a read of the forcing channel reports that separately as CompileError::CompilerRefusedRule.

Refused rather than evaluated at the parameter’s default, which is not a fallback value but a placeholder: a forcing at its default integrates to a complete, smooth trajectory reported under the label of a quantity the document says is read from a file.

Fields

§parameter: String

The flattened parameter nothing bound.

§data_source: String

The data_sources key its update names. Spelled data_source rather than source, which thiserror reserves for an error’s CAUSE — a String cannot be one.

§

Cancelled

A build progress observer asked crate::problem::esm_problem to stop (returned Flow::Cancel).

Distinct from every other variant in that nothing went wrong: it is the caller’s own decision. It stays an ERROR — unlike a cancelled solve, which is ReturnCode::Terminated with a partial trajectory — because a half-built EsmProblem is not a usable result.

Fields

§details: String

The phase and item the build stopped at.

§

UnsubstitutableBinding

crate::problem::remake was asked to substitute a binding the EsmProblem cannot honour without redoing part of construction.

Raised rather than silently rebuilding or silently ignoring the substitution (esm-libraries-spec.md §2.5.5): the name and the class that makes it un-substitutable are both reported so the caller knows to build a fresh EsmProblem instead.

Fields

§name: String

The binding the caller tried to substitute.

§class: String

The class that makes it un-substitutable.

§

InvalidTimeSpan

The caller supplied a time span whose start or end is not a finite number — NaN, +∞ or −∞.

A document cannot spell one: the schema’s TimeSpan bounds are JSON numbers, and esm-spec §6.6.4 records that “JSON has no infinite literal”. So this is a caller-supplied argument of a solve, validated alongside the parameter and initial-condition maps of the same call.

Refused rather than interpreted. Every ordering test against NaN is false, so a NaN endpoint reads as a run that cannot advance and would hand back the initial state as though it were a trajectory; an infinite end gives the solver loop a stop time it can never reach.

Fields

§start: f64

The requested start of the interval.

§end: f64

The requested end of the interval.

§

InvalidParameter

The user supplied a parameter name that does not appear in the flattened system.

Fields

§name: String

The unknown parameter name.

§

AmbiguousParameter

The user supplied a key that two or more of the flattened system’s parameters carry as a DOTTED SUFFIX — a shared local name (gain for Left.gain and Right.gain) or a shared partial qualification (sub.g for Left.sub.g and Right.sub.g), esm-spec §6.6.2 rule 4. Distinct from SimulateError::InvalidParameter: the name exists, it just does not identify ONE parameter, and binding it to either candidate would be a wrong answer rather than a missing one.

Fields

§name: String

The ambiguous local or partially qualified name.

§candidates: Vec<String>

The qualified parameters that carry it.

§

CollidingParameterKeys

Two or more NON-EXACT parameter_overrides keys designate the one flattened parameter (esm-spec §6.6.2): a bare local spelling and a more-qualified one (solo and Doc.Left.solo both landing on Left.solo), or two more-qualified ones (A.M.g and B.M.g both landing on M.g). The caller wrote two overrides and only one can take effect, so picking a winner would be a wrong answer rather than a missing one. An EXACT key is never part of a collision — it identifies its parameter outright and wins over any suffix or bare claim on it.

Fields

§name: String

The flattened parameter every colliding key designates.

§keys: Vec<String>

The colliding keys, sorted.

§

InvalidInitialCondition

The user supplied an initial condition for a name that is not a state variable, or a state variable has no initial value (no entry in initial_conditions and no default on the ModelVariable).

Fields

§name: String

The variable name.

§

AmbiguousInitialCondition

The user supplied a key that two or more of the flattened system’s states carry as a DOTTED SUFFIX (esm-spec §6.6.2 rule 4). The state-side counterpart of SimulateError::AmbiguousParameter.

Fields

§name: String

The ambiguous local or partially qualified name.

§candidates: Vec<String>

The qualified states that carry it.

§

CollidingInitialConditionKeys

Two or more NON-EXACT initial_conditions keys designate the one state element (esm-spec §6.6.2). The state-side counterpart of SimulateError::CollidingParameterKeys.

Fields

§name: String

The state element every colliding key designates.

§keys: Vec<String>

The colliding keys, sorted.

§

InvalidFieldInitialCondition

An ic(target) field initial condition could not be resolved to a per-cell value. Carries the ic(...) target state name plus a diagnostic saying why (wrong field rank, unresolvable RHS, …), so the name field stays a plain identifier.

Fields

§name: String

The ic(...) target state name.

§details: String

Why the initial condition could not be resolved.

§

ProviderError

A data provider bound in crate::problem::ProblemOptions failed to materialize its loader field, or produced the wrong number of fields for its target forcing variable.

Fields

§name: String

The forcing variable the provider was bound to.

§details: String

What went wrong.

Implementations§

Source§

impl SimulateError

Source

pub fn is_cancelled(&self) -> bool

Whether this is a build progress observer’s own Flow::Cancel rather than something going wrong — the counterpart of reading ReturnCode::Terminated off a Solution.

Trait Implementations§

Source§

impl Debug for SimulateError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SimulateError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SimulateError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<CompileError> for SimulateError

Source§

fn from(source: CompileError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V