discrete1.external1d module

Built-in external source factories used by tests and examples.

This module contains a set of ready-made external source constructors used across examples, tests, and solver inputs. Functions return NumPy arrays shaped to match solver expectations (spatial cells, angles, groups, and optional time axes).

Public functions - manufactured_ss_03, manufactured_ss_04, manufactured_ss_05 - manufactured_td_01, manufactured_td_02 - reeds, ambe - time_dependence_constant

Data files for some sources are loaded from the package sources/ directory via pkg_resources.

discrete1.external1d.ambe(x, loc_x, edges_g)[source]

Load an AmBe external neutron source and map it into groups.

Parameters:
  • x (array_like) – Spatial coordinates (n_x,).

  • loc_x (int) – Index in x where the AmBe source is located.

  • edges_g (array_like) – Energy group edges. If values appear large (>20) they are assumed to be in eV and will be converted to MeV.

Returns:

External source array with shape (n_x, 1, n_groups).

Return type:

numpy.ndarray

discrete1.external1d.manufactured_ss_03(x, angle_x)[source]

Manufactured steady-state source (case 03).

Constructs a one-group, angle-dependent external source used for manufactured-solution tests. The returned array has shape (n_x, n_angles, 1).

Parameters:
  • x (array_like) – Spatial cell centers or coordinates (length n_x).

  • angle_x (array_like) – Angular ordinates (length n_angles).

Returns:

External source array with shape (n_x, n_angles, 1).

Return type:

numpy.ndarray

discrete1.external1d.manufactured_ss_04(x, angle_x)[source]

Manufactured steady-state source (case 04).

One-group source with two material regions (quasi and scatter forms).

Parameters:
  • x (array_like) – Spatial coordinates (n_x,).

  • angle_x (array_like) – Angular ordinates (n_angles,).

Returns:

External source array with shape (n_x, n_angles, 1).

Return type:

numpy.ndarray

discrete1.external1d.manufactured_ss_05(x, angle_x)[source]

Manufactured steady-state source (case 05).

One-group manufactured source with region-dependent expressions.

Parameters:
  • x (array_like) – Spatial coordinates (n_x,).

  • angle_x (array_like) – Angular ordinates (n_angles,).

Returns:

External source array with shape (n_x, n_angles, 1).

Return type:

numpy.ndarray

discrete1.external1d.manufactured_td_01(x, angle_x, edges_t)[source]

Manufactured time-dependent source (case TD_01).

Parameters:
  • x (array_like) – Spatial coordinates (n_x,).

  • angle_x (array_like) – Angular ordinates (n_angles,).

  • edges_t (array_like) – Time edge values (n_time_edges,).

Returns:

External source array with shape (n_time_edges, n_x, n_angles, 1).

Return type:

numpy.ndarray

discrete1.external1d.manufactured_td_02(x, angle_x, edges_t)[source]

Manufactured time-dependent source (case TD_02).

Parameters:
  • x (array_like) – Spatial coordinates (n_x,).

  • angle_x (array_like) – Angular ordinates (n_angles,).

  • edges_t (array_like) – Time edge values (n_time_edges,).

Returns:

External source array with shape (n_time_edges, n_x, n_angles, 1).

Return type:

numpy.ndarray

discrete1.external1d.reeds(edges_x, bc)[source]

Reeds problem spatial-dependent source.

Constructs the piecewise spatial source used by the Reeds test problem.

Parameters:
  • edges_x (array_like) – Spatial edge coordinates.

  • bc (list-like) – Boundary condition indicator; used to select half-domain source patterns when bc indicates only one side is active.

Returns:

Spatial source array with shape (n_cells, 1, 1).

Return type:

numpy.ndarray

discrete1.external1d.time_dependence_constant(boundary_x)[source]

Wrap an external source to add a time axis (constant in time).

Parameters:

boundary_x (numpy.ndarray) – External source array without a time axis.

Returns:

Time-dependent external source with a leading time axis (shape: 1, …).

Return type:

numpy.ndarray