GEOS
SolidMechanicsDisplacementJumpUpdateKernels.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 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 
20 #ifndef GEOS_PHYSICSSOLVERS_CONTACT_KERNELS_SOLIDMECHANICSDISPLACEMENTJUPDATEKERNELS_HPP_
21 #define GEOS_PHYSICSSOLVERS_CONTACT_KERNELS_SOLIDMECHANICSDISPLACEMENTJUPDATEKERNELS_HPP_
22 
23 #include "SolidMechanicsConformingContactKernelsBase.hpp"
24 #include "mesh/MeshFields.hpp"
25 
26 namespace geos
27 {
28 
29 namespace solidMechanicsConformingContactKernels
30 {
31 
35 template< typename CONSTITUTIVE_TYPE,
36  typename FE_TYPE >
38  public ConformingContactKernelsBase< CONSTITUTIVE_TYPE,
39  FE_TYPE >
40 {
41 public:
43  using Base = ConformingContactKernelsBase< CONSTITUTIVE_TYPE,
44  FE_TYPE >;
45 
49 
51  static constexpr int numUdofs = Base::numUdofs;
52 
54  static constexpr int numBdofs = Base::numBdofs;
55 
57  static constexpr int numTdofs = Base::numTdofs;
58 
59  using Base::m_X;
61  using Base::m_dofNumber;
64  using Base::m_faceToNodes;
66  using Base::m_dispJump;
67 
72  DispJumpUpdate( NodeManager const & nodeManager,
73  EdgeManager const & edgeManager,
74  FaceManager const & faceManager,
75  localIndex const targetRegionIndex,
76  FaceElementSubRegion & elementSubRegion,
77  FE_TYPE const & finiteElementSpace,
78  CONSTITUTIVE_TYPE & inputConstitutiveType,
79  arrayView1d< globalIndex const > const uDofNumber,
80  arrayView1d< globalIndex const > const bDofNumber,
81  globalIndex const rankOffset,
83  arrayView1d< real64 > const inputRhs,
84  real64 const inputDt,
85  arrayView1d< localIndex const > const & faceElementList ):
86  Base( nodeManager,
87  edgeManager,
88  faceManager,
89  targetRegionIndex,
90  elementSubRegion,
91  finiteElementSpace,
92  inputConstitutiveType,
93  uDofNumber,
94  bDofNumber,
95  rankOffset,
96  inputMatrix,
97  inputRhs,
98  inputDt,
99  faceElementList ),
100  m_displacement( nodeManager.getField< fields::solidMechanics::totalDisplacement >()),
101  m_bubbleDisp( faceManager.getField< fields::solidMechanics::totalBubbleDisplacement >() ),
102  m_incrDisp( nodeManager.getField< fields::solidMechanics::incrementalDisplacement >() ),
103  m_incrBubbleDisp( faceManager.getField< fields::solidMechanics::incrementalBubbleDisplacement >() ),
104  m_deltaDispJump( elementSubRegion.getField< fields::contact::deltaDispJump >().toView() ),
105  m_elementArea( elementSubRegion.getField< fields::elementArea >().toView() ),
106  m_slip( elementSubRegion.getField< fields::contact::slip >().toView() )
107  {}
108 
109  //***************************************************************************
110 
114  struct StackVariables : public Base::StackVariables
115  {
116 
117 public:
118 
120  StackVariables():
121  Base::StackVariables(),
122  uLocal{},
123  bLocal{},
124  duLocal{},
125  dbLocal{},
127  {}
128 
131 
134 
137 
140 
143 
144  };
145 
146  //***************************************************************************
147 
148  //START_kernelLauncher
149  template< typename POLICY,
150  typename KERNEL_TYPE >
151  static
152  real64
153  kernelLaunch( localIndex const numElems,
154  KERNEL_TYPE const & kernelComponent )
155  {
156  return Base::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernelComponent );
157  }
158  //END_kernelLauncher
159 
165  inline
166  void setup( localIndex const k,
167  StackVariables & stack ) const
168  {
169  constexpr int shift = numNodesPerElem * 3;
170 
171  int permutation[numNodesPerElem];
172  m_finiteElementSpace.getPermutation( permutation );
173 
174  localIndex const kf0 = m_elemsToFaces[k][0];
175  localIndex const kf1 = m_elemsToFaces[k][1];
176  for( localIndex a=0; a<numNodesPerElem; ++a )
177  {
178  localIndex const kn0 = m_faceToNodes( kf0, a );
179  localIndex const kn1 = m_faceToNodes( kf1, a );
180 
181  for( int i=0; i<3; ++i )
182  {
183  stack.X[ a ][ i ] = m_X[ m_faceToNodes( kf0, permutation[ a ] ) ][ i ];
184  stack.uLocal[a*3+i] = m_displacement[kn0][i];
185  stack.uLocal[shift + a*3+i] = m_displacement[kn1][i];
186  stack.duLocal[a*3+i] = m_incrDisp[kn0][i];
187  stack.duLocal[shift + a*3+i] = m_incrDisp[kn1][i];
188  }
189  }
190 
191  for( int j=0; j<3; ++j )
192  {
193  for( int i=0; i<3; ++i )
194  {
195  stack.localRotationMatrix[ i ][ j ] = m_rotationMatrix( k, i, j );
196  }
197  }
198 
199  for( int i=0; i<3; ++i )
200  {
201  stack.bLocal[ i ] = m_bubbleDisp[ kf0 ][i];
202  stack.bLocal[ 3 + i ] = m_bubbleDisp[ kf1 ][i];
203  stack.dbLocal[ i ] = m_incrBubbleDisp[ kf0 ][i];
204  stack.dbLocal[ 3 + i ] = m_incrBubbleDisp[ kf1 ][i];
205  }
206 
207  }
208 
210  inline
211  real64 complete( localIndex const k,
212  StackVariables & stack ) const
213  {
214  real64 matRtAtu[3][numUdofs];
215  real64 matRtAtb[3][numBdofs];
216 
217  // transp(R) * Atu
218  LvArray::tensorOps::Rij_eq_AkiBkj< 3, numUdofs, 3 >( matRtAtu, stack.localRotationMatrix,
219  stack.localAtu );
220  // transp(R) * Atb
221  LvArray::tensorOps::Rij_eq_AkiBkj< 3, numBdofs, 3 >( matRtAtb, stack.localRotationMatrix,
222  stack.localAtb );
223 
224  // Compute the node contribute of the displacement and delta displacement jump
225  LvArray::tensorOps::Ri_eq_AijBj< 3, numUdofs >( stack.dispJumpLocal, matRtAtu, stack.uLocal );
226  LvArray::tensorOps::Ri_eq_AijBj< 3, numUdofs >( stack.deltaDispJumpLocal, matRtAtu, stack.duLocal );
227 
228  // Compute the bubble contribute of the displacement and delta displacement jump
229  LvArray::tensorOps::Ri_add_AijBj< 3, numBdofs >( stack.dispJumpLocal, matRtAtb, stack.bLocal );
230  LvArray::tensorOps::Ri_add_AijBj< 3, numBdofs >( stack.deltaDispJumpLocal, matRtAtb, stack.dbLocal );
231 
232  // Store the results
233  real64 const scale = 1 / m_elementArea[k];
234 
235  for( int i=0; i<3; ++i )
236  {
237  m_dispJump[ k ][ i ] = scale * stack.dispJumpLocal[ i ];
238  m_deltaDispJump[ k ][ i ] = scale * stack.deltaDispJumpLocal[ i ];
239  }
240 
241  m_slip[k] = LvArray::math::sqrt( LvArray::math::square( m_dispJump( k, 1 ) ) + LvArray::math::square( m_dispJump( k, 2 ) ) );
242 
243 
244  return 0.0;
245  }
246 
247 protected:
248 
251 
254 
257 
260 
263 
264  arrayView1d< real64 const > const m_elementArea;
265 
266  arrayView1d< real64 > const m_slip;
267 
268 };
269 
273  globalIndex const,
275  arrayView1d< real64 > const,
276  real64 const,
278 
279 } // namespace SolidMechanicsALMKernels
280 
281 } // namespace geos
282 
283 #endif /* GEOS_PHYSICSSOLVERS_CONTACT_KERNELS_SOLIDMECHANICSDISPLACEMENTJUPDATEKERNELS_HPP_ */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:43
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
Used to forward arguments to a class that implements the InterfaceKernelBase interface.
ArrayOfArraysView< localIndex const > const m_faceToNodes
The array of array containing the face to node map.
static constexpr int numTdofs
The number of lagrange multiplier dofs per element.
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const m_X
The array containing the nodal position array.
arrayView3d< real64 const > const m_rotationMatrix
The array containing the rotation matrix for each element.
arrayView2d< localIndex const > const m_elemsToFaces
The array of array containing the element to face map.
arrayView2d< real64 > const m_dispJump
The array containing the displacement jump.
Define the base interface for implicit finite element kernels.
DispJumpUpdate(NodeManager const &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, localIndex const targetRegionIndex, FaceElementSubRegion &elementSubRegion, FE_TYPE const &finiteElementSpace, CONSTITUTIVE_TYPE &inputConstitutiveType, arrayView1d< globalIndex const > const uDofNumber, arrayView1d< globalIndex const > const bDofNumber, globalIndex const rankOffset, CRSMatrixView< real64, globalIndex const > const inputMatrix, arrayView1d< real64 > const inputRhs, real64 const inputDt, arrayView1d< localIndex const > const &faceElementList)
Constructor.
arrayView2d< real64 const, nodes::INCR_DISPLACEMENT_USD > const m_incrDisp
The rank-global incremental displacement array.
static constexpr int numUdofs
The number of displacement dofs per element.
arrayView2d< real64 > const m_deltaDispJump
The rank-global delta displacement jump array.
arrayView2d< real64 const > const m_bubbleDisp
The rank-global bubble displacement array.
arrayView2d< real64 const > const m_incrBubbleDisp
The rank-global incremental bubble displacement array.
arrayView2d< real64 const, nodes::TOTAL_DISPLACEMENT_USD > const m_displacement
The rank-global displacement array.
static constexpr int numTdofs
The number of lagrange multiplier dofs per element.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Copy global values from primary field to a local stack array.
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
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
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196
real64 uLocal[numUdofs]
Stack storage for the element local displacement vector.
real64 bLocal[numBdofs]
Stack storage for the element local bubble displacement vector.
real64 duLocal[numUdofs]
Stack storage for the element local incremental displacement vector.
real64 dbLocal[numBdofs]
Stack storage for the element local incremental bubble displacement vector.
real64 deltaDispJumpLocal[numTdofs]
Stack storage for the element local delta displacement jump vector.