Class LBSProblem

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class LBSProblem : public opensn::Problem

Base class for all Linear Boltzmann Solvers.

Subclassed by opensn::DiscreteOrdinatesProblem

Public Functions

LBSProblem(const LBSProblem&) = delete
LBSProblem &operator=(const LBSProblem&) = delete
~LBSProblem() override
const LBSOptions &GetOptions() const

Returns a constant reference to the solver options.

double GetTime() const

Returns simulation time in seconds for time dependent problems.

void SetTime(double time)

Sets simulation time in seconds for time dependent problems.

void SetTimeStep(double dt)

Sets dt.

double GetTimeStep() const

Returns dt.

void SetTheta(double theta)

Sets theta for time discretization.

double GetTheta() const

Returns theta for time discretization.

virtual bool IsTimeDependent() const

Returns true if the problem is currently in time-dependent mode.

virtual void SetTimeDependentMode()

Set the problem to time-dependent mode.

virtual void SetSteadyStateMode()

Set the problem to steady-state mode.

void SetAdjoint(bool adjoint = true)

Toggle forward/adjoint transport mode.

If the requested mode differs from the current mode, this performs a mode-transition reset. Materials are reinitialized in the selected mode, sources and boundaries are cleared, and solution vectors are zeroed.

void SetForward()

Set the problem to forward mode.

bool IsAdjoint() const

Returns true if the problem is in adjoint mode.

virtual void SetSaveAngularFlux(bool save)
void ZeroPhi()
void CopyPhiNewToOld()
void SetPhiOldFrom(const std::vector<double> &phi_old)
void SetPhiNewFrom(const std::vector<double> &phi_new)
void ScalePhiOld(double factor)
void ScalePhiNew(double factor)
void ZeroQMoments()
void ScaleQMoments(double factor)
void SetQMomentsFrom(const std::vector<double> &q_moments)
void ScalePrecursors(double factor)
void ZeroPrecursors()
void ZeroExtSrcMoments()
void ScaleExtSrcMoments(double factor)
void SetUniformDensities(double density)
void SetDensity(size_t cell_local_id, double density)
void SetDensitiesFrom(const std::vector<double> &densities)
virtual void ZeroPsi() = 0
GeometryType GetGeometryType() const
unsigned int GetNumMoments() const

Returns the number of moments for the solver.

unsigned int GetMaxCellDOFCount() const
unsigned int GetMinCellDOFCount() const
bool UseGPUs() const
unsigned int GetNumGroups() const

Returns the number of groups for the solver.

unsigned int GetScatteringOrder() const

Returns the scattering order for the solver.

unsigned int GetNumPrecursors() const

Returns the number of precursors for the solver.

unsigned int GetMaxPrecursorsPerMaterial() const

Returns the maximum number of precursors defined on any material.

const std::vector<LBSGroupset> &GetGroupsets() const
LBSGroupset &GetGroupset(size_t groupset_id)
const LBSGroupset &GetGroupset(size_t groupset_id) const
size_t GetNumGroupsets() const
void AddPointSource(std::shared_ptr<PointSource> point_source)

Adds a point source to the solver.

void ClearPointSources()

Clears all the point sources from the solver.

const std::vector<std::shared_ptr<PointSource>> &GetPointSources() const

Constant accessor to the list of point sources.

void AddVolumetricSource(std::shared_ptr<VolumetricSource> volumetric_source)

Adds a volumetric source to the solver.

void ClearVolumetricSources()

Clears all the volumetric sources from the solver.

const std::vector<std::shared_ptr<VolumetricSource>> &GetVolumetricSources() const

Constant accessor to the list of volumetric sources.

virtual void ClearBoundaries() = 0

Clears all the boundary conditions from the solver.

const BlockID2XSMap &GetBlockID2XSMap() const

Returns a reference to the map of material ids to XSs.

void SetBlockID2XSMap(const BlockID2XSMap &xs_map)

Replaces the map of block ids to XSs and refreshes material data.

