GEOS
MobilityKernel.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_SINGLEPHASE_MOBILITYKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_MOBILITYKERNEL_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "common/GEOS_RAJA_Interface.hpp"
25 
26 namespace geos
27 {
28 
29 namespace singlePhaseBaseKernels
30 {
31 
32 /******************************** MobilityKernel ********************************/
33 
35 {
36  // Isothermal version
38  inline
39  static void
40  compute( real64 const & dens,
41  real64 const & dDens_dPres,
42  real64 const & visc,
43  real64 const & dVisc_dPres,
44  real64 & mob,
45  real64 & dMob_dPres )
46  {
47  mob = dens / visc;
48  dMob_dPres = dDens_dPres / visc - mob / visc * dVisc_dPres;
49  }
50 
51 // Thermal version
53  inline
54  static void
55  compute( real64 const & dens,
56  real64 const & dDens_dPres,
57  real64 const & dDens_dTemp,
58  real64 const & visc,
59  real64 const & dVisc_dPres,
60  real64 const & dVisc_dTemp,
61  real64 & mob,
62  real64 & dMob_dPres,
63  real64 & dMob_dTemp )
64  {
65  mob = dens / visc;
66  dMob_dPres = dDens_dPres / visc - mob / visc * dVisc_dPres;
67  dMob_dTemp = dDens_dTemp / visc - mob / visc * dVisc_dTemp;
68  }
69 
70 // Value-only (no derivatives) version
72  inline
73  static void
74  compute( real64 const & dens,
75  real64 const & visc,
76  real64 & mob )
77  {
78  mob = dens / visc;
79  }
80 
81  // Isothermal version
82  template< typename POLICY >
83  static void launch( localIndex const size,
84  arrayView2d< real64 const > const & dens,
85  arrayView2d< real64 const > const & dDens_dPres,
86  arrayView2d< real64 const > const & visc,
87  arrayView2d< real64 const > const & dVisc_dPres,
88  arrayView1d< real64 > const & mob,
89  arrayView1d< real64 > const & dMob_dPres )
90  {
91  forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const a )
92  {
93  compute( dens[a][0],
94  dDens_dPres[a][0],
95  visc[a][0],
96  dVisc_dPres[a][0],
97  mob[a],
98  dMob_dPres[a] );
99  } );
100  }
101 
102  // Thermal version
103  template< typename POLICY >
104  static void launch( localIndex const size,
105  arrayView2d< real64 const > const & dens,
106  arrayView2d< real64 const > const & dDens_dPres,
107  arrayView2d< real64 const > const & dDens_dTemp,
108  arrayView2d< real64 const > const & visc,
109  arrayView2d< real64 const > const & dVisc_dPres,
110  arrayView2d< real64 const > const & dVisc_dTemp,
111  arrayView1d< real64 > const & mob,
112  arrayView1d< real64 > const & dMob_dPres,
113  arrayView1d< real64 > const & dMob_dTemp )
114  {
115  forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const a )
116  {
117  compute( dens[a][0],
118  dDens_dPres[a][0],
119  dDens_dTemp[a][0],
120  visc[a][0],
121  dVisc_dPres[a][0],
122  dVisc_dTemp[a][0],
123  mob[a],
124  dMob_dPres[a],
125  dMob_dTemp[a] );
126  } );
127  }
128 
129 // Value-only (no derivatives) version
130  template< typename POLICY >
131  static void launch( localIndex const size,
132  arrayView2d< real64 const > const & dens,
133  arrayView2d< real64 const > const & visc,
134  arrayView1d< real64 > const & mob )
135  {
136  forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const a )
137  {
138  compute( dens[a][0],
139  visc[a][0],
140  mob[a] );
141  } );
142  }
143 };
144 
145 } // namespace singlePhaseBaseKernels
146 
147 } // namespace geos
148 
149 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_MOBILITYKERNEL_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
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
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:196