hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2// Copyright (c) 2026, Liam Pohlmann
3
4#ifndef HUMMINGBIRD_MESH_NODE_H_
5#define HUMMINGBIRD_MESH_NODE_H_
6
7#include <armadillo>
8#include <cmath>
9#include <cstddef>
10#include <cstdint>
11#include <vector>
12
13#include "banks/material_bank.h"
16#include "utils/enums.h"
17
18namespace hummingbird {
19class SourceBank;
20
21/**
22 * @brief A point in the mesh holding its coordinates, boundary info, and flux
23 * solution values
24 *
25 */
26struct Node {
27 /// @brief Unique identifier for the node
28 size_t id;
29
30 /// @brief X-coordinate of the node
31 double x;
32
33 /// @brief Y-coordinate of the node
34 double y;
35
36 /// @brief Z-coordinate of the node
37 double z;
38
39 /// @brief BC ID to access the boundary condition (BC) bank. ID of 0 is always
40 /// NONE, meaning the node is internal to the mesh.
41 int bc_id = 0;
42
43 /// @brief Outward pointing normal vector. This vector is only relevant if the
44 /// node is on a boundary
45 arma::vec3 outward_normal;
46
47 /// @brief Scalar flux on the node
49
50 /// @brief Angular flux values in order of the SN quadrature set
51 std::vector<double> angular_fluxes;
52
53 /// @brief Source flux values in order of the SN quadrature set. These are
54 /// scratch values: they are overwritten for each element during forcing
55 /// assembly (see Element::SetNodeSourceFluxes), so on interface nodes they
56 /// hold the last element's values. Do not read them outside assembly.
57 std::vector<double> source_fluxes;
58};
59
60/**
61 * @brief Compute the Euclidean distance between two nodes
62 *
63 * @param node_1 First node
64 * @param node_2 Second node
65 * @return Distance in units of the mesh
66 */
67double DistanceBetweenNodes(const Node& node_1, const Node& node_2);
68
69/**
70 * @brief Update the scalar flux of a node using the angular quadrature set
71 *
72 * @param node Node to update
73 * @param angular_quadrature Angular quadrature set
74 */
75void UpdateScalarFlux(Node& node,
76 const QuadratureBase<Ordinate> angular_quadrature);
77
78/**
79 * @brief Compute the node source flux values
80 *
81 * @param node Node
82 * @param material_id Material ID
83 * @param source_id Source ID
84 * @param material_bank Material bank
85 * @param source_bank Source bank
86 * @param angular_quadrature Angular quadrature set
87 * @return std::vector<double>
88 */
89std::vector<double> ComputeNodeSourceFluxes(
90 const Node& node, const int material_id, const int source_id,
91 const MaterialBank& material_bank, const SourceBank& source_bank,
92 const QuadratureBase<Ordinate>& angular_quadrature);
93} // namespace hummingbird
94
95#endif // HUMMINGBIRD_MESH_NODE_H_
Bank holding the materials defined in the input file.
Base class for defining a quadrature set.
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
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
std::vector< double > source_fluxes
Source flux values in order of the SN quadrature set. These are scratch values: they are overwritten ...
Definition node.h:57
arma::vec3 outward_normal
Outward pointing normal vector. This vector is only relevant if the node is on a boundary.
Definition node.h:45
int bc_id
BC ID to access the boundary condition (BC) bank. ID of 0 is always NONE, meaning the node is interna...
Definition node.h:41
double y
Y-coordinate of the node.
Definition node.h:34
size_t id
Unique identifier for the node.
Definition node.h:28