hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
node.cc
Go to the documentation of this file.
1#include "mesh/node.h"
2
3#include <vector>
4
5#include "banks/source_bank.h"
6
7namespace hummingbird {
8double DistanceBetweenNodes(const Node& node_1, const Node& node_2) {
9 double x_part = node_1.x - node_2.x;
10 double y_part = node_1.y - node_2.y;
11 double z_part = node_1.z - node_2.z;
12 return std::sqrt(x_part * x_part + y_part * y_part + z_part * z_part);
13}
14
16 const QuadratureBase<Ordinate> angular_quadrature) {
17 std::vector<QuadraturePair> quad_pairs;
18 quad_pairs.reserve(angular_quadrature.n_points());
19 for (auto i = 0; i < angular_quadrature.n_points(); i++)
20 quad_pairs.push_back(QuadraturePair(i, node.angular_fluxes.at(i)));
21 node.scalar_flux = angular_quadrature.Integrate(quad_pairs);
22}
23
24std::vector<double> ComputeNodeSourceFluxes(
25 const Node& node, const int material_id, const int source_id,
26 const MaterialBank& material_bank, const SourceBank& source_bank,
27 const QuadratureBase<Ordinate>& angular_quadrature) {
28 std::vector<double> source_fluxes;
29 source_fluxes.reserve(angular_quadrature.n_points());
30 for (auto n = 0; n < angular_quadrature.n_points(); n++) {
31 double ind_source = source_bank.GetByID(source_id)->EvaluateAtNode(
32 node, angular_quadrature.GetAbscissa(n));
33 double inscattering = material_bank.GetByID(material_id).scattering_xs /
34 (4.0 * M_PI) * node.scalar_flux;
35 source_fluxes.push_back(inscattering + ind_source);
36 }
37 return source_fluxes;
38}
39} // namespace hummingbird
const T & GetByID(const int id) const
Get the object by its ID.
Definition bank_base.h:29
Bank holding the materials defined in the input file.
Base class for defining a quadrature set.
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 Integrate(const std::vector< QuadraturePair > &quad_pairs) const
Integrate the function using the function value and its location on the quadrature grid.
Bank holding the volumetric sources defined in the input file.
Definition source_bank.h:25
void UpdateScalarFlux(Node &node, const QuadratureBase< Ordinate > angular_quadrature)
Update the scalar flux of a node using the angular quadrature set.
Definition node.cc:15
std::vector< double > ComputeNodeSourceFluxes(const Node &node, const int material_id, const int source_id, const MaterialBank &material_bank, const SourceBank &source_bank, const QuadratureBase< Ordinate > &angular_quadrature)
Compute the node source flux values.
Definition node.cc:24
double DistanceBetweenNodes(const Node &node_1, const Node &node_2)
Compute the Euclidean distance between two nodes.
Definition node.cc:8
double scattering_xs
Isotropic scattering macroscopic cross section in 1/cm.
Definition material.h:18
A point in the mesh holding its coordinates, boundary info, and flux solution values.
Definition node.h:26
std::vector< double > angular_fluxes
Angular flux values in order of the SN quadrature set.
Definition node.h:51
double x
X-coordinate of the node.
Definition node.h:31
double scalar_flux
Scalar flux on the node.
Definition node.h:48
double z
Z-coordinate of the node.
Definition node.h:37
double y
Y-coordinate of the node.
Definition node.h:34
Simple struct holding a function value evaluated at the supplied abscissa value.