hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
hummingbird::CGProblem Class Reference

Class defining a Continuous Galerkin formulation of the SAAF transport equation. More...

#include <cg_problem.h>

Inheritance diagram for hummingbird::CGProblem:
[legend]
Collaboration diagram for hummingbird::CGProblem:
[legend]

Public Member Functions

 CGProblem (const size_t n_dofs, const size_t n_ordinates)
 Construct a new CGProblem object.
std::vector< GlobalMatrixData > AssembleGlobalMatrixData (const Mesh &mesh, const GaussLobattoLegendre &gll_quad, const MaterialBank &material_bank, const Ordinate &ordinate) override
 See ProblemBase::AssembleGlobalMatrixData. For each element, the local mass and stiffness matrices are summed and scattered into GlobalMatrixData entries keyed by the element's node IDs.
std::vector< GlobalForcingData > AssembleGlobalForcingData (const GaussLobattoLegendre &gll_quad, Mesh &mesh, const MaterialBank &material_bank, const SourceBank &source_bank, const Ordinate &ordinate, const size_t ordinate_index, const QuadratureBase< Ordinate > &angular_quad_set) override
 See ProblemBase::AssembleGlobalForcingData. For each element, the element's node source fluxes are first recomputed with Element::SetNodeSourceFluxes (using that element's material and source), then the local forcing vector is scattered into GlobalForcingData entries keyed by the element's node IDs.
Public Member Functions inherited from hummingbird::ProblemBase
 ProblemBase (const size_t n_dofs, const size_t n_ordinates)
 Construct a new Problem Base object.
virtual ~ProblemBase ()=default
 Destroy the Problem Base object.
void AssembleGlobalSystem (const std::vector< GlobalMatrixData > &global_matrix_data, const size_t ordinate_index)
 Assemble the global element system. That is, form the matrix \(A\) in \( Ax=b\). This only should be called once per ordinate per simulation. The global matrix is sized from the n_dofs supplied at construction, not from global_matrix_data; row_id/col_id pairs are expected to repeat (shared nodes get summed contributions from multiple elements) and are summed via Armadillo's batch SpMat constructor's add_values=true overload (the default overload errors on duplicate locations instead of summing them).
void AssembleGlobalForcing (const std::vector< GlobalForcingData > &global_forcing_data, const size_t ordinate_index)
 Assemble the global forcing vector for a given ordinate index. The global vector is sized from the n_dofs supplied at construction, not from global_forcing_data; row_id values are expected to repeat (shared nodes get summed contributions from multiple elements).
void Solve (const size_t ordinate_index)
 Solve the linear system using Armadillo's sparse matrix solver. Stores the results in the solution_vectors_ member at the ordinate_index index.
void ApplyBCs (const Mesh &mesh, const Ordinate &ordinate, const BCBank &bc_bank, const size_t ordinate_index)
 Apply boundary conditions by adding in values needed at boundary nodes. Internally, a switch calls the correct methods depending on the mesh dimension.
const std::vector< arma::Col< double > > & solution_vectors () const
 Get the solution vectors.
size_t n_dofs () const
 Get the number of degrees of freedom.

Private Member Functions

void Apply1DBCs (const Mesh &mesh, const Ordinate &ordinate, const BCBank &bc_bank, const size_t ordinate_index) override
 See ProblemBase::Apply1DBCs. Only vacuum BCs are currently supported.

Additional Inherited Members

Protected Member Functions inherited from hummingbird::ProblemBase
void CheckGlobalMatrixData (const std::vector< GlobalMatrixData > &gmd)
 Validate a vector of GlobalMatrixData before it is used to assemble the global system matrix. row_id/col_id pairs are expected to repeat (shared nodes get summed contributions from multiple elements), so unique (row_id, col_id) pairs are not required. Instead, this checks that the set of distinct row/col IDs referenced is contiguous starting from 0, i.e. no node ID is missing from the data.
