16 const std::string fname =
"lbs::SNESKResidualFunction";
20 SNESGetApplicationContext(snes, &nl_context_ptr);
23 const auto& phi_old_local = lbs_solver.
PhiOldLocal();
24 auto& q_moments_local = lbs_solver.QMomentsLocal();
26 auto active_set_source_function = lbs_solver.GetActiveSetSourceFunction();
28 std::vector<int> groupset_ids;
29 for (
const auto& groupset : lbs_solver.Groupsets())
30 groupset_ids.push_back(groupset.id_);
33 lbs_solver.SetPrimarySTLvectorFromMultiGSPETScVecFrom(
38 for (
auto& groupset : lbs_solver.Groupsets())
39 active_set_source_function(groupset,
45 const double k_eff = lbs_solver.ComputeFissionProduction(phi_old_local);
49 for (
auto& groupset : lbs_solver.Groupsets())
51 auto& wgs_context = lbs_solver.GetWGSContext(groupset.id_);
52 const bool supress_wgs =
54 active_set_source_function(
64 for (
auto& groupset : lbs_solver.Groupsets())
66 auto& wgs_context = lbs_solver.GetWGSContext(groupset.id_);
73 lbs_solver.SetMultiGSPETScVecFromPrimarySTLvector(
76 VecAXPY(r, -1.0, phi);
78 for (
auto& groupset : lbs_solver.Groupsets())
80 if ((groupset.apply_wgdsa_ or groupset.apply_tgdsa_) and
81 lbs_solver.Groupsets().size() > 1)
82 throw std::logic_error(fname +
": Preconditioning currently only supports"
83 "single groupset simulations.");
85 auto& wgs_context = lbs_solver.GetWGSContext(groupset.id_);
91 function_context.k_eff = k_eff;
std::vector< double > & PhiOldLocal()
void Scale(VecDbl &x, const double &val)
void Set(VecDbl &x, const double &val)
PetscErrorCode NLKEigenResidualFunction(SNES snes, Vec phi, Vec r, void *ctx)
int WGDSA_TGDSA_PreConditionerMult2(lbs::WGSContext< Mat, Vec, KSP > &gs_context_ptr, Vec phi_input, Vec pc_output)
@ APPLY_AGS_FISSION_SOURCES
@ APPLY_WGS_FISSION_SOURCES
@ APPLY_WGS_SCATTER_SOURCES
@ APPLY_AGS_SCATTER_SOURCES