Skip to main content

AdaptiveConfig

Struct AdaptiveConfig 

Source
pub struct AdaptiveConfig {
    pub dt_init: f64,
    pub dt_min: f64,
    pub dt_max: f64,
    pub reltol: f64,
    pub abstol: f64,
}
Expand description

Parameters for [lte_attempt]’s local-truncation-error step-size control.

reltol/abstol together form the per-unknown error scale abstol + reltol * max(|x_trapezoidal|, |x_backward_euler|) a step’s estimated error is normalized against (the same RELTOL/ABSTOL idea every SPICE-family tool exposes) — reltol alone isn’t enough because it degenerates to zero right where many circuit unknowns spend a lot of their time (an AC-coupled voltage or an inductor current crossing zero), so abstol is the floor that keeps step control meaningful there. This crate uses one scalar abstol for every unknown regardless of whether it’s a voltage or a current — a real simplification relative to SPICE’s own separate voltage/current tolerances (VNTOL/ABSTOL), noted directly rather than silently: pick abstol relative to the smaller-magnitude unknowns in your own circuit if the defaults reject too aggressively.

Fields§

§dt_init: f64

The very first trial step size.

§dt_min: f64

Never shrink below this, no matter how large the estimated error — accept whatever result comes out instead of looping forever (a run that only converges below dt_min needs a smaller dt_min or looser tolerances, not an infinite retry loop).

§dt_max: f64

Never grow above this, even if the estimated error says a step could be much larger — the same role TSTEP/a .tran step ceiling plays in a real SPICE deck: without it, a long quiet stretch could grow the step past the resolution needed to catch the next fast event at all.

§reltol: f64

Relative error tolerance (dimensionless, e.g. 1e-3 for 0.1%).

§abstol: f64

Absolute error tolerance (same units as the circuit’s own unknowns — volts/amps).

Implementations§

Source§

impl AdaptiveConfig

Source

pub fn from_t_final(t_final: f64) -> Self

A reasonable default derived from t_final alone, for when the caller hasn’t measured their own circuit’s time constants — the same situation a real SPICE .tran line is in when only TSTOP is meaningfully chosen by the user and the internal step is left to the tool. dt_max = t_final/1000 (a 1000-point default resolution, comparable to a typical SPICE run’s point count), dt_init = dt_max/100 (start conservatively, like every real tool’s own small first step, then grow once the solution’s behavior is actually known), dt_min = dt_max*1e-9.

Trait Implementations§

Source§

impl Clone for AdaptiveConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AdaptiveConfig

Source§

impl Debug for AdaptiveConfig

Source§

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

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

impl PartialEq for AdaptiveConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AdaptiveConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.