GEOS
ExplicitFiniteStrain_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 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_SOLIDMECHANICS_KERNELS_EXPLICITFINITESTRAIN_IMPL_HPP_
21 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITFINITESTRAIN_IMPL_HPP_
22 
23 #include "constitutive/solid/SolidUtilities.hpp"
24 #include "ExplicitFiniteStrain.hpp"
25 #include "ExplicitSmallStrain_impl.hpp"
26 #include "finiteElement/Kinematics.h"
27 
28 namespace geos
29 {
30 
31 namespace solidMechanicsLagrangianFEMKernels
32 {
33 
34 template< typename SUBREGION_TYPE,
35  typename CONSTITUTIVE_TYPE,
36  typename FE_TYPE >
38  EdgeManager const & edgeManager,
39  FaceManager const & faceManager,
40  localIndex const targetRegionIndex,
41  SUBREGION_TYPE const & elementSubRegion,
42  FE_TYPE const & finiteElementSpace,
43  CONSTITUTIVE_TYPE & inputConstitutiveType,
44  real64 const dt,
45  string const elementListName ):
46  Base( nodeManager,
47  edgeManager,
48  faceManager,
49  targetRegionIndex,
50  elementSubRegion,
51  finiteElementSpace,
52  inputConstitutiveType,
53  dt,
54  elementListName )
55 {}
56 
57 template< typename SUBREGION_TYPE,
58  typename CONSTITUTIVE_TYPE,
59  typename FE_TYPE >
61 inline
63  StackVariables & stack ) const
64 {
65  for( localIndex a=0; a< numNodesPerElem; ++a )
66  {
67  localIndex const nodeIndex = m_elemsToNodes( k, a );
68  for( int i=0; i<numDofPerTrialSupportPoint; ++i )
69  {
70  stack.xLocal[ a ][ i ] = m_X[ nodeIndex ][ i ];
71  stack.uLocal[ a ][ i ] = m_u[ nodeIndex ][ i ];
72  stack.varLocal[ a ][ i ] = m_vel[ nodeIndex ][ i ];
73  }
74  }
75 }
76 
77 template< typename SUBREGION_TYPE,
78  typename CONSTITUTIVE_TYPE,
79  typename FE_TYPE >
81 inline
83  localIndex const q,
84  StackVariables & stack ) const
85 {
86  real64 dNdX[ numNodesPerElem ][ 3 ];
87  real64 const detJ = FE_TYPE::calcGradN( q, stack.xLocal, dNdX );
88 
89  real64 dUhatdX[3][3] = { {0} };
90  real64 dUdX[3][3] = { {0} };
91  real64 F[3][3] = { {0} };
92  real64 Ldt[3][3] = { {0} };
93  real64 fInv[3][3] = { {0} };
94 
95  finiteElement::feOps::gradient( dNdX, stack.varLocal, dUhatdX );
96  finiteElement::feOps::gradient( dNdX, stack.uLocal, dUdX );
97 
98  LvArray::tensorOps::scale< 3, 3 >( dUhatdX, m_dt );
99 
100  // calculate du/dX
101  LvArray::tensorOps::scaledCopy< 3, 3 >( F, dUhatdX, 0.5 );
102  LvArray::tensorOps::add< 3, 3 >( F, dUdX );
103  LvArray::tensorOps::addIdentity< 3 >( F, 1.0 );
104  LvArray::tensorOps::invert< 3 >( fInv, F );
105 
106  // chain rule: calculate dv/dx^(n+1/2) = dv/dX * dX/dx^(n+1/2)
107  LvArray::tensorOps::Rij_eq_AikBkj< 3, 3, 3 >( Ldt, dUhatdX, fInv );
108 
109  // calculate gradient (end of step)
110  LvArray::tensorOps::copy< 3, 3 >( F, dUhatdX );
111  LvArray::tensorOps::add< 3, 3 >( F, dUdX );
112  LvArray::tensorOps::addIdentity< 3 >( F, 1.0 );
113  real64 const detF = LvArray::tensorOps::invert< 3 >( fInv, F );
114 
115  real64 Rot[ 3 ][ 3 ]{};
116  real64 Dadt[ 6 ]{};
117  HughesWinget( Rot, Dadt, Ldt );
118 
119  real64 stress[ 6 ]{};
120  constitutive::SolidUtilities::
121  hypoUpdate_StressOnly( m_constitutiveUpdate,
122  k, q, m_dt, Dadt, Rot, stress );
123 
124  real64 P[ 3 ][ 3 ]{};
125  LvArray::tensorOps::Rij_eq_symAikBjk< 3 >( P, stress, fInv );
126  LvArray::tensorOps::scale< 3, 3 >( P, -detJ * detF );
127 
128  finiteElement::feOps::plusGradNajAij( dNdX, P, stack.fLocal );
129 }
130 
131 
132 template< typename SUBREGION_TYPE,
133  typename CONSTITUTIVE_TYPE,
134  typename FE_TYPE >
135 template< typename POLICY,
136  typename KERNEL_TYPE >
137 real64
139  KERNEL_TYPE const & kernelComponent )
140 {
141  return Base::template kernelLaunch< POLICY, KERNEL_TYPE >( numElems, kernelComponent );
142 }
143 
144 #undef UPDATE_STRESS
145 
146 
147 } // namespace solidMechanicsLagrangianFEMKernels
148 
149 } // namespace geos
150 
151 #endif //GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITFINITESTRAIN_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.
ExplicitFiniteStrain(NodeManager &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, localIndex const targetRegionIndex, SUBREGION_TYPE const &elementSubRegion, FE_TYPE const &finiteElementSpace, CONSTITUTIVE_TYPE &inputConstitutiveType, real64 const dt, string const elementListName)
Constructor.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Performs the setup phase for the kernel.
static real64 kernelLaunch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Kernel Launcher.
Implements kernels for solving the equations of motion using the explicit Newmark method under the sm...
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
real64 uLocal[numNodesPerElem][numDofPerTrialSupportPoint]
Local stack storage for nodal displacements.
real64 varLocal[numNodesPerElem][numDofPerTestSupportPoint]
C-array stack storage for element local primary variable values.
real64 fLocal[numNodesPerElem][numDofPerTrialSupportPoint]
C-array stack storage for the element local force.
real64 xLocal[numNodesPerElem][3]
C-array stack storage for element local the nodal positions.