25 params.
addParam<std::vector<NonlinearVariableName>>(
26 "vars", {},
"Variables Split operates on (omitting this implies \"all variables\"");
27 params.
addParam<std::vector<SubdomainName>>(
28 "blocks", {},
"Mesh blocks Split operates on (omitting this implies \"all blocks\"");
29 params.
addParam<std::vector<BoundaryName>>(
30 "sides", {},
"Sidesets Split operates on (omitting this implies \"all sidesets\")");
31 params.
addParam<std::vector<BoundaryName>>(
34 "Sidesets Split excludes (omitting this implies \"do not exclude any sidesets\")");
35 params.
addParam<std::vector<std::string>>(
36 "splitting", {},
"The names of the splits (subsystems) in the decomposition of this split");
37 params.
addParam<std::vector<BoundaryName>>(
38 "unside_by_var_boundary_name",
39 "A map from boundary name to unside by variable, e.g. only unside for a given variable.");
40 params.
addParam<std::vector<NonlinearVariableName>>(
41 "unside_by_var_var_name",
42 "A map from boundary name to unside by variable, e.g. only unside for a given variable.");
44 "Sideset restriction");
46 MooseEnum SplittingTypeEnum(
"additive multiplicative symmetric_multiplicative schur",
"additive");
47 params.
addParam<
MooseEnum>(
"splitting_type", SplittingTypeEnum,
"Split decomposition type");
49 MooseEnum SchurTypeEnum(
"diag upper lower full",
"full");
50 params.
addParam<
MooseEnum>(
"schur_type", SchurTypeEnum,
"Type of Schur complement");
60 "schur_pre", SchurPreEnum,
"Type of Schur complement preconditioner matrix");
64 "PETSc flags for the FieldSplit solver");
67 "PETSc option names for the FieldSplit solver");
68 params.
addParam<std::vector<std::string>>(
"petsc_options_value",
69 "PETSc option values for the FieldSplit solver");
79 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
80 _vars(getParam<
std::vector<NonlinearVariableName>>(
"vars")),
81 _blocks(getParam<
std::vector<SubdomainName>>(
"blocks")),
82 _sides(getParam<
std::vector<BoundaryName>>(
"sides")),
83 _unsides(getParam<
std::vector<BoundaryName>>(
"unsides")),
84 _splitting(getParam<
std::vector<
std::string>>(
"splitting")),
85 _splitting_type(getParam<
MooseEnum>(
"splitting_type")),
86 _schur_type(getParam<
MooseEnum>(
"schur_type")),
87 _schur_pre(getParam<
MooseEnum>(
"schur_pre"))
101 std::string dmprefix = prefix +
"dm_moose_";
105 const auto & unside_by_var_boundary_name =
106 getParam<std::vector<BoundaryName>>(
"unside_by_var_boundary_name");
107 const auto & unside_by_var_var_name =
108 getParam<std::vector<NonlinearVariableName>>(
"unside_by_var_var_name");
110 std::vector<std::string> vector_of_pairs;
111 for (
const auto i :
index_range(unside_by_var_boundary_name))
112 vector_of_pairs.push_back(unside_by_var_boundary_name[i] +
":" + unside_by_var_var_name[i]);
122 for (
const auto & var :
_vars)
124 mooseError(
"Variable '", var,
"' specified in split '",
name(),
"' does not exist");
144 po.
pairs.emplace_back(prefix +
"pc_type",
"fieldsplit");
147 const std::string petsc_splitting_type[] = {
148 "additive",
"multiplicative",
"symmetric_multiplicative",
"schur"};
154 const std::string petsc_schur_type[] = {
"diag",
"upper",
"lower",
"full"};
155 po.
pairs.emplace_back(prefix +
"pc_fieldsplit_schur_fact_type",
159 const std::string petsc_schur_pre[] = {
"self",
"selfp",
"a11"};
160 po.
pairs.emplace_back(prefix +
"pc_fieldsplit_schur_precondition",
172 std::string sprefix = prefix +
"fieldsplit_" + split_name +
"_";
173 split->setup(nl, sprefix);
virtual void setup(NonlinearSystemBase &nl, const std::string &prefix="-")
MultiMooseEnum getCommonPetscKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc iname options (keys in key-val...
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)
A class for creating restricted objects.
Base class for split-based preconditioners.
std::vector< SubdomainName > _blocks
std::vector< NonlinearVariableName > _vars
"Variables Split operates on
registerMooseObject("MooseApp", Split)
std::vector< std::string > _splitting
Split subsystem list.
A struct for storing the various types of petsc options and values.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided...
std::vector< std::pair< std::string, std::string > > pairs
PETSc key-value pairs.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
FEProblemBase & _fe_problem
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Nonlinear system to be solved.
std::vector< BoundaryName > _sides
MooseEnum _splitting_type
MultiMooseEnum getCommonPetscFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc single options (flags) ...
std::vector< BoundaryName > _unsides
Every object that can be built by the factory should be derived from this class.
std::shared_ptr< Split > getSplit(const std::string &name)
Retrieves a split by name.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::string stringify(const T &t)
conversion to string
Split(const InputParameters ¶meters)
static InputParameters validParams()
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
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.
static InputParameters validParams()
auto index_range(const T &sizable)