51 : Base(parameters),
52 _nl(this->_fe_problem.getNonlinearSystemBase(this->_nl_sys_num)),
54{
56 mooseError(
"The field split preconditioner can only be used with PETSc");
57
58
60
61
62
63 bool full = this->template getParam<bool>("full");
64
65
66 std::unique_ptr<CouplingMatrix> cm = std::make_unique<CouplingMatrix>(n_vars);
67 if (!full)
68 {
69 if (this->isParamValid("off_diag_row") && this->isParamValid("off_diag_column"))
70 {
71
72 const auto off_diag_rows =
73 this->template getParam<std::vector<NonlinearVariableName>>("off_diag_row");
74 const auto off_diag_columns =
75 this->template getParam<std::vector<NonlinearVariableName>>("off_diag_column");
76
77
78 for (
unsigned int i = 0; i <
n_vars; i++)
79 (*cm)(i, i) = 1;
80
81
82 std::vector<std::vector<unsigned int>> off_diag(n_vars);
83 if (off_diag_rows.size() * off_diag_columns.size() != 0 &&
84 off_diag_rows.size() == off_diag_columns.size())
86 {
89 (*cm)(row, column) = 1;
90 }
91 }
92 }
93 else
94 {
95 for (
unsigned int i = 0; i <
n_vars; i++)
96 for (
unsigned int j = 0; j <
n_vars; j++)
97 (*cm)(i, j) = 1;
98 }
99 this->setCouplingMatrix(std::move(cm));
100
101
103}
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()