12 ComputeLeakage(
const int groupset_id,
const uint64_t boundary_id)
const
14 const std::string fname =
"lbs::SteadySolver::ComputeLeakage";
17 if (groupset_id<0 or groupset_id>=
groupsets_.size())
18 throw std::invalid_argument(fname +
": Invalid groupset_id specified.");
21 throw std::logic_error(fname +
": Requires options.save_angular_flux to be"
26 const auto& groupset =
groupsets_.at(groupset_id);
27 const auto& psi_uk_man = groupset.psi_uk_man_;
28 const auto& quadrature = groupset.quadrature_;
30 const size_t num_angles = quadrature->omegas_.size();
32 const int gsi = groupset.groups_.front().id_;
33 const int gsf = groupset.groups_.back().id_;
34 const int gs_num_groups = gsf+1-gsi;
37 std::vector<double> local_leakage(gs_num_groups, 0.0);
38 for (
const auto& cell :
grid_ptr_->local_cells)
40 const auto& cell_mapping = sdm.GetCellMapping(cell);
44 for (
const auto& face : cell.faces_)
46 if (not face.has_neighbor_ and face.neighbor_id_ == boundary_id)
48 const auto& IntF_shapeI = fe_values.face_Si_vectors[f];
49 const size_t num_face_nodes = cell_mapping.NumFaceNodes(f);
50 for (
size_t fi=0; fi<num_face_nodes; ++fi)
52 const int i = cell_mapping.MapFaceNode(f, fi);
53 for (
size_t n=0; n<num_angles; ++n)
55 const auto& omega = quadrature->omegas_[n];
56 const auto& weight = quadrature->weights_[n];
57 const double mu = omega.Dot(face.normal_);
60 for (
int gi=0; gi<gs_num_groups; ++gi)
63 const int64_t imap = sdm.MapDOFLocal(cell, i, psi_uk_man, n, g);
67 local_leakage[gi] += weight * mu * psi * IntF_shapeI[i];
77 std::vector<double> global_leakage(gs_num_groups, 0.0);
78 MPI_Allreduce(local_leakage.data(),
79 global_leakage.data(),
80 gs_num_groups, MPI_DOUBLE,
84 return global_leakage;
static chi::MPI_Info & mpi
const MPI_Comm & comm
MPI communicator.
std::vector< double > ComputeLeakage(int groupset_id, uint64_t boundary_id) const
std::vector< std::vector< double > > psi_new_local_
chi_mesh::MeshContinuumPtr grid_ptr_
std::shared_ptr< chi_math::SpatialDiscretization > discretization_
std::vector< UnitCellMatrices > unit_cell_matrices_
std::vector< LBSGroupset > groupsets_