GEOS
SolidMechanicsLagrangeContactBubbleStab.hpp
Go to the documentation of this file.
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 TotalEnergies
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 
21 #ifndef GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_
22 #define GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_
23 
24 #include "physicsSolvers/solidMechanics/contact/ContactSolverBase.hpp"
25 
26 namespace geos
27 {
28 
29 class NumericalMethodsManager;
30 
32 {
33 public:
34 
35  SolidMechanicsLagrangeContactBubbleStab( const string & name,
36  Group * const parent );
37 
39 
44  static string catalogName()
45  {
46  return "SolidMechanicsLagrangeContactBubbleStab";
47  }
51  string getCatalogName() const override { return catalogName(); }
52 
53  virtual void postInputInitialization() override;
54 
56 
57  virtual void registerDataOnMesh( Group & MeshBodies ) override final;
58 
59  real64 solverStep( real64 const & time_n,
60  real64 const & dt,
61  integer const cycleNumber,
62  DomainPartition & domain ) override final;
63 
64  virtual void
65  setupDofs( DomainPartition const & domain,
66  DofManager & dofManager ) const override;
67 
68  virtual void
70  DofManager & dofManager,
72  ParallelVector & rhs,
73  ParallelVector & solution,
74  bool const setSparsity = true ) override final;
75 
76  virtual void setSparsityPattern( DomainPartition & domain,
77  DofManager & dofManager,
78  CRSMatrix< real64, globalIndex > & localMatrix,
79  SparsityPattern< globalIndex > & pattern ) override final;
80 
81  virtual void
82  implicitStepSetup( real64 const & time_n,
83  real64 const & dt,
84  DomainPartition & domain ) override final;
85 
86  virtual void
87  implicitStepComplete( real64 const & time_n,
88  real64 const & dt,
89  DomainPartition & domain ) override final;
90 
91  virtual void
92  assembleSystem( real64 const time,
93  real64 const dt,
94  DomainPartition & domain,
95  DofManager const & dofManager,
96  CRSMatrixView< real64, globalIndex const > const & localMatrix,
97  arrayView1d< real64 > const & localRhs ) override;
98 
99  virtual real64
101  real64 const & dt,
102  DomainPartition const & domain,
103  DofManager const & dofManager,
104  arrayView1d< real64 const > const & localRhs ) override;
105 
106  virtual void
107  applySystemSolution( DofManager const & dofManager,
108  arrayView1d< real64 const > const & localSolution,
109  real64 const scalingFactor,
110  real64 const dt,
111  DomainPartition & domain ) override;
112 
113  void assembleContact( real64 const dt,
114  DomainPartition & domain,
115  DofManager const & dofManager,
116  CRSMatrixView< real64, globalIndex const > const & localMatrix,
117  arrayView1d< real64 > const & localRhs );
118 
119  void assembleStabilization( real64 const dt,
120  DomainPartition & domain,
121  DofManager const & dofManager,
122  CRSMatrixView< real64, globalIndex const > const & localMatrix,
123  arrayView1d< real64 > const & localRhs );
124 
125  real64 calculateContactResidualNorm( DomainPartition const & domain,
126  DofManager const & dofManager,
127  arrayView1d< real64 const > const & localRhs );
128 
136  template< typename LAMBDA >
137  void forFiniteElementOnFractureSubRegions( string const & meshName, LAMBDA && lambda ) const
138  {
139  stdMap< string,
140  array1d< localIndex > > const & faceTypesToFaceElements = m_faceTypesToFaceElements.at( meshName );
141 
142  for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements )
143  {
144  arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst();
145 
146  finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName ));
147 
148  lambda( finiteElementName, subRegionFE, faceElemList );
149  }
150  }
151 
159  template< typename LAMBDA >
160  void forFiniteElementOnStickFractureSubRegions( string const & meshName, LAMBDA && lambda ) const
161  {
162  bool const isStickState = true;
163 
165  faceTypesToFaceElements = m_faceTypesToFaceElementsStick.at( meshName );
166 
167  for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements )
168  {
169  arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst();
170 
171  finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName ));
172 
173  lambda( finiteElementName, subRegionFE, faceElemList, isStickState );
174  }
175  }
176 
183  void updateStickSlipList( DomainPartition const & domain );
184 
190  void createFaceTypeList( DomainPartition const & domain );
191 
197  void createBubbleCellList( DomainPartition & domain ) const;
198 
203  void computeRotationMatrices( DomainPartition & domain ) const;
204 
205 
206 private:
211  void validateTetrahedralQuadrature( Group & meshBodies );
212 
220  void addCouplingNumNonzeros( DomainPartition & domain,
221  DofManager & dofManager,
222  arrayView1d< localIndex > const & rowLengths ) const;
223 
230  void addCouplingSparsityPattern( DomainPartition const & domain,
231  DofManager const & dofManager,
232  SparsityPatternView< globalIndex > const & pattern ) const;
233 
235  stdMap< string, stdMap< string, array1d< localIndex > > > m_faceTypesToFaceElements;
236 
238  stdMap< string, stdMap< string, array1d< localIndex > > > m_faceTypesToFaceElementsStick;
239 
241  stdMap< string, stdMap< string, array1d< localIndex > > > m_faceTypesToFaceElementsSlip;
242 
245 
246  struct viewKeyStruct : ContactSolverBase::viewKeyStruct
247  {
248  constexpr static char const * rotationMatrixString() { return "rotationMatrix"; }
249  };
250 
251 };
252 
253 } /* namespace geos */
254 
255 #endif /* GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_ */
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:45
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
virtual void registerDataOnMesh(Group &MeshBodies) override final
Register wrappers that contain data on the mesh objects.
void createBubbleCellList(DomainPartition &domain) const
Create the list of elements belonging to CellElementSubRegion that are enriched with the bubble basis...
void updateStickSlipList(DomainPartition const &domain)
Create the list of finite elements of the same type for each FaceElementSubRegion (Triangle or Quadri...
void createFaceTypeList(DomainPartition const &domain)
Create the list of finite elements of the same type for each FaceElementSubRegion (Triangle or Quadri...
virtual void setSparsityPattern(DomainPartition &domain, DofManager &dofManager, CRSMatrix< real64, globalIndex > &localMatrix, SparsityPattern< globalIndex > &pattern) override final
Set the sparsity pattern of the linear system matrix.
virtual void applySystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain) override
Function to apply the solution vector to the state.
virtual void implicitStepComplete(real64 const &time_n, real64 const &dt, DomainPartition &domain) override final
perform cleanup for implicit timestep
virtual void assembleSystem(real64 const time, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
function to assemble the linear system matrix and rhs
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
static string catalogName()
name of the node manager in the object catalog
void forFiniteElementOnStickFractureSubRegions(string const &meshName, LAMBDA &&lambda) const
Loop over the finite element type on the stick fracture subregions of meshName and apply callback.
virtual void setupDofs(DomainPartition const &domain, DofManager &dofManager) const override
Populate degree-of-freedom manager with fields relevant to this solver.
virtual void setupSystem(DomainPartition &domain, DofManager &dofManager, CRSMatrix< real64, globalIndex > &localMatrix, ParallelVector &rhs, ParallelVector &solution, bool const setSparsity=true) override final
Set up the linear system (DOF indices and sparsity patterns)
virtual real64 calculateResidualNorm(real64 const &time, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs) override
calculate the norm of the global system residual
void forFiniteElementOnFractureSubRegions(string const &meshName, LAMBDA &&lambda) const
Loop over the finite element type on the fracture subregions of meshName and apply callback.
void computeRotationMatrices(DomainPartition &domain) const
Compute rotation matrices and unit normal vectors for Face elements.
virtual void postInputInitialization() override
real64 solverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain) override final
entry function to perform a solver step
virtual void implicitStepSetup(real64 const &time_n, real64 const &dt, DomainPartition &domain) override final
function to perform setup for implicit timestep
Base class for FEM element implementations.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:87
LvArray::CRSMatrix< T, COL_INDEX, INDEX_TYPE, LvArray::ChaiBuffer > CRSMatrix
Alias for CRS Matrix class.
Definition: DataTypes.hpp:305
std::string string
String type.
Definition: DataTypes.hpp:90
LvArray::SparsityPatternView< COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > SparsityPatternView
Alias for Sparsity pattern View.
Definition: DataTypes.hpp:301
LvArray::SparsityPattern< COL_INDEX, INDEX_TYPE, LvArray::ChaiBuffer > SparsityPattern
Alias for Sparsity pattern class.
Definition: DataTypes.hpp:297
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:309
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.