LCOV - code coverage report
Current view: top level - include/geomsearch - PenetrationInfo.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 5 5 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 2 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             : // MOOSE includes
      13             : #include "Moose.h"
      14             : #include "DataIO.h"
      15             : 
      16             : #include "libmesh/vector_value.h"
      17             : #include "libmesh/point.h"
      18             : 
      19             : // libMesh forward declarations
      20             : namespace libMesh
      21             : {
      22             : class Node;
      23             : class Elem;
      24             : }
      25             : 
      26             : /**
      27             :  * Data structure used to hold penetration information
      28             :  */
      29             : class PenetrationInfo
      30             : {
      31             : public:
      32             :   PenetrationInfo(const Elem * elem,
      33             :                   const Elem * side,
      34             :                   unsigned int side_num,
      35             :                   RealVectorValue norm,
      36             :                   Real norm_distance,
      37             :                   Real tangential_distance,
      38             :                   const Point & closest_point,
      39             :                   const Point & closest_point_ref,
      40             :                   const Point & closest_point_on_face_ref,
      41             :                   std::vector<const Node *> off_edge_nodes,
      42             :                   const std::vector<std::vector<Real>> & side_phi,
      43             :                   const std::vector<std::vector<RealGradient>> & side_grad_phi,
      44             :                   const std::vector<RealGradient> & dxyzdxi,
      45             :                   const std::vector<RealGradient> & dxyzdeta,
      46             :                   const std::vector<RealGradient> & d2xyzdxideta);
      47             : 
      48             :   // Not currently supported due to double-delete memory corruption bug
      49             :   //  PenetrationInfo(const PenetrationInfo & p);
      50             : 
      51             :   PenetrationInfo();
      52             : 
      53             :   ~PenetrationInfo();
      54             : 
      55             :   enum MECH_STATUS_ENUM
      56             :   {
      57             :     MS_NO_CONTACT = 0,    // out of contact
      58             :     MS_STICKING,          // sticking (glued or frictional)
      59             :     MS_SLIPPING,          // slipping with zero frictional resistance
      60             :     MS_SLIPPING_FRICTION, // slipping with nonzero frictional resistance
      61             :     MS_CONTACT            // In contact, but unknown yet whether slipping or sticking.
      62             :   };
      63             : 
      64      692201 :   bool isCaptured() const { return _mech_status != MS_NO_CONTACT; }
      65         128 :   void capture()
      66             :   {
      67         128 :     if (_mech_status == MS_NO_CONTACT)
      68         128 :       _mech_status = MS_CONTACT;
      69         128 :   }
      70             :   void release() { _mech_status = MS_NO_CONTACT; }
      71             : 
      72             :   const Elem * _elem;
      73             :   const Elem * _side;
      74             :   unsigned int _side_num;
      75             :   RealVectorValue _normal;
      76             :   Real _distance; // Positive distance means the node has penetrated
      77             :   Real _tangential_distance;
      78             :   Point _closest_point;
      79             :   Point _closest_point_ref;
      80             :   Point _closest_point_on_face_ref;
      81             :   std::vector<const Node *> _off_edge_nodes;
      82             :   std::vector<std::vector<Real>> _side_phi;
      83             :   std::vector<std::vector<RealGradient>> _side_grad_phi;
      84             :   std::vector<RealGradient> _dxyzdxi;
      85             :   std::vector<RealGradient> _dxyzdeta;
      86             :   std::vector<RealGradient> _d2xyzdxideta;
      87             :   const Elem * _starting_elem;
      88             :   unsigned int _starting_side_num;
      89             :   Point _starting_closest_point_ref;
      90             :   Point _incremental_slip;
      91             :   Real _accumulated_slip;
      92             :   Real _accumulated_slip_old;
      93             :   Real _frictional_energy;
      94             :   Real _frictional_energy_old;
      95             :   RealVectorValue _contact_force;
      96             :   RealVectorValue _contact_force_old;
      97             : 
      98             :   Real _lagrange_multiplier;
      99             :   RealVectorValue _lagrange_multiplier_slip;
     100             : 
     101             :   unsigned int _locked_this_step;
     102             :   unsigned int _stick_locked_this_step;
     103             :   MECH_STATUS_ENUM _mech_status;
     104             :   MECH_STATUS_ENUM _mech_status_old;
     105             :   Point _incremental_slip_prev_iter;
     106             :   bool _slip_reversed;
     107             :   Real _slip_tol;
     108             : };
     109             : 
     110             : // Used for Restart
     111             : template <>
     112             : void dataStore(std::ostream & stream, PenetrationInfo *& pinfo, void * context);
     113             : template <>
     114             : void dataLoad(std::istream & stream, PenetrationInfo *& pinfo, void * context);

Generated by: LCOV version 1.14