19 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
20 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
30 namespace solidMechanicsLagrangianFEMKernels
34 template<
typename SUBREGION_TYPE,
35 typename CONSTITUTIVE_TYPE,
41 SUBREGION_TYPE
const & elementSubRegion,
42 FE_TYPE
const & finiteElementSpace,
43 CONSTITUTIVE_TYPE & inputConstitutiveType,
45 string const elementListName ):
46 Base( elementSubRegion,
48 inputConstitutiveType ),
49 m_X( nodeManager.referencePosition()),
50 m_u( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
51 m_vel( nodeManager.getField< fields::solidMechanics::velocity >() ),
52 m_acc( nodeManager.getField< fields::solidMechanics::acceleration >() ),
54 m_elementList( elementSubRegion.template getReference<
SortedArray<
localIndex > >( elementListName ).toViewConst() )
62 template<
typename SUBREGION_TYPE,
63 typename CONSTITUTIVE_TYPE,
72 localIndex const nodeIndex = m_elemsToNodes( k, a );
73 for(
int i=0; i<numDofPerTrialSupportPoint; ++i )
75 #if defined(CALC_FEM_SHAPE_IN_KERNEL)
76 stack.
xLocal[ a ][ i ] = m_X[ nodeIndex ][ i ];
80 stack.
varLocal[ a ][ i ] = m_vel[ nodeIndex ][ i ] * m_dt;
82 stack.
varLocal[ a ][ i ] = m_u[ nodeIndex ][ i ];
88 template<
typename SUBREGION_TYPE,
89 typename CONSTITUTIVE_TYPE,
98 #if !defined( USE_JACOBIAN )
99 real64 dNdX[ numNodesPerElem ][ 3 ];
100 real64 const detJ = m_finiteElementSpace.template getGradN< FE_TYPE >( k, q, stack.
xLocal, dNdX );
104 FE_TYPE::symmetricGradient( dNdX, stack.
varLocal, strain );
106 real64 stressLocal[ 6 ] = {0};
107 #if UPDATE_STRESS == 2
108 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
110 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
115 #if UPDATE_STRESS == 2
116 stressLocal[ c ] *= -detJ;
117 #elif UPDATE_STRESS == 1
118 stressLocal[ c ] = -( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * detJ;
122 stressLocal[ c ] *= -detJ;
126 FE_TYPE::plusGradNajAij( dNdX, stressLocal, stack.
fLocal );
130 real64 const detJ = FE_TYPE::inverseJacobianTransformation( q, stack.
xLocal, invJ );
133 FE_TYPE::symmetricGradient( q, invJ, stack.
varLocal, strain );
135 real64 stressLocal[ 6 ] = {0};
136 #if UPDATE_STRESS == 2
137 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
139 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
144 #if UPDATE_STRESS == 2
145 stressLocal[ c ] *= detJ;
146 #elif UPDATE_STRESS == 1
147 stressLocal[ c ] = ( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * DETJ;
151 stressLocal[ c ] *= DETJ;
155 FE_TYPE::plusGradNajAij( q, invJ, stressLocal, stack.
fLocal );
159 template<
typename SUBREGION_TYPE,
160 typename CONSTITUTIVE_TYPE,
167 for(
localIndex a = 0; a < numNodesPerElem; ++a )
169 localIndex const nodeIndex = m_elemsToNodes( k, a );
170 for(
int b = 0; b < numDofPerTestSupportPoint; ++b )
172 RAJA::atomicAdd< parallelDeviceAtomic >( &m_acc( nodeIndex, b ), stack.
fLocal[ a ][ b ] );
178 template<
typename SUBREGION_TYPE,
179 typename CONSTITUTIVE_TYPE,
181 template<
typename POLICY,
182 typename KERNEL_TYPE >
185 KERNEL_TYPE
const & kernelComponent )
191 localIndex const numProcElems = kernelComponent.m_elementList.size();
192 forAll< POLICY >( numProcElems,
195 localIndex const k = kernelComponent.m_elementList[ index ];
197 typename KERNEL_TYPE::StackVariables stack;
199 kernelComponent.setup( k, stack );
200 for(
integer q=0; q<KERNEL_TYPE::numQuadraturePointsPerElem; ++q )
202 kernelComponent.quadraturePointKernel( k, q, stack );
204 kernelComponent.complete( k, stack );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOS_DEVICE
Marks a device-only function.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
This class provides an interface to ObjectManagerBase in order to manage edge data.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
static real64 kernelLaunch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Kernel Launcher.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Performs the setup phase for the kernel.
ExplicitSmallStrain(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 quadraturePointKernel(localIndex const k, localIndex const q, StackVariables &stack) const
Performs a state update at a quadrature point.
GEOS_HOST_DEVICE real64 complete(localIndex const k, StackVariables const &stack) const
Performs the complete phase for the kernel.
double real64
64-bit floating point type.
std::int32_t integer
Signed integer type.
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Kernel variables allocated on the stack.
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.