21#include "libmesh/quadrature.h"
28 "eigen",
true,
"Use for eigenvalue problem (true) or source problem (false)");
30 "eigen_postprocessor", 1.0,
"The name of the postprocessor that provides the eigenvalue.");
37 _eigen(getParam<bool>(
"eigen")),
39 dynamic_cast<
MooseEigenSystem *>(&_fe_problem.getNonlinearSystemBase(_sys.number()))),
43 std::string eigen_pp_name;
56 eigen_pp_name = exec->
getParam<PostprocessorName>(
"bx_norm");
61 if (eigen_pp_name.empty())
87 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
96 var->sys().solution().add_vector(
_local_re, var->dofIndices());
108 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
121 var->sys().solution().add_vector(diag, var->dofIndices());
141 auto phi_size = jvar.dofIndices().size();
144 "The size of the phi container does not match the number of local Jacobian columns");
150 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
152 if (jvar.count() == 1)
155 for (
_j = 0;
_j < phi_size;
_j++)
162 unsigned int n = phi_size;
164 for (
_j = 0;
_j < n;
_j++)
170 for (
unsigned int k = 0; k < v.size(); ++k)
188 " requires a MooseEigenSystem and was designed to work with old eigenvalue",
189 " executioners such as 'NonlinearEigen'. It is suggested to use the new",
190 " eigenvalue executioner 'Eigenvalue' along with kernel tagging");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
DenseVector< Real > getJacobianDiagonal(const DenseMatrix< Number > &ke)
This class provides reusable routines for eigenvalue executioners.
const Real & eigenvalueOld()
The old eigenvalue used by inverse power iterations.
MooseEigenSystem * _eigen_sys
EigenKernel always lives in EigenSystem.
static InputParameters validParams()
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-residual / d-jvar... storing the result in Ke.
EigenKernel(const InputParameters ¶meters)
virtual bool enabled() const override
Return the enabled status of the object.
bool _eigen
flag for as an eigen kernel or a normal kernel
const Real * _eigenvalue
A pointer to the eigenvalue that is stored in a postprocessor This is a pointer so that the method fo...
virtual void computeJacobian() override
Compute this Kernel's contribution to the diagonal Jacobian entries.
virtual void computeResidual() override
Compute this Kernel's contribution to the residual.
std::vector< MooseVariableFEBase * > _save_in
bool _has_diag_save_in
The aux variables to save the diagonal Jacobian contributions to.
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz,...
unsigned int _qp
The current quadrature point index.
bool _has_save_in
The aux variables to save the residual contributions to.
const MooseArray< Real > & _JxW
The current quadrature point weight value.
unsigned int _j
current index for the shape function
std::vector< MooseVariableFEBase * > _diag_save_in
unsigned int _i
current index for the test function
const QBase *const & _qrule
active quadrature rule
virtual Real computeQpResidual()=0
Compute this Kernel's contribution to the residual at the current quadrature point.
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
const VariablePhiValue & _phi
the current shape functions
virtual RealEigenVector computeQpOffDiagJacobianArray(const ArrayMooseVariable &jvar)
For coupling array variables.
virtual Real computeQpOffDiagJacobian(unsigned int)
For coupling standard variables.
const VariableTestValue & _test
the current test function
static InputParameters validParams()
virtual Real computeQpJacobian()
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
const std::string & name() const
Get the name of the class.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool activeOnOld()
Return if eigen kernels should be on old solution.
virtual bool enabled() const
Return the enabled status of the object.
MooseApp & _app
The MOOSE application this is associated with.
unsigned int number() const
Get variable number coming from libMesh.
This class provides an interface for common operations on field variables of both FE and FV types wit...
bool isDefaultPostprocessorValue(const std::string ¶m_name, const unsigned int index=0) const
Determine whether or not the Postprocessor is a default value.
const PostprocessorName & getPostprocessorName(const std::string ¶m_name, const unsigned int index=0) const
Get the name of a postprocessor.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
const PostprocessorValue & getPostprocessorValueOldByName(const PostprocessorName &name) const
const PostprocessorValue & getPostprocessorValue(const std::string ¶m_name, const unsigned int index=0) const
doco-normal-methods-begin Retrieve the value of a Postprocessor or one of it's old or older values
virtual void precalculateJacobian()
Assembly & _assembly
Reference to this Kernel's assembly object.
const MooseVariableFieldBase & getVariable(unsigned int jvar_num) const
Retrieve the variable object from our system associated with jvar_num.
SystemBase & _sys
Reference to the EquationSystem object.
virtual void precalculateOffDiagJacobian(unsigned int)
virtual void precalculateResidual()
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
void accumulateTaggedLocalMatrix()
Local Jacobian blocks will be appended by adding the current local kernel Jacobian.
void prepareMatrixTag(Assembly &assembly, unsigned int ivar, unsigned int jvar)
Prepare data for computing element jacobian according to the active tags.
void accumulateTaggedLocalResidual()
Local residual blocks will be appended by adding the current local kernel residual.
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual according to active tags.
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
bool _is_implicit
If the object is using implicit or explicit form.