21 #ifndef GEOS_PHYSICSSOLVERS_CONTACT_EXPLICITMPM_HPP_
22 #define GEOS_PHYSICSSOLVERS_CONTACT_EXPLICITMPM_HPP_
24 #include "constitutive/solid/SolidUtilities.hpp"
26 #include "physicsSolvers/solidMechanics/MPMSolverFields.hpp"
31 namespace solidMechanicsMPMKernels
36 static inline void polarDecomposition(
real64 (& R)[3][3],
37 real64 const (&matrix)[3][3] )
40 LvArray::tensorOps::copy< 3, 3 >( R, matrix );
41 real64 RInverse[3][3] = { {0} },
42 RInverseTranspose[3][3] = { {0} },
43 RRTMinusI[3][3] = { {0} };
47 real64 tolerance = 10 * LvArray::NumericLimits< real64 >::epsilon;
49 while( errorSquared > tolerance * tolerance && iter < 100 )
55 LvArray::tensorOps::internal::SquareMatrixOps< 3 >::invert( RInverse, R );
56 LvArray::tensorOps::transpose< 3, 3 >( RInverseTranspose, RInverse );
57 LvArray::tensorOps::add< 3, 3 >( R, RInverseTranspose );
58 LvArray::tensorOps::scale< 3, 3 >( R, 0.5 );
62 LvArray::tensorOps::copy< 3, 3 >( copyR, R );
63 LvArray::tensorOps::Rij_eq_AikBjk< 3, 3, 3 >( RRTMinusI, R, copyR );
64 LvArray::tensorOps::addIdentity< 3 >( RRTMinusI, -1.0 );
65 for( std::ptrdiff_t i = 0; i < 3; i++ )
67 for( std::ptrdiff_t j = 0; j < 3; j++ )
69 errorSquared += RRTMinusI[i][j] * RRTMinusI[i][j];
75 GEOS_LOG_RANK(
"Polar decomposition did not converge in 100 iterations!" );
95 template<
typename POLICY,
typename CONSTITUTIVE_WRAPPER >
97 CONSTITUTIVE_WRAPPER
const & constitutiveWrapper,
115 #if defined(GEOS_USE_CUDA)
116 LvArray::tensorOps::copy< 6 >( oldStress[p][0], particleStress[p] );
120 real64 strainIncrement[6];
121 strainIncrement[0] = velocityGradient[p][0][0] * dt;
122 strainIncrement[1] = velocityGradient[p][1][1] * dt;
123 strainIncrement[2] = velocityGradient[p][2][2] * dt;
124 strainIncrement[3] = (velocityGradient[p][1][2] + velocityGradient[p][2][1]) * dt;
125 strainIncrement[4] = (velocityGradient[p][0][2] + velocityGradient[p][2][0]) * dt;
126 strainIncrement[5] = (velocityGradient[p][0][1] + velocityGradient[p][1][0]) * dt;
129 real64 fOld[3][3] = { {0} };
130 real64 fNew[3][3] = { {0} };
131 LvArray::tensorOps::copy< 3, 3 >( fNew, deformationGradient[p] );
132 LvArray::tensorOps::copy< 3, 3 >( fOld, deformationGradient[p] );
133 LvArray::tensorOps::scaledAdd< 3, 3 >( fOld, fDot[p], -dt );
136 real64 rotBeginning[3][3] = { {0} };
137 real64 rotEnd[3][3] = { {0} };
138 polarDecomposition( rotBeginning, fOld );
139 polarDecomposition( rotEnd, fNew );
143 constitutive::SolidUtilities::hypoUpdate2_StressOnly( constitutiveWrapper,
153 LvArray::tensorOps::copy< 6 >( particleStress[p], stress );
156 constitutiveWrapper.saveConvergedState( p, 0 );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_LOG_RANK(msg)
Log a message to the rank output stream.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
A struct to update particle stresses.
static void launch(SortedArrayView< localIndex const > const indices, CONSTITUTIVE_WRAPPER const &constitutiveWrapper, real64 dt, arrayView3d< real64 const > const deformationGradient, arrayView3d< real64 const > const fDot, arrayView3d< real64 const > const velocityGradient, arrayView2d< real64 > const particleStress)
Launch the kernel function doing constitutive updates.