pyopensn.solver.DiscreteOrdinatesCurvilinearProblem

class pyopensn.solver.DiscreteOrdinatesCurvilinearProblem

Base class for discrete ordinates problems in curvilinear geometry.

Wrapper of opensn::DiscreteOrdinatesCurvilinearProblem.

ComputeBalance(self: pyopensn.solver.DiscreteOrdinatesProblem) None

Compute and print particle balance for the problem.

ComputeFissionRate(self: pyopensn.solver.LBSProblem, scalar_flux_iterate: str) float

Computes the total fission rate.

Parameters:

scalar_flux_iterate ({'old', 'new'}) –

Specifies which scalar flux vector to use in the calculation.
  • ’old’: Use the previous scalar flux iterate.

  • ’new’: Use the current scalar flux iterate.

Returns:

The total fission rate.

Return type:

float

Raises:

ValueError – If scalar_flux_iterate is not ‘old’ or ‘new’.

ComputeLeakage(self: pyopensn.solver.DiscreteOrdinatesProblem, bnd_names: list) dict

Compute leakage for the problem.

Parameters:

bnd_names (List[str]) – A list of boundary names for which leakage should be computed.

Returns:

A dictionary mapping boundary names to group-wise leakage vectors. Each array contains the outgoing angular flux (per group) integrated over the corresponding boundary surface.

Return type:

Dict[str, numpy.ndarray]

Raises:
  • RuntimeError – If save_angular_flux option was not enabled during problem setup.

  • ValueError – If one or more boundary ids are not present on the current mesh.

CreateAndWriteSourceMoments(self: pyopensn.solver.LBSProblem, file_base: str) None

Write source moments from latest flux iterate to file.

Parameters:

file_base (str) – File basename.

GetFieldFunctions(self: pyopensn.solver.Problem) list

Get the list of field functions.

Returns:

List of grid-based field functions representing solution data such as scalar fluxes.

Return type:

List[pyopensn.fieldfunc.FieldFunctionGridBased]

GetPowerFieldFunction(self: pyopensn.solver.LBSProblem) pyopensn.fieldfunc.FieldFunctionGridBased

Returns the power generation field function, if enabled.

GetScalarFieldFunctionList(self: pyopensn.solver.LBSProblem, only_scalar_flux: bool = True) list

Return field functions grouped by energy group and, optionally, by moment.

Parameters:

only_scalar_flux (bool, default=True) –

If True, returns only the zeroth moment (scalar flux) field function for each group. The result is a flat list of field functions, one per group.

If False, returns all moment field functions for each group. The result is a nested list where each entry corresponds to a group and contains a list of field functions for all moments (e.g., scalar flux, higher-order moments).

Returns:

The structure of the returned list depends on the only_scalar_flux flag.

Return type:

Union[List[pyopensn.fieldfunc.FieldFunctionGridBased], List[List[pyopensn.fieldfunc.FieldFunctionGridBased]]]

Notes

The moment index varies more rapidly than the group index when only_scalar_flux is False.

ReadAngularFluxes(self: opensn::DiscreteOrdinatesProblem, file_base: str) None

Read angular fluxes from file.

Parameters:

file_base (str) – File basename.

ReadFluxMoments(self: pyopensn.solver.LBSProblem, file_base: str, single_file_flag: bool) None

Read flux moment data.

Parameters:
  • file_base (str) – File basename.

  • single_file_flag (bool) – True if all flux moments are in a single file.

ReadFluxMomentsAndMakeSourceMoments(self: pyopensn.solver.LBSProblem, file_base: str, single_file_flag: bool) None

Read flux moments and compute corresponding source moments.

Parameters:
  • file_base (str) – File basename.

  • single_file_flag (bool) – True if all flux moments are in a single file.

ReadSourceMoments(self: pyopensn.solver.LBSProblem, file_base: str, single_file_flag: bool) None

Read source moments from file.

Parameters:
  • file_base (str) – File basename.

  • single_file_flag (bool) – True if all source moments are in a single file.

SetAdjoint(self: pyopensn.solver.LBSProblem, arg0: bool) None
SetBoundaryOptions(self: pyopensn.solver.LBSProblem, **kwargs) None
SetOptions(self: pyopensn.solver.DiscreteOrdinatesProblem, **kwargs) None

Set problem options from a large list of parameters.

Parameters:

adjoint (bool, default=False) – Flag for toggling whether the solver is in adjoint mode.

SetPointSources(self: pyopensn.solver.LBSProblem, **kwargs) None

Set or clear point sources.

Parameters:
  • clear_point_sources (bool, default=False) – If true, all current the point sources of the problem are deleted.

  • point_sources (List[pyopensn.source.PointSource]) – List of new point sources to be added to the problem.

SetVolumetricSources(self: pyopensn.solver.LBSProblem, **kwargs) None

Set or clear volumetric sources.

Parameters:
  • clear_volumetric_sources (bool, default=False) – If true, all current the volumetric sources of the problem are deleted.

  • volumetric_sources (List[pyopensn.source.VolumetricSource]) – List of new volumetric sources to be added to the problem.

WriteAngularFluxes(self: opensn::DiscreteOrdinatesProblem, file_base: str) None

Write angular flux data to file.

Parameters:

file_base (str) – File basename.

WriteFluxMoments(self: pyopensn.solver.LBSProblem, file_base: str) None

Write flux moments to file.

Parameters:

file_base (str) – File basename.

__init__(self: pyopensn.solver.DiscreteOrdinatesCurvilinearProblem, **kwargs) None

Construct a discrete ordinates problem for curvilinear geometry.

Warning

DiscreteOrdinatesCurvilinearProblem is experimental and should be used with caution!

Parameters:
  • mesh (MeshContinuum) – The spatial mesh.

  • coord_system (int) – Coordinate system to use. Must be set to 2 (cylindrical coordinates).

  • num_groups (int) – The total number of energy groups.

  • groupsets (list of dict) – A list of input parameter blocks, each block provides the iterative properties for a groupset.

  • xs_map (list of dict) – A list of mappings from block ids to cross-section definitions.

  • scattering_order (int, default=0) – The level of harmonic expansion for the scattering source.

  • boundary_conditions (List[Dict], default=[]) – A list containing tables for each boundary specification.

  • point_sources (List[pyopensn.source.PointSource], default=[]) – A list of point sources.

  • volumetric_sources (List[pyopensn.source.VolumetricSource], default=[]) – A list of volumetric sources.

  • options (dict, optional) – A block of optional configuration parameters. See SetOptions for available settings.

  • sweep_type (str, optional) – The sweep type to use. Must be one of AAH or CBC. Defaults to AAH.