20 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
21 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_EXPLICITSMALLTRAIN_IMPL_HPP_
26 #include "finiteElement/elementFormulations/FiniteElementOperators.hpp"
32 namespace solidMechanicsLagrangianFEMKernels
36 template<
typename SUBREGION_TYPE,
37 typename CONSTITUTIVE_TYPE,
43 SUBREGION_TYPE
const & elementSubRegion,
44 FE_TYPE
const & finiteElementSpace,
45 CONSTITUTIVE_TYPE & inputConstitutiveType,
47 string const elementListName ):
48 Base( elementSubRegion,
50 inputConstitutiveType ),
51 m_X( nodeManager.referencePosition()),
52 m_u( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
53 m_vel( nodeManager.getField< fields::solidMechanics::velocity >() ),
54 m_acc( nodeManager.getField< fields::solidMechanics::acceleration >() ),
56 m_elementList( elementSubRegion.template getReference<
SortedArray<
localIndex > >( elementListName ).toViewConst() )
64 template<
typename SUBREGION_TYPE,
65 typename CONSTITUTIVE_TYPE,
74 localIndex const nodeIndex = m_elemsToNodes( k, a );
75 for(
int i=0; i<numDofPerTrialSupportPoint; ++i )
77 stack.
xLocal[ a ][ i ] = m_X[ nodeIndex ][ i ];
79 stack.
varLocal[ a ][ i ] = m_vel[ nodeIndex ][ i ] * m_dt;
81 stack.
varLocal[ a ][ i ] = m_u[ nodeIndex ][ i ];
87 template<
typename SUBREGION_TYPE,
88 typename CONSTITUTIVE_TYPE,
97 #if !defined( USE_JACOBIAN )
98 real64 dNdX[ numNodesPerElem ][ 3 ];
99 real64 const detJ = FE_TYPE::calcGradN( q, stack.
xLocal, dNdX );
103 finiteElement::feOps::symmetricGradient( dNdX, stack.
varLocal, strain );
105 real64 stressLocal[ 6 ] = {0};
106 #if UPDATE_STRESS == 2
107 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
109 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
114 #if UPDATE_STRESS == 2
115 stressLocal[ c ] *= -detJ;
116 #elif UPDATE_STRESS == 1
117 stressLocal[ c ] = -( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * detJ;
121 stressLocal[ c ] *= -detJ;
125 finiteElement::feOps::plusGradNajAij( dNdX, stressLocal, stack.
fLocal );
129 real64 const detJ = FE_TYPE::inverseJacobianTransformation( q, stack.
xLocal, invJ );
132 finiteElement::feOps::symmetricGradient( q, invJ, stack.
varLocal, strain );
134 real64 stressLocal[ 6 ] = {0};
135 #if UPDATE_STRESS == 2
136 m_constitutiveUpdate.smallStrainUpdate_StressOnly( k, q, m_dt, strain, stressLocal );
138 m_constitutiveUpdate.smallStrainNoStateUpdate_StressOnly( k, q, strain, stressLocal );
143 #if UPDATE_STRESS == 2
144 stressLocal[ c ] *= detJ;
145 #elif UPDATE_STRESS == 1
146 stressLocal[ c ] = ( stressLocal[ c ] + m_constitutiveUpdate.m_newStress( k, q, c ) ) * DETJ;
150 stressLocal[ c ] *= DETJ;
154 finiteElement::feOps::plusGradNajAij( q, invJ, stressLocal, stack.
fLocal );
158 template<
typename SUBREGION_TYPE,
159 typename CONSTITUTIVE_TYPE,
166 for(
localIndex a = 0; a < numNodesPerElem; ++a )
168 localIndex const nodeIndex = m_elemsToNodes( k, a );
169 for(
int b = 0; b < numDofPerTestSupportPoint; ++b )
171 RAJA::atomicAdd< parallelDeviceAtomic >( &m_acc( nodeIndex, b ), stack.
fLocal[ a ][ b ] );
177 template<
typename SUBREGION_TYPE,
178 typename CONSTITUTIVE_TYPE,
180 template<
typename POLICY,
181 typename KERNEL_TYPE >
184 KERNEL_TYPE
const & kernelComponent )
190 localIndex const numProcElems = kernelComponent.m_elementList.size();
191 forAll< POLICY >( numProcElems,
194 localIndex const k = kernelComponent.m_elementList[ index ];
196 typename KERNEL_TYPE::StackVariables stack;
198 kernelComponent.setup( k, stack );
199 for(
integer q=0; q<KERNEL_TYPE::numQuadraturePointsPerElem; ++q )
201 kernelComponent.quadraturePointKernel( k, q, stack );
203 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).
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
int integer
Signed integer type.
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.
real64 xLocal[numNodesPerElem][3]
C-array stack storage for element local the nodal positions.