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 \"no 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 MooseEnum SplittingTypeEnum(
"additive multiplicative symmetric_multiplicative schur",
"additive");
45 params.
addParam<
MooseEnum>(
"splitting_type", SplittingTypeEnum,
"Split decomposition type");
47 MooseEnum SchurTypeEnum(
"full upper lower",
"full");
48 params.
addParam<
MooseEnum>(
"schur_type", SchurTypeEnum,
"Type of Schur complement");
58 "schur_pre", SchurPreEnum,
"Type of Schur complement preconditioner matrix");
62 "PETSc flags for the FieldSplit solver");
63 params.
addParam<std::vector<std::string>>(
"petsc_options_iname",
64 "PETSc option names for the FieldSplit solver");
65 params.
addParam<std::vector<std::string>>(
"petsc_options_value",
66 "PETSc option values for the FieldSplit solver");
75 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
76 _vars(getParam<
std::vector<NonlinearVariableName>>(
"vars")),
77 _blocks(getParam<
std::vector<SubdomainName>>(
"blocks")),
78 _sides(getParam<
std::vector<BoundaryName>>(
"sides")),
79 _unsides(getParam<
std::vector<BoundaryName>>(
"unsides")),
80 _splitting(getParam<
std::vector<
std::string>>(
"splitting")),
81 _splitting_type(getParam<
MooseEnum>(
"splitting_type")),
82 _schur_type(getParam<
MooseEnum>(
"schur_type")),
83 _schur_pre(getParam<
MooseEnum>(
"schur_pre"))
87 getParam<std::string, std::string>(
"petsc_options_iname",
"petsc_options_value");
100 std::string dmprefix = prefix +
"dm_moose_";
104 const auto & unside_by_var_boundary_name =
105 getParam<std::vector<BoundaryName>>(
"unside_by_var_boundary_name");
106 const auto & unside_by_var_var_name =
107 getParam<std::vector<NonlinearVariableName>>(
"unside_by_var_var_name");
109 std::vector<std::string> vector_of_pairs;
110 for (
const auto i :
index_range(unside_by_var_boundary_name))
111 vector_of_pairs.push_back(unside_by_var_boundary_name[i] +
":" + unside_by_var_var_name[i]);
121 for (
const auto & var :
_vars)
123 mooseError(
"Variable '", var,
"' specified in split '",
name(),
"' does not exist");
143 po.
pairs.emplace_back(prefix +
"pc_type",
"fieldsplit");
146 const std::string petsc_splitting_type[] = {
147 "additive",
"multiplicative",
"symmetric_multiplicative",
"schur"};
153 const std::string petsc_schur_type[] = {
"diag",
"upper",
"lower",
"full"};
154 po.
pairs.emplace_back(prefix +
"pc_fieldsplit_schur_fact_type",
158 const std::string petsc_schur_pre[] = {
"self",
"selfp",
"a11"};
159 po.
pairs.emplace_back(prefix +
"pc_fieldsplit_schur_precondition",
171 std::string sprefix = prefix +
"fieldsplit_" + split_name +
"_";
172 split->setup(nl, sprefix);
181 std::string op(item);
192 const std::string & op = option.first;
196 po.
pairs.emplace_back(prefix + op.substr(1), option.second);
virtual void setup(NonlinearSystemBase &nl, const std::string &prefix="-")
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.
const std::string & _name
The name of this class, reference to value stored in InputParameters.
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.
MultiMooseEnum flags
Single value PETSc options (flags)
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
Moose::PetscSupport::PetscOptions _petsc_options
Additional PETSc options.
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 push_back(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
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 It sho...
static InputParameters validParams()
auto index_range(const T &sizable)