ndiffusion.TimeDependentSolver¶
- class ndiffusion.TimeDependentSolver¶
1-D multigroup time-dependent neutron diffusion solver.
Advances (1/v_g) d phi_g/dt = -A_g phi_g + fission + scatter + delayed using theta-weighted time differencing.
Materials.velocity must be set (neutron speed per group, cm/s).
Fission and scatter are both treated implicitly via Gauss-Seidel, and the delayed precursor balance is integrated in closed form, so the scheme is unconditionally stable. The time-absorption term 1/(theta * v_g * dt) is added to the spatial diagonal each step.
Pass delayed to enable delayed neutron precursors; with the default empty data the solver reduces to prompt-only kinetics. bc and bc_left are the right and left Robin BCs, as for KEigenSolver.
- __init__(self: ndiffusion._core.TimeDependentSolver, mats: ndiffusion._core.Materials, medium_map: numpy.ndarray[int32], edges_x: numpy.ndarray[float64], geom: ndiffusion._core.Geometry, 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 0x7facf3d3f630>, initial_precursors: object = None, theta: typing.SupportsFloat | typing.SupportsIndex = 1.0, bc_left: 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 time step of size dt (seconds).
update_materials(self, mats)Replace the cross sections mid-transient and rebuild the operator.
Attributes
Precursor concentrations per unit volume, shape (n_cells, n_precursor).
Time-differencing weight, in [0.5, 1].
- property n_cells¶
- property n_groups¶
- property precursors¶
Precursor concentrations per unit volume, shape (n_cells, n_precursor).
- result(self: ndiffusion._core.TimeDependentSolver) ndiffusion._core.TimeDependentResult¶
Return the current state as a TimeDependentResult.
- run(self: ndiffusion._core.TimeDependentSolver, dt: SupportsFloat | SupportsIndex, n_steps: SupportsInt | SupportsIndex) ndiffusion._core.TimeDependentResult¶
Advance n_steps uniform steps and return a TimeDependentResult.
- step(self: ndiffusion._core.TimeDependentSolver, dt: SupportsFloat | SupportsIndex) None¶
Advance one theta-weighted time 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.TimeDependentSolver, 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].