Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 24 fields pub epsilon: f64, pub max_iter: i32, pub num_regions: usize, pub num_zones: usize, pub nc: DVector<usize>, pub hr: DVector<f64>, pub izl: DVector<usize>, pub q: DVector<f64>, pub sct: DVector<f64>, pub scs: DVector<f64>, pub n: i32, pub n_half: usize, pub miu_m: DVector<f64>, pub omega_m: DVector<f64>, pub reflex_izq: bool, pub reflex_der: bool, pub bound_left: DVector<f64>, pub bound_right: DVector<f64>, pub ntc: usize, pub ntp: usize, pub sigma_t_vec: DVector<f64>, pub sigma_s_vec: DVector<f64>, pub q_ext_vec: DVector<f64>, pub dx_vec: DVector<f64>,
}
Expand description

Configuration for the neutron transport problem.

Contains geometry, material properties, quadrature settings, and boundary conditions for a 1D neutron transport simulation using the discrete ordinates (S_N) method.

§Fields

  • epsilon - Convergence tolerance for the iterative solver
  • max_iter - Maximum number of iterations allowed
  • num_regions - Number of spatial regions in the domain
  • num_zones - Number of material zones
  • nc - Number of cells per region
  • hr - Height (thickness) of each region [cm]
  • izl - Material zone ID for each region (1-based)
  • q - External source term per region
  • sct - Total macroscopic cross section per zone
  • scs - Scattering macroscopic cross section per zone
  • n - Order of the discrete ordinates (S_N)
  • n_half - Half of N (number of directions in one hemisphere)
  • miu_m - Directional cosines (mu values)
  • omega_m - Quadrature weights
  • reflex_izq - Reflective boundary condition at left boundary
  • reflex_der - Reflective boundary condition at right boundary
  • bound_left - Incident flux at left boundary (if non-reflective)
  • bound_right - Incident flux at right boundary (if non-reflective)
  • ntc - Total number of cells (sum of nc)
  • ntp - Total number of nodes (ntc + 1)
  • sigma_t_vec - Total cross section per cell
  • sigma_s_vec - Scattering cross section per cell
  • q_ext_vec - External source per cell
  • dx_vec - Cell widths

Fields§

§epsilon: f64§max_iter: i32§num_regions: usize§num_zones: usize§nc: DVector<usize>§hr: DVector<f64>§izl: DVector<usize>§q: DVector<f64>§sct: DVector<f64>§scs: DVector<f64>§n: i32§n_half: usize§miu_m: DVector<f64>§omega_m: DVector<f64>§reflex_izq: bool§reflex_der: bool§bound_left: DVector<f64>§bound_right: DVector<f64>§ntc: usize§ntp: usize§sigma_t_vec: DVector<f64>§sigma_s_vec: DVector<f64>§q_ext_vec: DVector<f64>§dx_vec: DVector<f64>

Implementations§

Source§

impl Config

Source

pub fn new_auto(epsilon: f64, max_iter: i32, input_path: &str) -> Self

Creates a new configuration by automatically loading from a JSON file.

This method deserializes configuration from a JSON file with the following format:

{
  "num_regions": 3,
  "num_zones": 3,
  "NC": [20, 60, 20],
  "HR": [10, 30, 10],
  "IZL": [1, 2, 3],
  "SCT": [1.0, 0.6, 1],
  "SCS": [0.99, 0.4, 0.9],
  "Q": [2, 0, 0],
  "N": 4,
  "reflex_izq": 1,
  "reflex_der": 0,
  "bound_left": [0, 0],
  "bound_right": [0, 0]
}
§Arguments
  • epsilon - Convergence tolerance for the iterative solver
  • max_iter - Maximum number of iterations
  • input_path - Path to the JSON configuration file
§Panics

Panics if the file cannot be opened or deserialized.

§Example
use neutron_diffusion_dd::algorithm::Config;

let config = Config::new_auto(1e-5, 2000, "data/input.json");
Source

pub fn new_manual(epsilon: f64, max_iter: i32) -> Self

Creates a new configuration through interactive manual input.

Prompts the user for all configuration parameters interactively. This is useful for testing and exploration.

§Arguments
  • epsilon - Convergence tolerance for the iterative solver
  • max_iter - Maximum number of iterations
§Example
use neutron_diffusion_dd::algorithm::Config;

let config = Config::new_manual(1e-5, 2000);

Trait Implementations§

Source§

impl Clone for Config

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 Debug for Config

Source§

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

Formats the value using the given formatter. 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, 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> 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> 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.