Skip to content

Commit 2dbdf20

Browse files
Added eosparm object for spray manifold model (#604)
* Updating code to a state in which it compiles with dummy eos calls * pushing for bruce to check * I now have a version that I am unable to compile and run without errors. But this version still includes PeleLMeX.H and is not meant to be a permanent solution to include spray monifold model. The version without PeleLMeX header file will be committed soon * compiles error free. but need to remove pelelmex.h header file * Removed PeleLMeX header files. should work independent of pelelmex now * Removed unnecessary comments * modified InterpolateGasPhase to include eos call * Modified spraySetup and readSprayParams functions to include default eosparm argument * Removed unnecessary comments * addressing reviewer suggestions to draft pr #604 * clang tidying * including pr reviewer suggestions * Moved spraydata eosparm initialisation to spraySetup. * Clang tidyied. Addressed Bruce's latest suggestions * Made changes in spraySetup () to include host and device parm pointers * UPdating amrex * Unused parameters --------- Co-authored-by: Bruce Perry <Bruce.Perry@nrel.gov>
1 parent 896e915 commit 2dbdf20

File tree

7 files changed

+63
-10
lines changed

7 files changed

+63
-10
lines changed

Source/Eos/Manifold.H

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ struct Manifold
147147
amrex::Error("RTY2Cv is not yet implemented for Manifold EOS");
148148
}
149149

150+
// Adding a dummy T2Cpi function
151+
AMREX_GPU_HOST_DEVICE
152+
AMREX_FORCE_INLINE
153+
static void T2Cpi(const amrex::Real /*T*/, amrex::Real* /*Cpi[NUM_SPECIES]*/)
154+
{
155+
// TODO: FIXME (T2Cpi need to be implemented for manifold model)
156+
amrex::Abort("\nT2Cpi is not yet implemented for Maniold model");
157+
}
158+
150159
AMREX_GPU_HOST_DEVICE
151160
AMREX_FORCE_INLINE
152161
static void
@@ -172,6 +181,18 @@ struct Manifold
172181
// amrex::Error("TY2Cp is not yet implemented for Manifold EOS");
173182
}
174183

