ndiffusion.TimeDependentSolver2D

class ndiffusion.TimeDependentSolver2D

2-D multigroup time-dependent neutron diffusion solver on a structured Cartesian or RZ 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).

Pass delayed to enable delayed neutron precursors; with the default empty data the solver reduces to prompt-only kinetics.

__init__(self: ndiffusion._core.TimeDependentSolver2D, mats: ndiffusion._core.Materials, medium_map: numpy.ndarray[int32], edges_x: numpy.ndarray[float64], edges_y: numpy.ndarray[float64], geom: ndiffusion._core.Geometry2D, bc_x: collections.abc.Sequence[ndiffusion._core.BoundaryCondition], bc_y: 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 0x7facf602adb0>, initial_precursors: object = None, theta: typing.SupportsFloat | typing.SupportsIndex = 1.0, bc_x_left: collections.abc.Sequence[ndiffusion._core.BoundaryCondition] = [], bc_y_bottom: collections.abc.Sequence[ndiffusion._core.BoundaryCondition] = []) → None

Methods

__init__(self, mats, medium_map, edges_x, ...)

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.TimeDependentSolver2D) → ndiffusion._core.TimeDependentResult

Return the current state as a TimeDependentResult.

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

Advance n_steps uniform steps and return a TimeDependentResult.

step(self: ndiffusion._core.TimeDependentSolver2D, 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.TimeDependentSolver2D, 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].