discrete1.boundary1d module
Built-in boundary condition factories for discrete1.
This module provides a set of reusable boundary condition constructors used across tests and examples. Each function returns arrays shaped to match the solver interfaces (spatial boundaries, angles, energy groups, and optional time axes).
Public functions - manufactured_ss_03, manufactured_ss_04, manufactured_ss_05 - manufactured_td_02 - deuterium_deuterium, deuterium_tritium - time_dependence_constant, time_dependence_decay_01, time_dependence_decay_02
All functions return NumPy arrays suitable as boundary source inputs to the solver.
- discrete1.boundary1d.deuterium_deuterium(location, edges_g)[source]
Create a monoenergetic boundary source for D-D fusion (2.45 MeV).
- Parameters:
location (
int) – Spatial boundary index (0 for left, 1 for right) where the source is applied.edges_g (
array_like) – Energy group edge values. Used to determine the group index nearest to 2.45 MeV.
- Returns:
Boundary array with shape (2, 1, n_groups) with a unit source in the selected group at the specified location.
- Return type:
numpy.ndarray
- discrete1.boundary1d.deuterium_tritium(location, edges_g)[source]
Create a monoenergetic boundary source for D-T fusion (14.1 MeV).
- Parameters:
location (
int) – Spatial boundary index (0 for left, 1 for right) where the source is applied.edges_g (
array_like) – Energy group edge values. Used to determine the group index nearest to 14.1 MeV.
- Returns:
Boundary array with shape (2, 1, n_groups) with a unit source in the selected group at the specified location.
- Return type:
numpy.ndarray
- discrete1.boundary1d.manufactured_ss_03(angle_x)[source]
Manufactured steady-state boundary (case 03).
One-group, angle-dependent boundary used for manufactured solution tests.
- Parameters:
angle_x (
array_like) – 1D array of angular ordinates (mu values) with shape (n_angles,).- Returns:
Boundary array with shape (2, n_angles, 1). Axis 0 indexes the two spatial boundaries (left, right).
- Return type:
numpy.ndarray
- discrete1.boundary1d.manufactured_ss_04()[source]
Manufactured steady-state boundary (case 04).
One-group, angle-independent boundary used for manufactured solution tests.
- Returns:
Boundary array with shape (2, 1, 1).
- Return type:
numpy.ndarray
- discrete1.boundary1d.manufactured_ss_05()[source]
Manufactured steady-state boundary (case 05).
One-group, angle-independent boundary (polynomial) used for tests.
- Returns:
Boundary array with shape (2, 1, 1).
- Return type:
numpy.ndarray
- discrete1.boundary1d.manufactured_td_02(angle_x, edges_t)[source]
Manufactured time-dependent boundary (case TD_02).
Builds a time- and angle-dependent boundary array for manufactured time-dependent tests.
- Parameters:
angle_x (
array_like) – 1D array of angular ordinates (mu values).edges_t (
array_like) – 1D array of time edge values. The returned array has one entry per time edge.
- Returns:
Boundary array with shape (n_time_edges, 2, n_angles, 1). The two entries along axis=1 correspond to the two spatial boundaries.
- Return type:
numpy.ndarray
- discrete1.boundary1d.time_dependence_constant(boundary_x)[source]
Wrap a boundary array to add a time axis (constant in time).
- Parameters:
boundary_x (
numpy.ndarray) – A boundary array without time dimension. The function will add a leading time axis of length 1.- Returns:
Boundary array with a leading time axis (shape: 1, …).
- Return type:
numpy.ndarray
- discrete1.boundary1d.time_dependence_decay_01(boundary_x, edges_t, off_time)[source]
Turn off a previously time-independent boundary after a given time.
The function repeats the provided boundary over all time steps defined by
edges_tand zeros it out for all steps where the time exceedsoff_time.- Parameters:
boundary_x (
numpy.ndarray) – Boundary array without a time axis.edges_t (
array_like) – Time edge array. Number of time steps isedges_t.shape[0] - 1.off_time (
float) – Time threshold (same units asedges_t) after which the boundary is turned off.
- Returns:
Time-dependent boundary array with shape (n_steps, …).
- Return type:
numpy.ndarray
- discrete1.boundary1d.time_dependence_decay_02(boundary_x, edges_t)[source]
Apply a smooth decay (erfc-based) to a boundary over time steps.
This function identifies non-zero entries in
boundary_xand applies a complementary error-function-based decay schedule over the provided time edges. Times are converted to microseconds internally for the decay logic.- Parameters:
boundary_x (
numpy.ndarray) – Boundary array without time axis. Non-zero entries will be decayed.edges_t (
array_like) – Time edge array. Number of time steps isedges_t.shape[0] - 1.
- Returns:
Time-dependent boundary array with shape (n_steps, …).
- Return type:
numpy.ndarray