19#include "libmesh/petsc_solver_exception.h"
30 "Solve object for a standard/generalized linear or nonlinear eigenvalue problem");
37 "Whether or not to use a matrix free fashion to form operators. "
38 "If true, shell matrices will be used and meanwhile a preconditioning matrix"
39 "may be formed as well.");
42 "precond_matrix_free",
44 "Whether or not to use a matrix free fashion for forming the preconditioning matrix. "
45 "If true, a shell matrix will be used for preconditioner.");
47 params.
addParam<
bool>(
"constant_matrices",
49 "Whether or not to use constant matrices so that we can use them to form "
50 "residuals on both linear and "
51 "nonlinear iterations");
54 "precond_matrix_includes_eigen",
56 "Whether or not to include eigen kernels in the preconditioning matrix. "
57 "If true, the preconditioning matrix could be singular with the converged eigenvalue if the "
58 "full matrix is assembled and the derivative of eigenvalue with respect to the solution "
59 "vector is not considered.");
63 params.
addParam<Real>(
"initial_eigenvalue", 1,
"Initial eigenvalue");
65 "normalization",
"Postprocessor evaluating norm of eigenvector for normalization");
66 params.
addParam<Real>(
"normal_factor",
67 "Normalize eigenvector to make a defined norm equal to this factor");
69 params.
addParam<
bool>(
"auto_initialization",
71 "If true, we will set an initial eigen vector in moose, otherwise EPS "
72 "solver will initialize eigen vector");
75 "precond_matrix_includes_eigen",
76 "Matrix and Matrix-Free");
78 "Eigenvector and eigenvalue initialization");
85#ifdef LIBMESH_HAVE_SLEPC
96 "_eigen_problem",
"This might happen if you don't have a mesh")),
97 _normalization(isParamValid(
"normalization") ? &getPostprocessorValue(
"normalization")
101#ifdef LIBMESH_HAVE_SLEPC
103 "The Eigenvalue executioner only currently supports a single solver system.");
114 getParam<unsigned int>(
"free_power_iterations");
116 getParam<unsigned int>(
"extra_power_iterations");
120 "Cannot set scaling factor without defining normalization postprocessor.");
124 const auto & normpp = getParam<PostprocessorName>(
"normalization");
137 mooseError(
"SLEPc is required to use Eigenvalue executioner, please use '--download-slepc in "
138 "PETSc configuration'");
142#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
144 "Please use SLEPc-3.13.0 or higher. Old versions of SLEPc likely produce bad convergence");
163 const auto & normpp = getParam<PostprocessorName>(
"normalization");
166 mooseError(
"Normalization postprocessor ", normpp,
" requires execute_on = 'linear'");
169#ifdef LIBMESH_HAVE_SLEPC
179 LibmeshPetscCall(PetscOptionsPop());
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_LINEAR
EigenProblem & _eigen_problem
EigenProblemSolve(Executioner &ex)
virtual void initialSetup() override
Method that should be executed once, before any solve calls.
static InputParameters validParams()
Problem for solving eigenvalue problems.
void setNormalization(const PostprocessorName &pp, const Real value=std::numeric_limits< Real >::max())
Set postprocessor and normalization factor 'Postprocessor' is often used to compute an integral of ph...
void setInitialEigenvalue(const Real initial_eigenvalue)
Set an initial eigenvalue for initial normalization.
NonlinearEigenSystem & getNonlinearEigenSystem(const unsigned int nl_sys_num)
void setEigenproblemType(Moose::EigenProblemType eigen_problem_type)
Set eigen problem type.
Executioners are objects that do the actual work of solving your problem.
static InputParameters validParams()
PetscOptions & petscOptionsDatabase()
T & getUserObject(const std::string &name, unsigned int tid=0) const
Get the user object by its name.
virtual std::size_t numSolverSystems() const override
bool & petscOptionsInserted()
If PETSc options are already inserted.
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)
static InputParameters validParams()
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
const InputParameters & parameters() const
Get the parameters of the object.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
const InputParameters & _pars
The object's parameters.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MooseApp & _app
The MOOSE application this is associated with.
void precondMatrixIncludesEigenKernels(bool precond_matrix_includes_eigen)
If the preconditioning matrix includes eigen kernels.
FEProblemBase & _problem
Reference to FEProblem.
unsigned int _free_power_iterations
unsigned int _extra_power_iterations
Moose::EigenProblemType _eigen_problem_type
Base class for user-specific data.
void dontAddLinearConvergedReason(FEProblemBase &fe_problem)
Function to ensure that -ksp_converged_reason is not added to the PetscOptions storage object to be l...
void dontAddPetscFlag(const std::string &flag, PetscOptions &petsc_options)
Function to ensure that a particular petsc option is not added to the PetscOptions storage object to ...
void dontAddNonlinearConvergedReason(FEProblemBase &fe_problem)
Function to ensure that -snes_converged_reason is not added to the PetscOptions storage object to be ...
void slepcSetOptions(EigenProblem &eigen_problem, SolverParams &solver_params, const InputParameters ¶ms)
Push all SLEPc/PETSc options into SLEPc/PETSc side.
InputParameters getSlepcEigenProblemValidParams()
Retrieve valid params that allow users to specify eigen problem configuration.
InputParameters getSlepcValidParams(InputParameters ¶ms)
void setEigenProblemSolverParams(EigenProblem &eigen_problem, const InputParameters ¶ms)
Retrieve eigen problem params from 'params', and then set these params into SolverParams.
void storeSolveType(FEProblemBase &fe_problem, const InputParameters ¶ms)
Set solve type into eigen problem (solverParams)