20 #ifndef GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_STRESSSTRAINAVERAGEKERNELS_HPP_
21 #define GEOS_PHYSICSSOLVERS_SOLIDMECHANICS_KERNELS_STRESSSTRAINAVERAGEKERNELS_HPP_
24 #include "common/GEOS_RAJA_Interface.hpp"
25 #include "finiteElement/FiniteElementDispatch.hpp"
26 #include "finiteElement/elementFormulations/FiniteElementOperators.hpp"
27 #include "constitutive/ConstitutivePassThru.hpp"
28 #include "mesh/CellElementSubRegion.hpp"
45 template<
typename FE_TYPE,
79 FE_TYPE
const & finiteElementSpace,
80 SOLID_TYPE
const & solidModel,
81 fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement
const displacement,
82 fields::solidMechanics::arrayViewConst2dLayoutIncrDisplacement
const displacementInc,
83 fields::solidMechanics::arrayView2dLayoutStrain
const avgStrain,
84 fields::solidMechanics::arrayView2dLayoutStrain
const avgPlasticStrain,
86 fields::solidMechanics::arrayView2dLayoutAvgStress
const avgStress,
109 {
real64 uLocal[FE_TYPE::maxSupportPoints][3];
110 real64 uHatLocal[FE_TYPE::maxSupportPoints][3]; };
123 for(
localIndex a = 0; a < FE_TYPE::maxSupportPoints; ++a )
126 for(
int i = 0; i < 3; ++i )
133 for(
int icomp = 0; icomp < 6; ++icomp )
153 real64 dNdX[ FE_TYPE::maxSupportPoints ][3];
154 real64 const detJxW = FE_TYPE::calcGradN( q, stack.xLocal, stack.feStack, dNdX );
156 real64 strainInc[6] = {0.0};
157 finiteElement::feOps::symmetricGradient( dNdX, stack.uLocal, strain );
158 finiteElement::feOps::symmetricGradient( dNdX, stack.uHatLocal, strainInc );
160 real64 elasticStrainInc[6] = {0.0};
163 real64 const thermalExpansionCoefficient =
m_solidUpdate.getThermalExpansionCoefficient( k );
168 real64 conversionFactor[6] = {1.0, 1.0, 1.0, 0.5, 0.5, 0.5};
170 for(
int icomp = 0; icomp < 6; ++icomp )
177 real64 const thermalStrainInc = ( icomp < 3 ) ? thermalExpansionCoefficient * deltaTemperature : 0.0;
178 real64 const mechanicalStrainInc = strainInc[icomp] - thermalStrainInc;
183 if( std::abs( mechanicalStrainInc ) > 1.0e-8 )
197 template<
typename POLICY,
198 typename KERNEL_TYPE >
201 KERNEL_TYPE
const & kernelComponent )
203 forAll< POLICY >( numElems,
206 typename KERNEL_TYPE::StackVariables stack;
208 kernelComponent.setup( k, stack );
209 for(
integer q = 0; q < FE_TYPE::numQuadraturePoints; ++q )
211 kernelComponent.quadraturePointKernel( k, q, stack );
221 using KernelWrapper = decltype( std::declval< SOLID_TYPE const & >().createKernelUpdates() );
227 fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement
const m_displacement;
233 fields::solidMechanics::arrayView2dLayoutStrain
const m_avgStrain;
242 fields::solidMechanics::arrayView2dLayoutAvgStress
const m_avgStress;
276 template<
typename FE_TYPE,
284 FE_TYPE
const & finiteElementSpace,
285 SOLID_TYPE
const & solidModel,
286 fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement
const displacement,
287 fields::solidMechanics::arrayViewConst2dLayoutIncrDisplacement
const displacementInc,
288 fields::solidMechanics::arrayView2dLayoutStrain
const avgStrain,
289 fields::solidMechanics::arrayView2dLayoutStrain
const avgPlasticStrain,
291 fields::solidMechanics::arrayView2dLayoutAvgStress
const avgStress,
295 AverageStressStrainOverQuadraturePoints< FE_TYPE, SOLID_TYPE >
296 kernel( nodeManager, edgeManager, faceManager, elementSubRegion, finiteElementSpace,
297 solidModel, displacement, displacementInc, avgStrain, avgPlasticStrain, stress, avgStress,
298 temperature, temperature_n );
300 AverageStressStrainOverQuadraturePoints< FE_TYPE, SOLID_TYPE >::template
301 kernelLaunch< POLICY >( elementSubRegion.
size(), kernel );
#define GEOS_HOST_DEVICE
Marks a host-device function.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Performs the setup phase for the kernel.
FE_TYPE const & m_finiteElementSpace
arrayView1d< real64 const > const m_elementVolume
The volume of the elements.
traits::ViewTypeConst< typename SUBREGION_TYPE::NodeMapType::base_type > const m_elemsToNodes
The element to nodes map.
GEOS_HOST_DEVICE void setup(localIndex const k, StackVariables &stack) const
Performs the setup phase for the kernel.
arrayView1d< real64 const > const m_temperature
The temperature at the current time step (empty for non-thermal simulations)
static void kernelLaunch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Launch the kernel over the elements in the subRegion.
AverageStressStrainOverQuadraturePoints(NodeManager &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, CellElementSubRegion const &elementSubRegion, FE_TYPE const &finiteElementSpace, SOLID_TYPE const &solidModel, fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement const displacement, fields::solidMechanics::arrayViewConst2dLayoutIncrDisplacement const displacementInc, fields::solidMechanics::arrayView2dLayoutStrain const avgStrain, fields::solidMechanics::arrayView2dLayoutStrain const avgPlasticStrain, arrayView3d< real64 const, solid::STRESS_USD > const stress, fields::solidMechanics::arrayView2dLayoutAvgStress const avgStress, arrayView1d< real64 const > const temperature, arrayView1d< real64 const > const temperature_n)
Constructor for the class.
fields::solidMechanics::arrayViewConst2dLayoutIncrDisplacement const m_displacementInc
The displacement increment.
fields::solidMechanics::arrayView2dLayoutStrain const m_avgPlasticStrain
The average plastic strain.
KernelWrapper const m_solidUpdate
The material.
arrayView1d< real64 const > const m_temperature_n
The temperature at the previous time step (empty for non-thermal simulations)
GEOS_HOST_DEVICE void quadraturePointKernel(localIndex const k, localIndex const q, StackVariables &stack) const
Increment the average property with the contribution of the property at this quadrature point.
fields::solidMechanics::arrayView2dLayoutStrain const m_avgStrain
The average strain.
fields::solidMechanics::arrayView2dLayoutAvgStress const m_avgStress
The average stress.
fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement const m_displacement
The displacement solution.
arrayView3d< real64 const, solid::STRESS_USD > const m_stress
The stress solution.
Class to create and launch the kernel.
static void createAndLaunch(NodeManager &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, CellElementSubRegion const &elementSubRegion, FE_TYPE const &finiteElementSpace, SOLID_TYPE const &solidModel, fields::solidMechanics::arrayViewConst2dLayoutTotalDisplacement const displacement, fields::solidMechanics::arrayViewConst2dLayoutIncrDisplacement const displacementInc, fields::solidMechanics::arrayView2dLayoutStrain const avgStrain, fields::solidMechanics::arrayView2dLayoutStrain const avgPlasticStrain, arrayView3d< real64 const, solid::STRESS_USD > const stress, fields::solidMechanics::arrayView2dLayoutAvgStress const avgStress, arrayView1d< real64 const > const temperature={}, arrayView1d< real64 const > const temperature_n={})
Create a new kernel and launch.
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.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
int integer
Signed integer type.
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Kernel variables allocated on the stack.