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 "Constraint.h" 14 : #include "NeighborCoupleableMooseVariableDependencyIntermediateInterface.h" 15 : 16 : class ElementPairInfo; 17 : class FEProblemBase; 18 : 19 : class ElemElemConstraint : public Constraint, 20 : public NeighborCoupleableMooseVariableDependencyIntermediateInterface, 21 : public NeighborMooseVariableInterface<Real> 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : ElemElemConstraint(const InputParameters & parameters); 27 : 28 : /** 29 : * reinit element-element constraint 30 : */ 31 : virtual void reinit(const ElementPairInfo & element_pair_info); 32 : 33 : /** 34 : * Set information needed for constraint integration 35 : */ 36 : virtual void reinitConstraintQuadrature(const ElementPairInfo & element_pair_info); 37 : 38 : /** 39 : * Computes the residual for this element or the neighbor 40 : */ 41 : virtual void computeElemNeighResidual(Moose::DGResidualType type); 42 : 43 : /** 44 : * Computes the residual for the current side. 45 : */ 46 : virtual void computeResidual() override; 47 : 48 : /** 49 : * Computes the element/neighbor-element/neighbor Jacobian 50 : */ 51 : virtual void computeElemNeighJacobian(Moose::DGJacobianType type); 52 : 53 : /** 54 : * Computes the jacobian for the current side. 55 : */ 56 : virtual void computeJacobian() override; 57 : 58 : /** 59 : * Get the interface ID 60 : */ 61 0 : unsigned int getInterfaceID() const { return _interface_id; }; 62 : 63 : /** 64 : * The variable number that this object operates on. 65 : */ 66 0 : const MooseVariable & variable() const override { return _var; } 67 : 68 : protected: 69 : FEProblemBase & _fe_problem; 70 : unsigned int _dim; 71 : 72 : unsigned int _interface_id; 73 : 74 : MooseVariable & _var; 75 : 76 : const Elem * const & _current_elem; 77 : 78 : /// The neighboring element 79 : const Elem * const & _neighbor_elem; 80 : 81 : /// Quadrature points used in integration of constraint 82 : std::vector<Point> _constraint_q_point; 83 : /// Weights of quadrature points used in integration of constraint 84 : std::vector<Real> _constraint_weight; 85 : 86 : /// Indices for looping over DOFs 87 : unsigned int _i, _j; 88 : 89 : /// Holds the current solution at the current quadrature point 90 : const VariableValue & _u; 91 : 92 : /// Holds the current solution gradient at the current quadrature point 93 : const VariableGradient & _grad_u; 94 : /// Shape function 95 : const VariablePhiValue & _phi; 96 : /// Shape function gradient 97 : const VariablePhiGradient & _grad_phi; 98 : 99 : /// Test function. 100 : const VariableTestValue & _test; 101 : /// Gradient of test function 102 : const VariableTestGradient & _grad_test; 103 : 104 : /// Neighbor shape function. 105 : const VariablePhiValue & _phi_neighbor; 106 : /// Gradient of neighbor shape function 107 : const VariablePhiGradient & _grad_phi_neighbor; 108 : 109 : /// Neighbor test function 110 : const VariableTestValue & _test_neighbor; 111 : /// Gradient of neighbor shape function 112 : const VariableTestGradient & _grad_test_neighbor; 113 : 114 : /// Holds the current solution at the current quadrature point on the neighbor element 115 : const VariableValue & _u_neighbor; 116 : /// Holds the current solution gradient at the current quadrature point on the neighbor element 117 : const VariableGradient & _grad_u_neighbor; 118 : 119 : /** 120 : * Compute the residual for one of the constraint quadrature points. Must be overwritten by 121 : * derived class. 122 : */ 123 : virtual Real computeQpResidual(Moose::DGResidualType type) = 0; 124 : 125 : /** 126 : * Compute the Jacobian for one of the constraint quadrature points. Must be overwritten by 127 : * derived class. 128 : */ 129 : virtual Real computeQpJacobian(Moose::DGJacobianType type) = 0; 130 : };