24 const auto& mat_id = mat_id_xs_pair.first;
25 const auto& xs = mat_id_xs_pair.second;
32 std::make_pair(mat_id, std::move(tginfo)));
37 typedef std::map<int, MGXS> MatID2MGDXSMap;
38 MatID2MGDXSMap matid_2_mgxs_map;
41 const auto& mat_id = matid_xs_pair.first;
46 matid_2_mgxs_map.insert(
47 std::make_pair(mat_id, MGXS{{tg_info.collapsed_D},
48 {tg_info.collapsed_sig_a}}));
54 auto solver = std::make_shared<acceleration::DiffusionMIPSolver>(
63 solver->options.residual_tolerance = groupset.
tgdsa_tol_;
66 solver->options.additional_options_string = groupset.
tgdsa_string_;
70 std::vector<double> dummy_rhs(sdm.GetNumLocalDOFs(uk_man), 0.0);
72 solver->AssembleAand_b(dummy_rhs);
89 const std::vector<double>& phi_in,
90 std::vector<double>& delta_phi_local)
92 const auto& sdm = *discretization_;
93 const auto& phi_uk_man = flux_moments_uk_man_;
95 const int gsi = groupset.
groups_.front().id_;
96 const size_t gss = groupset.
groups_.size();
98 delta_phi_local.clear();
99 delta_phi_local.assign(local_node_count_, 0.0);
101 for (
const auto& cell : grid_ptr_->local_cells)
103 const auto& cell_mapping = sdm.GetCellMapping(cell);
104 const size_t num_nodes = cell_mapping.NumNodes();
105 const auto& S = matid_to_xs_map_[cell.material_id_]->TransferMatrix(0);
107 for (
size_t i = 0; i < num_nodes; ++i)
109 const int64_t dphi_map = sdm.MapDOFLocal(cell, i);
110 const int64_t phi_map = sdm.MapDOFLocal(cell, i, phi_uk_man, 0, 0);
112 double& delta_phi_mapped = delta_phi_local[dphi_map];
113 const double* phi_in_mapped = &phi_in[phi_map];
115 for (
size_t g = 0; g < gss; ++g)
118 for (
const auto& [row_g, gprime, sigma_sm] : S.Row(gsi + g))
119 if (gprime >= gsi and gprime != (gsi + g))
120 R_g += sigma_sm * phi_in_mapped[gprime];
122 delta_phi_mapped += R_g;
132 const std::vector<double>& delta_phi_local,
133 std::vector<double>& ref_phi_new)
135 const auto& sdm = *discretization_;
136 const auto& phi_uk_man = flux_moments_uk_man_;
138 const int gsi = groupset.
groups_.front().id_;
139 const size_t gss = groupset.
groups_.size();
141 const auto& map_mat_id_2_tginfo =
144 for (
const auto& cell : grid_ptr_->local_cells)
146 const auto& cell_mapping = sdm.GetCellMapping(cell);
147 const size_t num_nodes = cell_mapping.NumNodes();
149 const auto& xi_g = map_mat_id_2_tginfo.at(cell.material_id_).spectrum;
151 for (
size_t i = 0; i < num_nodes; ++i)
153 const int64_t dphi_map = sdm.MapDOFLocal(cell, i);
154 const int64_t phi_map = sdm.MapDOFLocal(cell, i, phi_uk_man, 0, gsi);
156 const double delta_phi_mapped = delta_phi_local[dphi_map];
157 double* phi_new_mapped = &ref_phi_new[phi_map];
159 for (
int g = 0; g < gss; ++g)
160 phi_new_mapped[g] += delta_phi_mapped * xi_g[gsi + g];
std::string TextName() const
struct lbs::LBSGroupset::TwoGridAccelerationInfo tg_acceleration_info_
std::shared_ptr< lbs::acceleration::DiffusionMIPSolver > tgdsa_solver_
std::vector< LBSGroup > groups_
std::string tgdsa_string_
static void CleanUpTGDSA(LBSGroupset &groupset)
std::shared_ptr< chi_math::SpatialDiscretization > discretization_
std::vector< UnitCellMatrices > unit_cell_matrices_
void AssembleTGDSADeltaPhiVector(const LBSGroupset &groupset, const std::vector< double > &phi_in, std::vector< double > &delta_phi_local)
std::map< uint64_t, std::shared_ptr< SweepBndry > > sweep_boundaries_
void DisAssembleTGDSADeltaPhiVector(const LBSGroupset &groupset, const std::vector< double > &delta_phi_local, std::vector< double > &ref_phi_new)
void InitTGDSA(LBSGroupset &groupset)
std::map< int, XSPtr > matid_to_xs_map_
std::map< uint64_t, BoundaryCondition > TranslateBCs(const std::map< uint64_t, SwpBndryPtr > &sweep_boundaries, bool vaccum_bcs_are_dirichlet)
@ JFULL
Jacobi with full conv. of within-group scattering.
TwoGridCollapsedInfo MakeTwoGridCollapsedInfo(const chi_physics::MultiGroupXS &xs, EnergyCollapseScheme scheme)
std::map< int, acceleration::TwoGridCollapsedInfo > map_mat_id_2_tginfo