Chi-Tech
acceleration.cc
Go to the documentation of this file.
1#include "acceleration.h"
2
5
6#include "chi_runtime.h"
8
10{
11std::map<uint64_t, BoundaryCondition>
12TranslateBCs(const std::map<uint64_t, SwpBndryPtr>& sweep_boundaries,
13 bool vaccum_bcs_are_dirichlet /*=true*/)
14{
18
19 std::map<uint64_t, BC> bcs;
20 for (auto& [bid, lbs_bndry] : sweep_boundaries)
21 {
22 if (lbs_bndry->Type() == SwpBndryType::REFLECTING)
23 bcs[bid] = {BCType::ROBIN, {0.0, 1.0, 0.0}};
24 else if (lbs_bndry->Type() == SwpBndryType::INCIDENT_VACCUUM)
25 if (vaccum_bcs_are_dirichlet)
26 bcs[bid] = {BCType::DIRICHLET, {0.0, 0.0, 0.0}};
27 else
28 bcs[bid] = {BCType::ROBIN, {0.25, 0.5}};
29 else // dirichlet
30 bcs[bid] = {BCType::DIRICHLET, {0.0, 0.0, 0.0}};
31 }
32
33 return bcs;
34}
35
36std::map<int, Multigroup_D_and_sigR>
37PackGroupsetXS(const std::map<int, MGXSPtr>& matid_to_xs_map,
38 int first_grp_index,
39 int last_group_index)
40{
41 const int num_gs_groups = last_group_index - first_grp_index + 1;
42 ChiInvalidArgumentIf(num_gs_groups < 0,
43 "last_grp_index must be >= first_grp_index");
44
46 typedef std::map<int, lbs::acceleration::Multigroup_D_and_sigR> MatID2XSMap;
47 MatID2XSMap matid_2_mgxs_map;
48 for (const auto& matid_xs_pair : matid_to_xs_map)
49 {
50 const auto& mat_id = matid_xs_pair.first;
51 const auto& xs = matid_xs_pair.second;
52
53 std::vector<double> D(num_gs_groups, 0.0);
54 std::vector<double> sigma_r(num_gs_groups, 0.0);
55
56 size_t g = 0;
57 const auto& diffusion_coeff = xs->DiffusionCoefficient();
58 const auto& sigma_removal = xs->SigmaRemoval();
59 for (size_t gprime = first_grp_index; gprime <= last_group_index; ++gprime)
60 {
61 D[g] = diffusion_coeff[gprime];
62 sigma_r[g] = sigma_removal[gprime];
63 ++g;
64 } // for g
65
66 matid_2_mgxs_map.insert(std::make_pair(mat_id, MGXS{D, sigma_r}));
67 }
68
69 return matid_2_mgxs_map;
70}
71
72} // namespace lbs::acceleration
#define ChiInvalidArgumentIf(condition, message)
std::map< int, Multigroup_D_and_sigR > PackGroupsetXS(const std::map< int, MGXSPtr > &matid_to_xs_map, int first_grp_index, int last_group_index)
Definition: acceleration.cc:37
std::map< uint64_t, BoundaryCondition > TranslateBCs(const std::map< uint64_t, SwpBndryPtr > &sweep_boundaries, bool vaccum_bcs_are_dirichlet)
Definition: acceleration.cc:12