openmc.deplete.R2SManager

class openmc.deplete.R2SManager(neutron_model: Model, domains: MeshBase | Sequence[Cell], photon_model: Model | None = None)[source]

Manager for Rigorous 2-Step (R2S) method calculations.

This class is responsible for managing the materials and sources needed for mesh-based or cell-based R2S calculations. It provides methods to get activation materials and decay photon sources based on the mesh/cells and materials in the OpenMC model.

This class supports the use of a different models for the neutron and photon transport calculation. However, for cell-based calculations, it assumes that the only changes in the model are material assignments. For mesh-based calculations, it checks material assignments in the photon model and any element–material combinations that don’t appear in the photon model are skipped.

Parameters:
  • neutron_model (openmc.Model) – The OpenMC model to use for neutron transport.

  • domains (openmc.MeshBase or Sequence[openmc.Cell]) – The mesh or a sequence of cells that represent the spatial units over which the R2S calculation will be performed.

  • photon_model (openmc.Model, optional) – The OpenMC model to use for photon transport calculations. If None, a shallow copy of the neutron_model will be created and used.

Variables:
  • domains (openmc.MeshBase or Sequence[openmc.Cell]) – The mesh or a sequence of cells that represent the spatial units over which the R2S calculation will be performed.

  • neutron_model (openmc.Model) – The OpenMC model used for neutron transport.

  • photon_model (openmc.Model) – The OpenMC model used for photon transport calculations.

  • method ({'mesh-based', 'cell-based'}) – Indicates whether the R2S calculation uses mesh elements (‘mesh-based’) as the spatial discetization or a list of a cells (‘cell-based’).

  • results (dict) – A dictionary that stores results from the R2S calculation.

get_decay_photon_source_mesh(time_index: int = -1) list[MeshSource][source]

Create decay photon source for a mesh-based calculation.

This function creates N MeshSource objects where N is the maximum number of unique materials that appears in a single mesh element. For each mesh element-material combination, and IndependentSource instance is created with a spatial constraint limited the sampled decay photons to the correct region.

When the photon transport model is different from the neutron model, the photon MeshMaterialVolumes is used to determine whether an (element, material) combination exists in the photon model.

Parameters:

time_index (int, optional) – Time index for the decay photon source. Default is -1 (last time).

Returns:

A list of MeshSource objects, each containing IndependentSource instances for the decay photons in the corresponding mesh element.

Return type:

list of openmc.MeshSource

load_results(path: str | PathLike)[source]

Load results from a previous R2S calculation.

Parameters:

path (PathLike) – Path to the directory containing the R2S calculation results.

run(timesteps: Sequence[float] | Sequence[tuple[float, str]], source_rates: float | Sequence[float], timestep_units: str = 's', photon_time_indices: Sequence[int] | None = None, output_dir: str | PathLike | None = None, bounding_boxes: dict[int, BoundingBox] | None = None, chain_file: str | PathLike | None = None, micro_kwargs: dict | None = None, mat_vol_kwargs: dict | None = None, run_kwargs: dict | None = None, operator_kwargs: dict | None = None)[source]

Run the R2S calculation.

Parameters:
  • timesteps (Sequence[float] or Sequence[tuple[float, str]]) – Sequence of timesteps. Note that values are not cumulative. The units are specified by the timestep_units argument when timesteps is an iterable of float. Alternatively, units can be specified for each step by passing an iterable of (value, unit) tuples.

  • source_rates (float or Sequence[float]) – Source rate in [neutron/sec] for each interval in timesteps.

  • timestep_units ({'s', 'min', 'h', 'd', 'a'}, optional) – Units for values specified in the timesteps argument when passing float values. ‘s’ means seconds, ‘min’ means minutes, ‘h’ means hours, ‘d’ means days, and ‘a’ means years (Julian).

  • photon_time_indices (Sequence[int], optional) – Sequence of time indices at which photon transport should be run; represented as indices into the array of times formed by the timesteps. For example, if two timesteps are specified, the array of times would contain three entries, and [2] would indicate computing photon results at the last time. A value of None indicates to run photon transport for each time.

  • output_dir (PathLike, optional) – Path to directory where R2S calculation outputs will be saved. If not provided, a timestamped directory ‘r2s_YYYY-MM-DDTHH-MM-SS’ is created. Subdirectories will be created for the neutron transport, activation, and photon transport steps.

  • bounding_boxes (dict[int, openmc.BoundingBox], optional) – Dictionary mapping cell IDs to bounding boxes used for spatial source sampling in cell-based R2S calculations. Required if method is ‘cell-based’.

  • chain_file (PathLike, optional) – Path to the depletion chain XML file to use during activation. If not provided, the default configured chain file will be used.

  • micro_kwargs (dict, optional) – Additional keyword arguments passed to openmc.deplete.get_microxs_and_flux() during the neutron transport step.

  • mat_vol_kwargs (dict, optional) – Additional keyword arguments passed to openmc.MeshBase.material_volumes().

  • run_kwargs (dict, optional) – Additional keyword arguments passed to openmc.Model.run() during the neutron and photon transport step. By default, output is disabled.

  • operator_kwargs (dict, optional) – Additional keyword arguments passed to openmc.deplete.IndependentOperator.

