Go to the documentation of this file.
17 #include "libmesh/coupling_matrix.h"
28 params.
addParam<std::vector<std::string>>(
30 "The off diagonal row you want to add into the matrix, it will be associated "
31 "with an off diagonal column from the same position in off_diag_colum.");
32 params.
addParam<std::vector<std::string>>(
"off_diag_column",
33 "The off diagonal column you want to add into the "
34 "matrix, it will be associated with an off diagonal "
35 "row from the same position in off_diag_row.");
38 "Set to true if you want the full set of couplings. Simply "
39 "for convenience so you don't have to set every "
40 "off_diag_row and off_diag_column combination.");
41 params.
addParam<
bool>(
"implicit_geometric_coupling",
43 "Set to true if you want to add entries into the "
44 "matrix for degrees of freedom that might be coupled "
45 "by inspection of the geometric search objects.");
47 MooseEnum finite_difference_type(
"standard coloring",
"coloring");
49 finite_difference_type,
50 "standard: standard finite difference"
51 "coloring: finite difference based on coloring");
58 _finite_difference_type(getParam<
MooseEnum>(
"finite_difference_type"))
60 if (n_processors() > 1)
61 mooseWarning(
"Finite differencing to assemble the Jacobian is MUCH MUCH slower than forming "
62 "the Jacobian by hand, so don't complain about performance if you use it!");
67 std::unique_ptr<CouplingMatrix> cm = libmesh_make_unique<CouplingMatrix>(n_vars);
69 bool full = getParam<bool>(
"full");
78 for (
unsigned int i = 0; i < n_vars; i++)
82 std::vector<std::vector<unsigned int>> off_diag(n_vars);
83 for (
unsigned int i = 0; i < getParam<std::vector<std::string>>(
"off_diag_row").size(); i++)
89 (*cm)(row, column) = 1;
96 for (
unsigned int i = 0; i < n_vars; i++)
97 for (
unsigned int j = 0; j < n_vars; j++)
103 bool implicit_geometric_coupling = getParam<bool>(
"implicit_geometric_coupling");
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
static InputParameters validParams()
FiniteDifferencePreconditioner(const InputParameters ¶ms)
static InputParameters validParams()
FEProblemBase & _fe_problem
Subproblem this preconditioner is part of.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
registerMooseObjectAliased("MooseApp", FiniteDifferencePreconditioner, "FDP")
Finite difference preconditioner.
Base class for MOOSE preconditioners.
virtual unsigned int nVariables() const
Get the number of variables in this system.
defineLegacyParams(FiniteDifferencePreconditioner)
MooseEnum _finite_difference_type
void addImplicitGeometricCouplingEntriesToJacobian(bool add=true)
If called with true this will add entries into the jacobian to link together degrees of freedom that ...
void useFiniteDifferencedPreconditioner(bool use=true)
If called with true this system will use a finite differenced form of the Jacobian as the preconditio...
NonlinearSystemBase & getNonlinearSystemBase()
void setCouplingMatrix(std::unique_ptr< CouplingMatrix > cm)
Set custom coupling matrix.
Nonlinear system to be solved.
void mooseWarning(Args &&... args) const
unsigned int number() const
Get variable number coming from libMesh.