50 auto src_function = std::make_shared<SourceFunction>(*
this);
53 using namespace std::placeholders;
55 std::bind(&SourceFunction::operator(), src_function, _1, _2, _3, _4);
71 const size_t num_groupsets =
groupsets_.size();
72 for (
size_t gs = 0; gs < num_groupsets; ++gs)
77 const size_t gs_G = groupset.groups_.size();
86 std::map<uint64_t, BC> bcs;
89 if (lbs_bndry->Type() == SwpBndryType::REFLECTING)
90 bcs[bid] = {BCType::ROBIN, {0.0, 1.0, 0.0}};
91 else if (lbs_bndry->Type() == SwpBndryType::INCIDENT_ISOTROPIC_HOMOGENOUS)
94 if (not has_bndry_preference) bcs[bid] = {BCType::ROBIN, {0.25, 0.5}};
98 if (is_vaccuum) bcs[bid] = {BCType::ROBIN, {0.25, 0.5}};
100 throw std::logic_error(
"Dirichlet boundary conditions not supported"
101 "for diffusion solvers.");
107 typedef std::map<int, lbs::acceleration::Multigroup_D_and_sigR> MatID2XSMap;
108 MatID2XSMap matid_2_mgxs_map;
111 const auto& mat_id = matid_xs_pair.first;
112 const auto& xs = matid_xs_pair.second;
114 const auto& diffusion_coeff = xs->DiffusionCoefficient();
115 const auto& sigma_r = xs->SigmaRemoval();
117 std::vector<double> Dg(gs_G, 0.0);
118 std::vector<double> sigR(gs_G, 0.0);
121 for (
size_t gprime = groupset.groups_.front().id_;
122 gprime <= groupset.groups_.back().id_;
125 Dg[g] = diffusion_coeff[gprime];
126 sigR[g] = sigma_r[gprime];
130 matid_2_mgxs_map.insert(std::make_pair(mat_id, MGXS{Dg, sigR}));
136 auto solver = std::make_shared<acceleration::DiffusionMIPSolver>(
137 std::string(
TextName() +
"_WGSolver"),
145 solver->options.residual_tolerance = groupset.wgdsa_tol_;
146 solver->options.max_iters = groupset.wgdsa_max_iters_;
147 solver->options.verbose = groupset.wgdsa_verbose_;
148 solver->options.additional_options_string = groupset.wgdsa_string_;
150 solver->Initialize();
152 std::vector<double> dummy_rhs(sdm.GetNumLocalDOFs(uk_man), 0.0);
154 solver->AssembleAand_b(dummy_rhs);
163 auto mip_wgs_context_ptr = std::make_shared<MIPWGSContext2<Mat, Vec, KSP>>(
174 std::make_shared<WGSLinearSolver<Mat, Vec, KSP>>(mip_wgs_context_ptr);
unsigned int AddUnknown(UnknownType unk_type, unsigned int dimension=0)
std::string TextName() const
std::vector< MIPSolverPtr > gs_mip_solvers_
~DiffusionDFEMSolver() override
void Initialize() override
void InitializeWGSSolvers() override
DiffusionDFEMSolver(const chi::InputParameters ¶ms)
static chi::InputParameters GetInputParameters()
static chi::InputParameters GetInputParameters()
static void CleanUpTGDSA(LBSGroupset &groupset)
std::shared_ptr< chi_math::SpatialDiscretization > discretization_
std::vector< UnitCellMatrices > unit_cell_matrices_
std::map< uint64_t, std::shared_ptr< SweepBndry > > sweep_boundaries_
std::map< uint64_t, BoundaryPreference > boundary_preferences_
void InitTGDSA(LBSGroupset &groupset)
void Initialize() override
std::vector< LBSGroupset > groupsets_
virtual void InitializeSolverSchemes()
std::vector< LinSolvePtr > wgs_solvers_
std::map< int, XSPtr > matid_to_xs_map_
SetSourceFunction active_set_source_function_
RegisterChiObject(lbs, DiffusionDFEMSolver)
@ APPLY_AGS_FISSION_SOURCES
@ APPLY_WGS_FISSION_SOURCES
@ APPLY_WGS_SCATTER_SOURCES
@ APPLY_AGS_SCATTER_SOURCES
bool verbose_inner_iterations
unsigned int scattering_order