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 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 
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/MultiFluidBase.hpp"
27 #include "constitutive/fluid/multifluid/MultiFluidFields.hpp"
28 #include "constitutive/permeability/PermeabilityBase.hpp"
29 #include "constitutive/permeability/PermeabilityFields.hpp"
30 #include "constitutive/relativePermeability/RelativePermeabilityBase.hpp"
31 #include "constitutive/relativePermeability/RelativePermeabilityFields.hpp"
36 
37 namespace geos
38 {
39 
40 namespace isothermalCompositionalMultiphaseFVMKernels
41 {
42 
43 /******************************** CFLFluxKernel ********************************/
44 
49 {
50 
57  template< typename VIEWTYPE >
59 
60  template< typename VIEWTYPE >
62 
63  using CompFlowAccessors =
64  StencilAccessors< fields::flow::pressure,
65  fields::flow::gravityCoefficient,
66  fields::flow::phaseVolumeFraction,
67  fields::flow::phaseOutflux,
68  fields::flow::componentOutflux >;
69 
70  using MultiFluidAccessors =
71  StencilMaterialAccessors< constitutive::MultiFluidBase,
72  fields::multifluid::phaseViscosity,
73  fields::multifluid::phaseDensity,
74  fields::multifluid::phaseMassDensity,
75  fields::multifluid::phaseCompFraction >;
76 
77  using PermeabilityAccessors =
78  StencilMaterialAccessors< constitutive::PermeabilityBase,
79  fields::permeability::permeability,
80  fields::permeability::dPerm_dPressure >;
81 
82 
83  using RelPermAccessors =
85 
86  template< integer NC, localIndex NUM_ELEMS, localIndex maxStencilSize >
88  inline
89  static void
90  compute( integer const numPhases,
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  template< integer NC, typename STENCILWRAPPER_TYPE >
109  static void
110  launch( integer const numPhases,
111  real64 const dt,
112  STENCILWRAPPER_TYPE const & stencil,
114  ElementViewConst< arrayView1d< real64 const > > const & gravCoef,
116  ElementViewConst< arrayView3d< real64 const > > const & permeability,
117  ElementViewConst< arrayView3d< real64 const > > const & dPerm_dPres,
123  ElementView< arrayView2d< real64, compflow::USD_PHASE > > const & phaseOutflux,
124  ElementView< arrayView2d< real64, compflow::USD_COMP > > const & compOutflux );
125 };
126 
127 /******************************** CFLKernel ********************************/
128 
132 struct CFLKernel
133 {
134 
135  static constexpr real64 minPhaseMobility = 1e-12;
136  static constexpr real64 minComponentFraction = 1e-12;
137 
138  template< integer NP >
140  inline
141  static void
142  computePhaseCFL( real64 const poreVol,
148  real64 & phaseCFLNumber );
149 
150  template< integer NC >
152  inline
153  static void
154  computeCompCFL( real64 const poreVol,
158  real64 & compCFLNumber );
159 
160  template< integer NC, integer NP >
161  static void
162  launch( localIndex const size,
163  arrayView1d< real64 const > const & volume,
164  arrayView2d< real64 const > const & porosity,
169  arrayView4d< real64 const, constitutive::relperm::USD_RELPERM_DS > const & dPhaseRelPerm_dPhaseVolFrac,
173  arrayView1d< real64 > const & phaseCFLNumber,
174  arrayView1d< real64 > const & compCFLNumber,
175  real64 & maxPhaseCFLNumber,
176  real64 & maxCompCFLNumber );
177 
178 };
179 
180 } // namespace isothermalCompositionalMultiphaseFVMKernels
181 
182 } // namespace geos
183 
184 #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:49
ElementRegionManager::ElementViewConst< VIEWTYPE > ElementViewConst
The type for element-based data. Consists entirely of ArrayView's.
Definition: CFLKernel.hpp:58
Functions to compute the CFL number using the phase volumetric outflux and the component mass outflux...
Definition: CFLKernel.hpp:133