19#include "libmesh/petsc_solver_exception.h"
27 "Solve object for a standard/generalized linear or nonlinear eigenvalue problem");
34 "Whether or not to use a matrix free fashion to form operators. "
35 "If true, shell matrices will be used and meanwhile a preconditioning matrix"
36 "may be formed as well.");
39 "precond_matrix_free",
41 "Whether or not to use a matrix free fashion for forming the preconditioning matrix. "
42 "If true, a shell matrix will be used for preconditioner.");
44 params.
addParam<
bool>(
"constant_matrices",
46 "Whether or not to use constant matrices so that we can use them to form "
47 "residuals on both linear and "
48 "nonlinear iterations");
51 "precond_matrix_includes_eigen",
53 "Whether or not to include eigen kernels in the preconditioning matrix. "
54 "If true, the preconditioning matrix could be singular with the converged eigenvalue if the "
55 "full matrix is assembled and the derivative of eigenvalue with respect to the solution "
56 "vector is not considered.");
60 params.
addParam<Real>(
"initial_eigenvalue", 1,
"Initial eigenvalue");
62 "normalization",
"Postprocessor evaluating norm of eigenvector for normalization");
63 params.
addParam<Real>(
"normal_factor",
64 "Normalize eigenvector to make a defined norm equal to this factor");
66 params.
addParam<
bool>(
"auto_initialization",
68 "If true, we will set an initial eigen vector in moose, otherwise EPS "
69 "solver will initialize eigen vector");
72 "precond_matrix_includes_eigen",
73 "Matrix and Matrix-Free");
75 "Eigenvector and eigenvalue initialization");
82#ifdef LIBMESH_HAVE_SLEPC
93 "_eigen_problem",
"This might happen if you don't have a mesh")),
94 _normalization(isParamValid(
"normalization") ? &getPostprocessorValue(
"normalization")
98#ifdef LIBMESH_HAVE_SLEPC
100 "The Eigenvalue executioner only currently supports a single solver system.");
111 getParam<unsigned int>(
"free_power_iterations");
113 getParam<unsigned int>(
"extra_power_iterations");
117 "Cannot set scaling factor without defining normalization postprocessor.");
121 const auto & normpp = getParam<PostprocessorName>(
"normalization");
134 mooseError(
"SLEPc is required to use Eigenvalue executioner, please use '--download-slepc in "
135 "PETSc configuration'");
139#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
141 "Please use SLEPc-3.13.0 or higher. Old versions of SLEPc likely produce bad convergence");
160 const auto & normpp = getParam<PostprocessorName>(
"normalization");
163 mooseError(
"Normalization postprocessor ", normpp,
" requires execute_on = 'linear'");
166#ifdef LIBMESH_HAVE_SLEPC
176 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)