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 "NodeFaceConstraint.h" 14 : #include "PenetrationLocator.h" 15 : 16 : // Forward Declarations 17 : class ContactLineSearchBase; 18 : class AugmentedLagrangianContactProblemInterface; 19 : enum class ContactModel; 20 : enum class ContactFormulation; 21 : class DisplacedProblem; 22 : 23 : /** 24 : * A MechanicalContactConstraint forces the value of a variable to be the same on both sides of an 25 : * interface. 26 : */ 27 : class MechanicalContactConstraint : public NodeFaceConstraint 28 : { 29 : public: 30 : static InputParameters validParams(); 31 : 32 : MechanicalContactConstraint(const InputParameters & parameters); 33 : 34 : virtual void timestepSetup() override; 35 : virtual void jacobianSetup() override; 36 : virtual void residualEnd() override; 37 : 38 : virtual bool AugmentedLagrangianContactConverged(); 39 : 40 : virtual void updateAugmentedLagrangianMultiplier(bool beginning_of_step); 41 : virtual void updateContactStatefulData(bool beginning_of_step); 42 : 43 : virtual Real computeQpSecondaryValue() override; 44 : 45 : virtual Real computeQpResidual(Moose::ConstraintType type) override; 46 : 47 : /** 48 : * Computes the jacobian for the current element. 49 : */ 50 : virtual void computeJacobian() override; 51 : 52 : /** 53 : * Compute off-diagonal Jacobian entries 54 : * @param jvar The index of the coupled variable 55 : */ 56 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 57 : 58 : virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override; 59 : 60 : /** 61 : * Compute off-diagonal Jacobian entries 62 : * @param type The type of coupling 63 : * @param jvar The index of the coupled variable 64 : */ 65 : virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType type, 66 : unsigned int jvar) override; 67 : 68 : /** 69 : * Get the dof indices of the nodes connected to the secondary node for a specific variable 70 : * @param var_num The number of the variable for which dof indices are gathered 71 : * @return bool indicating whether the coupled variable is one of the displacement variables 72 : */ 73 : virtual void getConnectedDofIndices(unsigned int var_num) override; 74 : 75 : /** 76 : * Determine whether the coupled variable is one of the displacement variables, 77 : * and find its component 78 : * @param var_num The number of the variable to be checked 79 : * @param component The component index computed in this routine 80 : * @return bool indicating whether the coupled variable is one of the displacement variables 81 : */ 82 : bool getCoupledVarComponent(unsigned int var_num, unsigned int & component); 83 : 84 216857 : virtual bool addCouplingEntriesToJacobian() override { return _primary_secondary_jacobian; } 85 : 86 : bool shouldApply() override; 87 : void computeContactForce(const Node & node, PenetrationInfo * pinfo, bool update_contact_set); 88 : 89 : protected: 90 : MooseSharedPointer<DisplacedProblem> _displaced_problem; 91 : Real gapOffset(const Node & node); 92 : Real nodalArea(const Node & node); 93 : Real getPenalty(const Node & node); 94 : Real getTangentialPenalty(const Node & node); 95 : 96 : const unsigned int _component; 97 : const ContactModel _model; 98 : const ContactFormulation _formulation; 99 : const bool _normalize_penalty; 100 : 101 : const Real _penalty; 102 : const Real _penalty_multiplier; 103 : Real _penalty_tangential; 104 : const Real _friction_coefficient; 105 : const Real _tension_release; 106 : const Real _capture_tolerance; 107 : const unsigned int _stick_lock_iterations; 108 : const Real _stick_unlock_factor; 109 : bool _update_stateful_data; 110 : 111 : NumericVector<Number> & _residual_copy; 112 : // std::map<Point, PenetrationInfo *> _point_to_info; 113 : 114 : const unsigned int _mesh_dimension; 115 : 116 : std::vector<unsigned int> _vars; 117 : std::vector<MooseVariable *> _var_objects; 118 : 119 : /// gap offset from either secondary, primary or both 120 : const bool _has_secondary_gap_offset; 121 : const MooseVariable * const _secondary_gap_offset_var; 122 : const bool _has_mapped_primary_gap_offset; 123 : const MooseVariable * const _mapped_primary_gap_offset_var; 124 : 125 : MooseVariable * _nodal_area_var; 126 : SystemBase & _aux_system; 127 : const NumericVector<Number> * const _aux_solution; 128 : 129 : /// Whether to include coupling between the primary and secondary nodes in the Jacobian 130 : const bool _primary_secondary_jacobian; 131 : /// Whether to include coupling terms with the nodes connected to the secondary nodes in the Jacobian 132 : const bool _connected_secondary_nodes_jacobian; 133 : /// Whether to include coupling terms with non-displacement variables in the Jacobian 134 : const bool _non_displacement_vars_jacobian; 135 : 136 : /// The tolerance of the penetration for augmented Lagrangian method 137 : Real _al_penetration_tolerance; 138 : /// The tolerance of the incremental slip for augmented Lagrangian method 139 : Real _al_incremental_slip_tolerance; 140 : /// The tolerance of the frictional force for augmented Lagrangian method 141 : Real _al_frictional_force_tolerance; 142 : 143 : ContactLineSearchBase * _contact_linesearch; 144 : std::set<dof_id_type> _current_contact_state; 145 : std::set<dof_id_type> _old_contact_state; 146 : 147 : const bool _print_contact_nodes; 148 : static Threads::spin_mutex _contact_set_mutex; 149 : 150 : AugmentedLagrangianContactProblemInterface * const _augmented_lagrange_problem; 151 : const static unsigned int _no_iterations; 152 : const unsigned int & _lagrangian_iteration_number; 153 : 154 : DenseMatrix<Number> _Knn; 155 : DenseMatrix<Number> _Ken; 156 : };