Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : // Moose Includes 13 : #include "Damper.h" 14 : #include "MaterialPropertyInterface.h" 15 : #include "MooseTypes.h" 16 : 17 : class SubProblem; 18 : class SystemBase; 19 : template <typename> 20 : class MooseVariableFE; 21 : typedef MooseVariableFE<Real> MooseVariable; 22 : typedef MooseVariableFE<VectorValue<Real>> VectorMooseVariable; 23 : class Assembly; 24 : 25 : namespace libMesh 26 : { 27 : class QBase; 28 : } 29 : 30 : /** 31 : * Base class for deriving element dampers 32 : */ 33 : class ElementDamper : public Damper, public MaterialPropertyInterface 34 : { 35 : public: 36 : static InputParameters validParams(); 37 : 38 : ElementDamper(const InputParameters & parameters); 39 : 40 : /** 41 : * Computes this Damper's damping for one element. 42 : */ 43 : Real computeDamping(); 44 : 45 : /** 46 : * Check whether this damper's variable has DOFs/components on the given element 47 : */ 48 : bool variableDefinedOnElement(const Elem * elem) const; 49 : 50 : /** 51 : * Get the variable this damper is acting on 52 : */ 53 1563 : MooseVariable * getVariable() { return &_var; } 54 : 55 : protected: 56 : /** 57 : * This MUST be overridden by a child damper. 58 : * 59 : * This is where they actually compute a number between 0 and 1. 60 : */ 61 : virtual Real computeQpDamping() = 0; 62 : 63 : /// Thread ID 64 : THREAD_ID _tid; 65 : Assembly & _assembly; 66 : 67 : /// Coordinate system 68 : const Moose::CoordinateSystemType & _coord_sys; 69 : 70 : /// Non-linear variable this damper works on 71 : MooseVariable & _var; 72 : 73 : /// Current element 74 : const Elem * const & _current_elem; 75 : 76 : /// Quadrature point index 77 : unsigned int _qp; 78 : /// Quadrature points 79 : const MooseArray<Point> & _q_point; 80 : /// Quadrature rule 81 : const libMesh::QBase * const & _qrule; 82 : /// Transformed Jacobian weights 83 : const MooseArray<Real> & _JxW; 84 : 85 : /// The current Newton increment 86 : const VariableValue & _u_increment; 87 : /// Holds the current solution at the current quadrature point 88 : const VariableValue & _u; 89 : /// Holds the current solution gradient at the current quadrature point 90 : const VariableGradient & _grad_u; 91 : };