13#define sc_double static_cast<double>
14#define PCShellPtr PetscErrorCode (*)(PC, Vec, Vec)
25 std::string method_name;
26 switch (groupset_.iterative_method_)
29 method_name =
"KRYLOV_RICHARDSON";
32 method_name =
"KRYLOV_GMRES";
35 method_name =
"KRYLOV_BICGSTAB";
38 method_name =
"KRYLOV_GMRES";
41 <<
"********** Solving groupset " << groupset_.id_
42 <<
" with " << method_name <<
".\n\n"
43 <<
"Quadrature number of angles: "
44 << groupset_.quadrature_->abscissae_.size() <<
"\n"
45 <<
"Groups " << groupset_.groups_.front().id_ <<
" "
46 << groupset_.groups_.back().id_ <<
"\n\n";
59 if (groupset_.apply_wgdsa_ or groupset_.apply_tgdsa_)
61 PCSetType(pc, PCSHELL);
63 PCShellSetContext(pc, &(*
this));
66 KSPSetPCSide(ksp, PC_LEFT);
74 const size_t local_node_count = lbs_solver_.LocalNodeCount();
75 const size_t globl_node_count = lbs_solver_.GlobalNodeCount();
76 const size_t num_moments = lbs_solver_.NumMoments();
78 const size_t groupset_numgrps = groupset_.groups_.size();
79 const auto num_delayed_psi_info =
80 groupset_.angle_agg_->GetNumDelayedAngularDOFs();
81 const size_t local_size = local_node_count * num_moments * groupset_numgrps +
82 num_delayed_psi_info.first;
83 const size_t globl_size = globl_node_count * num_moments * groupset_numgrps +
84 num_delayed_psi_info.second;
85 const size_t num_angles = groupset_.quadrature_->abscissae_.size();
86 const size_t num_psi_global =
87 globl_node_count * num_angles * groupset_.groups_.size();
88 const size_t num_delayed_psi_globl = num_delayed_psi_info.second;
92 Chi::log.
Log() <<
"Total number of angular unknowns: " << num_psi_global
94 <<
"Number of lagged angular unknowns: "
95 << num_delayed_psi_globl <<
"(" << std::setprecision(2)
96 <<
sc_double(num_delayed_psi_globl) * 100 /
101 return {
static_cast<int64_t
>(local_size),
static_cast<int64_t
>(globl_size)};
109 ++counter_applications_of_inv_op_;
110 const bool use_bndry_source_flag =
112 (not lbs_solver_.Options().use_src_moments);
114 sweep_scheduler_.SetBoundarySourceActiveFlag(use_bndry_source_flag);
117 sweep_scheduler_.ZeroIncomingDelayedPsi();
120 sweep_scheduler_.ZeroOutputFluxDataStructures();
121 sweep_scheduler_.Sweep();
137 lbs_ss_solver_.ZeroOutflowBalanceVars(groupset_);
139 const int scope = lhs_src_scope_ | rhs_src_scope_;
141 set_source_function_(
142 groupset_, lbs_solver_.QMomentsLocal(), lbs_solver_.PhiOldLocal(), scope);
143 sweep_scheduler_.SetDestinationPhi(lbs_solver_.PhiNewLocal());
145 ApplyInverseTransportOperator(scope);
147 lbs_solver_.GSScopedCopyPrimarySTLvectors(
153 double sweep_time = sweep_scheduler_.GetAverageSweepTime();
154 double chunk_overhead_ratio =
155 1.0 - sweep_scheduler_.GetAngleSetTimings()[2];
159 size_t num_angles = groupset_.quadrature_->abscissae_.size();
160 size_t num_unknowns =
161 lbs_solver_.GlobalNodeCount() * num_angles * groupset_.groups_.size();
168 Chi::log.
Log() <<
" Average sweep time (s): " << sweep_time;
170 << chunk_overhead_ratio;
173 static_cast<double>(num_unknowns);
174 Chi::log.
Log() <<
" Number of unknowns per sweep: "
178 std::string sweep_log_file_name =
179 std::string(
"GS_") + std::to_string(groupset_.id_) +
180 std::string(
"_SweepLog_") + std::to_string(
Chi::mpi.location_id) +
182 groupset_.PrintSweepInfoFile(sweep_scheduler_.SweepEventTag(),
183 sweep_log_file_name);
static chi::MPI_Info & mpi
double ProcessEvent(size_t ev_tag, EventOperation ev_operation)
@ AVERAGE_DURATION
Computes average time between begins and ends.
LogStream Log(LOG_LVL level=LOG_0)
const int & process_count
Total number of processes.
int WGDSA_TGDSA_PreConditionerMult(PC pc, Vec phi_input, Vec pc_output)
@ KRYLOV_BICGSTAB
BiCGStab iterative algorithm.
@ KRYLOV_RICHARDSON
Richardson iteration.
@ KRYLOV_GMRES
GMRES iterative algorithm.
@ ZERO_INCOMING_DELAYED_PSI
void ApplyInverseTransportOperator(int scope) override
void SetPreconditioner(SolverType &solver) override
std::pair< int64_t, int64_t > SystemSize() override
void PreSetupCallback() override
void PostSolveCallback() override