20 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
21 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
31 namespace solidMechanicsLagrangianFEMKernels
35 template<
typename SUBREGION_TYPE,
36 typename CONSTITUTIVE_TYPE,
42 SUBREGION_TYPE
const & elementSubRegion,
43 FE_TYPE
const & finiteElementSpace,
44 CONSTITUTIVE_TYPE & inputConstitutiveType,
46 string const elementListName ):
47 Base( elementSubRegion,
49 inputConstitutiveType ),
50 m_X( nodeManager.referencePosition()),
51 m_u( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
52 m_vel( nodeManager.getField< fields::solidMechanics::velocity >() ),
53 m_acc( nodeManager.getField< fields::solidMechanics::acceleration >() ),
55 m_elementList( elementSubRegion.template getReference<
SortedArray<
localIndex > >( elementListName ).toViewConst() )
63 template<
typename SUBREGION_TYPE,
64 typename CONSTITUTIVE_TYPE,
73 localIndex const nodeIndex = m_elemsToNodes( k, a );
74 for(
int i=0; i<numDofPerTrialSupportPoint; ++i )
76 #if defined(CALC_FEM_SHAPE_IN_KERNEL)
77 stack.
xLocal[ a ][ i ] = m_X[ nodeIndex ][ i ];
81 stack.
varLocal[ a ][ i ] = m_vel[ nodeIndex ][ i ] * m_dt;
83 stack.
varLocal[ a ][ i ] = m_u[ nodeIndex ][ i ];
89 template<
typename SUBREGION_TYPE,
90 typename CONSTITUTIVE_TYPE,
99 #if !defined( USE_JACOBIAN )
100 real64 dNdX[ numNodesPerElem ][ 3 ];
101 real64 const detJ = m_finiteElementSpace.template getGradN< FE_TYPE >( k, q, stack.
xLocal, dNdX );
105 FE_TYPE::symmetricGradient( dNdX, stack.
varLocal, strain );
107 real64 stressLocal[ 6 ] = {0};
108 #if UPDATE_STRESS == 2
109 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
111 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
116 #if UPDATE_STRESS == 2
117 stressLocal[ c ] *= -detJ;
118 #elif UPDATE_STRESS == 1
119 stressLocal[ c ] = -( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * detJ;
123 stressLocal[ c ] *= -detJ;
127 FE_TYPE::plusGradNajAij( dNdX, stressLocal, stack.
fLocal );
131 real64 const detJ = FE_TYPE::inverseJacobianTransformation( q, stack.
xLocal, invJ );
134 FE_TYPE::symmetricGradient( q, invJ, stack.
varLocal, strain );
136 real64 stressLocal[ 6 ] = {0};
137 #if UPDATE_STRESS == 2
138 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
140 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
145 #if UPDATE_STRESS == 2
146 stressLocal[ c ] *= detJ;
147 #elif UPDATE_STRESS == 1
148 stressLocal[ c ] = ( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * DETJ;
152 stressLocal[ c ] *= DETJ;
156 FE_TYPE::plusGradNajAij( q, invJ, stressLocal, stack.
fLocal );
160 template<
typename SUBREGION_TYPE,
161 typename CONSTITUTIVE_TYPE,
168 for(
localIndex a = 0; a < numNodesPerElem; ++a )
170 localIndex const nodeIndex = m_elemsToNodes( k, a );
171 for(
int b = 0; b < numDofPerTestSupportPoint; ++b )
173 RAJA::atomicAdd< parallelDeviceAtomic >( &m_acc( nodeIndex, b ), stack.
fLocal[ a ][ b ] );
179 template<
typename SUBREGION_TYPE,
180 typename CONSTITUTIVE_TYPE,
182 template<
typename POLICY,
183 typename KERNEL_TYPE >
186 KERNEL_TYPE
const & kernelComponent )
192 localIndex const numProcElems = kernelComponent.m_elementList.size();
193 forAll< POLICY >( numProcElems,
196 localIndex const k = kernelComponent.m_elementList[ index ];
198 typename KERNEL_TYPE::StackVariables stack;
200 kernelComponent.setup( k, stack );
201 for(
integer q=0; q<KERNEL_TYPE::numQuadraturePointsPerElem; ++q )
203 kernelComponent.quadraturePointKernel( k, q, stack );
205 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.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
std::int32_t integer
Signed integer type.
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
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.