10#include "libmesh/libmesh_config.h"
12#ifdef LIBMESH_HAVE_SLEPC
21#include "libmesh/petsc_vector.h"
22#include "libmesh/petsc_matrix.h"
23#include "libmesh/slepc_macro.h"
39 MooseEnum solve_type(
"POWER ARNOLDI KRYLOVSCHUR JACOBI_DAVIDSON "
40 "NONLINEAR_POWER NEWTON PJFNK PJFNKMO JFNK",
45 "POWER: Power / Inverse / RQI "
47 "KRYLOVSCHUR: Krylov-Schur "
48 "JACOBI_DAVIDSON: Jacobi-Davidson "
49 "NONLINEAR_POWER: Nonlinear Power "
51 "PJFNK: Preconditioned Jacobian-free Newton-Kyrlov"
52 "JFNK: Jacobian-free Newton-Kyrlov"
53 "PJFNKMO: Preconditioned Jacobian-free Newton-Kyrlov with Matrix Only");
60 params.
set<
Real>(
"l_tol") = 1e-2;
71 MooseEnum eigen_problem_type(
"HERMITIAN NON_HERMITIAN GEN_HERMITIAN GEN_NON_HERMITIAN "
72 "GEN_INDEFINITE POS_GEN_NON_HERMITIAN SLEPC_DEFAULT",
77 "Type of the eigenvalue problem we are solving "
78 "HERMITIAN: Hermitian "
79 "NON_HERMITIAN: Non-Hermitian "
80 "GEN_HERMITIAN: Generalized Hermitian "
81 "GEN_NON_HERMITIAN: Generalized Non-Hermitian "
82 "GEN_INDEFINITE: Generalized indefinite Hermitian "
83 "POS_GEN_NON_HERMITIAN: Generalized Non-Hermitian with positive (semi-)definite B "
84 "SLEPC_DEFAULT: Use whatever SLEPC has by default ");
87 MooseEnum which_eigen_pairs(
"LARGEST_MAGNITUDE SMALLEST_MAGNITUDE LARGEST_REAL SMALLEST_REAL "
88 "LARGEST_IMAGINARY SMALLEST_IMAGINARY TARGET_MAGNITUDE TARGET_REAL "
89 "TARGET_IMAGINARY ALL_EIGENVALUES SLEPC_DEFAULT");
92 "Which eigenvalue pairs to obtain from the solution "
105 params.
addParam<
unsigned int>(
"n_eigen_pairs", 1,
"The number of eigen pairs");
106 params.
addParam<
unsigned int>(
"n_basis_vectors", 3,
"The dimension of eigen subspaces");
108 params.
addParam<
Real>(
"eigen_tol", 1.0e-4,
"Relative Tolerance for Eigen Solver");
109 params.
addParam<
unsigned int>(
"eigen_max_its", 10000,
"Max Iterations for Eigen Solver");
111 params.
addParam<
Real>(
"l_abs_tol", 1e-50,
"Absolute Tolerances for Linear Solver");
113 params.
addParam<
unsigned int>(
"free_power_iterations", 4,
"The number of free power iterations");
116 "extra_power_iterations", 0,
"The number of extra free power iterations");
119 "eigen_problem_type which_eigen_pairs n_eigen_pairs n_basis_vectors eigen_tol eigen_max_its "
120 "free_power_iterations extra_power_iterations",
133 const auto prefix_with_dash =
'-' + solver_params.
_prefix;
136 "The solver system number must be initialized");
139 prefix_with_dash +
"eps_tol",
143 dont_add_these_options,
144 prefix_with_dash +
"eps_max_it",
153 dont_add_these_options,
154 prefix_with_dash +
"snes_max_it",
158 dont_add_these_options,
159 prefix_with_dash +
"snes_max_funcs",
163 dont_add_these_options,
164 prefix_with_dash +
"snes_atol",
168 dont_add_these_options,
169 prefix_with_dash +
"snes_rtol",
173 dont_add_these_options,
174 prefix_with_dash +
"snes_stol",
179 dont_add_these_options,
180 prefix_with_dash +
"ksp_max_it",
184 prefix_with_dash +
"ksp_rtol",
188 dont_add_these_options,
189 prefix_with_dash +
"ksp_atol",
196 dont_add_these_options,
197 prefix_with_dash +
"st_ksp_max_it",
201 prefix_with_dash +
"st_ksp_rtol",
205 dont_add_these_options,
206 prefix_with_dash +
"st_ksp_atol",
216 const std::string & eigen_problem_type = params.
get<
MooseEnum>(
"eigen_problem_type");
217 if (!eigen_problem_type.empty())
219 Moose::stringToEnum<Moose::EigenProblemType>(eigen_problem_type);
221 mooseError(
"Have to specify a valid eigen problem type");
223 const std::string & which_eigen_pairs = params.
get<
MooseEnum>(
"which_eigen_pairs");
224 if (!which_eigen_pairs.empty())
226 Moose::stringToEnum<Moose::WhichEigenPairs>(which_eigen_pairs);
232 unsigned int n_eigen_pairs = params.
get<
unsigned int>(
"n_eigen_pairs");
233 unsigned int n_basis_vectors = params.
get<
unsigned int>(
"n_basis_vectors");
237 eigen_problem.
es().
parameters.
set<
unsigned int>(
"eigenpairs") = n_eigen_pairs;
244 "Number of subspaces in Eigensolver is changed by moose because the value you set "
248 eigen_problem.
es().
parameters.
set<
unsigned int>(
"basis vectors") = n_basis_vectors;
281 mooseError(
"constant_matrices flag is only valid for solve type: PJFNKMO");
294 Moose::stringToEnum<Moose::EigenSolveType>(params.
get<
MooseEnum>(
"solve_type"));
309 "-eps_non_hermitian");
314 "-eps_gen_hermitian");
319 "-eps_gen_indefinite");
324 "-eps_gen_non_hermitian");
329 "-eps_pos_gen_non_hermitian");
348 "-eps_largest_magnitude");
353 "-eps_smallest_magnitude");
358 "-eps_largest_real");
363 "-eps_smallest_real");
368 "-eps_largest_imaginary");
373 "-eps_smallest_imaginary");
378 "-eps_target_magnitude");
388 "-eps_target_imaginary");
399 mooseError(
"Unknown type of WhichEigenPairs \n");
433#if !SLEPC_VERSION_LESS_THAN(3, 8, 0) || !PETSC_VERSION_RELEASE
435 bool initial_power = params.
get<
bool>(
"_newton_inverse_power");
448 "-init_eps_max_it",
stringify(params.
get<
unsigned int>(
"free_power_iterations")));
463#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
469 mooseError(
"Newton-based eigenvalue solver requires SLEPc 3.7.3 or higher");
476#if !SLEPC_VERSION_LESS_THAN(3, 8, 0) || !PETSC_VERSION_RELEASE
485#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
489 mooseError(
"Nonlinear Inverse Power requires SLEPc 3.7.3 or higher");
565 dont_add_these_options,
"-eps_power_sign_normalization",
"0", &eigen_problem);
577 PetscBool aisshell, bisshell;
590 auto & sys = eigen_nl.
sys();
591 SNES snes = eigen_nl.
getSNES();
598 if (aisshell || bisshell)
600 SETERRQ(PetscObjectComm((PetscObject)eps),
601 PETSC_ERR_ARG_INCOMP,
602 "A and B matrices can not be shell matrices when using PJFNKMO \n");
605 std::vector<Mat> mats = {A,
B};
606 std::vector<SparseMatrix<Number> *> libmesh_mats = {&sys.get_matrix_A(), &sys.get_matrix_B()};
622 if (dof_map.n_constrained_dofs())
626 dof_map.enforce_constraints_exactly(sys);
637 X_global.
swap(X_sys);
639 X_global.swap(X_sys);
643std::unique_ptr<NumericVector<Number>>
648 if (dof_map.n_constrained_dofs())
652 auto R = std::make_unique<PetscVector<Number>>(r, sys.
comm());
662 auto & sys = nl.sys();
665 updateCurrentLocalSolution(sys, x);
666 auto R = createWrappedResidual(sys, r);
672 if (dof_map.n_constrained_dofs())
686 auto & sys = nl.sys();
690 auto & petsc_all_dofs_mat = cast_ref<PetscMatrix<Number> &>(all_dofs_mat);
692 !dof_map.n_constrained_dofs() == (eigen_mat == petsc_all_dofs_mat.mat()),
693 "If we do not have constrained dofs, then eigen_mat and all_dofs_mat should be the same. "
694 "Conversely, if we do have constrained dofs, they must be different");
697 updateCurrentLocalSolution(sys, x);
704 if (dof_map.n_constrained_dofs())
714 std::vector<Mat> & eigen_mats,
717 const std::set<TagID> & tags)
721 auto & sys = nl.sys();
726 mooseAssert(!dof_map.n_constrained_dofs() ==
727 (eigen_mats[i] == cast_ptr<PetscMatrix<Number> *>(all_dofs_mats[i])->mat()),
728 "If we do not have constrained dofs, then mat and libmesh_mat should be the same. "
729 "Conversely, if we do have constrained dofs, they must be different");
732 updateCurrentLocalSolution(sys, x);
734 for (
auto *
const all_dofs_mat : all_dofs_mats)
736 all_dofs_mat->zero();
740 if (dof_map.n_constrained_dofs())
751 PetscErrorCode (*func)(SNES, Vec, Vec,
void *);
757 SNES snes = eigen_nl.
getSNES();
765 PetscObjectComm((PetscObject)snes), PETSC_ERR_ARG_INCOMP,
"Contexts are not consistent \n");
777 PetscBool jisshell, pisshell;
784 auto & sys = eigen_nl.
sys();
788 LibmeshPetscCallQ(PetscObjectTypeCompare((PetscObject)jac, MATSHELL, &jisshell));
796 EPS eps = eigen_nl.
getEPS();
809 if ((jisshell || jismffd) && pisshell)
831 if (!jisshell && !jismffd && !pisshell)
833 std::vector<Mat> mats = {jac, pc};
834 std::vector<SparseMatrix<Number> *> libmesh_mats = {&sys.
get_matrix_A(),
848 if (!jisshell && !jismffd)
863 PetscBool jshell, pshell;
870 auto & sys = eigen_nl.
sys();
877 if ((jshell || jismffd) && pshell)
888 if (jac != pc && (!jshell && !jshell))
889 SETERRQ(PetscObjectComm((PetscObject)snes),
890 PETSC_ERR_ARG_INCOMP,
891 "Jacobian and precond matrices should be the same for eigen kernels \n");
907 evaluateResidual(*eigen_problem, x, r, tag);
921 EPS eps = eigen_nl.
getEPS();
953 EPS eps = eigen_nl.
getEPS();
969 updateCurrentLocalSolution(eigen_nl.
sys(), x);
991 auto & sys = eigen_nl.
sys();
997 EPS eps = eigen_nl.
getEPS();
1018 updateCurrentLocalSolution(sys, x);
1025 updateCurrentLocalSolution(sys, x);
1026 auto AX = createWrappedResidual(sys, Ax);
1027 auto BX = createWrappedResidual(sys, Bx);
1038 if (dof_map.n_constrained_dofs())
1077 PetscObjectComposeFunction((PetscObject)mat,
1087 PetscObjectComposeFunction((PetscObject)mat,
1093 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1094 PetscObjectComposeFunction((PetscObject)mat,
1100 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1101 PetscObjectComposeFunction((PetscObject)mat,
1107 PetscContainer container;
1108 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1109 PetscContainerCreate(eigen_problem.
comm().
get(), &container));
1110 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1111 PetscContainerSetPointer(container, &eigen_problem));
1114 PetscObjectCompose((PetscObject)mat,
"formJacobianCtx", (PetscObject)container));
1117 PetscObjectCompose((PetscObject)mat,
"formFunctionCtx", (PetscObject)container));
1119 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1120 PetscObjectCompose((PetscObject)mat,
"formNormCtx", (PetscObject)container));
1122 LibmeshPetscCallA(eigen_problem.
comm().
get(), PetscContainerDestroy(&container));
1129 void *
ctx =
nullptr;
1133 mooseError(
"No context is set for shell matrix ");
1138 evaluateResidual(*eigen_problem, x, r, eigen_nl.
eigenVectorTag());
1150 void *
ctx =
nullptr;
1154 mooseError(
"No context is set for shell matrix ");
1167 LibmeshPetscCallA(eigen_problem.
comm().
get(), MatShellSetContext(mat, &eigen_problem));
1168 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1169 MatShellSetOperation(mat,
1175PETSC_EXTERN PetscErrorCode
1185PETSC_EXTERN PetscErrorCode
1213 LibmeshPetscCallQ(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERASCII, &iascii));
1225 PetscContainer container;
1230 PetscObjectQuery((PetscObject)Pmat,
"formFunctionCtx", (PetscObject *)&container));
1240 if (!preconditioner)
1241 mooseError(
"There is no moose preconditioner in nonlinear eigen system \n");
1246 preconditioner->apply(x_vec, y_vec);
1256 PetscContainer container;
1261 PetscObjectQuery((PetscObject)Pmat,
"formFunctionCtx", (PetscObject *)&container));
1271 if (!preconditioner)
1272 mooseError(
"There is no moose preconditioner in nonlinear eigen system \n");
1275 preconditioner->
init();
1277 preconditioner->
setup();
1288 EPSConvergedReason * reason,
1294 LibmeshPetscCallQ(EPSStoppingBasic(eps, its, max_it, nconv, nev, reason, NULL));
1304 *reason = EPS_CONVERGED_USER;
1313 PetscBool same, nonlinear;
1319 mooseError(
"It is not eps power, and there is no snes");
1324 mooseError(
"It is not a nonlinear eigen solver");
1335 const char * prefix =
nullptr;
1397 PetscScalar eigenr, eigeni;
1401 auto & console = eigen_problem->
console();
1410 auto eigenvalue = inverse ? 1.0 / eigenr : eigenr;
1413 console <<
" Iteration " << its << std::setprecision(10) << std::fixed
1414 << (inverse ?
" k-eigenvalue = " :
" eigenvalue = ") << eigenvalue << std::endl;
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_LINEAR
Problem for solving eigenvalue problems.
bool negativeSignEigenKernel() const
A flag indicates if a negative sign is used in eigen kernels.
void computeMatricesTags(const NumericVector< Number > &soln, const std::vector< SparseMatrix< Number > * > &jacobians, const std::set< TagID > &tags)
Form several matrices simultaneously.
bool onLinearSolver() const
Whether or not we are in a linear solver iteration.
bool constantMatrices() const
Whether or not matrices are constant.
void computeResidualAB(const NumericVector< Number > &soln, NumericVector< Number > &residualA, NumericVector< Number > &residualB, TagID tagA, TagID tagB)
Form two vetors, where each is associated with one tag, through one element-loop.
virtual void execute(const ExecFlagType &exec_type) override
Convenience function for performing execution of MOOSE systems.
bool bxNormProvided() const
Whether a Bx norm postprocessor has been provided.
bool doFreePowerIteration() const
Whether or not we are doing free power iteration.
NonlinearEigenSystem & getCurrentNonlinearEigenSystem()
virtual void computeJacobianTag(const NumericVector< Number > &soln, SparseMatrix< Number > &jacobian, TagID tag) override
Form a Jacobian matrix for all kernels and BCs with a given tag.
bool isNonlinearEigenvalueSolver(unsigned int eigen_sys_num) const
bool outputInverseEigenvalue() const
Whether or not to output eigenvalue inverse.
Real formNorm()
Form the Bx norm.
bool wereMatricesFormed() const
Whether or not constant matrices were already formed.
void setNEigenPairsRequired(unsigned int n_eigen_pairs)
virtual void computeResidualTag(const NumericVector< Number > &soln, NumericVector< Number > &residual, TagID tag) override
Form a vector for all kernels and BCs with a given tag.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual libMesh::EquationSystems & es() override
virtual std::size_t numNonlinearSystems() const override
void setCoupling(Moose::CouplingType type)
Set the coupling between variables TODO: allow user-defined coupling.
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
bool constJacobian() const
Returns _const_jacobian (whether a MOOSE object has specified that the Jacobian is the same as the pr...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MultiMooseEnum dont_add_these_options
Flags to explicitly not set, even if they are specified programmatically.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Nonlinear eigenvalue system to be solved.
TagID eigenVectorTag() const
Vector tag ID of right hand side.
TagID nonEigenVectorTag() const
Vector tag ID of left hand side.
virtual SNES getSNES() override
Retrieve snes from slepc eigen solver.
TagID precondMatrixTag() const
libMesh::Preconditioner< Number > * preconditioner() const
TagID nonEigenMatrixTag() const
Matrix tag ID of left hand side.
TagID eigenMatrixTag() const
Matrix tag ID of right hand side.
libMesh::CondensedEigenSystem & sys()
virtual EPS getEPS()
Retrieve EPS (SLEPc eigen solver)
const ConsoleStream & console() const
Return console handle.
unsigned int _solver_sys_num
Moose::WhichEigenPairs _which_eigen_pairs
Moose::EigenSolveType _eigen_solve_type
bool _customized_pc_for_eigen
Moose::EigenProblemType _eigen_problem_type
bool _precond_matrix_free
bool _eigen_matrix_vector_mult
unsigned int number() const
Gets the number of this system.
void copy_super_to_sub(NumericVector< Number > &super, NumericVector< Number > &sub)
void copy_sub_to_super(const NumericVector< Number > &sub, NumericVector< Number > &super)
const SparseMatrix< Number > & get_matrix_B() const
const SparseMatrix< Number > & get_precond_matrix() const
const SparseMatrix< Number > & get_matrix_A() const
const Parallel::Communicator & comm() const
T & set(const std::string &)
virtual void swap(NumericVector< T > &v) override
virtual bool initialized() const
std::unique_ptr< NumericVector< Number > > current_local_solution
std::unique_ptr< NumericVector< Number > > solution
const DofMap & get_dof_map() const
void petscSetOptions(const PetscOptions &po, const SolverParams &solver_params, FEProblemBase *const problem=nullptr)
A function for setting the PETSc options in PETSc from the options supplied to MOOSE.
void petscSetDefaultKSPNormType(FEProblemBase &problem, KSP ksp)
Set norm type.
void addPetscOptionsFromCommandline(FEProblemBase *const problem=nullptr)
Insert command-line PETSc options into the active PETSc options database.
void petscSetDefaultPCSide(FEProblemBase &problem, KSP ksp)
Setup which side we want to apply preconditioner.
void setSinglePetscOptionIfAppropriate(const MultiMooseEnum &dont_add_these_options, const std::string &name, const std::string &value="", FEProblemBase *const problem=nullptr)
Same as setSinglePetscOption, but does not set the option if it doesn't make sense for the current si...
void setSinglePetscOption(const std::string &name, const std::string &value="", FEProblemBase *const problem=nullptr)
A wrapper function for dealing with different versions of PetscOptionsSetValue.
PETSC_EXTERN PetscErrorCode registerPCToPETSc()
Let PETSc know there is a preconditioner.
void moosePetscSNESFormMatricesTags(SNES snes, Vec x, std::vector< Mat > &eigen_mats, std::vector< SparseMatrix< Number > * > &all_dofs_mats, void *ctx, const std::set< TagID > &tags)
Form multiple matrices for multiple tags.
void setFreeNonlinearPowerIterations(unsigned int free_power_iterations)
Set SLEPc/PETSc options to trigger free power iteration.
PetscErrorCode mooseSlepcEPSSNESKSPSetPCSide(FEProblemBase &problem, EPS eps)
Allow users to specify PC side.
PetscErrorCode PCSetUp_MoosePC(PC pc)
Setup preconditioner.
void slepcSetOptions(EigenProblem &eigen_problem, SolverParams &solver_params, const InputParameters ¶ms)
Push all SLEPc/PETSc options into SLEPc/PETSc side.
PetscErrorCode mooseSlepcEigenFormFunctionMFFD(void *ctx, Vec x, Vec r)
Function call for MFFD.
PETSC_EXTERN PetscErrorCode PCCreate_MoosePC(PC pc)
Create a preconditioner from moose side.
PetscErrorCode mooseSlepcEigenFormNorm(SNES, Vec, PetscReal *norm, void *ctx)
void moosePetscSNESFormFunction(SNES, Vec x, Vec r, void *ctx, TagID tag)
PetscErrorCode mooseSlepcEPSGetSNES(EPS eps, SNES *snes)
Retrieve SNES from EPS.
PetscErrorCode mooseSlepcEPSSNESSetCustomizePC(EPS eps)
Attach a customized PC.
const int subspace_factor
PetscErrorCode mooseSlepcEigenFormFunctionB(SNES snes, Vec x, Vec r, void *ctx)
Form function residual Bx.
PetscErrorCode mooseSlepcEigenFormFunctionAB(SNES snes, Vec x, Vec Ax, Vec Bx, void *ctx)
Form function residual Ax-Bx.
void setOperationsForShellMat(EigenProblem &eigen_problem, Mat mat, bool eigen)
Set operations to shell mat.
void setWhichEigenPairsOptions(SolverParams &solver_params, const MultiMooseEnum &dont_add_these_options)
InputParameters getSlepcEigenProblemValidParams()
Retrieve valid params that allow users to specify eigen problem configuration.
PetscErrorCode mooseMatMult_NonEigen(Mat mat, Vec x, Vec y)
Implement MatMult via function evaluation for Ax.
void setNewtonPetscOptions(SolverParams &solver_params, const InputParameters ¶ms)
void moosePetscSNESFormMatrixTag(SNES snes, Vec x, Mat eigen_mat, SparseMatrix< Number > &all_dofs_mat, void *ctx, TagID tag)
Form matrix according to tag.
InputParameters getSlepcValidParams(InputParameters ¶ms)
void setSlepcEigenSolverTolerances(EigenProblem &eigen_problem, const SolverParams &solver_params, const InputParameters ¶ms)
Control eigen solver tolerances via SLEPc options.
void setEigenProblemSolverParams(EigenProblem &eigen_problem, const InputParameters ¶ms)
Retrieve eigen problem params from 'params', and then set these params into SolverParams.
PetscErrorCode mooseSlepcEigenFormJacobianA(SNES snes, Vec x, Mat jac, Mat pc, void *ctx)
Form Jacobian matrix A.
PetscErrorCode mooseSlepcEPSSNESSetUpOptionPrefix(EPS eps)
Get rid of prefix "-eps_power" for SNES, KSP, PC, etc.
PetscErrorCode mooseEPSFormMatrices(EigenProblem &eigen_problem, EPS eps, Vec x, void *ctx)
void storeSolveType(FEProblemBase &fe_problem, const InputParameters ¶ms)
Set solve type into eigen problem (solverParams)
PetscErrorCode PCDestroy_MoosePC(PC pc)
Destroy preconditioner.
PetscErrorCode mooseSlepcEPSMonitor(EPS eps, PetscInt its, PetscInt nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal *errest, PetscInt nest, void *mctx)
A customized solver monitor to print out eigenvalue.
PetscErrorCode mooseMatMult_Eigen(Mat mat, Vec x, Vec y)
Implement MatMult via function evaluation for Bx.
void setEigenSolverOptions(SolverParams &solver_params, const InputParameters ¶ms)
void attachCallbacksToMat(EigenProblem &eigen_problem, Mat mat, bool eigen)
Attach call backs to mat.
PetscErrorCode mooseSlepcEigenFormFunctionA(SNES snes, Vec x, Vec r, void *ctx)
Form function residual Ax.
void setEigenProblemOptions(SolverParams &solver_params, const MultiMooseEnum &dont_add_these_options)
PetscErrorCode PCApply_MoosePC(PC pc, Vec x, Vec y)
Preconditioner application.
PetscErrorCode PCView_MoosePC(PC pc, PetscViewer viewer)
View preconditioner.
void setNonlinearPowerOptions(SolverParams &solver_params)
void clearFreeNonlinearPowerIterations(const InputParameters ¶ms)
PetscErrorCode mooseSlepcStoppingTest(EPS eps, PetscInt its, PetscInt max_it, PetscInt nconv, PetscInt nev, EPSConvergedReason *reason, void *ctx)
A customized convergence checker.
PetscErrorCode mooseSlepcEigenFormJacobianB(SNES snes, Vec x, Mat jac, Mat pc, void *ctx)
Form Jacobian matrix B.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::string stringify(const T &t)
conversion to string
@ WEP_TARGET_MAGNITUDE
target magnitude
@ WEP_LARGEST_IMAGINARY
largest imaginary
@ WEP_TARGET_IMAGINARY
target imaginary
@ WEP_SMALLEST_REAL
smallest real
@ WEP_SLEPC_DEFAULT
use whatever we have in SLEPC
@ WEP_LARGEST_MAGNITUDE
largest magnitude
@ WEP_SMALLEST_MAGNITUDE
smallest magnitude
@ WEP_ALL_EIGENVALUES
all eigenvalues
@ WEP_SMALLEST_IMAGINARY
smallest imaginary
@ WEP_TARGET_REAL
target real
@ WEP_LARGEST_REAL
largest real
@ EST_PJFNKMO
The same as PJFNK except that matrix-vector multiplication is employed to replace residual evaluation...
@ EST_JACOBI_DAVIDSON
Jacobi-Davidson.
@ EST_KRYLOVSCHUR
Krylov-Schur.
@ EST_JFNK
Jacobian-free Newton Krylov.
@ EST_NEWTON
Newton-based eigensolver with an assembled Jacobian matrix (fully coupled by default)
@ EST_POWER
Power / Inverse / RQI.
@ EST_NONLINEAR_POWER
Nonlinear inverse power.
@ EST_PJFNK
Preconditioned Jacobian-free Newton Krylov.
@ EPT_GEN_INDEFINITE
Generalized Hermitian indefinite.
@ EPT_NON_HERMITIAN
Non-Hermitian.
@ EPT_GEN_HERMITIAN
Generalized Hermitian.
@ EPT_HERMITIAN
Hermitian.
@ EPT_GEN_NON_HERMITIAN
Generalized Non-Hermitian.
@ EPT_POS_GEN_NON_HERMITIAN
Generalized Non-Hermitian with positive (semi-)definite B.
@ EPT_SLEPC_DEFAULT
use whatever SLPEC has by default
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
auto index_range(const T &sizable)
void libmesh_ignore(const Args &...)
const unsigned int invalid_uint
LibmeshPetscCallQ(DMShellGetContext(dm, &ctx))
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)