std::shared_ptr<MeshContinuum> GetGrid() const

Obtains a reference to the grid.

inline TotalXSCarrier *GetTotalXSCarrier()
inline const TotalXSCarrier *GetTotalXSCarrier() const
inline OutflowCarrier *GetOutflowCarrier()
inline const OutflowCarrier *GetOutflowCarrier() const
inline MeshCarrier *GetMeshCarrier()
inline const MeshCarrier *GetMeshCarrier() const
inline MemoryPinner<double> *GetSourceMomentsPinner()
inline const MemoryPinner<double> *GetSourceMomentsPinner() const
inline MemoryPinner<double> *GetPhiPinner()
inline const MemoryPinner<double> *GetPhiPinner() const
const SpatialDiscretization &GetSpatialDiscretization() const

Obtains a reference to the spatial discretization.

const std::vector<UnitCellMatrices> &GetUnitCellMatrices() const

Returns read-only access to the unit cell matrices.

const std::map<uint64_t, UnitCellMatrices> &GetUnitGhostCellMatrices() const

Returns read-only access to the unit ghost cell matrices.

std::vector<CellLBSView> &GetCellTransportViews()

Returns a reference to the list of local cell transport views.

const std::vector<CellLBSView> &GetCellTransportViews() const

Returns a const reference to the list of local cell transport views.

const UnknownManager &GetUnknownManager() const

Obtains a reference to the unknown manager for flux-moments.

size_t GetLocalNodeCount() const

Returns the local node count for the flux-moments data structures.

size_t GetGlobalNodeCount() const

Returns the global node count for the flux-moments data structures.

std::vector<double> &GetQMomentsLocal()

Read/write access to source moments vector.

const std::vector<double> &GetQMomentsLocal() const

Read access to source moments vector.

std::vector<double> &GetExtSrcMomentsLocal()

Read/write access to exterior src moments vector.

const std::vector<double> &GetExtSrcMomentsLocal() const

Read access to exterior src moments vector.

void SetExtSrcMomentsFrom(const std::vector<double> &ext_src_moments)

Replaces exterior source moments vector.

std::vector<double> &GetPhiOldLocal()

Read/write access to last updated flux vector.

const std::vector<double> &GetPhiOldLocal() const

Read access to last updated flux vector.

std::vector<double> &GetPhiNewLocal()

Read/write access to newest updated flux vector.

const std::vector<double> &GetPhiNewLocal() const

Read access to newest updated flux vector.

std::vector<double> &GetPrecursorsNewLocal()

Read/write access to newest updated precursors vector.

const std::vector<double> &GetPrecursorsNewLocal() const

Read access to newest updated precursors vector.

std::vector<double> &GetDensitiesLocal()

Read/write access to the cell-wise densities.

const std::vector<double> &GetDensitiesLocal() const

Read access to the cell-wise densities.

SetSourceFunction GetActiveSetSourceFunction() const
std::shared_ptr<AGSLinearSolver> GetAGSSolver() const
std::shared_ptr<LinearSolver> GetWGSSolver(size_t groupset_id) const
size_t GetNumWGSSolvers() const
WGSContext &GetWGSContext(int groupset_id)
virtual std::pair<size_t, size_t> GetNumPhiIterativeUnknowns()

Gets the local and global number of iterative unknowns.

This normally is only the flux moments, however, the sweep based solvers might include delayed angular fluxes in this number.

std::shared_ptr<FieldFunctionGridBased> GetScalarFluxFieldFunction(unsigned int g, unsigned int m = 0) const

Returns a flux-moment field function for a given group and moment.

std::shared_ptr<FieldFunctionGridBased> GetPowerFieldFunction() const

Returns the power generation field function, if enabled.

inline bool TriggerRestartDump() const
inline void UpdateRestartWriteTime()
std::vector<double> MakeSourceMomentsFromPhi()

Makes a source-moments vector from scattering and fission based on the latest phi-solution.

void UpdateFieldFunctions()

