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

explicit LBSProblem(const std::string &name, std::shared_ptr<MeshContinuum> grid)
explicit LBSProblem(const InputParameters &params)

Input parameters based construction.

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

Returns a reference to the solver options.

const LBSOptions &GetOptions() const

Returns a constant reference to the solver options.

void SetOptions(const InputParameters &input)
void SetBoundaryOptions(const InputParameters &params)
size_t GetNumMoments() const

Returns the number of moments for the solver. This will only be non-zero after initialization.

size_t GetNumGroups() const

Returns the number of groups for the solver. This will only be non-zero after initialization.

size_t GetScatteringOrder() const

Returns the scattering order for the solver. This will only be non-zero after initialization.

size_t GetNumPrecursors() const

Returns the number of precursors for the solver. This will only be non-zero after initialization.

size_t GetMaxPrecursorsPerMaterial() const

Returns the maximum number of precursors defined on any material. This will only be non-zero after initialization.

void AddGroup(int id)

Adds a group to the list of groups. If group id < 0, the id will be logically derived from the list size. If >= 0 the id will be set to the id specified.

const std::vector<LBSGroup> &GetGroups() const
void AddGroupset()

Adds a groupset to the list of groupsets. The groupset id will be logically derived from the list size.

std::vector<LBSGroupset> &GetGroupsets()
const std::vector<LBSGroupset> &GetGroupsets() 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.

size_t &GetLastRestartTime()
const std::map<int, std::shared_ptr<MultiGroupXS>> &GetMatID2XSMap() const

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

std::shared_ptr<MeshContinuum> GetGrid() const

Obtains a reference to the grid.

inline void *GetCarrier(std::uint32_t idx)

Get pointer to carriers.

inline void *GetPinner(std::uint32_t idx)

Get pointer to pinners.

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.

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

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

std::map<uint64_t, BoundaryPreference> &GetBoundaryPreferences()

Read/Write access to the boundary preferences.

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.

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<std::vector<double>> &GetPsiNewLocal()

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<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()
std::vector<std::shared_ptr<LinearSolver>> &GetWGSSolvers()
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.

size_t MapPhiFieldFunction(size_t g, size_t m) const

Gets the local handle of a flux-moment based field function.

std::shared_ptr<FieldFunctionGridBased> GetPowerFieldFunction() const

Returns the power generation field function, if enabled.

virtual void Initialize() override

Initialize function.

void InitializeMaterials()

Initializes default materials and physics materials.

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<size_t> &m_indices, const std::vector<size_t> &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.

Public Static Functions

static InputParameters GetOptionsBlock()
static InputParameters GetBoundaryOptionsBlock()
static InputParameters GetXSMapEntryBlock()
static InputParameters GetInputParameters()

Returns the input parameters for this object.

Public Static Attributes

static std::map<std::string, uint64_t> supported_boundary_names
static std::map<uint64_t, std::string> supported_boundary_ids

Protected Functions

virtual void PerformInputChecks()

Performs general input checks before initialization continues.

void PrintSimHeader()

Prints header information of simulation.

virtual void InitializeSpatialDiscretization()
void ComputeUnitIntegrals()
void InitializeGroupsets()

Initializes common groupset items.

void ValidateAndComputeScatteringMoments()

Computes the number of moments for the given mesher types.

virtual void InitializeParrays()

Initializes parallel arrays.

void InitializeFieldFunctions()
inline virtual void InitializeBoundaries()

Initializes boundaries.

virtual void InitializeSolverSchemes()
inline virtual void InitializeWGSSolvers()
void InitializeGPUExtras()

Initializes data carriers to GPUs and memory pinner.

void ResetGPUCarriers()

Reset data carriers to null and unpin memory.

Protected Attributes

LBSOptions options_
size_t num_moments_ = 0
size_t num_groups_ = 0
size_t scattering_order_ = 0
size_t num_precursors_ = 0
size_t max_precursors_per_material_ = 0
std::vector<LBSGroup> groups_
std::vector<LBSGroupset> groupsets_
std::map<int, std::shared_ptr<MultiGroupXS>> 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_
std::map<uint64_t, BoundaryPreference> boundary_preferences_
UnknownManager flux_moments_uk_man_
size_t max_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<std::vector<double>> psi_new_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_
std::map<std::pair<size_t, size_t>, size_t> phi_field_functions_local_map_
size_t power_gen_fieldfunc_local_handle_ = 0
std::shared_ptr<const TimeIntegration> time_integration_ = nullptr

Time integration parameter meant to be set by an executor.

std::array<void*, 3> carriers_ = {nullptr, nullptr, nullptr}

Data carriers for necessary data to run the sweep on GPU.

These objects manage GPU memory allocation automatically, organize cross-section, outflow, and mesh data into contiguous memory on the CPU, and handle copying it to the GPU.

There are 3 carriers, respectively for cross sections, outflow and mesh.

std::array<void*, 2> pinners_ = {nullptr, nullptr}

Memory pinner for source moments and destination phi.

bool use_gpus_

Flag indicating if GPU acceleration is enabled.

Protected Static Functions

static void CheckCapableDevices()

Checks if the current CPU is associated with any GPU.