ndiffusion.TimeDependentSolverUnstructured2D

class ndiffusion.TimeDependentSolverUnstructured2D

2-D multigroup time-dependent neutron diffusion solver on an unstructured polygonal mesh.

Uses theta-weighted time differencing with an implicit fission source and delayed neutron precursors integrated in closed form. Materials.velocity must be set (neutron speed per group, cm/s).

Precursor concentrations are stored per unit volume, matching the volumetric source convention of the fixed-source solver.

__init__(self: ndiffusion._core.TimeDependentSolverUnstructured2D, mats: ndiffusion._core.Materials, mesh: ndiffusion._core.UnstructuredMesh2D, bc: collections.abc.Sequence[ndiffusion._core.BoundaryCondition], initial_flux: object = None, epsilon: typing.SupportsFloat | typing.SupportsIndex = 1e-06, max_inner: typing.SupportsInt | typing.SupportsIndex = 50, verbose: bool = False, delayed: ndiffusion._core.DelayedNeutronData = <ndiffusion._core.DelayedNeutronData object at 0x7facf3d54970>, initial_precursors: object = None, theta: typing.SupportsFloat | typing.SupportsIndex = 1.0) → None

Methods

__init__(self, mats, mesh, bc, initial_flux, ...)

result(self)

Return the current state as a TimeDependentResult.

run(self, dt, n_steps)

Advance n_steps uniform steps and return a TimeDependentResult.

step(self, dt)

Advance one theta-weighted step of size dt (seconds).

update_materials(self, mats)

Replace the cross sections mid-transient and rebuild the operator.

Attributes

n_cells

n_groups

precursors

Precursor concentrations per unit volume, shape (n_cells, n_precursor).

steps

theta

Time-differencing weight, in [0.5, 1].

time

property n_cells
property n_groups
property precursors

Precursor concentrations per unit volume, shape (n_cells, n_precursor).

result(self: ndiffusion._core.TimeDependentSolverUnstructured2D) → ndiffusion._core.TimeDependentResult

Return the current state as a TimeDependentResult.

run(self: ndiffusion._core.TimeDependentSolverUnstructured2D, dt: SupportsFloat | SupportsIndex, n_steps: SupportsInt | SupportsIndex) → ndiffusion._core.TimeDependentResult

Advance n_steps uniform steps and return a TimeDependentResult.

step(self: ndiffusion._core.TimeDependentSolverUnstructured2D, dt: SupportsFloat | SupportsIndex) → None

Advance one theta-weighted step of size dt (seconds).

property steps
property theta

Time-differencing weight, in [0.5, 1].

1 is backward Euler (first order in dt), 0.5 is Crank-Nicolson (second order). Both are unconditionally stable, but only backward Euler damps the stiff modes: at theta = 0.5 a mode too fast for the step size rings - decaying slowly with an alternating sign - instead of being killed. Whether that matters depends on how much stiff content a perturbation excites; a smooth, mode-shaped one excites very little. When it does matter, take one or two steps at theta = 1 right after the perturbation, then set it back to 0.5 for the smooth part of the transient.

Raises ValueError if set outside [0.5, 1]: below 0.5 the scheme is only conditionally stable, and the condition is hopeless here (the fast spatial modes decay at ~v * Sigma_r, of order 1e4 per second).

property time
update_materials(self: ndiffusion._core.TimeDependentSolverUnstructured2D, mats: ndiffusion._core.Materials) → None

Replace the cross sections mid-transient and rebuild the operator. Flux and precursor state are preserved; n_mat and n_groups must not change. Call once per step with interpolated data to drive a ramp. The change takes effect at the start of the next step - a step insertion at t_n, holding across the whole of [t_n, t_n + dt].