Class DiscreteOrdinatesProblem
Defined in File discrete_ordinates_problem.h
Inheritance Relationships
Base Type
public opensn::LBSProblem(Class LBSProblem)
Derived Type
public opensn::DiscreteOrdinatesCurvilinearProblem(Class DiscreteOrdinatesCurvilinearProblem)
Class Documentation
-
class DiscreteOrdinatesProblem : public opensn::LBSProblem
Base class for discrete ordinates solvers.
Subclassed by opensn::DiscreteOrdinatesCurvilinearProblem
Sweep dependency data
-
std::map<std::shared_ptr<AngularQuadrature>, SweepOrderGroupingInfo> quadrature_unq_so_grouping_map_
-
std::map<std::shared_ptr<AngularQuadrature>, std::vector<std::shared_ptr<SPDS>>> quadrature_spds_map_
-
std::map<std::shared_ptr<AngularQuadrature>, std::vector<std::unique_ptr<FLUDSCommonData>>> quadrature_fluds_commondata_map_
-
const std::string sweep_type_
Boundary data
-
BoundaryBank boundary_bank_
-
std::map<uint64_t, std::shared_ptr<SweepBoundary>> sweep_boundaries_
-
std::map<uint64_t, BoundaryDefinition> boundary_definitions_
-
std::shared_ptr<BoundaryCarrier> boundary_carrier_ = nullptr
-
std::optional<ParameterBlock> boundary_conditions_block_
-
bool boundary_runtime_data_initialized_ = false
-
bool has_reflecting_boundaries_ = false
-
bool has_time_dependent_boundaries_ = false
Sweep size metadata
-
std::size_t max_level_size_ = 0
Max level size.
-
std::size_t max_angleset_size_ = 0
Max angle-set size.
-
unsigned int max_groupset_size_ = 0
Max group-set size.
-
std::vector<std::vector<double>> psi_new_local_
Max level size.
-
std::vector<std::vector<double>> psi_old_local_
Max level size.
-
std::optional<SweepChunkMode> sweep_chunk_mode_
Max level size.
-
std::string uncollided_flux_file_
Max level size.
-
std::vector<double> uncollided_flux_moments_local_
Max level size.
-
std::vector<double> first_collision_source_moments_local_
Max level size.
-
double uncollided_source_rate_ = 0.0
Max level size.
-
double uncollided_outflow_rate_ = 0.0
Max level size.
-
bool uncollided_flux_applied_ = false
Max level size.
-
std::shared_ptr<AGSLinearSolver> ags_solver_
Max level size.
-
std::vector<std::shared_ptr<WGSContext>> wgs_contexts_
Max level size.
-
std::vector<std::shared_ptr<LinearSolver>> wgs_solvers_
Max level size.
Construction and transport-mode controls
-
inline virtual bool IsTimeDependent() const override
Returns true if the problem is currently in time-dependent mode.
-
virtual void SetTimeDependentMode() override
Set the problem to time-dependent mode.
-
virtual void SetSteadyStateMode() override
Set the problem to steady-state mode.
-
virtual void SetTime(double time) override
Sets simulation time in seconds for time dependent problems.
Problem metadata and solver access
-
inline const std::string &GetSweepType() const
-
virtual std::pair<std::uint64_t, std::uint64_t> GetNumPhiIterativeUnknowns() override
Gets the local and global number of iterative unknowns.
This is typically only the flux moments, however, the sweep based solvers might include delayed angular fluxes in this number.
-
std::shared_ptr<AGSLinearSolver> GetAGSSolver()
-
std::shared_ptr<LinearSolver> GetWGSSolver(size_t groupset_id)
-
size_t GetNumWGSSolvers()
-
WGSContext &GetWGSContext(int groupset_id)
Balance and output helpers
-
BalanceTable ComputeBalanceTable(double scaling_factor = 1.0)
Returns the sweep boundaries as a read-only reference.
-
void ComputeBalance(double scaling_factor = 1.0)
Returns the sweep boundaries as a read-only reference.
-
const std::map<uint64_t, std::shared_ptr<SweepBoundary>> &GetSweepBoundaries() const
Returns the sweep boundaries as a read-only reference.
-
const std::map<uint64_t, BoundaryDefinition> &GetBoundaryDefinitions() const
Returns the sweep boundaries as a read-only reference.
-
std::optional<uint64_t> FindBoundaryID(const std::string &name) const
Look up the mesh boundary ID for a user-facing boundary name.
Orthogonal 2D cylindrical (RZ) meshes are addressed as rmin, rmax, zmin, and zmax, which map to the mesh boundaries xmin, xmax, ymin, and ymax. Other meshes use their boundary names directly.
- Returns:
The boundary ID, or std::nullopt if the name is not valid for this problem.
-
virtual void ReorientAdjointSolution() override
Reorient an adjoint solution to account for backwards streaming.
-
void ZeroOutflowBalanceVars(LBSGroupset &groupset)
Zeroes all the outflow data-structures required to compute balance.
-
std::vector<std::shared_ptr<FieldFunctionGridBased>> CreateAngularFluxFieldFunctionList(const std::vector<unsigned int> &groups, const std::vector<size_t> &angles)
Create angular flux field functions for the given groups and angles.
Angles are indices into the groupset quadrature associated with each group.
Construction and setup
-
explicit DiscreteOrdinatesProblem(const InputParameters ¶ms)
Factory-only constructor.
-
void BuildRuntime()
Internal factory step: build sweep/runtime data once base runtime data is available.
-
virtual void InitializeBoundaries() override
Factory-only constructor.
-
inline virtual bool SupportsTimeDependentMode() const
Returns false if this geometry does not support time-dependent mode.
-
inline virtual void ValidateBoundaryConfiguration() const
Hook for geometry-specific boundary-configuration checks, called from
InitializeBoundaries().
-
void ValidateTimeDependentModeAllowed() const
Validates that time-dependent mode may be enabled, given the current GPU, adjoint, geometry, and angular-flux-storage configuration.
Solver and sweep state
-
void InitializeSolverSchemes()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void ReinitializeSolverSchemes()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void ConfigureTransientSourceScopes()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void SetSweepChunkMode(SweepChunkMode mode)
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
inline void ResetSweepChunkMode()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void ResetMode(SweepChunkMode target_mode)
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void ReconstructAngularFluxFromSteadyState()
Reconstructs lagged angular fluxes from the converged steady-state scalar flux via a fixed-point iteration, holding phi/q at the converged steady-state value.
Used when transitioning into time-dependent mode.
-
void InitializeBoundaryCarrier()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void SortAngleSetsAngleIndices()
Sort the angle indices within each angle set so that one set maps exactly to another under all reflected angle mappings.
-
void ResetBoundaryCarrier()
Rebuild WGS/AGS solver schemes after runtime configuration changes.
-
void InitializeSweepDataStructures()
This routine initializes basic sweep datastructures that are agnostic of the number of groups and essentially the groupsets.
The routine rebuilds the data structures i)
quadrature_unq_so_grouping_map_, ii)quadrature_spds_map_and iii)quadrature_fluds_templates_map_. i) is a mapping, per quadrature, to a collection of angle-index-sets where all the angles in a particular angleset share the same sweep ordering. ii) is a mapping, per quadrature, to a collection of SPDSs where each SPDS mirrors an angle-index-set in i) iii) is again a mapping, per quadrature, to a collection of Template FLUDS where each FLUDS mirrors a SPDS in ii).
-
void InitFluxDataStructures(LBSGroupset &groupset)
Initializes fluds_ data structures.
-
void ResetSweepOrderings(LBSGroupset &groupset)
Clears all the sweep orderings for a groupset in preparation for another.
-
virtual std::shared_ptr<SweepChunk> SetSweepChunk(LBSGroupset &groupset)
Sets up the sweep chunk for the given discretization method.
Restart and runtime reconfiguration
-
virtual bool ReadProblemRestartData(hid_t file_id, bool allow_transient_initialization_from_steady) override
-
virtual bool WriteProblemRestartData(hid_t file_id) const override
-
virtual void ResetDerivedSolutionVectors() override
-
void UpdateBoundaryDefinition(const InputParameters ¶ms)
-
void RebuildBoundaryRuntimeData()
Factory interface
-
static InputParameters GetInputParameters()
-
static InputParameters GetBoundaryOptionsBlock()
-
static std::shared_ptr<DiscreteOrdinatesProblem> Create(const ParameterBlock ¶ms)
Public Types
Public Functions
-
~DiscreteOrdinatesProblem() override
-
std::vector<std::vector<double>> &GetPsiNewLocal()
Internal angular-flux state access.
These mutable references are used by sweep chunks, transient solvers, acceleration, restart I/O, and angular-flux I/O. User-facing Python APIs expose copies or field functions rather than mutable access to this storage. Read/write access to newest updated angular flux vector.
-
const std::vector<std::vector<double>> &GetPsiNewLocal() const
Read access to newest updated angular flux vector.
-
std::vector<std::vector<double>> &GetPsiOldLocal()
Read/write access to newest updated angular flux vector.
-
const std::vector<std::vector<double>> &GetPsiOldLocal() const
Read access to previous angular flux vector.
-
void ZeroPsi()
-
inline bool SaveAngularFluxEnabled() const
-
size_t GetMaxLevelSize() const
-
size_t GetMaxGroupsetSize() const
-
size_t GetMaxAngleSetSize() const
-
void UpdatePsiOld()
Copy psi_new to psi_old.
-
void SetSaveAngularFlux(bool save)
Supported runtime discrete-ordinates reconfiguration.
These methods update the dependent sweep, boundary, acceleration, and solver data owned by the problem. Lower-level sweep chunk and solver-scheme controls remain protected implementation details.
-
virtual void SetBlockID2XSMap(const BlockID2XSMap &xs_map) override
Replaces the map of block ids to XSs and refreshes material data.
-
void SetBoundaryOptions(const std::vector<InputParameters> &boundary_params, bool clear_existing)
-
virtual void ClearBoundaries() override
Clears all the boundary conditions from the solver.
-
inline BoundaryCarrier *GetBoundaryCarrier()
-
inline const BoundaryCarrier *GetBoundaryCarrier() const
-
void CopyPhiAndSrcToDevice()
-
void CopyPhiAndOutflowBackToHost()
-
void TransferDeviceBoundaryData(int groupset_id, bool host_to_device, bool force = false)
Transfer data in boundary to device or vice-versa.
- Parameters:
groupset_id – Groupset ID.
host_to_device – Flag indicating the direction of transfer.
force – Force update.
-
inline bool HasUncollidedFlux() const
-
inline const std::vector<double> &GetFirstCollisionSourceMoments() const
-
inline double GetUncollidedSourceRate() const
-
inline double GetUncollidedOutflowRate() const
-
bool RemoveUncollidedFlux()
Removes a previously applied uncollided scalar flux from the iterative state.
Returns true when flux was removed.
-
void ComputeFluxFromUncollided()
Adds the uncollided scalar flux to the converged collided scalar flux.
Protected Types
-
using SweepOrderGroupingInfo = std::pair<UniqueSOGroupings, DirIDToSOMap>
-
std::map<std::shared_ptr<AngularQuadrature>, SweepOrderGroupingInfo> quadrature_unq_so_grouping_map_