184+
AMREX_GPU_HOST_DEVICE
185+
AMREX_FORCE_INLINE
186+
void EY2T(
187+
const amrex::Real /*E*/, const amrex::Real Y[NUM_SPECIES], amrex::Real& T)
188+
{
189+
if (eosparm->compute_temperature) {
190+
manfunc.get_func()->get_value(eosparm->idx_T, Y, T);
191+
} else {
192+
T = 1.0;
193+
}
194+
}
195+
175196
AMREX_GPU_HOST_DEVICE
176197
AMREX_FORCE_INLINE
177198
void REY2T(

Source/Spray/Drag.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ calculateSpraySource(
170170
pele::physics::EosType,
171171
pele::physics::TransportType> const* trans_parm)
172172
{
173-
auto eos = pele::physics::PhysicsType::eos();
173+
auto eos = pele::physics::PhysicsType::eos(fdat.eosparm);
174174
SprayUnits SPU;
175175
const amrex::Real rule = 1. / 3.;
176176
const amrex::Real C_eps = 1.E-15;

Source/Spray/SprayFuelData.H

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ struct SprayData
125125

126126
// Instance of the liquid properties for the specified model
127127
pele::physics::SprayProps::LiqPropType liqprops;
128+
// adding a eosparm here to be used with Spray and manifold
129+
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
130+
eosparm;
128131

129132
// Estimate the boil temperature
130133
AMREX_GPU_HOST_DEVICE

Source/Spray/SprayInterpolation.H

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ check_bounds(
9696
return false;
9797
}
9898

99+
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateGasPhase(
100+
GasPhaseVals& gpv,
101+
const amrex::Box& state_box,
102+
amrex::Array4<const amrex::Real> const& rhoarr,
103+
amrex::Array4<const amrex::Real> const& rhoYarr,
104+
amrex::Array4<const amrex::Real> const& Tarr,
105+
amrex::Array4<const amrex::Real> const& momarr,
106+
amrex::Array4<const amrex::Real> const& engarr,
107+
const amrex::IntVect* indx_array,
108+
const amrex::Real* weights,
109+
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
110+
eosparm = nullptr);
111+
99112
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void
100113
InterpolateGasPhase(
101114
GasPhaseVals& gpv,
@@ -106,9 +119,11 @@ InterpolateGasPhase(
106119
amrex::Array4<const amrex::Real> const& momarr,
107120
amrex::Array4<const amrex::Real> const& engarr,
108121
const amrex::IntVect* indx_array,
109-
const amrex::Real* weights)
122+
const amrex::Real* weights,
123+
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
124+
eosparm)
110125
{
111-
auto eos = pele::physics::PhysicsType::eos();
126+
auto eos = pele::physics::PhysicsType::eos(eosparm);
112127
#ifdef PELELM_USE_SPRAY
113128
amrex::ignore_unused(engarr);
114129
#endif

Source/Spray/SprayParticles.H

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ public:
8383
const amrex::Real num_ppp = 1.);
8484

8585
/// \brief Setup spray parameters
86-
static void spraySetup(const amrex::Real* body_force);
86+
static void spraySetup(
87+
const amrex::Real* body_force,
88+
pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
89+
eosparms_h = nullptr,
90+
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
91+
eosparms_d = nullptr);
8792

8893
/// \brief Read in spray parameters from input file
8994
static void readSprayParams(int& particle_verbose);

Source/Spray/SprayParticles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ SprayParticleContainer::updateParticles(
330330
amrex::ParallelFor(Np, [=] AMREX_GPU_DEVICE(int pid) noexcept {
331331
ParticleType& p = pstruct[pid];
332332
if (p.id() > 0) {
333-
auto eos = pele::physics::PhysicsType::eos();
333+
auto eos = pele::physics::PhysicsType::eos(fdat->eosparm);
334334
SprayUnits SPU;
335335
GasPhaseVals gpv;
336336
GpuArray<Real, SPRAY_FUEL_NUM>
@@ -385,7 +385,7 @@ SprayParticleContainer::updateParticles(
385385
gpv.reset();
386386
InterpolateGasPhase(
387387
gpv, state_box, rhoarr, rhoYarr, Tarr, momarr, engarr,
388-
indx_array.data(), weights.data());
388+
indx_array.data(), weights.data(), fdat->eosparm);
389389
// Solve for avg mw and pressure at droplet location
390390
fdat->calcBoilT(gpv, cBoilT.data());
391391
if (is_film) {

Source/Spray/SpraySetup.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ SprayParticleContainer::readSprayParams(int& particle_verbose)
5454
// Must match the number specified at compile time
5555
const int nfuel = pp.countval("fuel_species");
5656
if (nfuel != SPRAY_FUEL_NUM) {
57-
Abort("Number of fuel species in input file must match SPRAY_FUEL_NUM");
57+
amrex::Abort(
58+
"Error! Number of fuel species in input file must match "
59+
"SPRAY_FUEL_NUM");
5860
}
5961

6062
std::vector<std::string> fuel_names;
@@ -202,12 +204,17 @@ SprayParticleContainer::readSprayParams(int& particle_verbose)
202204
}
203205

204206
void
205-
SprayParticleContainer::spraySetup(const Real* body_force)
207+
SprayParticleContainer::spraySetup(
208+
const Real* body_force,
209+
pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>* eosparms_h,
210+
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
211+
eosparms_d)
206212
{
207213
#if NUM_SPECIES > 1
208214
Vector<std::string> spec_names;
209215
pele::physics::eos::speciesNames<pele::physics::PhysicsType::eos_type>(
210-
spec_names);
216+
spec_names, eosparms_h);
217+
211218
for (int i = 0; i < SPRAY_FUEL_NUM; ++i) {
212219
for (int ns = 0; ns < NUM_SPECIES; ++ns) {
213220
std::string gas_spec = spec_names[ns];
@@ -239,7 +246,7 @@ SprayParticleContainer::spraySetup(const Real* body_force)
239246
#endif
240247
SprayUnits SPU;
241248
Vector<Real> fuelEnth(NUM_SPECIES);
242-
auto eos = pele::physics::PhysicsType::eos();
249+
auto eos = pele::physics::PhysicsType::eos(eosparms_h);
243250
eos.T2Hi(m_sprayData->liqprops.ref_T, fuelEnth.data());
244251
for (int ns = 0; ns < SPRAY_FUEL_NUM; ++ns) {
245252
const int fspec = m_sprayData->indx[ns];
@@ -249,7 +256,9 @@ SprayParticleContainer::spraySetup(const Real* body_force)
249256
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
250257
m_sprayData->body_force[dir] = body_force[dir];
251258
}
259+
m_sprayData->eosparm = eosparms_d;
252260
Gpu::copy(Gpu::hostToDevice, m_sprayData, m_sprayData + 1, d_sprayData);
261+
m_sprayData->eosparm = eosparms_h;
253262
Gpu::streamSynchronize();
254263
ParallelDescriptor::Barrier();
255264
}

0 commit comments

Comments
 (0)