27 params.
addParam<std::vector<NonlinearVariableName>>(
28 "vars", {},
"Variables Split operates on (omitting this implies \"all variables\"");
29 params.
addParam<std::vector<SubdomainName>>(
30 "blocks", {},
"Mesh blocks Split operates on (omitting this implies \"all blocks\"");
31 params.
addParam<std::vector<BoundaryName>>(
32 "sides", {},
"Sidesets Split operates on (omitting this implies \"all sidesets\")");
33 params.
addParam<std::vector<BoundaryName>>(
36 "Sidesets Split excludes (omitting this implies \"do not exclude any sidesets\")");
37 params.
addParam<std::vector<std::string>>(
38 "splitting", {},
"The names of the splits (subsystems) in the decomposition of this split");
39 params.
addParam<std::vector<BoundaryName>>(
40 "unside_by_var_boundary_name",
41 "A map from boundary name to unside by variable, e.g. only unside for a given variable.");
42 params.
addParam<std::vector<NonlinearVariableName>>(
43 "unside_by_var_var_name",
44 "A map from boundary name to unside by variable, e.g. only unside for a given variable.");
46 "Sideset restriction");
48 MooseEnum SplittingTypeEnum(
"additive multiplicative symmetric_multiplicative schur",
"additive");
49 params.
addParam<
MooseEnum>(
"splitting_type", SplittingTypeEnum,
"Split decomposition type");
51 MooseEnum SchurTypeEnum(
"diag upper lower full",
"full");
52 params.
addParam<
MooseEnum>(
"schur_type", SchurTypeEnum,
"Type of Schur complement");
62 "schur_pre", SchurPreEnum,
"Type of Schur complement preconditioner matrix");
66 "PETSc flags for the FieldSplit solver");
69 "PETSc option names for the FieldSplit solver");
70 params.
addParam<std::vector<std::string>>(
"petsc_options_value",
71 "PETSc option values for the FieldSplit solver");
81 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
82 _vars(getParam<
std::vector<NonlinearVariableName>>(
"vars")),
83 _blocks(getParam<
std::vector<SubdomainName>>(
"blocks")),
84 _sides(getParam<
std::vector<BoundaryName>>(
"sides")),
85 _unsides(getParam<
std::vector<BoundaryName>>(
"unsides")),
86 _splitting(getParam<
std::vector<
std::string>>(
"splitting")),
87 _splitting_type(getParam<
MooseEnum>(
"splitting_type")),
88 _schur_type(getParam<
MooseEnum>(
"schur_type")),
89 _schur_pre(getParam<
MooseEnum>(
"schur_pre"))
103 const std::string prefix_with_dash =
'-' + prefix;
104 std::string dmprefix = prefix_with_dash +
"dm_moose_";
108 const auto & unside_by_var_boundary_name =
109 getParam<std::vector<BoundaryName>>(
"unside_by_var_boundary_name");
110 const auto & unside_by_var_var_name =
111 getParam<std::vector<NonlinearVariableName>>(
"unside_by_var_var_name");
113 std::vector<std::string> vector_of_pairs;
114 for (
const auto i : index_range(unside_by_var_boundary_name))
115 vector_of_pairs.push_back(unside_by_var_boundary_name[i] +
":" + unside_by_var_var_name[i]);
125 for (
const auto & var :
_vars)
127 mooseError(
"Variable '", var,
"' specified in split '",
name(),
"' does not exist");
147 po.
pairs.emplace_back(prefix_with_dash +
"pc_type",
"fieldsplit");
150 const std::string petsc_splitting_type[] = {
151 "additive",
"multiplicative",
"symmetric_multiplicative",
"schur"};
152 po.
pairs.emplace_back(prefix_with_dash +
"pc_fieldsplit_type",
158 const std::string petsc_schur_type[] = {
"diag",
"upper",
"lower",
"full"};
159 po.
pairs.emplace_back(prefix_with_dash +
"pc_fieldsplit_schur_fact_type",
163 const std::string petsc_schur_pre[] = {
"self",
"selfp",
"a11"};
164 po.
pairs.emplace_back(prefix_with_dash +
"pc_fieldsplit_schur_precondition",
173 std::map<NonlinearVariableName, std::vector<std::pair<std::string, std::shared_ptr<Split>>>>
177 std::shared_ptr<Split> split = nl.
getSplit(split_name);
188 for (
const auto & var : split->getVars())
190 auto & prior_claims = vars_to_splits[var];
191 for (
const auto & [prior_name, prior_split] : prior_claims)
193 const auto &
blocks = split->getBlocks();
194 const auto & prior_blocks = prior_split->getBlocks();
195 const bool blocks_overlap =
196 !
blocks.empty() && !prior_blocks.empty() &&
197 std::any_of(
blocks.begin(),
199 [&prior_blocks](
const auto & block)
201 return std::find(prior_blocks.begin(), prior_blocks.end(), block) !=
204 if (!split->restrictsRegion() || !prior_split->restrictsRegion() || blocks_overlap)
207 "' is specified in both split '",
211 "', which are both part of split '",
215 prior_claims.emplace_back(split_name, split);
218 std::string sprefix = prefix +
"fieldsplit_" + split_name +
"_";
219 split->setup(nl, sprefix);
registerMooseObject("MooseApp", Split)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided.
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
const std::string & name() const
Get the name of the class.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Every object that can be built by the factory should be derived from this class.
static InputParameters validParams()
A struct for storing the various types of petsc options and values.
std::vector< std::pair< std::string, std::string > > pairs
PETSc key-value pairs.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Nonlinear system to be solved.
std::shared_ptr< Split > getSplit(const std::string &name)
Retrieves a split by name.
A class for creating restricted objects.
Base class for split-based preconditioners.
Split(const InputParameters ¶meters)
std::vector< BoundaryName > _sides
static InputParameters validParams()
virtual void setup(NonlinearSystemBase &nl, const std::string &prefix="")
MooseEnum _splitting_type
std::vector< NonlinearVariableName > _vars
"Variables Split operates on
std::vector< SubdomainName > _blocks
std::vector< BoundaryName > _unsides
FEProblemBase & _fe_problem
std::vector< std::string > _splitting
Split subsystem list.
MultiMooseEnum getCommonPetscFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc single options (flags)
void storePetscOptions(FEProblemBase &fe_problem, const std::string &prefix, const ParallelParamObject ¶m_object)
Stores the PETSc options supplied from the parameter object on the problem.
MultiMooseEnum getCommonPetscKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc iname options (keys in key-val...
std::string stringify(const T &t)
conversion to string