12 auto left_node = mesh.
GetNode(boundary_node_ids.front());
13 auto right_node = mesh.
GetNode(boundary_node_ids.back());
20 const std::vector<Node>& existing_nodes,
23 size_t id = existing_nodes.size();
27 double direction_x = right_node.
x - left_node.
x;
28 double direction_y = right_node.
y - left_node.
y;
29 double direction_z = right_node.
z - left_node.
z;
31 unsigned int interior_bc_id =
34 std::vector<Node> nodes(gll_quadrature.
n_points() - 2);
35 for (
auto i = 1; i < gll_quadrature.
n_points() - 1; i++) {
37 double fraction = (xi + 1.0) / 2.0;
41 new_node.
x = left_node.
x + fraction * direction_x;
42 new_node.
y = left_node.
y + fraction * direction_y;
43 new_node.
z = left_node.
z + fraction * direction_z;
44 new_node.
bc_id = interior_bc_id;
45 nodes.at(i - 1) = std::move(new_node);
55 const size_t ordinate_index) {
56 arma::Col<double> forcing_vec(gll_quad.
n_points(), arma::fill::zeros);
60 double orientation = (right_x >= left_x) ? 1.0 : -1.0;
61 double streaming_coeff = orientation * ordinate.
x() / sigma_t;
62 for (
auto i = 0; i < gll_quad.
n_points(); i++) {
64 for (
auto k = 0; k < gll_quad.
n_points(); k++) {
68 if (i == k) sum += weight * node_source *
length_ / 2.0;
69 sum += streaming_coeff * weight * node_source *
83 double front_coeff = ordinate.
x() * ordinate.
x() / sigma_t * 2.0 /
length_;
84 for (
auto i = 0; i < gll_quad.
n_points(); i++) {
85 for (
auto j = 0; j < gll_quad.
n_points(); j++) {
87 for (
auto k = 0; k < gll_quad.
n_points(); k++) {
91 stiffness_mat(i, j) = front_coeff * sum;
100 arma::SpMat<double> material_matrix = arma::speye<arma::SpMat<double>>(
102 for (
auto k = 0; k < gll_quad.
n_points(); k++)
104 return material_matrix;
const T & GetByID(const int id) const
Get the object by its ID.
int material_id() const
Get Material ID.
std::vector< size_t > node_ids_
IDs of nodes defining the element.
int material_id_
Material ID to access Material Bank. Auto initialized to -1. Value must be set to a positive value (i...
Element(const int material_id, const int source_id)
Construct a new Element object.
int source_id() const
Get Source ID.
Class defining a 1D Gauss-Legendre-Lobatto quadrature set on [-1,1]. The quadrature set approximates ...
double GetLagrangeDerivative(const size_t node_idx, const size_t polynomial_idx) const
Get the derivative of the specific Lagrange polynomial at the specified node. Note that both the node...
Bank holding the materials defined in the input file.
const Node & GetNode(const size_t id) const
Get Node by ID.
Defines a solid angle, or ordinate, in spherical geometry.
double x() const
Evaluate the x-direction cosine.
T GetAbscissa(const unsigned int index) const
Get the abscissa corresponding to the index.
size_t n_points() const
Get total number of abscissas.
double GetWeight(const unsigned int abscissa_index) const
Get the weight value corresponding to a given abscissa value.
Segment(const std::array< size_t, 2 > boundary_node_ids, const int material_id, const int source_id, const Mesh &mesh)
Construct a new Segment object.
std::array< size_t, 2 > boundary_node_ids_
Node IDs defining the Segment bounds.
double ComputeLength(const std::array< size_t, 2 > boundary_node_ids, const Mesh &mesh)
Compute the length of the element on construction.
arma::Col< double > LocalForcingVector(const GaussLobattoLegendre &gll_quad, const Mesh &mesh, const MaterialBank &material_bank, const Ordinate &ordinate, const size_t ordinate_index) override
Construct the local forcing vector, which is:
std::vector< Node > CreateInteriorNodes(const std::vector< Node > &existing_nodes, const GaussLobattoLegendre &gll_quadrature) override
Create interior Node objects using the Gauss-Lobatto-Legendre quadrature set. The mapping from the re...
unsigned int dimension() const override
Get the spatial dimension of a Segment (always 1).
arma::Mat< double > LocalStiffnessMatrix(const GaussLobattoLegendre &gll_quad, const MaterialBank &material_bank, const Ordinate &ordinate) override
Construct the dense local stiffness matrix using spectral elements on a Gauss-Lobatto-Legendre grid,...
arma::SpMat< double > LocalMassMatrix(const GaussLobattoLegendre &gll_quad, const MaterialBank &material_bank) override
Construct the sparse diagonal local mass matrix using spectral elements on a Gauss-Lobatto-Legendre g...
const double length_
Length of the element.
double DistanceBetweenNodes(const Node &node_1, const Node &node_2)
Compute the Euclidean distance between two nodes.
double total_xs
Total macroscopic cross section in 1/cm.
A point in the mesh holding its coordinates, boundary info, and flux solution values.
double x
X-coordinate of the node.
double z
Z-coordinate of the node.
std::vector< double > source_fluxes
Source flux values in order of the SN quadrature set. These are scratch values: they are overwritten ...
int bc_id
BC ID to access the boundary condition (BC) bank. ID of 0 is always NONE, meaning the node is interna...
double y
Y-coordinate of the node.
size_t id
Unique identifier for the node.