Struct SolverBuilder

Source
pub struct SolverBuilder { /* private fields */ }
Expand description

Fluent builder for ThermalizationSolver.

Groups all configuration into a chainable API. The existing ThermalizationSolver::new() + manual field mutation still works; this is a convenience layer on top.

Implementations§

Source§

impl SolverBuilder

Source

pub fn grid(self, config: GridConfig) -> Self

Set the frequency grid configuration.

Source

pub fn grid_fast(self) -> Self

Use the fast (500-point) grid for quick tests.

Source

pub fn grid_production(self) -> Self

Use the production (4000-point) grid for high-accuracy runs.

Source

pub fn injection(self, scenario: InjectionScenario) -> Self

Set the energy injection scenario.

Source

pub fn initial_delta_n(self, delta_n: Vec<f64>) -> Self

Set an initial photon perturbation Δn(x).

Source

pub fn z_range(self, z_start: f64, z_end: f64) -> Self

Set the redshift range (z_start, z_end).

Source

pub fn solver_config(self, config: SolverConfig) -> Self

Set a complete solver config, overriding individual z/dy/dtau settings.

Source

pub fn dy_max(self, val: f64) -> Self

Set the maximum Kompaneets step size.

Source

pub fn dtau_max(self, val: f64) -> Self

Set the maximum Compton optical depth per step.

Source

pub fn disable_dcbr(self) -> Self

Disable DC/BR processes (Kompaneets only).

Source

pub fn split_dcbr(self) -> Self

Use operator-split DC/BR instead of coupled IMEX.

Source

pub fn number_conserving(self) -> Self

Enable number-conserving T-shift subtraction (on by default).

Source

pub fn no_number_conserving(self) -> Self

Disable number-conserving T-shift subtraction.

Source

pub fn nc_z_min(self, val: f64) -> Self

Set the minimum redshift for number-conserving subtraction.

Source

pub fn nc_stride(self, val: usize) -> Self

Set the NC stripping stride (strip every N steps).

Source

pub fn dcbr_scale(self, val: f64) -> Self

Scale DC/BR emission rates by this factor (diagnostic).

Source

pub fn max_newton_iter(self, val: usize) -> Self

Set the maximum number of Newton iterations per Kompaneets step.

Source

pub fn no_auto_refine(self) -> Self

Disable automatic refinement zone insertion for photon injection scenarios.

Source

pub fn build(self) -> Result<ThermalizationSolver, String>

Build the configured solver.

Validates all configuration (cosmology, grid, solver config, injection) before constructing the solver. Returns Err with a descriptive message if any parameter is invalid.

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> 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, 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.