10#define scint static_cast<int>
16 std::vector<double>& destination_phi,
17 std::vector<double>& destination_psi,
20 const std::vector<UnitCellMatrices>& unit_cell_matrices,
21 std::vector<lbs::CellLBSView>& cell_transport_views,
22 const std::vector<double>& source_moments,
24 const std::map<int, XSPtr>& xs,
26 int max_num_cell_dofs,
27 std::unique_ptr<SweepDependencyInterface> sweep_dependency_interface_ptr)
30 grid_fe_view_(discretization),
31 unit_cell_matrices_(unit_cell_matrices),
32 grid_transport_view_(cell_transport_views),
33 q_moments_(source_moments),
36 num_moments_(num_moments),
37 save_angular_flux_(!destination_psi.empty()),
38 sweep_dependency_interface_ptr_(std::move(sweep_dependency_interface_ptr)),
39 sweep_dependency_interface_(*sweep_dependency_interface_ptr_),
40 groupset_angle_group_stride_(groupset_.psi_uk_man_.NumberOfUnknowns() *
41 groupset_.groups_.size()),
42 groupset_group_stride_(groupset_.groups_.size())
44 Amat_.resize(max_num_cell_dofs, std::vector<double>(max_num_cell_dofs));
45 Atemp_.resize(max_num_cell_dofs, std::vector<double>(max_num_cell_dofs));
47 std::vector<double>(max_num_cell_dofs, 0.0));
48 source_.resize(max_num_cell_dofs, 0.0);
61 "Attempting to register kernel with name \"" + name +
62 "\" but the kernel already exists.");
64 kernels_[name] = std::move(function);
72 "No register kernel with name \"" + name +
"\" found");
80 for (
auto& kernel : kernels)
92 const auto& IntF_shapeI = (*IntS_shapeI_)[f];
97 const bool is_reflecting_boundary =
101 for (
int fi = 0; fi < num_face_nodes; ++fi)
108 if (not on_boundary or is_reflecting_boundary)
110 psi[gsg] =
b_[gsg][i];
111 if (on_boundary and not is_reflecting_boundary)
114 wt * mu *
b_[gsg][i] * IntF_shapeI[i]);
135 const auto& M_surf_f = (*M_surf_)[f];
138 for (
int fi = 0; fi < num_face_nodes; ++fi)
141 for (
int fj = 0; fj < num_face_nodes; ++fj)
147 const double mu_Nij = -mu * M_surf_f[i][j];
148 Amat_[i][j] += mu_Nij;
150 if (psi ==
nullptr)
continue;
153 b_[gsg][i] += psi[gsg] * mu_Nij;
169 double temp_src = 0.0;
186 const double Mij = M[i][j];
209 output_phi[ir + gsg] += wn_d2m *
b_[gsg][i];
230 cell_psi_data[imap + gsg] =
b_[gsg][i];
237 size_t num_face_nodes,
238 uint64_t neighbor_id,
252 size_t num_face_nodes,
253 uint64_t neighbor_id,
#define ChiInvalidArgumentIf(condition, message)
int MapFaceNode(size_t face_index, size_t face_node_index) const
size_t NumFaceNodes(size_t face_index) const
virtual int64_t MapDOFLocal(const chi_mesh::Cell &cell, unsigned int node, const UnknownManager &unknown_manager, unsigned int unknown_id, unsigned int component) const =0
std::map< uint64_t, SweepBndryPtr > & GetBoundaries()
std::vector< double > & GetDestinationPsi()
std::vector< double > & GetDestinationPhi()
size_t MapDOF(int node, int moment, int grp) const
void AddOutflow(int g, double intS_mu_psi)
std::shared_ptr< chi_math::AngularQuadrature > quadrature_
chi_math::UnknownManager psi_uk_man_
std::vector< LBSGroup > groups_
std::vector< std::vector< double > > Atemp_
std::vector< double > source_
void KernelFEMSTDMassTerms()
void RegisterKernel(const std::string &name, CallbackFunction function)
double direction_qweight_
std::function< void()> CallbackFunction
std::vector< double > face_mu_values_
const size_t groupset_angle_group_stride_
CellLBSView * cell_transport_view_
const LBSGroupset & groupset_
const chi_math::SpatialDiscretization & grid_fe_view_
CallbackFunction Kernel(const std::string &name) const
const std::vector< double > & q_moments_
SweepDependencyInterface & sweep_dependency_interface_
void KernelFEMVolumetricGradientTerm()
std::map< std::string, CallbackFunction > kernels_
virtual void OutgoingSurfaceOperations()
static void ExecuteKernels(const std::vector< CallbackFunction > &kernels)
const chi_mesh::Cell * cell_
std::vector< std::vector< double > > b_
std::vector< std::vector< double > > Amat_
const size_t groupset_group_stride_
void KernelFEMUpwindSurfaceIntegrals()
const chi_math::CellMapping * cell_mapping_
SweepChunk(std::vector< double > &destination_phi, std::vector< double > &destination_psi, const chi_mesh::MeshContinuum &grid, const chi_math::SpatialDiscretization &discretization, const std::vector< UnitCellMatrices > &unit_cell_matrices, std::vector< lbs::CellLBSView > &cell_transport_views, const std::vector< double > &source_moments, const LBSGroupset &groupset, const std::map< int, XSPtr > &xs, int num_moments, int max_num_cell_dofs, std::unique_ptr< SweepDependencyInterface > sweep_dependency_interface_ptr)
const bool save_angular_flux_
Vector3 Dot(const chi_mesh::TensorRank2Dim3 &that) const
bool is_reflecting_bndry_
virtual void SetupOutgoingFace(int face_id, size_t num_face_nodes, uint64_t neighbor_id, bool on_local_face, bool on_boundary, int locality)
size_t groupset_angle_group_stride_
size_t groupset_group_stride_
virtual const double * GetUpwindPsi(int face_node_local_idx) const =0
virtual void SetupIncomingFace(int face_id, size_t num_face_nodes, uint64_t neighbor_id, bool on_local_face, bool on_boundary)
chi_mesh::sweep_management::AngleSet * angle_set_
virtual double * GetDownwindPsi(int face_node_local_idx) const =0