Returns:

Path to the output directory containing all calculation results

Return type:

Path

step1_neutron_transport(output_dir: str | PathLike = 'neutron_transport', mat_vol_kwargs: dict | None = None, micro_kwargs: dict | None = None)[source]

Run the neutron transport step.

This step computes the material volume fractions on the mesh, creates a mesh-material filter, and retrieves the fluxes and microscopic cross sections for each mesh/material combination. This step will populate the ‘fluxes’ and ‘micros’ keys in the results dictionary. For a mesh-based calculation, it will also populate the ‘mesh_material_volumes’ key.

Parameters:
  • output_dir (PathLike, optional) – The directory where the results will be saved.

  • mat_vol_kwargs (dict, optional) – Additional keyword arguments based to openmc.MeshBase.material_volumes().

  • micro_kwargs (dict, optional) – Additional keyword arguments passed to openmc.deplete.get_microxs_and_flux().

step2_activation(timesteps: Sequence[float] | Sequence[tuple[float, str]], source_rates: float | Sequence[float], timestep_units: str = 's', output_dir: str | PathLike = 'activation', operator_kwargs: dict | None = None)[source]

Run the activation step.

This step creates a unique copy of each activation material based on the mesh elements or cells, then solves the depletion equations for each material using the fluxes and microscopic cross sections obtained in the neutron transport step. This step will populate the ‘depletion_results’ and ‘activation_materials’ keys in the results dictionary.

Parameters:
  • timesteps (Sequence[float] or Sequence[tuple[float, str]]) – Sequence of timesteps. Note that values are not cumulative. The units are specified by the timestep_units argument when timesteps is an iterable of float. Alternatively, units can be specified for each step by passing an iterable of (value, unit) tuples.

  • source_rates (float | Sequence[float]) – Source rate in [neutron/sec] for each interval in timesteps.

  • timestep_units ({'s', 'min', 'h', 'd', 'a'}, optional) – Units for values specified in the timesteps argument when passing float values. ‘s’ means seconds, ‘min’ means minutes, ‘h’ means hours, ‘d’ means days, and ‘a’ means years (Julian).

  • output_dir (PathLike, optional) – Path to directory where activation calculation outputs will be saved.

  • operator_kwargs (dict, optional) – Additional keyword arguments passed to openmc.deplete.IndependentOperator.

step3_photon_transport(time_indices: Sequence[int] | None = None, bounding_boxes: dict[int, BoundingBox] | None = None, output_dir: str | PathLike = 'photon_transport', mat_vol_kwargs: dict | None = None, run_kwargs: dict | None = None)[source]

Run the photon transport step.

This step performs photon transport calculations using decay photon sources created from the activated materials. For each specified time, it creates appropriate photon sources and runs a transport calculation. In mesh-based mode, the sources are created using the mesh material volumes, while in cell-based mode, they are created using bounding boxes for each cell. This step will populate the ‘photon_tallies’ key in the results dictionary.

Parameters:
  • time_indices (Sequence[int], optional) – Sequence of time indices at which photon transport should be run; represented as indices into the array of times formed by the timesteps. For example, if two timesteps are specified, the array of times would contain three entries, and [2] would indicate computing photon results at the last time. A value of None indicates to run photon transport for each time.

  • bounding_boxes (dict[int, openmc.BoundingBox], optional) – Dictionary mapping cell IDs to bounding boxes used for spatial source sampling in cell-based R2S calculations. Required if method is ‘cell-based’.

  • output_dir (PathLike, optional) – Path to directory where photon transport outputs will be saved.

  • mat_vol_kwargs (dict, optional) – Additional keyword arguments passed to openmc.MeshBase.material_volumes().

  • run_kwargs (dict, optional) – Additional keyword arguments passed to openmc.Model.run() during the photon transport step. By default, output is disabled.