Base class defining a formulation of the transport equation to be solved. More...
#include <problem_base.h>
Public Member Functions | |
| 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. | |
| virtual std::vector< GlobalMatrixData > | AssembleGlobalMatrixData (const Mesh &mesh, const GaussLobattoLegendre &gll_quad, const MaterialBank &material_bank, const Ordinate &ordinate)=0 |
| Assemble the vector of GlobalMatrixData structs that will be used in AssembleGlobalSystem to create the global system matrix. | |
| virtual 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)=0 |
| Assemble the vector of GlobalForcingData structs that will be using in AssembleGlobalForcing to create the global forcing vector. Implementations may overwrite Node::source_fluxes on the mesh, which is why mesh is non-const. | |
| 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. | |
Protected Member Functions | |
| 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. | |
| virtual void | Apply1DBCs (const Mesh &mesh, const Ordinate &Ordinate, const BCBank &bc_bank, const size_t ordinate_index)=0 |
| Apply boundary conditions to a 1D problem. | |
Protected Attributes | |
| 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. | |
Base class defining a formulation of the transport equation to be solved.
Definition at line 52 of file problem_base.h.
| hummingbird::ProblemBase::ProblemBase | ( | const size_t | n_dofs, |
| const size_t | n_ordinates ) |
Construct a new Problem Base object.
| n_dofs | Number of Degrees of Freedom |
| n_ordinates | Number of ordinates in angular mesh |
Definition at line 8 of file problem_base.cc.
|
virtualdefault |
Destroy the Problem Base object.
|
protectedpure virtual |
Apply boundary conditions to a 1D problem.
| mesh | Mesh |
| Ordinate | Ordinate (direction) |
| bc_bank | BCBank object |
| ordinate_index | Index of the ordinate in the angular quadrature |
Implemented in hummingbird::CGProblem.
| void hummingbird::ProblemBase::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.
| mesh | Mesh |
| ordinate | Ordinate (direction) |
| bc_bank | BCBank object |
| ordinate_index | Index of the ordinate in the angular quadrature |
Definition at line 58 of file problem_base.cc.
| void hummingbird::ProblemBase::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).
| global_forcing_data | Vector of GlobalForcingData structs |
| ordinate_index | Ordinate index |
Definition at line 40 of file problem_base.cc.
|
pure virtual |
Assemble the vector of GlobalForcingData structs that will be using in AssembleGlobalForcing to create the global forcing vector. Implementations may overwrite Node::source_fluxes on the mesh, which is why mesh is non-const.
| gll_quad | GaussLobattoLegendre quadrature set |
| mesh | Mesh |
| material_bank | Material bank |
| source_bank | Source bank |
| ordinate | Ordinate (direction) |
| ordinate_index | Index in the angular quadrature |
| angular_quad_set | Angular quadrature set |
Implemented in hummingbird::CGProblem.
|
pure virtual |
Assemble the vector of GlobalMatrixData structs that will be used in AssembleGlobalSystem to create the global system matrix.
| mesh | Mesh |
| gll_quad | GaussLobattoLegendre quadrature set |
| material_bank | Material bank |
| ordinate | Ordinate for equation |
Implemented in hummingbird::CGProblem.
| void hummingbird::ProblemBase::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).
| global_matrix_data | Vector of GlobalMatrixData structs |
| ordinate_index | Ordinate index within the angular quadrature set (i.e. the direction number) |
Definition at line 18 of file problem_base.cc.
|
protected |
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.
| gfd | Vector of GlobalForcingData structs |
Definition at line 91 of file problem_base.cc.
|
protected |
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.
| gmd | Vector of GlobalMatrixData structs |
Definition at line 72 of file problem_base.cc.
|
inline |
|
inline |
Get the solution vectors.
Definition at line 160 of file problem_base.h.
| void hummingbird::ProblemBase::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.
Definition at line 52 of file problem_base.cc.
|
protected |
Global forcing vectors in order of ordinates in angular quadrature set.
Definition at line 181 of file problem_base.h.
|
protected |
Global system matrices in order of ordinates in angular quadrature set.
Definition at line 177 of file problem_base.h.
|
protected |
Number of degrees of freedom in simulation.
Definition at line 173 of file problem_base.h.
|
protected |
Column vector of the angular flux at the nodes in order of ordinates in angular quadrature set.
Definition at line 185 of file problem_base.h.