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 "NodeElemConstraintBase.h" 14 : 15 : /** 16 : * A NodeElemConstraintBase is a base class for constraints between a subdomain with secondary nodes 17 : * and a subdomain with primary elements. It works by allowing you to modify the residual and 18 : * jacobian entries on the secondary nodes and the primary elements. 19 : */ 20 : class NodeElemConstraint : public NodeElemConstraintBase 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : NodeElemConstraint(const InputParameters & parameters); 26 : 27 : /// Computes the residual Nodal residual. 28 : virtual void computeResidual() override; 29 : 30 : /// Computes the jacobian for the current element. 31 : virtual void computeJacobian() override; 32 : 33 : /// Computes d-residual / d-jvar... 34 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 35 : 36 : /// Gets the indices for all dofs connected to the constraint 37 : void getConnectedDofIndices(unsigned int var_num); 38 : 39 : protected: 40 : /// prepare the _secondary_to_primary_map (see NodeElemConstraintBase) 41 : virtual void prepareSecondaryToPrimaryMap() = 0; 42 : 43 : /// This is the virtual method that derived classes should override for computing the residual. 44 : virtual Real computeQpResidual(Moose::ConstraintType type) = 0; 45 : 46 : /// This is the virtual method that derived classes should override for computing the Jacobian. 47 : virtual Real computeQpJacobian(Moose::ConstraintJacobianType type); 48 : 49 : /// This is the virtual method that derived classes should override for computing the off-diag Jacobian. 50 0 : virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType /*type*/, 51 : unsigned int /*jvar*/) 52 : { 53 0 : return 0; 54 : } 55 : 56 : /// Holds the current solution at the current quadrature point 57 : const VariableValue & _u_primary; 58 : 59 : /// Value of the unknown variable on the secondary node 60 : const VariableValue & _u_secondary; 61 : 62 : /// Gradient of side shape function 63 : const VariablePhiGradient & _grad_phi_primary; 64 : 65 : /// Gradient of side shape function 66 : const VariableTestGradient & _grad_test_primary; 67 : 68 : /// Holds the current solution gradient at the current quadrature point 69 : const VariableGradient & _grad_u_primary; 70 : };