Skip to content

Commit 1aee07d

Browse files
Remove using namespace amrex from SprayProperties.H (#609)
* Remove using amrex * Fix typo in comment * Formatting... * remove one more using amrex namespace from header * make some SprayProperties member functions static --------- Co-authored-by: Bruce Perry <bruce.perry@nrel.gov>
1 parent 5397298 commit 1aee07d

File tree

2 files changed

+58
-58
lines changed

2 files changed

+58
-58
lines changed

Source/Spray/SprayFuelData.H

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include "SprayProperties.H"
77
#include <AMReX_RealVect.H>
88

9-
using namespace amrex;
10-
119
// Spray flags and indices
1210
struct SprayComps
1311
{

Source/Spray/SprayProperties.H

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,101 @@
11
#ifndef SPRAYPROPERTIES_H
22
#define SPRAYPROPERTIES_H
33

4-
using namespace amrex;
5-
64
// Structs for liquid fuel properties
75
namespace pele::physics::SprayProps {
86

97
// Original spray properties ported from PeleMP to PelePhysics
108
struct MPLiqProps
119
{
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
1917
// 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;
2422

2523
AMREX_GPU_HOST_DEVICE
2624
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]; }
2826

2927
AMREX_GPU_HOST_DEVICE
3028
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]; }
3230

3331
AMREX_GPU_HOST_DEVICE
3432
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+
}
3637

3738
AMREX_GPU_HOST_DEVICE
3839
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
4041
{
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];
4546
return a + T * (b + T * (c + T * d));
4647
}
4748

4849
AMREX_GPU_HOST_DEVICE
4950
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
5152
{
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];
5657
return a + T * (b + T * (c + T * d));
5758
}
5859

5960
AMREX_GPU_HOST_DEVICE
6061
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
6263
{
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];
6768
return a + ((d / T + c) / T + b) / T;
6869
}
6970

7071
AMREX_GPU_HOST_DEVICE
7172
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
7374
{
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];
7879
return d * std::pow(10., a - b / (T + c));
7980
}
8081

8182
AMREX_GPU_HOST_DEVICE
8283
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
8485
{
8586
// Since we only know the latent heat at the reference temperature,
8687
// modify Watsons power law to find latent heat at any temperature
8788
return latent[spf] *
8889
std::pow((critT_i(spf) - ref_T) / (critT_i(spf) - T), -0.38);
8990
}
9091

91-
// ReallArrayLike can be anything with an [] operator that returns
92+
// RealArrayLike can be anything with an [] operator that returns
9293
// amrex::Real&
9394
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
9697
{
97-
Real rho = 0.;
98+
amrex::Real rho = 0.;
9899
for (int spf = 0; spf < SPRAY_FUEL_NUM; ++spf) {
99100
rho += Y[spf] / rho_i(T, spf);
100101
}
@@ -103,10 +104,12 @@ struct MPLiqProps
103104
}
104105

105106
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
108111
{
109-
Real rho = 0.;
112+
amrex::Real rho = 0.;
110113
for (int spf = 0; spf < SPRAY_FUEL_NUM; ++spf) {
111114
rho += Y[spf] / rho_i(amrex::min(T, cBoilT[spf]), spf);
112115
}
@@ -133,7 +136,7 @@ struct InitLiqProps
133136
void
134137
operator()(LiqPropType* /*ldata*/, std::vector<std::string>& /*fuel_names*/)
135138
{
136-
Abort("InitLiqProps not implemented for this LiqPropType.");
139+
amrex::Abort("InitLiqProps not implemented for this LiqPropType.");
137140
}
138141
};
139142

@@ -143,7 +146,7 @@ struct InitLiqProps<MPLiqProps>
143146
{
144147
void operator()(MPLiqProps* ldata, std::vector<std::string>& fuel_names)
145148
{
146-
ParmParse pp("particles");
149+
amrex::ParmParse pp("particles");
147150
getInpVal(ldata->critT.data(), pp, fuel_names.data(), "crit_temp");
148151
getInpVal(ldata->boilT.data(), pp, fuel_names.data(), "boil_temp");
149152
getInpVal(ldata->cp.data(), pp, fuel_names.data(), "cp");
@@ -156,9 +159,9 @@ struct InitLiqProps<MPLiqProps>
156159
getInpCoef(ldata->mu_coef.data(), pp, fuel_names.data(), "mu");
157160
}
158161

159-
void getInpCoef(
160-
Real* coef,
161-
const ParmParse& ppp,
162+
static void getInpCoef(
163+
amrex::Real* coef,
164+
const amrex::ParmParse& ppp,
162165
const std::string* fuel_names,
163166
const std::string& varname,
164167
bool is_required = false)
@@ -167,7 +170,7 @@ struct InitLiqProps<MPLiqProps>
167170
std::string var_read = fuel_names[spf] + "_" + varname;
168171
int numvals = ppp.countval(var_read.c_str());
169172
if (numvals == 4) {
170-
std::vector<Real> inp_coef(4, 0.);
173+
std::vector<amrex::Real> inp_coef(4, 0.);
171174
if (is_required) {
172175
ppp.getarr(var_read.c_str(), inp_coef);
173176
} else {
@@ -177,7 +180,7 @@ struct InitLiqProps<MPLiqProps>
177180
coef[4 * spf + i] = inp_coef[i];
178181
}
179182
} else if (numvals == 1) {
180-
Real inp_coef = 0.;
183+
amrex::Real inp_coef = 0.;
181184
for (int i = 0; i < 4; ++i) {
182185
coef[4 * spf + i] = 0.;
183186
}
@@ -191,9 +194,9 @@ struct InitLiqProps<MPLiqProps>
191194
}
192195
}
193196

194-
void getInpVal(
195-
Real* coef,
196-
const ParmParse& ppp,
197+
static void getInpVal(
198+
amrex::Real* coef,
199+
const amrex::ParmParse& ppp,
197200
const std::string* fuel_names,
198201
const std::string& varname)
199202
{
@@ -211,10 +214,9 @@ struct InitLiqProps<GCMLiqProps>
211214
void
212215
operator()(GCMLiqProps* /*ldata*/, std::vector<std::string>& /*fuel_names*/)
213216
{
214-
// ParmParse pp("particles");
215217
}
216218
};
217219

218220
} // namespace pele::physics::SprayProps
219221

220-
#endif
222+
#endif

0 commit comments

Comments
 (0)