GEOS
ContactSolverBase.hpp
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
16 /*
17  * @file ContactSolverBase.hpp
18  *
19  */
20 
21 #ifndef GEOS_PHYSICSSOLVERS_CONTACT_CONTACTSOLVERBASE_HPP_
22 #define GEOS_PHYSICSSOLVERS_CONTACT_CONTACTSOLVERBASE_HPP_
23 
26 
27 namespace geos
28 {
29 
31 {
32 public:
33  ContactSolverBase( const string & name,
34  Group * const parent );
35 
36  ~ContactSolverBase() override = default;
37 
38  virtual void registerDataOnMesh( dataRepository::Group & meshBodies ) override;
39 
40  virtual real64
41  explicitStep( real64 const & time_n,
42  real64 const & dt,
43  integer const cycleNumber,
44  DomainPartition & domain ) override final;
45 
46  string const & getUniqueFractureRegionName() const { return m_fractureRegionNames[0]; }
47 
48  void outputConfigurationStatistics( DomainPartition const & domain ) const override final;
49 
50  void synchronizeFractureState( DomainPartition & domain ) const;
51 
53  {
54  constexpr static char const * fractureStateString() { return "fractureState"; }
55 
56  constexpr static char const * oldFractureStateString() { return "oldFractureState"; }
57 
58  constexpr static char const * frictionLawNameString() { return "frictionLawName"; }
59 
60  };
61 
62 protected:
63  virtual void postInputInitialization() override;
64 
65  virtual void setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const override final;
66 
67  void computeFractureStateStatistics( MeshLevel const & mesh,
68  globalIndex & numStick,
69  globalIndex & numNewSlip,
70  globalIndex & numSlip,
71  globalIndex & numOpen ) const;
72 
74  inline
75  static bool compareFractureStates( integer const state0,
76  integer const state1 )
77  {
78  return state0 == state1
81  }
82 
83  void setFractureRegions( dataRepository::Group const & domain );
84 
85  std::vector< string > m_fractureRegionNames;
86 
87  template< typename LAMBDA >
88  void forFractureRegionOnMeshTargets( Group const & meshBodies, LAMBDA && lambda ) const
89  {
91  [&]( string const,
92  MeshLevel const & mesh,
94  {
95  ElementRegionManager const & elemManager = mesh.getElemManager();
96 
97  elemManager.forElementRegions< SurfaceElementRegion >( m_fractureRegionNames,
98  [&] ( localIndex const,
99  SurfaceElementRegion const & region )
100  {
101  lambda( region );
102  } );
103  } );
104  }
105 
106  template< typename LAMBDA >
107  void forFractureRegionOnMeshTargets( Group & meshBodies, LAMBDA && lambda ) const
108  {
109  forDiscretizationOnMeshTargets( meshBodies,
110  [&]( string const,
111  MeshLevel & mesh,
112  arrayView1d< string const > const )
113  {
114  ElementRegionManager & elemManager = mesh.getElemManager();
115 
116  elemManager.forElementRegions< SurfaceElementRegion >( m_fractureRegionNames,
117  [&] ( localIndex const,
118  SurfaceElementRegion & region )
119  {
120  lambda( region );
121  } );
122  } );
123  }
124 };
125 
126 } /* namespace geos */
127 
128 #endif /* GEOS_PHYSICSSOLVERS_CONTACT_CONTACTSOLVERBASE_HPP_ */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
virtual void setConstitutiveNamesCallSuper(ElementSubRegionBase &subRegion) const override final
This function sets constitutive name fields on an ElementSubRegionBase, and calls the base function i...
virtual void registerDataOnMesh(dataRepository::Group &meshBodies) override
Register wrappers that contain data on the mesh objects.
virtual void postInputInitialization() override
virtual real64 explicitStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain) override final
Entry function for an explicit time integration step.
void outputConfigurationStatistics(DomainPartition const &domain) const override final
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
void forElementRegions(LAMBDA &&lambda)
This function is used to launch kernel function over all the element regions with region type = Eleme...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
ElementRegionManager const & getElemManager() const
Get the element region manager.
Definition: MeshLevel.hpp:207
void forDiscretizationOnMeshTargets(Group const &meshBodies, LAMBDA &&lambda) const
Loop over the target discretization on all mesh targets and apply callback.
Group()=delete
Deleted default constructor.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:88
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
@ Slip
element is sliding: no normal jump across the discontinuity, but sliding is allowed.
@ NewSlip
element just starts sliding: no normal jump across the discontinuity, but sliding is allowed.