LCOV - code coverage report
Current view: top level - include/actions - ContactAction.h (source / functions) Hit Total Coverage
Test: idaholab/moose contact: #33416 (b10b36) with base 9fbd27 Lines: 5 5 100.0 %
Date: 2026-07-23 16:16:21 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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             : #include "Action.h"
      13             : #include "MooseTypes.h"
      14             : #include "MooseEnum.h"
      15             : 
      16       75439 : CreateMooseEnumClass(ContactModel, FRICTIONLESS, GLUED, COULOMB);
      17      101519 : CreateMooseEnumClass(ContactFormulation,
      18             :                      RANFS,
      19             :                      KINEMATIC,
      20             :                      PENALTY,
      21             :                      AUGMENTED_LAGRANGE,
      22             :                      TANGENTIAL_PENALTY,
      23             :                      MORTAR,
      24             :                      MORTAR_PENALTY);
      25        9288 : CreateMooseEnumClass(ProximityMethod, NODE, CENTROID);
      26        9288 : CreateMooseEnumClass(ContactLMSpace, MATCH_DISPLACEMENT, LINEAR);
      27             : 
      28             : /**
      29             :  * Action class for creating constraints, kernels, and user objects necessary for mechanical
      30             :  * contact.
      31             :  */
      32             : class ContactAction : public Action
      33             : {
      34             : public:
      35             :   static InputParameters validParams();
      36             : 
      37             :   ContactAction(const InputParameters & params);
      38             : 
      39             :   virtual void act() override;
      40             : 
      41             :   using Action::addRelationshipManagers;
      42             :   virtual void addRelationshipManagers(Moose::RelationshipManagerType input_rm_type) override;
      43             : 
      44             :   /**
      45             :    * Get contact model
      46             :    * @return enum
      47             :    */
      48             :   static MooseEnum getModelEnum();
      49             : 
      50             :   /**
      51             :    * Get contact formulation
      52             :    * @return enum
      53             :    */
      54             : 
      55             :   static MooseEnum getFormulationEnum();
      56             :   /**
      57             :    * Get contact system
      58             :    * @return enum
      59             :    */
      60             :   static MooseEnum getSystemEnum();
      61             : 
      62             :   /**
      63             :    * Get smoothing type
      64             :    * @return enum
      65             :    */
      66             :   static MooseEnum getSmoothingEnum();
      67             : 
      68             :   /**
      69             :    * Get proximity method for automatic pairing
      70             :    * @return enum
      71             :    */
      72             :   static MooseEnum getProximityMethod();
      73             : 
      74             :   /**
      75             :    * Define parameters used by multiple contact objects
      76             :    * @return InputParameters object populated with common parameters
      77             :    */
      78             :   static InputParameters commonParameters();
      79             : 
      80             : protected:
      81             :   /// Primary/Secondary boundary name pairs for mechanical contact
      82             :   std::vector<std::pair<BoundaryName, BoundaryName>> _boundary_pairs;
      83             : 
      84             :   /// List of all possible boundaries for contact for automatic pairing (optional)
      85             :   std::vector<BoundaryName> _automatic_pairing_boundaries;
      86             : 
      87             :   /// Contact model type enum
      88             :   const ContactModel _model;
      89             : 
      90             :   /// Contact formulation
      91             :   const ContactFormulation _formulation;
      92             : 
      93             :   /// Finite element space to use for action-generated mortar Lagrange multiplier variables
      94             :   const ContactLMSpace _lm_space;
      95             : 
      96             :   /// Whether to use the dual Mortar approach
      97             :   bool _use_dual;
      98             : 
      99             :   /// Whether to generate the mortar mesh (useful in a restart simulation e.g.).
     100             :   const bool _generate_mortar_mesh;
     101             : 
     102             :   /// Whether mortar dynamic contact constraints are to be used
     103             :   const bool _mortar_dynamics;
     104             : 
     105         724 :   struct MortarInfo
     106             :   {
     107             :     BoundaryID primary_id;
     108             :     BoundaryID secondary_id;
     109             :     std::string uo_name;
     110             :   };
     111             : 
     112             :   /// Map from boundary pair to mortar user object name
     113             :   std::map<std::pair<BoundaryName, BoundaryName>, const MortarInfo> _bnd_pair_to_mortar_info;
     114             : 
     115             : private:
     116             :   /**
     117             :    * Generate mesh and other Moose objects for Mortar contact
     118             :    */
     119             :   void addMortarContact();
     120             :   /**
     121             :    * Generate constraints for node to face contact
     122             :    */
     123             :   void addNodeFaceContact();
     124             :   /**
     125             :    * Add single contact pressure auxiliary kernel for various contact action objects
     126             :    */
     127             :   void addContactPressureAuxKernel();
     128             :   /**
     129             :    * Remove repeated contact pairs from _boundary_pairs.
     130             :    */
     131             :   void removeRepeatedPairs();
     132             :   /**
     133             :    * Create contact pairs between all boundaries whose centroids are within a user-specified
     134             :    * distance of each other.
     135             :    */
     136             :   void createSidesetPairsFromGeometry();
     137             :   /**
     138             :    * Create contact pairs between all boundaries by determining that _nodes_ on both boundaries are
     139             :    * close enough.
     140             :    */
     141             :   void createSidesetsFromNodeProximity();
     142             : };

Generated by: LCOV version 1.14