void CheckGlobalForcingData (const std::vector< GlobalForcingData > &gfd)
 Validate a vector of GlobalForcingData before it is used to assemble the global forcing vector. row_id values are expected to repeat (shared nodes get summed contributions from multiple elements), so unique row_ids are not required. Instead, this checks that the set of distinct row IDs referenced is contiguous starting from 0, i.e. no DOF is missing from the data.
Protected Attributes inherited from hummingbird::ProblemBase
const size_t n_dofs_
 Number of degrees of freedom in simulation.
std::vector< arma::SpMat< double > > global_system_matrices_
 Global system matrices in order of ordinates in angular quadrature set.
std::vector< arma::Col< double > > global_forcing_vectors_
 Global forcing vectors in order of ordinates in angular quadrature set.
std::vector< arma::Col< double > > solution_vectors_
 Column vector of the angular flux at the nodes in order of ordinates in angular quadrature set.

Detailed Description

Class defining a Continuous Galerkin formulation of the SAAF transport equation.

Definition at line 15 of file cg_problem.h.

Constructor & Destructor Documentation

◆ CGProblem()

hummingbird::CGProblem::CGProblem ( const size_t n_dofs,
const size_t n_ordinates )

Construct a new CGProblem object.

Parameters
n_dofsNumber of Degrees of Freedom
n_ordinatesNumber of ordinates in angular quadrature

Definition at line 5 of file cg_problem.cc.

Member Function Documentation

◆ Apply1DBCs()

void hummingbird::CGProblem::Apply1DBCs ( const Mesh & mesh,
const Ordinate & ordinate,
const BCBank & bc_bank,
const size_t ordinate_index )
overrideprivatevirtual

See ProblemBase::Apply1DBCs. Only vacuum BCs are currently supported.

Parameters
meshMesh
ordinateOrdinate (direction)
bc_bankBCBank object
ordinate_indexIndex of the ordinate in the angular quadrature
Exceptions
std::runtime_errorif a boundary node has a reflective or unsupported BC
Todo
Need to implement reflective BCs.

Implements hummingbird::ProblemBase.

Definition at line 52 of file cg_problem.cc.

◆ AssembleGlobalForcingData()

std::vector< GlobalForcingData > hummingbird::CGProblem::AssembleGlobalForcingData ( const GaussLobattoLegendre & gll_quad,
Mesh & mesh,
const MaterialBank & material_bank,
const SourceBank & source_bank,
const Ordinate & ordinate,
const size_t ordinate_index,
const QuadratureBase< Ordinate > & angular_quad_set )
overridevirtual

See ProblemBase::AssembleGlobalForcingData. For each element, the element's node source fluxes are first recomputed with Element::SetNodeSourceFluxes (using that element's material and source), then the local forcing vector is scattered into GlobalForcingData entries keyed by the element's node IDs.

Parameters
gll_quadGaussLobattoLegendre quadrature set
meshMesh
material_bankMaterial bank
source_bankSource bank
ordinateOrdinate (direction)
ordinate_indexIndex in the angular quadrature
angular_quad_setAngular quadrature set
Returns
std::vector<GlobalForcingData>

Implements hummingbird::ProblemBase.

Definition at line 30 of file cg_problem.cc.

◆ AssembleGlobalMatrixData()

std::vector< GlobalMatrixData > hummingbird::CGProblem::AssembleGlobalMatrixData ( const Mesh & mesh,
const GaussLobattoLegendre & gll_quad,
const MaterialBank & material_bank,
const Ordinate & ordinate )
overridevirtual

See ProblemBase::AssembleGlobalMatrixData. For each element, the local mass and stiffness matrices are summed and scattered into GlobalMatrixData entries keyed by the element's node IDs.

Parameters
meshMesh
gll_quadGaussLobattoLegendre quadrature set
material_bankMaterial bank
ordinateOrdinate for equation
Returns
std::vector<GlobalMatrixData>

Implements hummingbird::ProblemBase.

Definition at line 8 of file cg_problem.cc.


The documentation for this class was generated from the following files:
  • /home/runner/work/hummingbird/hummingbird/include/problem/cg_problem.h
  • /home/runner/work/hummingbird/hummingbird/src/problem/cg_problem.cc