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"
37 MooseEnum solve_type(
"POWER ARNOLDI KRYLOVSCHUR JACOBI_DAVIDSON "
38 "NONLINEAR_POWER NEWTON PJFNK PJFNKMO JFNK",
43 "POWER: Power / Inverse / RQI "
45 "KRYLOVSCHUR: Krylov-Schur "
46 "JACOBI_DAVIDSON: Jacobi-Davidson "
47 "NONLINEAR_POWER: Nonlinear Power "
49 "PJFNK: Preconditioned Jacobian-free Newton-Kyrlov"
50 "JFNK: Jacobian-free Newton-Kyrlov"
51 "PJFNKMO: Preconditioned Jacobian-free Newton-Kyrlov with Matrix Only");
58 params.
set<Real>(
"l_tol") = 1e-2;
69 MooseEnum eigen_problem_type(
"HERMITIAN NON_HERMITIAN GEN_HERMITIAN GEN_NON_HERMITIAN "
70 "GEN_INDEFINITE POS_GEN_NON_HERMITIAN SLEPC_DEFAULT",
75 "Type of the eigenvalue problem we are solving "
76 "HERMITIAN: Hermitian "
77 "NON_HERMITIAN: Non-Hermitian "
78 "GEN_HERMITIAN: Generalized Hermitian "
79 "GEN_NON_HERMITIAN: Generalized Non-Hermitian "
80 "GEN_INDEFINITE: Generalized indefinite Hermitian "
81 "POS_GEN_NON_HERMITIAN: Generalized Non-Hermitian with positive (semi-)definite B "
82 "SLEPC_DEFAULT: Use whatever SLEPC has by default ");
85 MooseEnum which_eigen_pairs(
"LARGEST_MAGNITUDE SMALLEST_MAGNITUDE LARGEST_REAL SMALLEST_REAL "
86 "LARGEST_IMAGINARY SMALLEST_IMAGINARY TARGET_MAGNITUDE TARGET_REAL "
87 "TARGET_IMAGINARY ALL_EIGENVALUES SLEPC_DEFAULT");
90 "Which eigenvalue pairs to obtain from the solution "
103 params.
addParam<
unsigned int>(
"n_eigen_pairs", 1,
"The number of eigen pairs");
104 params.
addParam<
unsigned int>(
"n_basis_vectors", 3,
"The dimension of eigen subspaces");
106 params.
addParam<Real>(
"eigen_tol", 1.0e-4,
"Relative Tolerance for Eigen Solver");
107 params.
addParam<
unsigned int>(
"eigen_max_its", 10000,
"Max Iterations for Eigen Solver");
109 params.
addParam<Real>(
"l_abs_tol", 1e-50,
"Absolute Tolerances for Linear Solver");
111 params.
addParam<
unsigned int>(
"free_power_iterations", 4,
"The number of free power iterations");
114 "extra_power_iterations", 0,
"The number of extra free power iterations");
117 "eigen_problem_type which_eigen_pairs n_eigen_pairs n_basis_vectors eigen_tol eigen_max_its "
118 "free_power_iterations extra_power_iterations",
131 const auto prefix_with_dash =
'-' + solver_params.
_prefix;
134 "The solver system number must be initialized");
137 prefix_with_dash +
"eps_tol",
141 dont_add_these_options,
142 prefix_with_dash +
"eps_max_it",
151 dont_add_these_options,
152 prefix_with_dash +
"snes_max_it",
156 dont_add_these_options,
157 prefix_with_dash +
"snes_max_funcs",
161 dont_add_these_options,
162 prefix_with_dash +
"snes_atol",
166 dont_add_these_options,
167 prefix_with_dash +
"snes_rtol",
171 dont_add_these_options,
172 prefix_with_dash +
"snes_stol",
177 dont_add_these_options,
178 prefix_with_dash +
"ksp_max_it",
182 prefix_with_dash +
"ksp_rtol",
186 dont_add_these_options,
187 prefix_with_dash +
"ksp_atol",
194 dont_add_these_options,
195 prefix_with_dash +
"st_ksp_max_it",
199 prefix_with_dash +
"st_ksp_rtol",
203 dont_add_these_options,
204 prefix_with_dash +
"st_ksp_atol",
214 const std::string & eigen_problem_type = params.
get<
MooseEnum>(
"eigen_problem_type");
215 if (!eigen_problem_type.empty())
217 Moose::stringToEnum<Moose::EigenProblemType>(eigen_problem_type);
219 mooseError(
"Have to specify a valid eigen problem type");
221 const std::string & which_eigen_pairs = params.
get<
MooseEnum>(
"which_eigen_pairs");
222 if (!which_eigen_pairs.empty())
224 Moose::stringToEnum<Moose::WhichEigenPairs>(which_eigen_pairs);
230 unsigned int n_eigen_pairs = params.
get<
unsigned int>(
"n_eigen_pairs");
231 unsigned int n_basis_vectors = params.
get<
unsigned int>(
"n_basis_vectors");
235 eigen_problem.
es().
parameters.
set<
unsigned int>(
"eigenpairs") = n_eigen_pairs;
242 "Number of subspaces in Eigensolver is changed by moose because the value you set "
246 eigen_problem.
es().
parameters.
set<
unsigned int>(
"basis vectors") = n_basis_vectors;
279 mooseError(
"constant_matrices flag is only valid for solve type: PJFNKMO");
292 Moose::stringToEnum<Moose::EigenSolveType>(params.
get<
MooseEnum>(
"solve_type"));
307 "-eps_non_hermitian");
312 "-eps_gen_hermitian");
317 "-eps_gen_indefinite");
322 "-eps_gen_non_hermitian");
327 "-eps_pos_gen_non_hermitian");
346 "-eps_largest_magnitude");
351 "-eps_smallest_magnitude");
356 "-eps_largest_real");
361 "-eps_smallest_real");
366 "-eps_largest_imaginary");
371 "-eps_smallest_imaginary");
376 "-eps_target_magnitude");
386 "-eps_target_imaginary");
397 mooseError(
"Unknown type of WhichEigenPairs \n");
431#if !SLEPC_VERSION_LESS_THAN(3, 8, 0) || !PETSC_VERSION_RELEASE
433 bool initial_power = params.
get<
bool>(
"_newton_inverse_power");
446 "-init_eps_max_it",
stringify(params.
get<
unsigned int>(
"free_power_iterations")));
461#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
467 mooseError(
"Newton-based eigenvalue solver requires SLEPc 3.7.3 or higher");
474#if !SLEPC_VERSION_LESS_THAN(3, 8, 0) || !PETSC_VERSION_RELEASE
483#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
487 mooseError(
"Nonlinear Inverse Power requires SLEPc 3.7.3 or higher");
495 libmesh_ignore(params);
563 dont_add_these_options,
"-eps_power_sign_normalization",
"0", &eigen_problem);
575 PetscBool aisshell, bisshell;
588 auto & sys = eigen_nl.
sys();
589 SNES snes = eigen_nl.
getSNES();
596 if (aisshell || bisshell)
598 SETERRQ(PetscObjectComm((PetscObject)eps),
599 PETSC_ERR_ARG_INCOMP,
600 "A and B matrices can not be shell matrices when using PJFNKMO \n");
603 std::vector<Mat> mats = {A,
B};
604 std::vector<SparseMatrix<Number> *> libmesh_mats = {&sys.get_matrix_A(), &sys.get_matrix_B()};
618 PetscVector<Number> X_global(x, sys.
comm());
620 if (dof_map.n_constrained_dofs())
624 dof_map.enforce_constraints_exactly(sys);
629 PetscVector<Number> & X_sys = *cast_ptr<PetscVector<Number> *>(sys.
solution.get());
635 X_global.swap(X_sys);
637 X_global.swap(X_sys);
641std::unique_ptr<NumericVector<Number>>
646 if (dof_map.n_constrained_dofs())
650 auto R = std::make_unique<PetscVector<Number>>(r, sys.
comm());
660 auto & sys = nl.sys();
663 updateCurrentLocalSolution(sys, x);
664 auto R = createWrappedResidual(sys, r);
670 if (dof_map.n_constrained_dofs())
672 PetscVector<Number> sub_r(r, sys.
comm());
680 SNES , Vec x, Mat eigen_mat, SparseMatrix<Number> & all_dofs_mat,
void * ctx,
TagID tag)
684 auto & sys = nl.sys();
688 auto & petsc_all_dofs_mat = cast_ref<PetscMatrix<Number> &>(all_dofs_mat);
690 !dof_map.n_constrained_dofs() == (eigen_mat == petsc_all_dofs_mat.mat()),
691 "If we do not have constrained dofs, then eigen_mat and all_dofs_mat should be the same. "
692 "Conversely, if we do have constrained dofs, they must be different");
695 updateCurrentLocalSolution(sys, x);
702 if (dof_map.n_constrained_dofs())
704 PetscMatrix<Number> wrapped_eigen_mat(eigen_mat, sys.
comm());
712 std::vector<Mat> & eigen_mats,
713 std::vector<SparseMatrix<Number> *> & all_dofs_mats,
715 const std::set<TagID> & tags)
719 auto & sys = nl.sys();
723 for (
const auto i : index_range(eigen_mats))
724 mooseAssert(!dof_map.n_constrained_dofs() ==
725 (eigen_mats[i] == cast_ptr<PetscMatrix<Number> *>(all_dofs_mats[i])->mat()),
726 "If we do not have constrained dofs, then mat and libmesh_mat should be the same. "
727 "Conversely, if we do have constrained dofs, they must be different");
730 updateCurrentLocalSolution(sys, x);
732 for (
auto *
const all_dofs_mat : all_dofs_mats)
734 all_dofs_mat->zero();
738 if (dof_map.n_constrained_dofs())
739 for (
const auto i : index_range(eigen_mats))
741 PetscMatrix<Number> wrapped_eigen_mat(eigen_mats[i], sys.
comm());
749 PetscErrorCode (*func)(SNES, Vec, Vec,
void *);
755 SNES snes = eigen_nl.
getSNES();
763 PetscObjectComm((PetscObject)snes), PETSC_ERR_ARG_INCOMP,
"Contexts are not consistent \n");
775 PetscBool jisshell, pisshell;
782 auto & sys = eigen_nl.
sys();
786 LibmeshPetscCallQ(PetscObjectTypeCompare((PetscObject)jac, MATSHELL, &jisshell));
794 EPS eps = eigen_nl.
getEPS();
807 if ((jisshell || jismffd) && pisshell)
829 if (!jisshell && !jismffd && !pisshell)
831 std::vector<Mat> mats = {jac, pc};
832 std::vector<SparseMatrix<Number> *> libmesh_mats = {&sys.
get_matrix_A(),
846 if (!jisshell && !jismffd)
861 PetscBool jshell, pshell;
868 auto & sys = eigen_nl.
sys();
875 if ((jshell || jismffd) && pshell)
886 if (jac != pc && (!jshell && !jshell))
887 SETERRQ(PetscObjectComm((PetscObject)snes),
888 PETSC_ERR_ARG_INCOMP,
889 "Jacobian and precond matrices should be the same for eigen kernels \n");
905 evaluateResidual(*eigen_problem, x, r, tag);
919 EPS eps = eigen_nl.
getEPS();
951 EPS eps = eigen_nl.
getEPS();
967 updateCurrentLocalSolution(eigen_nl.
sys(), x);
989 auto & sys = eigen_nl.
sys();
995 EPS eps = eigen_nl.
getEPS();
1016 updateCurrentLocalSolution(sys, x);
1023 updateCurrentLocalSolution(sys, x);
1024 auto AX = createWrappedResidual(sys, Ax);
1025 auto BX = createWrappedResidual(sys, Bx);
1036 if (dof_map.n_constrained_dofs())
1038 PetscVector<Number> sub_Ax(Ax, sys.
comm());
1040 PetscVector<Number> sub_Bx(Bx, sys.
comm());
1054 auto *
const eigen_problem =
static_cast<EigenProblem *
>(ctx);
1075 PetscObjectComposeFunction((PetscObject)mat,
1085 PetscObjectComposeFunction((PetscObject)mat,
1091 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1092 PetscObjectComposeFunction((PetscObject)mat,
1098 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1099 PetscObjectComposeFunction((PetscObject)mat,
1105 PetscContainer container;
1106 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1107 PetscContainerCreate(eigen_problem.
comm().
get(), &container));
1108 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1109 PetscContainerSetPointer(container, &eigen_problem));
1112 PetscObjectCompose((PetscObject)mat,
"formJacobianCtx", (PetscObject)container));
1115 PetscObjectCompose((PetscObject)mat,
"formFunctionCtx", (PetscObject)container));
1117 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1118 PetscObjectCompose((PetscObject)mat,
"formNormCtx", (PetscObject)container));
1120 LibmeshPetscCallA(eigen_problem.
comm().
get(), PetscContainerDestroy(&container));
1127 void * ctx =
nullptr;
1131 mooseError(
"No context is set for shell matrix ");
1136 evaluateResidual(*eigen_problem, x, r, eigen_nl.
eigenVectorTag());
1148 void * ctx =
nullptr;
1152 mooseError(
"No context is set for shell matrix ");
1165 LibmeshPetscCallA(eigen_problem.
comm().
get(), MatShellSetContext(mat, &eigen_problem));
1166 LibmeshPetscCallA(eigen_problem.
comm().
get(),
1167 MatShellSetOperation(mat,
1173PETSC_EXTERN PetscErrorCode
1183PETSC_EXTERN PetscErrorCode
1211 LibmeshPetscCallQ(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERASCII, &iascii));
1223 PetscContainer container;
1228 PetscObjectQuery((PetscObject)Pmat,
"formFunctionCtx", (PetscObject *)&container));
1238 if (!preconditioner)
1239 mooseError(
"There is no moose preconditioner in nonlinear eigen system \n");
1241 PetscVector<Number> x_vec(x, preconditioner->comm());
1242 PetscVector<Number> y_vec(y, preconditioner->comm());
1244 preconditioner->apply(x_vec, y_vec);
1254 PetscContainer container;
1259 PetscObjectQuery((PetscObject)Pmat,
"formFunctionCtx", (PetscObject *)&container));
1267 Preconditioner<Number> * preconditioner = nl_eigen.
preconditioner();
1269 if (!preconditioner)
1270 mooseError(
"There is no moose preconditioner in nonlinear eigen system \n");
1272 if (!preconditioner->initialized())
1273 preconditioner->init();
1275 preconditioner->setup();
1286 EPSConvergedReason * reason,
1292 LibmeshPetscCallQ(EPSStoppingBasic(eps, its, max_it, nconv, nev, reason, NULL));
1302 *reason = EPS_CONVERGED_USER;
1311 PetscBool same, nonlinear;
1317 mooseError(
"It is not eps power, and there is no snes");
1322 mooseError(
"It is not a nonlinear eigen solver");
1333 const char * prefix =
nullptr;
1395 PetscScalar eigenr, eigeni;
1399 auto & console = eigen_problem->
console();
1408 auto eigenvalue = inverse ? 1.0 / eigenr : eigenr;
1411 console <<
" Iteration " << its << std::setprecision(10) << std::fixed
1412 << (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
LibmeshPetscCallQ(DMMooseValidityCheck(dm))
PetscFunctionReturn(PETSC_SUCCESS)
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 &)
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
const unsigned int invalid_uint