pub struct Runner { /* private fields */ }Expand description
Solves neutron transport problems using the Discrete Ordinates (S_N) method with domain decomposition.
The Runner struct implements the sweep-based algorithm for solving the one-dimensional
neutron transport equation. It maintains the angular flux distribution across spatial
nodes and angular directions, and iteratively updates the scalar flux until convergence.
§Fields
config- The configuration parameters defining the problem domain and materialsconverged- Flag indicating whether the iterative solver has convergediteration- Current iteration count in the convergence looppsi_right- Angular flux for rightward-moving directions (μ > 0), dimensions: [spatial_nodes × n_half]psi_left- Angular flux for leftward-moving directions (μ < 0), dimensions: [spatial_nodes × n_half]scalar_flux- Integrated angular flux over all directions, dimensions: [spatial_cells]total_source- Total source term including external and scattering contributions, dimensions: [spatial_cells]
§Example
use neutron_diffusion_dd::algorithm::{Config, Runner};
let config = Config::new_auto(1e-5, 2000, "data/input.json");
let mut runner = Runner::new(config);
let result = runner.run();Implementations§
Source§impl Runner
impl Runner
Sourcepub fn new(config: Config) -> Self
pub fn new(config: Config) -> Self
Constructs a new Runner with the provided configuration.
Initializes all angular flux matrices with zeros and applies initial boundary conditions from the configuration. The solver is ready to start iterations after construction.
§Arguments
config- AConfigstruct containing all problem parameters
§Returns
A new Runner instance with initialized flux matrices and boundary conditions applied.
§Example
use neutron_diffusion_dd::algorithm::{Config, Runner};
let config = Config::new_auto(1e-5, 2000, "data/input.json");
let runner = Runner::new(config);Sourcepub fn run(&mut self) -> RunnerResult
pub fn run(&mut self) -> RunnerResult
Runs the iterative S_N solver until convergence or maximum iterations.
Executes the main solution algorithm:
- Updates reflective boundary conditions if applicable
- Performs a complete sweep of angular fluxes in all spatial cells and directions
- Computes scalar flux by integrating angular fluxes
- Checks convergence based on relative change in scalar flux
The iteration process continues until either the convergence tolerance is achieved or the maximum number of iterations is exceeded. Convergence diagnostics are printed every 100 iterations.
§Returns
A RunnerResult containing the final scalar flux distribution, convergence status,
iteration count, and computation time.
§Example
use neutron_diffusion_dd::algorithm::{Config, Runner};
let config = Config::new_auto(1e-5, 2000, "data/input.json");
let mut runner = Runner::new(config);
let result = runner.run();
println!("Converged: {}", result.converged);
println!("Iterations: {}", result.iteration);Auto Trait Implementations§
impl Freeze for Runner
impl RefUnwindSafe for Runner
impl Send for Runner
impl Sync for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
impl UnwindSafe for Runner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.