Struct SolverConfig

Source
pub struct SolverConfig {
    pub z_start: f64,
    pub z_end: f64,
    pub dy_max: f64,
    pub dz_min: f64,
    pub dtau_max: f64,
    pub nc_z_min: f64,
    pub dtau_max_photon_source: f64,
    pub max_newton_iter: usize,
    pub cn_dcbr: bool,
}
Expand description

Tunable solver parameters.

Defaults are production-quality and match the values used for all paper runs. The fields that most users will want to change are Self::z_start, Self::z_end, and Self::dtau_max.

Fields§

§z_start: f64

Upper redshift at which integration begins (solver evolves from z_start down to z_end). Must satisfy z_start > z_end.

§z_end: f64

Lower redshift at which integration ends.

§dy_max: f64

Maximum fractional change in ln(1+z) per step (limits step size for slow-varying sources). Default 0.02. Historical value 0.005 was calibrated for photon-injection bursts; for smooth (continuous) heat injection scenarios 0.02 gives the same μ/y to 4 significant figures with 5–6× fewer steps, since dtau_max takes over as the binding constraint at z ≲ 1.5×10⁶.

§dz_min: f64

Minimum allowed step size in z; smaller values trigger a warning. Default 1e-6.

§dtau_max: f64

Maximum Compton optical depth per step. With exact exponential DC/BR (unconditionally stable), this primarily limits Kompaneets CN accuracy. Default 10.0 matches the CLI default (the value used for all paper runs). Raise to ~50 for exploratory runs where modest accuracy loss is acceptable.

§nc_z_min: f64

Minimum redshift for number-conserving T-shift subtraction. Default 5e4: only subtract at z > nc_z_min where DC/BR is significant. Set to 0.0 to subtract at all redshifts (CosmoTherm-like behavior).

§dtau_max_photon_source: f64

Maximum dtau per step during active photon source injection. Limits the Kompaneets Δn² nonlinearity at the injection spike, which causes timestep-dependent wake formation at intermediate x. Default 1.0 (production quality, ~1% from converged). Set to 10.0 for exploratory/fast runs (~3% from converged).

§max_newton_iter: usize

Maximum number of Newton iterations per Kompaneets step. Default 10. Increase for extreme injection parameters.

§cn_dcbr: bool

Use Crank-Nicolson (instead of backward Euler) for DC/BR. Second-order in time, matching CosmoTherm’s scheme. May be less stable at very low x where DC/BR rates diverge.

Implementations§

Source§

impl SolverConfig

Source

pub fn validate(&self) -> Result<(), String>

Validate solver configuration parameters.

Returns Err with a descriptive message if any parameter would cause the solver to fail or produce meaningless results.

Trait Implementations§

Source§

impl Clone for SolverConfig

Source§

fn clone(&self) -> SolverConfig

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SolverConfig

Source§

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

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

impl Default for SolverConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.