16 #ifndef GEOS_PHYSICSSOLVERS_INDUCEDSEISMICITY_KERNELS_RATEANDSTATEKERNELSBASE_HPP_
17 #define GEOS_PHYSICSSOLVERS_INDUCEDSEISMICITY_KERNELS_RATEANDSTATEKERNELSBASE_HPP_
20 #include "common/GEOS_RAJA_Interface.hpp"
21 #include "constitutive/contact/RateAndStateFriction.hpp"
27 namespace rateAndStateKernels
33 static void projectSlipRateBase(
localIndex const k,
34 real64 const frictionCoefficient,
35 real64 const shearImpedance,
36 arrayView1d< real64 const >
const normalTraction,
37 arrayView2d< real64 const >
const shearTraction,
38 arrayView1d< real64 const >
const slipRate,
39 arrayView2d< real64 >
const slipVelocity )
42 real64 const frictionForce = normalTraction[k] * frictionCoefficient;
43 real64 const projectionScaling = 1.0 / ( shearImpedance + frictionForce / slipRate[k] );
44 slipVelocity[k][0] = projectionScaling * shearTraction[k][0];
45 slipVelocity[k][1] = projectionScaling * shearTraction[k][1];
48 template<
typename POLICY,
typename KERNEL_TYPE >
49 static bool newtonSolve( SurfaceElementSubRegion & subRegion,
55 bool allConverged =
false;
56 for(
integer iter = 0; iter < maxNewtonIter; iter++ )
58 RAJA::ReduceMin< parallelDeviceReduce, int > converged( 1 );
59 RAJA::ReduceMax< parallelDeviceReduce, real64 > residualNorm( 0.0 );
62 typename KERNEL_TYPE::StackVariables stack;
63 kernel.setup( k, dt, stack );
64 kernel.solve( k, stack );
65 auto const [elementConverged, elementResidualNorm] = kernel.checkConvergence( stack, newtonTol );
66 converged.min( elementConverged );
67 residualNorm.max( elementResidualNorm );
71 GEOS_LOG_RANK_0( GEOS_FMT(
" Newton iter {} : residual = {:.10e} ", iter, maxResidualNorm ) );
86 template<
typename KERNEL_TYPE,
typename POLICY >
88 createAndLaunch( SurfaceElementSubRegion & subRegion,
89 string const & frictionLawNameKey,
90 real64 const shearImpedance,
100 string const & frictionaLawName = subRegion.getReference<
string >( frictionLawNameKey );
101 constitutive::RateAndStateFriction
const & frictionLaw = subRegion.getConstitutiveModel< constitutive::RateAndStateFriction >( frictionaLawName );
102 KERNEL_TYPE kernel( subRegion, frictionLaw, shearImpedance );
104 real64 dtRemaining = totalDt;
106 for(
integer subStep = 0; subStep < 5 && dtRemaining > 0.0; ++subStep )
108 real64 dtAccepted = KERNEL_TYPE::template solveRateAndStateEquation< POLICY >( subRegion, kernel, dt, maxNewtonIter, newtonTol );
109 dtRemaining -= dtAccepted;
111 if( dtRemaining > 0.0 )
115 GEOS_LOG_RANK_0( GEOS_FMT(
" sub-step = {} completed, dt = {}, remaining dt = {}", subStep, dt, dtRemaining ) );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOS_LOG_RANK_0(msg)
Log a message on screen on rank 0.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
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.
static T max(T const &value, MPI_Comm comm=MPI_COMM_GEOS)
Convenience function for a MPI_Allreduce using a MPI_MAX operation.