20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_SOLUTIONSCALINGKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_SOLUTIONSCALINGKERNEL_HPP
24 #include "common/GEOS_RAJA_Interface.hpp"
29 namespace singlePhaseBaseKernels
36 template<
typename POLICY >
41 real64 const maxAbsolutePresChange )
43 RAJA::ReduceMin< ReducePolicy< POLICY >,
real64 > scalingFactor( 1.0 );
44 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxDeltaPres( 0.0 );
48 if( ghostRank[ei] < 0 && dofNumber[ei] >= 0 )
50 localIndex const lid = dofNumber[ei] - rankOffset;
53 real64 const absPresChange = LvArray::math::abs( localSolution[lid] );
54 maxDeltaPres.max( absPresChange );
57 if( maxAbsolutePresChange > 0.0 && absPresChange > maxAbsolutePresChange )
59 real64 const presScalingFactor = maxAbsolutePresChange / absPresChange;
60 scalingFactor.min( presScalingFactor );
66 return { scalingFactor.get(), maxDeltaPres.get() };
#define GEOS_HOST_DEVICE
Marks a host-device function.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).