GEOS
HydrostaticPressureKernel.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_HYDROSTATICPRESSUREKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_HYDROSTATICPRESSUREKERNEL_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "constitutive/fluid/multifluid/Layouts.hpp"
26 
27 namespace geos
28 {
29 
30 namespace isothermalCompositionalMultiphaseBaseKernels
31 {
32 
33 /******************************** HydrostaticPressureKernel ********************************/
34 
35 template< typename FLUID_WRAPPER >
37 {
38  enum class ReturnType : integer
39  {
40  FAILED_TO_CONVERGE = 0,
41  DETECTED_MULTIPHASE_FLOW = 1,
42  SUCCESS = 2,
43  DETECTED_SINGLEPHASE_FLOW = 3,
44  PHASE_CORRECTION_NOT_NEEDED = 4
45  };
46 
47  static ReturnType
48  computeHydrostaticPressure( integer const & numComps,
49  integer const & numPhases,
50  integer const & ipGas,
51  integer const & ipOil,
52  integer const & ipWater,
53  integer const & ipInit,
54  arrayView1d< real64 const > const & phaseContacts,
55  arrayView1d< real64 const > const & phaseMinVolumeFraction,
56  integer const maxNumEquilIterations,
57  real64 const & equilTolerance,
58  real64 const (&gravVector)[ 3 ],
59  FLUID_WRAPPER fluidWrapper,
61  TableFunction::KernelWrapper tempTableWrapper,
62  real64 const & refElevation,
64  arraySlice1d< real64 const > const & refPhaseMassDens,
65  real64 const & newElevation,
67  arraySlice1d< real64 > const & newPhaseMassDens,
70 
71  static ReturnType
72  computeHydrostaticPressureAtMultipleElevations( localIndex const & startElevationIndex,
73  localIndex const & endElevationIndex,
74  integer const & numComps,
75  integer const & numPhases,
76  integer const & ipGas,
77  integer const & ipOil,
78  integer const & ipWater,
79  integer const & ipInit,
80  arrayView1d< real64 const > const & phaseContacts,
81  arrayView1d< real64 const > const & phaseMinVolumeFraction,
82  integer const & maxNumEquilIterations,
83  real64 const & equilTolerance,
84  real64 const (&gravVector)[ 3 ],
85  FLUID_WRAPPER fluidWrapper,
87  TableFunction::KernelWrapper tempTableWrapper,
88  arrayView1d< arrayView1d< real64 > const > elevationValues,
90  arrayView2d< real64 > const & phaseMassDens,
93 
94  static ReturnType
95  marchBetweenTwoElevations( real64 const & startElevation,
96  real64 const & endElevation,
97  integer const & numComps,
98  integer const & numPhases,
99  integer const & ipGas,
100  integer const & ipOil,
101  integer const & ipWater,
102  integer const & ipInit,
103  arrayView1d< real64 const > const & phaseContacts,
104  arrayView1d< real64 const > const & phaseMinVolumeFraction,
105  integer const maxNumEquilIterations,
106  real64 const & equilTolerance,
107  real64 const (&gravVector)[ 3 ],
108  FLUID_WRAPPER fluidWrapper,
110  TableFunction::KernelWrapper tempTableWrapper,
111  arrayView1d< arrayView1d< real64 > const > elevationValues,
113  arrayView2d< real64 > const & phaseMassDens,
116 
117  static ReturnType
118  launch( localIndex const & size,
119  integer const & numComps,
120  integer const & numPhases,
121  integer const & ipGas,
122  integer const & ipOil,
123  integer const & ipWater,
124  integer const & ipInit,
125  integer const & maxNumEquilIterations,
126  arrayView1d< real64 const > const & phaseContacts,
127  arrayView1d< real64 const > const & phaseMinVolumeFraction,
128  real64 const equilTolerance,
129  real64 const (&gravVector)[ 3 ],
130  real64 const & datumElevation,
131  real64 const & datumPres,
132  FLUID_WRAPPER fluidWrapper,
134  TableFunction::KernelWrapper tempTableWrapper,
135  arrayView1d< arrayView1d< real64 > const > elevationValues,
139 
140  static ReturnType
141  phaseCorrection( integer const & numComps,
142  integer const & numPhases,
143  integer const & ipGas,
144  integer const & ipWater,
145  arrayView1d< real64 const > const & phaseMinVolumeFraction,
146  real64 const & pres,
147  real64 const & temp,
151  FLUID_WRAPPER fluidWrapper );
152 
153  static ReturnType
154  applyPhaseCorrection( integer const & numComps,
155  integer const & numPhases,
156  integer const & ip_phase,
157  integer const & ip_otherPhase,
158  real64 const & pres,
159  real64 const & temp,
163  FLUID_WRAPPER fluidWrapper );
164 
165  static void mixingStep( integer const & numComps,
166  real64 const & a,
170 
171  static integer evaluateFlashPhaseIndex( integer const & numPhases,
172  integer const & ipGas,
173  integer const & ipOil,
174  integer const & ipWater,
175  integer const & ipInit,
176  real64 const & elevation,
177  arrayView1d< real64 const > const & phaseContacts );
178 
179  static void evaluatePrimaryAndContactPhaseIndices( integer const & numPhases,
180  integer const & ipGas,
181  integer const & ipOil,
182  integer const & ipWater,
183  real64 const & startElevation,
184  real64 const & endElevation,
185  arrayView1d< real64 const > const & phaseContacts,
186  integer & ipPP,
187  integer & ipCP );
188 
189  static void
190  computeDatumPhaseMassDens( integer const & numComps,
191  integer const & numPhases,
192  integer const & ipGas,
193  integer const & ipWater,
194  arrayView1d< real64 const > const & phaseMinVolumeFraction,
195  real64 const & datumElevation,
196  real64 const & datumPres,
197  real64 const & datumTemp,
200  bool singlePhase,
201  FLUID_WRAPPER fluidWrapper );
202 };
203 
204 } // namespace isothermalCompositionalMultiphaseBaseKernels
205 } // namespace geos
206 
207 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_HYDROSTATICPRESSUREKERNEL_HPP
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
Definition: DataTypes.hpp:199
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:183
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:227
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
int integer
Signed integer type.
Definition: DataTypes.hpp:81
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Definition: DataTypes.hpp:211