11 std::vector<GlobalMatrixData> global_matrix_data;
13 for (
const auto& elem : mesh.
elements()) {
14 auto local_mass_matrix = elem->LocalMassMatrix(gll_quad, material_bank);
15 auto local_stiffness_matrix =
16 elem->LocalStiffnessMatrix(gll_quad, material_bank, ordinate);
17 for (
auto i = 0; i < gll_quad.
n_points(); i++) {
18 for (
auto j = 0; j < gll_quad.
n_points(); j++) {
20 gmd.
value = local_mass_matrix(i, j) + local_stiffness_matrix(i, j);
21 gmd.
row_id = elem->node_ids().at(i);
22 gmd.
col_id = elem->node_ids().at(j);
23 global_matrix_data.push_back(std::move(gmd));
27 return global_matrix_data;
33 const Ordinate& ordinate,
const size_t ordinate_index,
35 std::vector<GlobalForcingData> assembled_global_forcing_data;
37 for (
const auto& elem : mesh.
elements()) {
38 elem->SetNodeSourceFluxes(mesh, material_bank, source_bank,
40 auto local_forcing_vector = elem->LocalForcingVector(
41 gll_quad, mesh, material_bank, ordinate, ordinate_index);
42 for (
auto i = 0; i < gll_quad.
n_points(); i++) {
44 gfd.
row_id = elem->node_ids().at(i);
45 gfd.
value = local_forcing_vector(i);
46 assembled_global_forcing_data.push_back(std::move(gfd));
49 return assembled_global_forcing_data;
53 const BCBank& bc_bank,
const size_t ordinate_index) {
56 for (
const auto boundary_node_id : boundary_node_ids) {
57 auto& node = mesh.
GetNode(boundary_node_id);
58 switch (bc_bank.
GetByID(node.bc_id)) {
60 double direction_dot_product =
63 if (direction_dot_product > 0)
65 boundary_node_id, boundary_node_id) += direction_dot_product;
69 throw std::runtime_error(
70 "Reflective BCs have not been implemented for 1D yet.");
74 throw std::runtime_error(
75 "Invalid or unsupported BC type passed to Apply1D BCs");
Bank holding the boundary conditions defined in the input file.
const T & GetByID(const int id) const
Get the object by its ID.
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 fi...
CGProblem(const size_t n_dofs, const size_t n_ordinates)
Construct a new CGProblem object.
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.
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 ar...
Class defining a 1D Gauss-Legendre-Lobatto quadrature set on [-1,1]. The quadrature set approximates ...
Bank holding the materials defined in the input file.
const Node & GetNode(const size_t id) const
Get Node by ID.
const std::vector< size_t > & boundary_node_ids() const
Get the boundary node IDs.
const std::vector< std::unique_ptr< Element > > & elements() const
Get the elements in the mesh.
Defines a solid angle, or ordinate, in spherical geometry.
arma::vec3 CartesianUnitVector() const
Returns the Ordinate as a Cartesian unit vector.
std::vector< arma::SpMat< double > > global_system_matrices_
Global system matrices in order of ordinates in angular quadrature set.
ProblemBase(const size_t n_dofs, const size_t n_ordinates)
Construct a new Problem Base object.
size_t n_dofs() const
Get the number of degrees of freedom.
Base class for defining a quadrature set.
size_t n_points() const
Get total number of abscissas.
Bank holding the volumetric sources defined in the input file.
Convenience struct for hold the contribution for an entry in a single element to the global forcing v...
size_t row_id
Global forcing vector row ID.
double value
Value to be placed in the global vector.
Convenience struct for holding the contribution for an entry in a single element to the global matrix...
double value
Value to be placed in the global matrix. This could be an entry from a local stiffness or mass matrix...
size_t row_id
Global matrix row ID.
size_t col_id
Global matrix column ID.