1
1
#ifndef SPRAYPROPERTIES_H
2
2
#define SPRAYPROPERTIES_H
3
3
4
- using namespace amrex ;
5
-
6
4
// Structs for liquid fuel properties
7
5
namespace pele ::physics::SprayProps {
8
6
9
7
// Original spray properties ported from PeleMP to PelePhysics
10
8
struct MPLiqProps
11
9
{
12
- Real ref_T = 300 .; // Reference temperature for liquid properties
13
- GpuArray<Real, SPRAY_FUEL_NUM> critT;
14
- GpuArray<Real, SPRAY_FUEL_NUM> boilT;
15
- GpuArray<Real, SPRAY_FUEL_NUM> cp;
16
- GpuArray<Real, SPRAY_FUEL_NUM> latent;
17
- GpuArray<Real, SPRAY_FUEL_NUM> latentRef_minus_gasRefH_i;
18
- Real sigma = -1 .; // Surface tension
10
+ amrex:: Real ref_T = 300 .; // Reference temperature for liquid properties
11
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM> critT;
12
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM> boilT;
13
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM> cp;
14
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM> latent;
15
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM> latentRef_minus_gasRefH_i;
16
+ amrex:: Real sigma = -1 .; // Surface tension
19
17
// 3 coefficients for Antoine equation and conversion to appropriate units
20
- GpuArray<Real, SPRAY_FUEL_NUM * 4 > psat_coef;
21
- GpuArray<Real, SPRAY_FUEL_NUM * 4 > rho_coef;
22
- GpuArray<Real, SPRAY_FUEL_NUM * 4 > lambda_coef;
23
- GpuArray<Real, SPRAY_FUEL_NUM * 4 > mu_coef;
18
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM * 4 > psat_coef;
19
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM * 4 > rho_coef;
20
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM * 4 > lambda_coef;
21
+ amrex:: GpuArray<amrex:: Real, SPRAY_FUEL_NUM * 4 > mu_coef;
24
22
25
23
AMREX_GPU_HOST_DEVICE
26
24
AMREX_FORCE_INLINE
27
- Real critT_i (const int spf) const { return critT[spf]; }
25
+ amrex:: Real critT_i (const int spf) const { return critT[spf]; }
28
26
29
27
AMREX_GPU_HOST_DEVICE
30
28
AMREX_FORCE_INLINE
31
- Real boilT_i (const int spf) const { return boilT[spf]; }
29
+ amrex:: Real boilT_i (const int spf) const { return boilT[spf]; }
32
30
33
31
AMREX_GPU_HOST_DEVICE
34
32
AMREX_FORCE_INLINE
35
- Real cp_i (const Real& /* T*/ , const int spf) const { return cp[spf]; }
33
+ amrex::Real cp_i (const amrex::Real& /* T*/ , const int spf) const
34
+ {
35
+ return cp[spf];
36
+ }
36
37
37
38
AMREX_GPU_HOST_DEVICE
38
39
AMREX_FORCE_INLINE
39
- Real rho_i (const Real& T, const int spf) const
40
+ amrex:: Real rho_i (const amrex:: Real& T, const int spf) const
40
41
{
41
- Real a = rho_coef[4 * spf];
42
- Real b = rho_coef[4 * spf + 1 ];
43
- Real c = rho_coef[4 * spf + 2 ];
44
- Real d = rho_coef[4 * spf + 3 ];
42
+ amrex:: Real a = rho_coef[4 * spf];
43
+ amrex:: Real b = rho_coef[4 * spf + 1 ];
44
+ amrex:: Real c = rho_coef[4 * spf + 2 ];
45
+ amrex:: Real d = rho_coef[4 * spf + 3 ];
45
46
return a + T * (b + T * (c + T * d));
46
47
}
47
48
48
49
AMREX_GPU_HOST_DEVICE
49
50
AMREX_FORCE_INLINE
50
- Real lambda_i (const Real& T, const int spf) const
51
+ amrex:: Real lambda_i (const amrex:: Real& T, const int spf) const
51
52
{
52
- Real a = lambda_coef[4 * spf];
53
- Real b = lambda_coef[4 * spf + 1 ];
54
- Real c = lambda_coef[4 * spf + 2 ];
55
- Real d = lambda_coef[4 * spf + 3 ];
53
+ amrex:: Real a = lambda_coef[4 * spf];
54
+ amrex:: Real b = lambda_coef[4 * spf + 1 ];
55
+ amrex:: Real c = lambda_coef[4 * spf + 2 ];
56
+ amrex:: Real d = lambda_coef[4 * spf + 3 ];
56
57
return a + T * (b + T * (c + T * d));
57
58
}
58
59
59
60
AMREX_GPU_HOST_DEVICE
60
61
AMREX_FORCE_INLINE
61
- Real mu_i (const Real& T, const int spf) const
62
+ amrex:: Real mu_i (const amrex:: Real& T, const int spf) const
62
63
{
63
- Real a = mu_coef[4 * spf];
64
- Real b = mu_coef[4 * spf + 1 ];
65
- Real c = mu_coef[4 * spf + 2 ];
66
- Real d = mu_coef[4 * spf + 3 ];
64
+ amrex:: Real a = mu_coef[4 * spf];
65
+ amrex:: Real b = mu_coef[4 * spf + 1 ];
66
+ amrex:: Real c = mu_coef[4 * spf + 2 ];
67
+ amrex:: Real d = mu_coef[4 * spf + 3 ];
67
68
return a + ((d / T + c) / T + b) / T;
68
69
}
69
70
70
71
AMREX_GPU_HOST_DEVICE
71
72
AMREX_FORCE_INLINE
72
- Real psat_i (const Real& T, const int spf) const
73
+ amrex:: Real psat_i (const amrex:: Real& T, const int spf) const
73
74
{
74
- Real a = psat_coef[4 * spf];
75
- Real b = psat_coef[4 * spf + 1 ];
76
- Real c = psat_coef[4 * spf + 2 ];
77
- Real d = psat_coef[4 * spf + 3 ];
75
+ amrex:: Real a = psat_coef[4 * spf];
76
+ amrex:: Real b = psat_coef[4 * spf + 1 ];
77
+ amrex:: Real c = psat_coef[4 * spf + 2 ];
78
+ amrex:: Real d = psat_coef[4 * spf + 3 ];
78
79
return d * std::pow (10 ., a - b / (T + c));
79
80
}
80
81
81
82
AMREX_GPU_HOST_DEVICE
82
83
AMREX_FORCE_INLINE
83
- Real latent_i (const Real& T, const int spf) const
84
+ amrex:: Real latent_i (const amrex:: Real& T, const int spf) const
84
85
{
85
86
// Since we only know the latent heat at the reference temperature,
86
87
// modify Watsons power law to find latent heat at any temperature
87
88
return latent[spf] *
88
89
std::pow ((critT_i (spf) - ref_T) / (critT_i (spf) - T), -0.38 );
89
90
}
90
91
91
- // ReallArrayLike can be anything with an [] operator that returns
92
+ // RealArrayLike can be anything with an [] operator that returns
92
93
// amrex::Real&
93
94
template <typename RealArrayLike>
94
- AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real
95
- rho_mix (const RealArrayLike& Y, const Real& T) const
95
+ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex:: Real
96
+ rho_mix (const RealArrayLike& Y, const amrex:: Real& T) const
96
97
{
97
- Real rho = 0 .;
98
+ amrex:: Real rho = 0 .;
98
99
for (int spf = 0 ; spf < SPRAY_FUEL_NUM; ++spf) {
99
100
rho += Y[spf] / rho_i (T, spf);
100
101
}
@@ -103,10 +104,12 @@ struct MPLiqProps
103
104
}
104
105
105
106
template <typename RealArrayLike>
106
- AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real
107
- rho_mix (const RealArrayLike& Y, const Real& T, const Real* cBoilT) const
107
+ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real rho_mix (
108
+ const RealArrayLike& Y,
109
+ const amrex::Real& T,
110
+ const amrex::Real* cBoilT) const
108
111
{
109
- Real rho = 0 .;
112
+ amrex:: Real rho = 0 .;
110
113
for (int spf = 0 ; spf < SPRAY_FUEL_NUM; ++spf) {
111
114
rho += Y[spf] / rho_i (amrex::min (T, cBoilT[spf]), spf);
112
115
}
@@ -133,7 +136,7 @@ struct InitLiqProps
133
136
void
134
137
operator ()(LiqPropType* /* ldata*/ , std::vector<std::string>& /* fuel_names*/ )
135
138
{
136
- Abort (" InitLiqProps not implemented for this LiqPropType." );
139
+ amrex:: Abort (" InitLiqProps not implemented for this LiqPropType." );
137
140
}
138
141
};
139
142
@@ -143,7 +146,7 @@ struct InitLiqProps<MPLiqProps>
143
146
{
144
147
void operator ()(MPLiqProps* ldata, std::vector<std::string>& fuel_names)
145
148
{
146
- ParmParse pp (" particles" );
149
+ amrex:: ParmParse pp (" particles" );
147
150
getInpVal (ldata->critT .data (), pp, fuel_names.data (), " crit_temp" );
148
151
getInpVal (ldata->boilT .data (), pp, fuel_names.data (), " boil_temp" );
149
152
getInpVal (ldata->cp .data (), pp, fuel_names.data (), " cp" );
@@ -156,9 +159,9 @@ struct InitLiqProps<MPLiqProps>
156
159
getInpCoef (ldata->mu_coef .data (), pp, fuel_names.data (), " mu" );
157
160
}
158
161
159
- void getInpCoef (
160
- Real* coef,
161
- const ParmParse& ppp,
162
+ static void getInpCoef (
163
+ amrex:: Real* coef,
164
+ const amrex:: ParmParse& ppp,
162
165
const std::string* fuel_names,
163
166
const std::string& varname,
164
167
bool is_required = false )
@@ -167,7 +170,7 @@ struct InitLiqProps<MPLiqProps>
167
170
std::string var_read = fuel_names[spf] + " _" + varname;
168
171
int numvals = ppp.countval (var_read.c_str ());
169
172
if (numvals == 4 ) {
170
- std::vector<Real> inp_coef (4 , 0 .);
173
+ std::vector<amrex:: Real> inp_coef (4 , 0 .);
171
174
if (is_required) {
172
175
ppp.getarr (var_read.c_str (), inp_coef);
173
176
} else {
@@ -177,7 +180,7 @@ struct InitLiqProps<MPLiqProps>
177
180
coef[4 * spf + i] = inp_coef[i];
178
181
}
179
182
} else if (numvals == 1 ) {
180
- Real inp_coef = 0 .;
183
+ amrex:: Real inp_coef = 0 .;
181
184
for (int i = 0 ; i < 4 ; ++i) {
182
185
coef[4 * spf + i] = 0 .;
183
186
}
@@ -191,9 +194,9 @@ struct InitLiqProps<MPLiqProps>
191
194
}
192
195
}
193
196
194
- void getInpVal (
195
- Real* coef,
196
- const ParmParse& ppp,
197
+ static void getInpVal (
198
+ amrex:: Real* coef,
199
+ const amrex:: ParmParse& ppp,
197
200
const std::string* fuel_names,
198
201
const std::string& varname)
199
202
{
@@ -211,10 +214,9 @@ struct InitLiqProps<GCMLiqProps>
211
214
void
212
215
operator ()(GCMLiqProps* /* ldata*/ , std::vector<std::string>& /* fuel_names*/ )
213
216
{
214
- // ParmParse pp("particles");
215
217
}
216
218
};
217
219
218
220
} // namespace pele::physics::SprayProps
219
221
220
- #endif
222
+ #endif
0 commit comments