GEOS
ImplicitSmallStrainNewmark_impl.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 
20 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_HPP_
21 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_HPP_
22 
25 
26 namespace geos
27 {
28 
29 namespace solidMechanicsLagrangianFEMKernels
30 {
31 
32 template< typename SUBREGION_TYPE,
33  typename CONSTITUTIVE_TYPE,
34  typename FE_TYPE >
36 ImplicitSmallStrainNewmark( NodeManager const & nodeManager,
37  EdgeManager const & edgeManager,
38  FaceManager const & faceManager,
39  localIndex const targetRegionIndex,
40  SUBREGION_TYPE const & elementSubRegion,
41  FE_TYPE const & finiteElementSpace,
42  CONSTITUTIVE_TYPE & inputConstitutiveType,
43  arrayView1d< globalIndex const > const & inputDofNumber,
44  globalIndex const rankOffset,
46  arrayView1d< real64 > const inputRhs,
47  real64 const inputDt,
48  real64 const (&inputGravityVector)[3],
49  real64 const inputNewmarkGamma,
50  real64 const inputNewmarkBeta,
51  real64 const inputMassDamping,
52  real64 const inputStiffnessDamping ):
53  // real64 const inputDt ):
54  Base( nodeManager,
55  edgeManager,
56  faceManager,
57  targetRegionIndex,
58  elementSubRegion,
59  finiteElementSpace,
60  inputConstitutiveType,
61  inputDofNumber,
62  rankOffset,
63  inputMatrix,
64  inputRhs,
65  inputDt,
66  inputGravityVector ),
67  m_vtilde( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
68  m_uhattilde( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
69  m_newmarkGamma( inputNewmarkGamma ),
70  m_newmarkBeta( inputNewmarkBeta ),
71  m_massDamping( inputMassDamping ),
72  m_stiffnessDamping( inputStiffnessDamping )
73  //m_dt( inputDt )
74 {}
75 
76 
77 template< typename SUBREGION_TYPE,
78  typename CONSTITUTIVE_TYPE,
79  typename FE_TYPE >
81 inline
83 setup( localIndex const k,
84  StackVariables & stack ) const
85 {
86  for( localIndex a=0; a<numNodesPerElem; ++a )
87  {
88  localIndex const localNodeIndex = m_elemsToNodes( k, a );
89  for( localIndex i=0; i<numDofPerTrialSupportPoint; ++i )
90  {
91  stack.vtilde_local[ a ][ i ] = m_vtilde[ localNodeIndex ][ i ];
92  stack.uhattilde_local[ a ][ i ] = m_uhattilde[ localNodeIndex ][ i ];
93  }
94  }
95  Base::setup( k, stack );
96 }
97 
98 template< typename SUBREGION_TYPE,
99  typename CONSTITUTIVE_TYPE,
100  typename FE_TYPE >
102 inline
105  localIndex const q,
106  StackVariables & stack ) const
107 {
108 
109  Base::quadraturePointKernel( k, q, stack );
110  real64 detJ=0;
111 
112  real64 N[numNodesPerElem];
113  FE_TYPE::calcN( q, N );
114 
115  for( int a=0; a<numNodesPerElem; ++a )
116  {
117  for( int b=a; b<numNodesPerElem; ++b )
118  {
119  real64 const integrationFactor = m_density( k, q ) * N[a] * N[b] * detJ;
120  real64 const temp1 = ( m_massDamping * m_newmarkGamma/( m_newmarkBeta * m_dt )
121  + 1.0 / ( m_newmarkBeta * m_dt * m_dt ) )* integrationFactor;
122 
123  constexpr int nsdof = numDofPerTestSupportPoint;
124  for( int i=0; i<nsdof; ++i )
125  {
126  real64 const acc = 1.0 / ( m_newmarkBeta * m_dt * m_dt ) * ( stack.uhat_local[b][i] - stack.uhattilde_local[b][i] );
127  real64 const vel = stack.vtilde_local[b][i] +
128  m_newmarkGamma/( m_newmarkBeta * m_dt ) *( stack.uhat_local[b][i]
129  - stack.uhattilde_local[b][i] );
130 
131  stack.dRdU_InertiaMassDamping[ a*nsdof+i][ b*nsdof+i ] -= temp1;
132  stack.localResidual[ a*nsdof+i ] -= ( m_massDamping * vel + acc ) * integrationFactor;
133  }
134  }
135  }
136 }
137 
138 template< typename SUBREGION_TYPE,
139  typename CONSTITUTIVE_TYPE,
140  typename FE_TYPE >
142 inline
144 complete( localIndex const k,
145  StackVariables & stack ) const
146 {
147 
148  for( int a=0; a<numNodesPerElem; ++a )
149  {
150  for( int b=0; b<numNodesPerElem; ++b )
151  {
152  for( int i=0; i<numDofPerTestSupportPoint; ++i )
153  {
154  for( int j=0; j<numDofPerTrialSupportPoint; ++j )
155  {
156  stack.localResidual[ a*numDofPerTestSupportPoint+i ] =
157  stack.localResidual[ a*numDofPerTestSupportPoint+i ] +
158  m_stiffnessDamping * stack.localJacobian[ a*numDofPerTestSupportPoint+i][ b*numDofPerTrialSupportPoint+j ] *
159  ( stack.vtilde_local[b][j] + m_newmarkGamma/(m_newmarkBeta * m_dt)*(stack.uhat_local[b][j]-stack.uhattilde_local[b][j]) );
160 
161  stack.localJacobian[a*numDofPerTestSupportPoint+i][b*numDofPerTrialSupportPoint+j] =
162  stack.localJacobian[a*numDofPerTestSupportPoint+i][b*numDofPerTrialSupportPoint+j] +
163  stack.localJacobian[a][b] * (1.0 + m_stiffnessDamping * m_newmarkGamma / ( m_newmarkBeta * m_dt ) ) +
164  stack.dRdU_InertiaMassDamping[ a*numDofPerTestSupportPoint+i ][ b*numDofPerTrialSupportPoint+j ];
165  }
166  }
167  }
168  }
169 
170  for( int a=0; a<stack.maxNumRows; ++a )
171  {
172  for( int b=0; b<stack.maxNumCols; ++b )
173  {
174  stack.localJacobian[a][b] += stack.localJacobian[a][b] * (1.0 + m_stiffnessDamping * m_newmarkGamma / ( m_newmarkBeta * m_dt ) )
175  + stack.dRdU_InertiaMassDamping[ a ][ b ];
176  }
177  }
178 
179  return Base::complete( k, stack );
180 }
181 
182 template< typename SUBREGION_TYPE,
183  typename CONSTITUTIVE_TYPE,
184  typename FE_TYPE >
185 template< typename POLICY,
186  typename KERNEL_TYPE >
187 real64
189  KERNEL_TYPE const & kernelComponent )
190 {
191  return Base::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernelComponent );
192 }
193 
194 
195 } // namespace solidMechanicsLagrangianFEMKernels
196 
197 } // namespace geos
198 
199 #endif //GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_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
GEOS_HOST_DEVICE void quadraturePointKernel(localIndex const k, localIndex const q, StackVariables &stack) const
Performs a state update at a quadrature point.
ImplicitSmallStrainNewmark(NodeManager const &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, localIndex const targetRegionIndex, SUBREGION_TYPE const &elementSubRegion, FE_TYPE const &finiteElementSpace, CONSTITUTIVE_TYPE &inputConstitutiveType, arrayView1d< globalIndex const > const &inputDofNumber, globalIndex const rankOffset, CRSMatrixView< real64, globalIndex const > const inputMatrix, arrayView1d< real64 > const inputRhs, real64 const inputDt, real64 const (&inputGravityVector)[3], real64 const inputNewmarkGamma, real64 const inputNewmarkBeta, real64 const inputMassDamping, real64 const inputStiffnessDamping)
Constructor.
static real64 kernelLaunch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Kernel Launcher.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Copy global values from primary field to a local stack array.
GEOS_HOST_DEVICE real64 complete(localIndex const k, StackVariables &stack) const
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
real64 uhattilde_local[numNodesPerElem][numDofPerTrialSupportPoint]
Stack storage for the incremental displacement predictor.
real64 vtilde_local[numNodesPerElem][numDofPerTrialSupportPoint]
Stack storage for the velocity predictor.
real64 dRdU_InertiaMassDamping[maxNumRows][maxNumCols]
Stack storage for the Inertial damping contributions to the Jacobian.
real64 uhat_local[numNodesPerElem][numDofPerTrialSupportPoint]
Stack storage for the element local nodal incremental displacement.