24 auto SetLBSScatterSourcePhi0 =
25 [
this, &phi_temp](
const VecDbl& input,
27 const bool suppress_wg_scat =
false)
33 const size_t tag_SCDSA_solve_time =
40 double k_eff_prev = 1.0;
41 double k_eff_change = 1.0;
45 bool converged =
false;
71 SetLBSScatterSourcePhi0(phi0_lph_ip1 - phi0_lph_i,
false);
76 VecDbl epsilon_k(phi0_lph_ip1.size(), 0.0);
77 auto epsilon_kp1 = epsilon_k;
80 double lambda_kp1 = lambda_k;
85 epsilon_k + phi0_lph_ip1,
97 for (
int i = 0; i < 1; ++i)
99 SetLBSScatterSourcePhi0(epsilon_k,
113 epsilon_k = epsilon_kp1;
117 epsilon_kp1 + phi0_lph_ip1,
120 double production_kp1 =
123 lambda_kp1 = production_kp1 / (production_k / lambda_k);
125 const double lambda_change = std::fabs(1.0 - lambda_kp1 / lambda_k);
127 Chi::log.
Log() <<
"PISCDSA iteration " << k <<
" lambda " << lambda_kp1
128 <<
" lambda change " << lambda_change;
132 lambda_k = lambda_kp1;
133 epsilon_k = epsilon_kp1;
134 production_k = production_kp1;
138 epsilon_kp1 + phi0_lph_ip1,
144 const double production =
157 if (k_eff_change < std::max(
k_tolerance_, 1.0e-12)) converged =
true;
162 std::stringstream k_iter_info;
164 <<
" Iteration " << std::setw(5) << nit <<
" k_eff "
165 << std::setw(11) << std::setprecision(7) <<
k_eff_
166 <<
" k_eff change " << std::setw(12) << k_eff_change
167 <<
" reactivity " << std::setw(10) << reactivity * 1e5;
168 if (converged) k_iter_info <<
" CONVERGED\n";
173 if (converged)
break;
179 << std::setprecision(7) <<
k_eff_;
181 <<
" Final change : " << std::setprecision(6)
186 <<
" Diffusion solve time : "
191 <<
" Total sweep time : "
205 <<
"LinearBoltzmann::KEigenvalueSolver execution completed\n\n";
static chi::Timer program_timer
double ProcessEvent(size_t ev_tag, EventOperation ev_operation)
@ TOTAL_DURATION
Integrates times between begins and ends.
@ EVENT_BEGIN
Signals the begin of an event.
@ EVENT_END
Signals the end of an event.
LogStream Log(LOG_LVL level=LOG_0)
size_t GetRepeatingEventTag(std::string event_name)
void LogEvent(size_t ev_tag, EventType ev_type, const std::shared_ptr< EventInfo > &ev_info)
std::string GetTimeString() const
std::vector< double > & PrecursorsNewLocal()
double ComputeFissionProduction(const std::vector< double > &phi)
virtual void ScalePhiVector(PhiSTLOption which_phi, double value)
void UpdateFieldFunctions()
virtual void GSScopedCopyPrimarySTLvectors(LBSGroupset &groupset, const std::vector< double > &x_src, std::vector< double > &y)
std::shared_ptr< lbs::WGSContext< Mat, Vec, KSP > > front_wgs_context_
std::shared_ptr< AGSLinearSolver< Mat, Vec, KSP > > primary_ags_solver_
void SetLBSScatterSource(const VecDbl &input, bool additive, bool suppress_wg_scat=false)
VecDbl & q_moments_local_
void SetLBSFissionSource(const VecDbl &input, bool additive)
std::vector< double > CopyOnlyPhi0(const LBSGroupset &groupset, const std::vector< double > &phi_in)
DiffusionSolverPtr diffusion_solver_
void ProjectBackPhi0(const LBSGroupset &groupset, const std::vector< double > &input, std::vector< double > &output)
void Scale(VecDbl &x, const double &val)
std::vector< double > VecDbl
bool verbose_outer_iterations