49 : Base(parameters),
50 _nl(this->_fe_problem.getNonlinearSystemBase(this->_nl_sys_num)),
52{
54 mooseError(
"The field split preconditioner can only be used with PETSc");
55
56
58
59
60
61 bool full = this->template getParam<bool>("full");
62
63
64 std::unique_ptr<CouplingMatrix> cm = std::make_unique<CouplingMatrix>(n_vars);
65 if (!full)
66 {
67 if (this->isParamValid("off_diag_row") && this->isParamValid("off_diag_column"))
68 {
69
70 const auto off_diag_rows =
71 this->template getParam<std::vector<NonlinearVariableName>>("off_diag_row");
72 const auto off_diag_columns =
73 this->template getParam<std::vector<NonlinearVariableName>>("off_diag_column");
74
75
76 for (
unsigned int i = 0; i <
n_vars; i++)
77 (*cm)(i, i) = 1;
78
79
80 std::vector<std::vector<unsigned int>> off_diag(n_vars);
81 if (off_diag_rows.size() * off_diag_columns.size() != 0 &&
82 off_diag_rows.size() == off_diag_columns.size())
84 {
87 (*cm)(row, column) = 1;
88 }
89 }
90 }
91 else
92 {
93 for (
unsigned int i = 0; i <
n_vars; i++)
94 for (
unsigned int j = 0; j <
n_vars; j++)
95 (*cm)(i, j) = 1;
96 }
97 this->setCouplingMatrix(std::move(cm));
98
99
101}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
std::string _decomposition_split
The decomposition split.
NonlinearSystemBase & _nl
The nonlinear system this FSP is associated with (convenience reference)
unsigned int number() const
Get variable number coming from libMesh.
void useFieldSplitPreconditioner(FieldSplitPreconditionerBase *fsp)
If called with a non-null object true this system will use a field split preconditioner matrix.
virtual unsigned int nVariables() const
Get the number of variables in this system.
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
auto index_range(const T &sizable)
SolverPackage default_solver_package()