Copy relevant section of phi_old to the field functions.

void SetPhiFromFieldFunctions(PhiSTLOption which_phi, const std::vector<unsigned int> &m_indices, const std::vector<unsigned int> &g_indices)

Sets the internal phi vector to the value in the associated field function.

inline virtual void ReorientAdjointSolution()

A method for post-processing an adjoint solution.

Note

This does nothing for diffusion-based solvers.

inline virtual void UpdatePsiOld()

Public Static Functions

static InputParameters GetInputParameters()

Returns the input parameters for this object.

static InputParameters GetOptionsBlock()
static InputParameters GetXSMapEntryBlock()

Public Static Attributes

static std::uint32_t max_dofs_gpu = 10

Max number of DOFs per cell that the sweep kernel on GPU can handle.

Protected Functions

explicit LBSProblem(const InputParameters &params)

Input parameters based construction.

void BuildRuntime()

Build runtime data structures once all constructor-time configuration is complete.

virtual void PrintSimHeader()
void ComputeUnitIntegrals()
virtual void InitializeSpatialDiscretization()
inline virtual void InitializeBoundaries()

Initializes boundaries.

virtual void SetBoundaryOptions(const InputParameters &params) = 0

Derived problems handle boundary options.

void InitializeSolverSchemes()
inline virtual void InitializeWGSSolvers()
void SetActiveSetSourceFunction(SetSourceFunction source_function)

Protected Attributes

LBSOptions options_
double time_ = 0.0
double theta_ = 1.0
double dt_ = 1.0
GeometryType geometry_type_ = GeometryType::INVALID
unsigned int num_moments_ = 0
unsigned int num_groups_ = 0
unsigned int scattering_order_ = 0
unsigned int num_precursors_ = 0
unsigned int max_precursors_per_material_ = 0
std::vector<LBSGroupset> groupsets_
BlockID2XSMap block_id_to_xs_map_
std::vector<std::shared_ptr<PointSource>> point_sources_
std::vector<std::shared_ptr<VolumetricSource>> volumetric_sources_
std::shared_ptr<MeshContinuum> grid_
std::shared_ptr<SpatialDiscretization> discretization_ = nullptr
std::vector<CellFaceNodalMapping> grid_nodal_mappings_
std::shared_ptr<MPICommunicatorSet> grid_local_comm_set_ = nullptr
std::vector<UnitCellMatrices> unit_cell_matrices_
std::map<uint64_t, UnitCellMatrices> unit_ghost_cell_matrices_
std::vector<CellLBSView> cell_transport_views_
UnknownManager flux_moments_uk_man_
unsigned int max_cell_dof_count_ = 0
unsigned int min_cell_dof_count_ = 0
uint64_t local_node_count_ = 0
uint64_t global_node_count_ = 0
std::vector<double> q_moments_local_
std::vector<double> ext_src_moments_local_
std::vector<double> phi_new_local_
std::vector<double> phi_old_local_
std::vector<double> precursor_new_local_
std::vector<double> densities_local_
SetSourceFunction active_set_source_function_
std::shared_ptr<AGSLinearSolver> ags_solver_
std::vector<std::shared_ptr<LinearSolver>> wgs_solvers_
bool initialized_ = false
std::map<std::pair<unsigned int, unsigned int>, size_t> phi_field_functions_local_map_
size_t power_gen_fieldfunc_local_handle_ = 0
std::shared_ptr<TotalXSCarrier> total_xs_carrier_ = nullptr

Data carriers needed to run the sweep on GPU.

std::shared_ptr<OutflowCarrier> outflow_carrier_ = nullptr
std::shared_ptr<MeshCarrier> mesh_carrier_ = nullptr
std::shared_ptr<MemoryPinner<double>> source_pinner_ = nullptr

Memory pinners for source moments and destination phi.

std::shared_ptr<MemoryPinner<double>> phi_pinner_ = nullptr
bool use_gpus_

Flag indicating if GPU acceleration is enabled.