20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_THERMALSOLUTIONSCALINGKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_THERMALSOLUTIONSCALINGKERNEL_HPP
28 namespace thermalCompositionalMultiphaseBaseKernels
65 real64 const maxAbsolutePresChange,
66 real64 const maxRelativeTempChange,
67 real64 const maxCompFracChange,
68 real64 const maxRelativeCompDensChange,
80 integer const temperatureOffset )
81 :
Base( maxRelativePresChange,
82 maxAbsolutePresChange,
84 maxRelativeCompDensChange,
92 pressureScalingFactor,
93 compDensScalingFactor ),
121 real64 constexpr eps = isothermalCompositionalMultiphaseBaseKernels::minDensForDivision;
127 if( stack.localMaxDeltaTemp < absTempChange )
129 stack.localMaxDeltaTemp = absTempChange;
136 real64 const relativeTempChange = absTempChange / temp;
141 if( stack.localMinVal > tempScalingFactor )
143 stack.localMinVal = tempScalingFactor;
145 if( stack.localMinTempScalingFactor > tempScalingFactor )
147 stack.localMinTempScalingFactor = tempScalingFactor;
190 template<
typename POLICY >
193 real64 const maxAbsolutePresChange,
194 real64 const maxRelativeTempChange,
195 real64 const maxCompFracChange,
196 real64 const maxRelativeCompDensChange,
208 integer const temperatureOffset )
211 maxCompFracChange, maxRelativeCompDensChange,
212 rankOffset, numComp, dofKey, subRegion, localSolution,
213 pressure, temperature, compDens, pressureScalingFactor,
214 compDensScalingFactor, temperatureScalingFactor, temperatureOffset );
215 return thermalCompositionalMultiphaseBaseKernels::
216 SolutionScalingKernel::launch< POLICY >( subRegion.
size(), kernel );
#define GEOS_HOST_DEVICE
Marks a host-device function.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
arrayView1d< real64 const > const m_localSolution
View on the local residual.
real64 const m_numComp
Number of components.
Define the kernel for scaling the Newton update.
GEOS_HOST_DEVICE void computeScalingFactor(localIndex const ei, StackVariables &stack, FUNC &&kernelOp=NoOpFunc{}) const
Compute the local value of the scaling factor.
static SolutionScalingKernel::StackVariables createAndLaunch(real64 const maxRelativePresChange, real64 const maxAbsolutePresChange, real64 const maxRelativeTempChange, real64 const maxCompFracChange, real64 const maxRelativeCompDensChange, arrayView1d< real64 const > const pressure, arrayView1d< real64 const > const temperature, arrayView2d< real64 const, compflow::USD_COMP > const compDens, arrayView1d< real64 > pressureScalingFactor, arrayView1d< real64 > compDensScalingFactor, arrayView1d< real64 > temperatureScalingFactor, globalIndex const rankOffset, integer const numComp, string const dofKey, ElementSubRegionBase &subRegion, arrayView1d< real64 const > const localSolution, integer const temperatureOffset)
Create a new kernel and launch.
Define the kernel for scaling the Newton update.
GEOS_HOST_DEVICE void compute(localIndex const ei, StackVariables &stack) const
Compute the local value.
arrayView1d< real64 > const m_temperatureScalingFactor
View on the scaling factor.
real64 const m_maxRelativeTempChange
Max allowed changes in primary variables.
arrayView1d< real64 const > const m_temperature
View on the primary variables.
integer const m_temperatureOffset
Temperature offset in solution array.
GEOS_HOST_DEVICE void computeScalingFactor(localIndex const ei, StackVariables &stack) const
Compute the local value of the scaling factor.
SolutionScalingKernel(real64 const maxRelativePresChange, real64 const maxAbsolutePresChange, real64 const maxRelativeTempChange, real64 const maxCompFracChange, real64 const maxRelativeCompDensChange, globalIndex const rankOffset, integer const numComp, string const dofKey, ElementSubRegionBase const &subRegion, arrayView1d< real64 const > const localSolution, arrayView1d< real64 const > const pressure, arrayView1d< real64 const > const temperature, arrayView2d< real64 const, compflow::USD_COMP > const compDens, arrayView1d< real64 > pressureScalingFactor, arrayView1d< real64 > compDensScalingFactor, arrayView1d< real64 > temperatureScalingFactor, integer const temperatureOffset)
Create a new kernel instance.
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).
std::int32_t integer
Signed integer type.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Kernel variables located on the stack.