20 #include "libmesh/quadrature.h" 27 "eigen",
true,
"Use for eigenvalue problem (true) or source problem (false)");
29 "eigen_postprocessor", 1.0,
"The name of the postprocessor that provides the eigenvalue.");
36 _eigen(getParam<bool>(
"eigen")),
38 dynamic_cast<
MooseEigenSystem *>(&_fe_problem.getNonlinearSystemBase(_sys.number()))),
42 std::string eigen_pp_name;
55 eigen_pp_name = exec->
getParam<PostprocessorName>(
"bx_norm");
60 if (eigen_pp_name.empty())
86 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
95 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
97 var->sys().solution().add_vector(
_local_re, var->dofIndices());
110 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
122 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
124 var->sys().solution().add_vector(diag, var->dofIndices());
144 auto phi_size = jvar.dofIndices().size();
147 "The size of the phi container does not match the number of local Jacobian columns");
153 mooseAssert(*
_eigenvalue != 0.0,
"Can't divide by zero eigenvalue in EigenKernel!");
155 if (jvar.count() == 1)
158 for (
_j = 0;
_j < phi_size;
_j++)
165 unsigned int n = phi_size;
167 for (
_j = 0;
_j < n;
_j++)
172 const_cast<MooseVariableFieldBase &>(jvar)));
173 for (
unsigned int k = 0; k < v.size(); ++k)
MooseEigenSystem * _eigen_sys
EigenKernel always lives in EigenSystem.
static InputParameters validParams()
void accumulateTaggedLocalResidual()
Local residual blocks will be appended by adding the current local kernel residual.
virtual Real computeQpResidual()=0
Compute this Kernel's contribution to the residual at the current quadrature point.
virtual RealEigenVector computeQpOffDiagJacobianArray(const ArrayMooseVariable &jvar)
For coupling array variables.
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
std::vector< MooseVariableFEBase * > _save_in
const MooseArray< Real > & _JxW
The current quadrature point weight value.
virtual void precalculateOffDiagJacobian(unsigned int)
const Real * _eigenvalue
A pointer to the eigenvalue that is stored in a postprocessor This is a pointer so that the method fo...
unsigned int number() const
Get variable number coming from libMesh.
virtual Real computeQpOffDiagJacobian(unsigned int)
For coupling standard variables.
bool activeOnOld()
Return if eigen kernels should be on old solution.
const Real & eigenvalueOld()
The old eigenvalue used by inverse power iterations.
virtual void precalculateResidual()
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
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 ...
bool _has_diag_save_in
The aux variables to save the diagonal Jacobian contributions to.
DenseVector< Real > getJacobianDiagonal(DenseMatrix< Number > &ke)
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
static InputParameters validParams()
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 computeResidual() override
Compute this Kernel's contribution to the residual.
unsigned int size() const
The number of elements that can currently be stored in the array.
const VariableTestValue & _test
the current test function
virtual void precalculateJacobian()
std::vector< MooseVariableFEBase * > _diag_save_in
This class provides reusable routines for eigenvalue executioners.
const QBase *const & _qrule
active quadrature rule
bool _has_save_in
The aux variables to save the residual contributions to.
virtual Real computeQpJacobian()
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
virtual bool enabled() const override
Return the enabled status of the object.
unsigned int _i
current index for the test function
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-residual / d-jvar... storing the result in Ke.
MooseApp & _app
The MOOSE application this is associated with.
void accumulateTaggedLocalMatrix()
Local Jacobian blocks will be appended by adding the current local kernel Jacobian.
bool isDefaultPostprocessorValue(const std::string ¶m_name, const unsigned int index=0) const
Determine whether or not the Postprocessor is a default value.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz, spherical, etc.)
Assembly & _assembly
Reference to this Kernel's assembly object.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
unsigned int _j
current index for the shape function
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
virtual void computeJacobian() override
Compute this Kernel's contribution to the diagonal Jacobian entries.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual according to active tags.
void prepareMatrixTag(Assembly &assembly, unsigned int ivar, unsigned int jvar)
Prepare data for computing element jacobian according to the active tags.
const VariablePhiValue & _phi
the current shape functions
EigenKernel(const InputParameters ¶meters)
bool _is_implicit
If the object is using implicit or explicit form.
virtual bool enabled() const
Return the enabled status of the object.
const PostprocessorName & getPostprocessorName(const std::string ¶m_name, const unsigned int index=0) const
Get the name of a postprocessor.
bool _eigen
flag for as an eigen kernel or a normal kernel
unsigned int _qp
The current quadrature point index.