GEOS
AquiferBoundaryCondition.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 Total, S.A
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 
21 #ifndef GEOS_FIELDSPECIFICATION_AQUIFERBOUNDARYCONDITION_HPP
22 #define GEOS_FIELDSPECIFICATION_AQUIFERBOUNDARYCONDITION_HPP
23 
26 
27 namespace geos
28 {
29 
35 {
36 public:
37 
44  {
45 public:
46 
57  KernelWrapper( real64 initialPressure,
58  real64 density,
59  real64 gravCoef,
60  real64 timeConstant,
61  real64 influxConstant,
62  real64 cumulativeFlux,
63  TableFunction::KernelWrapper pressureInfluenceFunction )
64  : m_initialPressure( initialPressure ),
65  m_density( density ),
66  m_gravCoef( gravCoef ),
67  m_timeConstant( timeConstant ),
68  m_influxConstant( influxConstant ),
69  m_cumulativeFlux( cumulativeFlux ),
70  m_pressureInfluenceFunction( pressureInfluenceFunction )
71  {}
72 
85  inline real64
86  compute( real64 const & timeAtBeginningOfStep,
87  real64 const & dt,
88  real64 const & reservoirPressure,
89  real64 const & reservoirPressure_n,
90  real64 const & reservoirGravCoef,
91  real64 const & areaFraction,
92  real64 & dAquiferVolFlux_dPres ) const;
93 
94 private:
95 
96  // Physical parameters
97 
99  real64 m_initialPressure;
100 
102  real64 m_density;
103 
105  real64 m_gravCoef;
106 
108  real64 m_timeConstant;
109 
111  real64 m_influxConstant;
112 
114  real64 m_cumulativeFlux;
115 
117  TableFunction::KernelWrapper m_pressureInfluenceFunction;
118 
119  };
120 
122  AquiferBoundaryCondition( string const & name, Group * parent );
123 
126 
128  virtual ~AquiferBoundaryCondition() = default;
129 
132 
135 
138 
141 
146  static string catalogName() { return "Aquifer"; }
147 
153 
158  void setGravityVector( R1Tensor const & gravityVector );
159 
164  void saveConvergedState( real64 const fluxIncrement ) { m_cumulativeFlux += fluxIncrement; }
165 
170  void setWaterPhaseIndex( integer const waterPhaseIndex ) { m_waterPhaseIndex = waterPhaseIndex; }
171 
176  integer getWaterPhaseIndex() const { return m_waterPhaseIndex; }
177 
182  real64 const & getWaterPhaseDensity() const { return m_density; }
183 
188  arrayView1d< real64 const > getWaterPhaseComponentFraction() const { return m_phaseComponentFraction.toViewConst(); }
189 
194  arrayView1d< string const > getWaterPhaseComponentNames() const { return m_phaseComponentNames.toViewConst(); }
195 
200  bool allowAllPhasesIntoAquifer() const { return m_allowAllPhasesIntoAquifer; }
201 
206  {
207 
208  // aquifer geological properties
209 
211  constexpr static char const * aquiferPorosityString() { return "aquiferPorosity"; }
212 
214  constexpr static char const * aquiferPermeabilityString() { return "aquiferPermeability"; }
215 
216  // aquifer fluid properties
217 
219  constexpr static char const * aquiferInitialPressureString() { return "aquiferInitialPressure"; }
220 
222  constexpr static char const * aquiferWaterViscosityString() { return "aquiferWaterViscosity"; }
223 
225  constexpr static char const * aquiferWaterDensityString() { return "aquiferWaterDensity"; }
226 
228  constexpr static char const * aquiferWaterPhaseComponentFractionString() { return "aquiferWaterPhaseComponentFraction"; }
229 
231  constexpr static char const * aquiferWaterPhaseComponentNamesString() { return "aquiferWaterPhaseComponentNames"; }
232 
234  constexpr static char const * aquiferTotalCompressibilityString() { return "aquiferTotalCompressibility"; }
235 
237  constexpr static char const * allowAllPhasesIntoAquiferString() { return "allowAllPhasesIntoAquifer"; }
238 
239  // aquifer geometry
240 
242  constexpr static char const * aquiferElevationString() { return "aquiferElevation"; }
243 
245  constexpr static char const * aquiferThicknessString() { return "aquiferThickness"; }
246 
248  constexpr static char const * aquiferInnerRadiusString() { return "aquiferInnerRadius"; }
249 
251  constexpr static char const * aquiferAngleString() { return "aquiferAngle"; }
252 
253  // table influence function
254 
256  constexpr static char const * pressureInfluenceFunctionNameString() { return "pressureInfluenceFunctionName"; }
257 
258  // cumulative flux
259 
261  constexpr static char const * cumulativeFluxString() { return "cumulativeFlux"; }
262 
263  };
264 
265 
266 protected:
267 
268  virtual void postInputInitialization() override final;
269 
270 private:
271 
275  void setupDefaultPressureInfluenceFunction();
276 
280  void computeTimeConstant();
281 
285  void computeInfluxConstant();
286 
287 
288  // Physical parameters
289 
291  R1Tensor m_gravityVector;
292 
294  real64 m_porosity;
295 
297  real64 m_permeability;
298 
300  real64 m_initialPressure;
301 
303  integer m_allowAllPhasesIntoAquifer;
304 
306  integer m_waterPhaseIndex;
307 
309  real64 m_viscosity;
310 
312  real64 m_density;
313 
315  array1d< real64 > m_phaseComponentFraction;
316 
318  array1d< string > m_phaseComponentNames;
319 
321  real64 m_totalCompressibility;
322 
324  real64 m_elevation;
325 
327  real64 m_thickness;
328 
330  real64 m_innerRadius;
331 
333  real64 m_angle;
334 
336  real64 m_timeConstant;
337 
339  real64 m_influxConstant;
340 
342  real64 m_cumulativeFlux;
343 
345  string m_pressureInfluenceFunctionName;
346 
347 };
348 
350 real64
352  compute( real64 const & timeAtBeginningOfStep,
353  real64 const & dt,
354  real64 const & reservoirPressure,
355  real64 const & reservoirPressure_n,
356  real64 const & reservoirGravCoef,
357  real64 const & areaFraction,
358  real64 & dAquiferVolFlux_dPres ) const
359 {
360  // compute the dimensionless time
361  real64 const dimensionlessTimeAtBeginningOfStep = timeAtBeginningOfStep / m_timeConstant;
362  real64 const dimensionlessTimeAtEndOfStep = ( timeAtBeginningOfStep + dt ) / m_timeConstant;
363 
364  // compute the pressure influence and its derivative wrt to dimensionless time
365  real64 dPresInfluence_dTime = 0;
366  real64 const presInfluence = m_pressureInfluenceFunction.compute( &dimensionlessTimeAtEndOfStep, &dPresInfluence_dTime );
367 
368  // compute the potential difference between the reservoir (old pressure) and the aquifer
369  real64 const potDiff = m_initialPressure - reservoirPressure_n - m_density * ( m_gravCoef - reservoirGravCoef );
370 
371  // compute the a
372  real64 const timeConstantInv = 1.0 / m_timeConstant;
373  real64 const denom = presInfluence - dimensionlessTimeAtBeginningOfStep * dPresInfluence_dTime;
374  real64 const a = timeConstantInv * ( m_influxConstant * potDiff - m_cumulativeFlux * dPresInfluence_dTime ) / denom;
375 
376  // compute the b
377  real64 const b = timeConstantInv * m_influxConstant / denom;
378 
379  // compute the average inflow rate Q
380  real64 const aquiferVolFlux = areaFraction * ( a - b * ( reservoirPressure - reservoirPressure_n ) );
381  dAquiferVolFlux_dPres = -areaFraction * b;
382 
383  return aquiferVolFlux;
384 }
385 
386 
387 } /* namespace geos */
388 
389 #endif /* GEOS_FIELDSPECIFICATION_AQUIFERBOUNDARYCONDITION_HPP */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
KernelWrapper(real64 initialPressure, real64 density, real64 gravCoef, real64 timeConstant, real64 influxConstant, real64 cumulativeFlux, TableFunction::KernelWrapper pressureInfluenceFunction)
Constructor of the kernel wrapper.
GEOS_HOST_DEVICE real64 compute(real64 const &timeAtBeginningOfStep, real64 const &dt, real64 const &reservoirPressure, real64 const &reservoirPressure_n, real64 const &reservoirGravCoef, real64 const &areaFraction, real64 &dAquiferVolFlux_dPres) const
Compute the aquifer-reservoir volumetric flux.
real64 const & getWaterPhaseDensity() const
Getter for the aquifer water phase density.
static string catalogName()
Static Factory Catalog Functions.
bool allowAllPhasesIntoAquifer() const
Flag to allow all phases to flow into the aquifer.
void saveConvergedState(real64 const fluxIncrement)
Increment the cumulative flux for this aquifer.
AquiferBoundaryCondition & operator=(AquiferBoundaryCondition &&)=delete
deleted move assignment operator
void setGravityVector(R1Tensor const &gravityVector)
Setter for the R1Tensor storing the gravity vector.
AquiferBoundaryCondition(AquiferBoundaryCondition const &)=delete
deleted copy constructor
void setWaterPhaseIndex(integer const waterPhaseIndex)
Setter for the water phase index.
AquiferBoundaryCondition(AquiferBoundaryCondition &&)=default
defaulted move constructor
AquiferBoundaryCondition(string const &name, Group *parent)
constructor
integer getWaterPhaseIndex() const
Getter for the water phase index.
virtual void postInputInitialization() override final
KernelWrapper createKernelWrapper() const
Create the wrapper performing in-kernel aquifer flow rate computation.
arrayView1d< string const > getWaterPhaseComponentNames() const
Getter for the aquifer water phase component names.
AquiferBoundaryCondition & operator=(AquiferBoundaryCondition const &)=delete
deleted copy assignment operator
AquiferBoundaryCondition()=delete
deleted default constructor
arrayView1d< real64 const > getWaterPhaseComponentFraction() const
Getter for the aquifer water phase composition.
virtual ~AquiferBoundaryCondition()=default
default destructor
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
constexpr static char const * aquiferTotalCompressibilityString()
constexpr static char const * aquiferWaterPhaseComponentNamesString()
constexpr static char const * aquiferWaterPhaseComponentFractionString()
constexpr static char const * aquiferInitialPressureString()
constexpr static char const * aquiferWaterViscosityString()
constexpr static char const * pressureInfluenceFunctionNameString()
constexpr static char const * allowAllPhasesIntoAquiferString()