20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_HYDROSTATICPRESSUREKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_HYDROSTATICPRESSUREKERNEL_HPP
24 #include "common/GEOS_RAJA_Interface.hpp"
25 #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp"
30 namespace singlePhaseBaseKernels
38 template<
typename FLUID_WRAPPER >
40 computeHydrostaticPressure(
integer const maxNumEquilIterations,
41 real64 const & equilTolerance,
42 real64 const (&gravVector)[ 3 ],
43 FLUID_WRAPPER fluidWrapper,
44 real64 const & refElevation,
47 real64 const & newElevation,
53 real64 const gravCoef = gravVector[2] * ( refElevation - newElevation );
54 real64 pres0 = refPres - refDens * gravCoef;
61 constitutive::SingleFluidBaseUpdate::computeValues( fluidWrapper,
65 pres1 = refPres - 0.5 * ( refDens + dens ) * gravCoef;
69 bool equilHasConverged =
false;
70 for(
localIndex eqIter = 0; eqIter < maxNumEquilIterations; ++eqIter )
74 equilHasConverged = ( LvArray::math::abs( pres0 - pres1 ) < equilTolerance );
78 if( equilHasConverged )
84 constitutive::SingleFluidBaseUpdate::computeValues( fluidWrapper,
88 pres1 = refPres - 0.5 * ( refDens + dens ) * gravCoef;
96 return equilHasConverged;
100 template<
typename FLUID_WRAPPER >
103 integer const maxNumEquilIterations,
104 real64 const equilTolerance,
105 real64 const (&gravVector)[ 3 ],
106 real64 const & minElevation,
107 real64 const & elevationIncrement,
108 real64 const & datumElevation,
110 FLUID_WRAPPER fluidWrapper,
114 bool hasConverged =
true;
121 constitutive::SingleFluidBaseUpdate::computeValues( fluidWrapper,
128 forAll< parallelHostPolicy >( size, [=] (
localIndex const i )
130 real64 const elevation = minElevation + i * elevationIncrement;
131 elevationValues[0][i] = elevation;
133 integer const iRef = LvArray::sortedArrayManipulation::find( elevationValues[0].begin(),
134 elevationValues[0].size(),
142 bool const hasConvergedRef =
143 computeHydrostaticPressure( maxNumEquilIterations,
150 elevationValues[0][iRef],
151 pressureValues[iRef],
153 if( !hasConvergedRef )
161 localIndex const numEntriesAboveRef = size - iRef - 1;
162 forAll< serialPolicy >( numEntriesAboveRef, [=, &hasConverged] (
localIndex const i )
164 bool const hasConvergedAboveRef =
165 computeHydrostaticPressure( maxNumEquilIterations,
169 elevationValues[0][iRef+i],
170 pressureValues[iRef+i],
172 elevationValues[0][iRef+i+1],
173 pressureValues[iRef+i+1],
175 if( !hasConvergedAboveRef )
177 hasConverged =
false;
186 forAll< serialPolicy >( numEntriesBelowRef, [=, &hasConverged] (
localIndex const i )
188 bool const hasConvergedBelowRef =
189 computeHydrostaticPressure( maxNumEquilIterations,
193 elevationValues[0][iRef-i],
194 pressureValues[iRef-i],
196 elevationValues[0][iRef-i-1],
197 pressureValues[iRef-i-1],
199 if( !hasConvergedBelowRef )
201 hasConverged =
false;
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
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.
Array< T, 1 > array1d
Alias for 1D array.