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 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 
21 #ifndef GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_
22 #define GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_
23 
24 #include "physicsSolvers/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 registerDataOnMesh( Group & MeshBodies ) override final;
54 
55  real64 solverStep( real64 const & time_n,
56  real64 const & dt,
57  const integer cycleNumber,
58  DomainPartition & domain ) override final;
59 
60  virtual void
61  setupDofs( DomainPartition const & domain,
62  DofManager & dofManager ) const override;
63 
64  virtual void
66  DofManager & dofManager,
68  ParallelVector & rhs,
69  ParallelVector & solution,
70  bool const setSparsity = true ) override final;
71 
72  virtual void
73  implicitStepSetup( real64 const & time_n,
74  real64 const & dt,
75  DomainPartition & domain ) override final;
76 
77  virtual void
78  implicitStepComplete( real64 const & time_n,
79  real64 const & dt,
80  DomainPartition & domain ) override final;
81 
82  virtual void
83  assembleSystem( real64 const time,
84  real64 const dt,
85  DomainPartition & domain,
86  DofManager const & dofManager,
87  CRSMatrixView< real64, globalIndex const > const & localMatrix,
88  arrayView1d< real64 > const & localRhs ) override;
89 
90  virtual real64
92  real64 const & dt,
93  DomainPartition const & domain,
94  DofManager const & dofManager,
95  arrayView1d< real64 const > const & localRhs ) override;
96 
97  virtual void
98  applySystemSolution( DofManager const & dofManager,
99  arrayView1d< real64 const > const & localSolution,
100  real64 const scalingFactor,
101  real64 const dt,
102  DomainPartition & domain ) override;
103 
104  void assembleContact( real64 const dt,
105  DomainPartition & domain,
106  DofManager const & dofManager,
107  CRSMatrixView< real64, globalIndex const > const & localMatrix,
108  arrayView1d< real64 > const & localRhs );
109 
110  void assembleStabilization( real64 const dt,
111  DomainPartition & domain,
112  DofManager const & dofManager,
113  CRSMatrixView< real64, globalIndex const > const & localMatrix,
114  arrayView1d< real64 > const & localRhs );
115 
116  real64 calculateContactResidualNorm( DomainPartition const & domain,
117  DofManager const & dofManager,
118  arrayView1d< real64 const > const & localRhs );
119 
127  template< typename LAMBDA >
128  void forFiniteElementOnFractureSubRegions( string const & meshName, LAMBDA && lambda ) const
129  {
130  std::map< string,
131  array1d< localIndex > > const & faceTypesToFaceElements = m_faceTypesToFaceElements.at( meshName );
132 
133  for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements )
134  {
135  arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst();
136 
137  finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName ));
138 
139  lambda( finiteElementName, subRegionFE, faceElemList );
140  }
141  }
142 
150  template< typename LAMBDA >
151  void forFiniteElementOnStickFractureSubRegions( string const & meshName, LAMBDA && lambda ) const
152  {
153  bool const isStickState = true;
154 
155  std::map< string, array1d< localIndex > > const &
156  faceTypesToFaceElements = m_faceTypesToFaceElementsStick.at( meshName );
157 
158  for( const auto & [finiteElementName, faceElementList] : faceTypesToFaceElements )
159  {
160  arrayView1d< localIndex const > const faceElemList = faceElementList.toViewConst();
161 
162  finiteElement::FiniteElementBase const & subRegionFE = *(m_faceTypeToFiniteElements.at( finiteElementName ));
163 
164  lambda( finiteElementName, subRegionFE, faceElemList, isStickState );
165  }
166  }
167 
174  void updateStickSlipList( DomainPartition const & domain );
175 
181  void createFaceTypeList( DomainPartition const & domain );
182 
188  void createBubbleCellList( DomainPartition & domain ) const;
189 
194  void computeRotationMatrices( DomainPartition & domain ) const;
195 
196 
197 private:
205  void addCouplingNumNonzeros( DomainPartition & domain,
206  DofManager & dofManager,
207  arrayView1d< localIndex > const & rowLengths ) const;
208 
215  void addCouplingSparsityPattern( DomainPartition const & domain,
216  DofManager const & dofManager,
217  SparsityPatternView< globalIndex > const & pattern ) const;
218 
220  std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElements;
221 
223  std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElementsStick;
224 
226  std::map< string, std::map< string, array1d< localIndex > > > m_faceTypesToFaceElementsSlip;
227 
229  std::map< string, std::unique_ptr< geos::finiteElement::FiniteElementBase > > m_faceTypeToFiniteElements;
230 
231  struct viewKeyStruct : ContactSolverBase::viewKeyStruct
232  {
233  constexpr static char const * rotationMatrixString() { return "rotationMatrix"; }
234  };
235 
236 };
237 
238 } /* namespace geos */
239 
240 #endif /* GEOS_PHYSICSSOLVERS_CONTACT_SOLIDMECHANICSLAGRANGECONTACTBUBBLESTAB_HPP_ */
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
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 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
real64 solverStep(real64 const &time_n, real64 const &dt, const integer cycleNumber, DomainPartition &domain) override final
entry function to perform a solver step
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 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:180
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:310
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:88
std::string string
String type.
Definition: DataTypes.hpp:91
LvArray::SparsityPatternView< COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > SparsityPatternView
Alias for Sparsity pattern View.
Definition: DataTypes.hpp:302
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
LvArray::CRSMatrix< T, COL_INDEX, localIndex, LvArray::ChaiBuffer > CRSMatrix
Alias for CRS Matrix class.
Definition: DataTypes.hpp:306
mapBase< TKEY, TVAL, std::integral_constant< bool, true > > map
Ordered map type.
Definition: DataTypes.hpp:369
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.