29 "groups_from_to",
"The first and last group id this groupset operates on."
30 " e.g. A 4 group problem <TT>groups_from_to= {0, 3}</TT>");
33 "A handle to an angular quadrature");
35 "angle_aggregation_type",
37 "The angle aggregation method to use during sweeping");
40 "angle_aggregation_num_subsets",
42 "The number of subsets to apply to sets of "
43 "angles that have been aggregated. This is useful for increasing "
44 "pipeline size for parallel simulations");
47 "groupset_num_subsets",
49 "The number of subsets to apply to the set of groups in this set. This is "
50 "useful for increasing pipeline size for parallel simulations");
53 "inner_linear_method",
55 "The iterative method to use for inner linear solves");
58 "l_abs_tol", 1.0e-6,
"Inner linear solver residual absolute tolerance");
60 "l_max_its", 200,
"Inner linear solver maximum iterations");
63 "If this inner linear solver is gmres, sets the"
64 " number of iterations before a restart occurs.");
69 "Flag indicating whether cycles are to be allowed or not");
72 "log_sweep_events",
false,
"Turns on a log of sweep events");
77 "Flag to turn on within-group Diffusion "
78 "Synthetic Acceleration for this groupset");
80 "wgdsa_l_abs_tol", 1.0e-4,
"Within-group DSA linear absolute tolerance");
82 "wgdsa_l_max_its", 30,
"Within-group DSA linear maximum iterations");
84 "wgdsa_verbose",
false,
"If true, WGDSA routines will print verbosely");
86 "wgdsa_petsc_options",
"",
"PETSc options to pass to WGDSA solver");
92 "Flag to turn on Two-Grid Acceleration for this groupset");
94 "tgdsa_l_abs_tol", 1.0e-4,
"Two-Grid DSA linear absolute tolerance");
96 "tgdsa_l_max_its", 30,
"Two-Grid DSA linear maximum iterations");
98 "tgdsa_verbose",
false,
"If true, TGDSA routines will print verbosely");
100 "tgdsa_petsc_options",
"",
"PETSc options to pass to TGDSA solver");
106 "angle_aggregation_type",
107 AllowableRangeList::New({
"polar",
"single",
"azimuthal"}));
110 AllowableRangeLowLimit::New(1));
113 AllowableRangeLowLimit::New(1));
116 "inner_linear_method",
117 AllowableRangeList::New({
"richardson",
"gmres",
"bicgstab"}));
120 AllowableRangeLowLimit::New(1.0e-18));
123 AllowableRangeLowLimit::New(1));
137 const std::string fname = __FUNCTION__;
140 const auto groups_from_to =
143 "Parameter \"groups_from_to\" can only have 2 entries");
145 const size_t from = groups_from_to[0];
146 const size_t to = groups_from_to[1];
148 "\"to\" field is less than the \"from\" field.");
152 for (
size_t g = from; g <= to; ++g)
157 catch (
const std::exception& exc)
159 throw std::invalid_argument(
"Attempting to group to groupset that is not"
160 "part of the solver.");
166 const size_t quad_handle =
168 quadrature_ = Chi::GetStackItemPtr<chi_math::AngularQuadrature>(
172 const auto angle_agg_typestr =
174 if (angle_agg_typestr ==
"polar")
176 else if (angle_agg_typestr ==
"single")
178 else if (angle_agg_typestr ==
"azimuthal")
185 const auto inner_linear_method =
187 if (inner_linear_method ==
"richardson")
189 else if (inner_linear_method ==
"gmres")
191 else if (inner_linear_method ==
"bicgstab")
227 quadrature_->BuildDiscreteToMomentOperator(scattering_order, 1);
232 quadrature_->BuildDiscreteToMomentOperator(scattering_order, 2);
236 quadrature_->BuildDiscreteToMomentOperator(scattering_order, 3);
249 quadrature_->BuildMomentToDiscreteOperator(scattering_order, 1);
254 quadrature_->BuildMomentToDiscreteOperator(scattering_order, 2);
258 quadrature_->BuildMomentToDiscreteOperator(scattering_order, 3);
266 grp_subset_infos_ =
chi::MakeSubSets(groups_.size(), master_num_grp_subsets_);
269 for (
const auto& info : grp_subset_infos_)
271 Chi::log.
Log() <<
"Groupset " << id_ <<
" has group-subset " << ss <<
" "
272 << info.ss_begin <<
"->" << info.ss_end;
281 const std::string& file_name)
283 if (not log_sweep_events_)
return;
286 ofile.open(file_name, std::ofstream::out);
288 ofile <<
"Groupset Sweep information "
292 for (
int q = 0; q < angle_agg_->angle_set_groups.size(); ++q)
294 ofile <<
"Angle-set group " << q <<
":\n";
295 auto& ang_set_grp = angle_agg_->angle_set_groups[q];
296 int num_ang_sets_per_grp = (int)ang_set_grp.AngleSets().size();
297 for (
int as = 0; as < num_ang_sets_per_grp; ++as)
299 auto ang_set = ang_set_grp.AngleSets()[as];
301 int ang_set_num = as + q * num_ang_sets_per_grp;
303 ofile <<
" Angle-set " << ang_set_num <<
" angles [# varphi theta]:\n";
305 for (
auto& ang_num : ang_set->GetAngleIndices())
307 const auto& angle = quadrature_->abscissae_[ang_num];
309 ofile <<
" " << ang_num <<
" " << angle.phi <<
" " << angle.theta
#define ChiInvalidArgumentIf(condition, message)
static std::vector< chi_math::AngularQuadraturePtr > angular_quadrature_stack
static chi::MPI_Info & mpi
static chi::InputParameters GetInputParameters()
std::string PrintEventHistory(size_t ev_tag)
LogStream Log(LOG_LVL level=LOG_0)
const int & location_id
Current process rank.
T GetParamValue(const std::string ¶m_name) const
std::vector< T > GetParamVectorValue(const std::string ¶m_name) const
double residual_tolerance_
AngleAggregationType angleagg_method_
std::string wgdsa_string_
void PrintSweepInfoFile(size_t ev_tag, const std::string &file_name)
int master_num_ang_subsets_
void BuildDiscMomOperator(unsigned int scattering_order, GeometryType geometry_type)
std::shared_ptr< chi_math::AngularQuadrature > quadrature_
void BuildMomDiscOperator(unsigned int scattering_order, GeometryType geometry_type)
static chi::InputParameters GetInputParameters()
int master_num_grp_subsets_
std::vector< LBSGroup > groups_
std::string tgdsa_string_
IterativeMethod iterative_method_
const std::vector< LBSGroup > & Groups() const
std::vector< SubSetInfo > MakeSubSets(size_t num_items, size_t desired_num_subsets)
@ KRYLOV_BICGSTAB
BiCGStab iterative algorithm.
@ KRYLOV_RICHARDSON
Richardson iteration.
@ KRYLOV_GMRES
GMRES iterative algorithm.
RegisterChiObjectParametersOnly(lbs, LBSGroupset)