GEOS
CFLKernel.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_CFLKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_CFLKERNEL_HPP
22 
23 #include "common/DataLayouts.hpp"
24 #include "common/DataTypes.hpp"
25 #include "common/GEOS_RAJA_Interface.hpp"
26 #include "constitutive/fluid/multifluid/Layouts.hpp"
27 #include "constitutive/fluid/multifluid/MultiFluidBase.hpp"
28 #include "constitutive/fluid/multifluid/MultiFluidFields.hpp"
29 #include "constitutive/permeability/PermeabilityBase.hpp"
30 #include "constitutive/permeability/PermeabilityFields.hpp"
31 #include "constitutive/relativePermeability/RelativePermeabilityBase.hpp"
32 #include "constitutive/relativePermeability/RelativePermeabilityFields.hpp"
37 
38 namespace geos
39 {
40 
41 namespace isothermalCompositionalMultiphaseFVMKernels
42 {
43 
44 /******************************** CFLFluxKernel ********************************/
45 
50 {
51 
58  template< typename VIEWTYPE >
60 
61  template< typename VIEWTYPE >
63 
64  using CompFlowAccessors =
65  StencilAccessors< fields::flow::pressure,
66  fields::flow::gravityCoefficient,
67  fields::flow::phaseVolumeFraction,
68  fields::flow::phaseOutflux,
69  fields::flow::componentOutflux >;
70 
71  using MultiFluidAccessors =
72  StencilMaterialAccessors< constitutive::MultiFluidBase,
73  fields::multifluid::phaseViscosity,
74  fields::multifluid::phaseDensity,
75  fields::multifluid::phaseMassDensity,
76  fields::multifluid::phaseCompFraction >;
77 
78  using PermeabilityAccessors =
79  StencilMaterialAccessors< constitutive::PermeabilityBase,
80  fields::permeability::permeability,
81  fields::permeability::dPerm_dPressure >;
82 
83 
84  using RelPermAccessors =
86 
87  template< integer NC >
88  GEOS_HOST_DEVICE inline static void
89  compute( integer const numPhases,
90  integer const checkPhasePresenceInGravity,
91  localIndex const stencilSize,
92  real64 const dt,
96  real64 const (&transmissibility)[2],
105  ElementView< arrayView2d< real64, compflow::USD_PHASE > > const & phaseOutflux,
106  ElementView< arrayView2d< real64, compflow::USD_COMP > > const & compOutflux );
107 
108  GEOS_HOST_DEVICE inline static void
109  calculateMeanDensity( integer const checkPhasePresenceInGravity,
110  integer const ip, localIndex const stencilSize,
116  real64 & densMean );
117 
118  template< integer NC, typename STENCILWRAPPER_TYPE >
119  static void
120  launch( integer const numPhases,
121  integer const checkPhasePresenceInGravity,
122  real64 const dt,
123  STENCILWRAPPER_TYPE const & stencil,
125  ElementViewConst< arrayView1d< real64 const > > const & gravCoef,
127  ElementViewConst< arrayView3d< real64 const > > const & permeability,
128  ElementViewConst< arrayView3d< real64 const > > const & dPerm_dPres,
134  ElementView< arrayView2d< real64, compflow::USD_PHASE > > const & phaseOutflux,
135  ElementView< arrayView2d< real64, compflow::USD_COMP > > const & compOutflux );
136 };
137 
138 /******************************** CFLKernel ********************************/
139 
143 struct CFLKernel
144 {
145 
146  static constexpr real64 minPhaseMobility = 1e-12;
147  static constexpr real64 minComponentFraction = 1e-12;
148 
149  template< integer NP >
151  inline
152  static void
153  computePhaseCFL( real64 const poreVol,
159  real64 & phaseCFLNumber );
160 
161  template< integer NC >
163  inline
164  static void
165  computeCompCFL( real64 const poreVol,
169  real64 & compCFLNumber );
170 
171  template< integer NC, integer NP >
172  static void
173  launch( localIndex const size,
174  arrayView1d< real64 const > const & volume,
175  arrayView2d< real64 const > const & porosity,
180  arrayView4d< real64 const, constitutive::relperm::USD_RELPERM_DS > const & dPhaseRelPerm_dPhaseVolFrac,
184  arrayView1d< real64 > const & phaseCFLNumber,
185  arrayView1d< real64 > const & compCFLNumber,
186  real64 & maxPhaseCFLNumber,
187  real64 & maxCompCFLNumber );
188 
189 };
190 
191 } // namespace isothermalCompositionalMultiphaseFVMKernels
192 
193 } // namespace geos
194 
195 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_CFLKERNEL_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
typename ElementViewAccessor< VIEWTYPE >::NestedViewType ElementView
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
typename ElementViewAccessor< VIEWTYPE >::NestedViewTypeConst ElementViewConst
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
A struct to automatically construct and store element view accessors.
A struct to automatically construct and store element view accessors.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
Definition: DataTypes.hpp:200
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:184
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:228
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Definition: DataTypes.hpp:212
Functions to compute the (outflux) total volumetric flux needed in the calculation of CFL numbers.
Definition: CFLKernel.hpp:50
ElementRegionManager::ElementViewConst< VIEWTYPE > ElementViewConst
The type for element-based data. Consists entirely of ArrayView's.
Definition: CFLKernel.hpp:59
Functions to compute the CFL number using the phase volumetric outflux and the component mass outflux...
Definition: CFLKernel.hpp:144