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
54 template<
typename POLICY >
59 real64 const maxAbsolutePresChange,
62 RAJA::ReduceMin< ReducePolicy< POLICY >,
real64 > scalingFactor( 1.0 );
63 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxDeltaPres( 0.0 );
67 if( ghostRank[ei] < 0 && dofNumber[ei] >= 0 )
69 pressureScalingFactor[ei] = 1.0;
71 localIndex const lid = dofNumber[ei] - rankOffset;
74 real64 const absPresChange = LvArray::math::abs( localSolution[lid] );
75 maxDeltaPres.max( absPresChange );
78 if( maxAbsolutePresChange > 0.0 && absPresChange > maxAbsolutePresChange )
80 real64 const presScalingFactor = maxAbsolutePresChange / absPresChange;
81 pressureScalingFactor[ei] = presScalingFactor;
82 scalingFactor.min( presScalingFactor );
90 scalingData.maxDeltaPres = maxDeltaPres.get();
91 scalingData.minPresScalingFactor = scalingFactor.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).
Rank-local reductions from the single-phase solution scaling kernels.
real64 maxDeltaPres
the maximum absolute pressure change (before scaling)
real64 scalingFactor
the Newton update scaling factor
real64 maxDeltaTemp
the maximum absolute temperature change (before scaling)
real64 minTempScalingFactor
the minimum temperature scaling factor
real64 minPresScalingFactor
the minimum pressure scaling factor