GEOSX
ImplicitSmallStrainNewmark_impl.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_HPP_
20 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_HPP_
21 
24 
25 namespace geos
26 {
27 
28 namespace solidMechanicsLagrangianFEMKernels
29 {
30 
31 template< typename SUBREGION_TYPE,
32  typename CONSTITUTIVE_TYPE,
33  typename FE_TYPE >
35 ImplicitSmallStrainNewmark( NodeManager const & nodeManager,
36  EdgeManager const & edgeManager,
37  FaceManager const & faceManager,
38  localIndex const targetRegionIndex,
39  SUBREGION_TYPE const & elementSubRegion,
40  FE_TYPE const & finiteElementSpace,
41  CONSTITUTIVE_TYPE & inputConstitutiveType,
42  arrayView1d< globalIndex const > const & inputDofNumber,
43  globalIndex const rankOffset,
45  arrayView1d< real64 > const inputRhs,
46  real64 const inputDt,
47  real64 const (&inputGravityVector)[3],
48  real64 const inputNewmarkGamma,
49  real64 const inputNewmarkBeta,
50  real64 const inputMassDamping,
51  real64 const inputStiffnessDamping ):
52  // real64 const inputDt ):
53  Base( nodeManager,
54  edgeManager,
55  faceManager,
56  targetRegionIndex,
57  elementSubRegion,
58  finiteElementSpace,
59  inputConstitutiveType,
60  inputDofNumber,
61  rankOffset,
62  inputMatrix,
63  inputRhs,
64  inputDt,
65  inputGravityVector ),
66  m_vtilde( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
67  m_uhattilde( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
68  m_newmarkGamma( inputNewmarkGamma ),
69  m_newmarkBeta( inputNewmarkBeta ),
70  m_massDamping( inputMassDamping ),
71  m_stiffnessDamping( inputStiffnessDamping )
72  //m_dt( inputDt )
73 {}
74 
75 
76 template< typename SUBREGION_TYPE,
77  typename CONSTITUTIVE_TYPE,
78  typename FE_TYPE >
80 inline
82 setup( localIndex const k,
83  StackVariables & stack ) const
84 {
85  for( localIndex a=0; a<numNodesPerElem; ++a )
86  {
87  localIndex const localNodeIndex = m_elemsToNodes( k, a );
88  for( localIndex i=0; i<numDofPerTrialSupportPoint; ++i )
89  {
90  stack.vtilde_local[ a ][ i ] = m_vtilde[ localNodeIndex ][ i ];
91  stack.uhattilde_local[ a ][ i ] = m_uhattilde[ localNodeIndex ][ i ];
92  }
93  }
94  Base::setup( k, stack );
95 }
96 
97 template< typename SUBREGION_TYPE,
98  typename CONSTITUTIVE_TYPE,
99  typename FE_TYPE >
101 inline
104  localIndex const q,
105  StackVariables & stack ) const
106 {
107 
108  Base::quadraturePointKernel( k, q, stack );
109  real64 detJ=0;
110 
111  real64 N[numNodesPerElem];
112  FE_TYPE::calcN( q, N );
113 
114  for( int a=0; a<numNodesPerElem; ++a )
115  {
116  for( int b=a; b<numNodesPerElem; ++b )
117  {
118  real64 const integrationFactor = m_density( k, q ) * N[a] * N[b] * detJ;
119  real64 const temp1 = ( m_massDamping * m_newmarkGamma/( m_newmarkBeta * m_dt )
120  + 1.0 / ( m_newmarkBeta * m_dt * m_dt ) )* integrationFactor;
121 
122  constexpr int nsdof = numDofPerTestSupportPoint;
123  for( int i=0; i<nsdof; ++i )
124  {
125  real64 const acc = 1.0 / ( m_newmarkBeta * m_dt * m_dt ) * ( stack.uhat_local[b][i] - stack.uhattilde_local[b][i] );
126  real64 const vel = stack.vtilde_local[b][i] +
127  m_newmarkGamma/( m_newmarkBeta * m_dt ) *( stack.uhat_local[b][i]
128  - stack.uhattilde_local[b][i] );
129 
130  stack.dRdU_InertiaMassDamping[ a*nsdof+i][ b*nsdof+i ] -= temp1;
131  stack.localResidual[ a*nsdof+i ] -= ( m_massDamping * vel + acc ) * integrationFactor;
132  }
133  }
134  }
135 }
136 
137 template< typename SUBREGION_TYPE,
138  typename CONSTITUTIVE_TYPE,
139  typename FE_TYPE >
141 inline
143 complete( localIndex const k,
144  StackVariables & stack ) const
145 {
146 
147  for( int a=0; a<numNodesPerElem; ++a )
148  {
149  for( int b=0; b<numNodesPerElem; ++b )
150  {
151  for( int i=0; i<numDofPerTestSupportPoint; ++i )
152  {
153  for( int j=0; j<numDofPerTrialSupportPoint; ++j )
154  {
155  stack.localResidual[ a*numDofPerTestSupportPoint+i ] =
156  stack.localResidual[ a*numDofPerTestSupportPoint+i ] +
157  m_stiffnessDamping * stack.localJacobian[ a*numDofPerTestSupportPoint+i][ b*numDofPerTrialSupportPoint+j ] *
158  ( stack.vtilde_local[b][j] + m_newmarkGamma/(m_newmarkBeta * m_dt)*(stack.uhat_local[b][j]-stack.uhattilde_local[b][j]) );
159 
160  stack.localJacobian[a*numDofPerTestSupportPoint+i][b*numDofPerTrialSupportPoint+j] =
161  stack.localJacobian[a*numDofPerTestSupportPoint+i][b*numDofPerTrialSupportPoint+j] +
162  stack.localJacobian[a][b] * (1.0 + m_stiffnessDamping * m_newmarkGamma / ( m_newmarkBeta * m_dt ) ) +
163  stack.dRdU_InertiaMassDamping[ a*numDofPerTestSupportPoint+i ][ b*numDofPerTrialSupportPoint+j ];
164  }
165  }
166  }
167  }
168 
169  for( int a=0; a<stack.maxNumRows; ++a )
170  {
171  for( int b=0; b<stack.maxNumCols; ++b )
172  {
173  stack.localJacobian[a][b] += stack.localJacobian[a][b] * (1.0 + m_stiffnessDamping * m_newmarkGamma / ( m_newmarkBeta * m_dt ) )
174  + stack.dRdU_InertiaMassDamping[ a ][ b ];
175  }
176  }
177 
178  return Base::complete( k, stack );
179 }
180 
181 template< typename SUBREGION_TYPE,
182  typename CONSTITUTIVE_TYPE,
183  typename FE_TYPE >
184 template< typename POLICY,
185  typename KERNEL_TYPE >
186 real64
188  KERNEL_TYPE const & kernelComponent )
189 {
190  return Base::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernelComponent );
191 }
192 
193 
194 } // namespace solidMechanicsLagrangianFEMKernels
195 
196 } // namespace geos
197 
198 #endif //GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_IMPLCITSMALLSTRAINNEWMARK_IMPL_HPP_
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:48
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:42
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:43
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:45
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:220
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:350
double real64
64-bit floating point type.
Definition: DataTypes.hpp:139
GEOSX_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
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.