Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PeleMP submodule, update spray setup to reflect changes in PeleMP #124

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Source/PeleLM.H
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,6 @@ class PeleLM : public amrex::AmrCore {
static int num_spray_src;
static bool do_spray_particles;
static int plot_spray_src;
static std::string spray_fuel_names[SPRAY_FUEL_NUM];
static amrex::Vector<std::string> spray_derive_vars;
static SprayParticleContainer* theSprayPC();
static SprayParticleContainer* theVirtPC();
static SprayParticleContainer* theGhostPC();
Expand Down
26 changes: 13 additions & 13 deletions Source/PeleLMPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void PeleLM::WritePlotFile() {
ncomp += deriveEntryCount;
#ifdef PELELM_USE_SPRAY
if (do_spray_particles) {
ncomp += spray_derive_vars.size();
ncomp += SprayParticleContainer::spray_derive_vars.size();
}
#endif

Expand Down Expand Up @@ -192,11 +192,12 @@ void PeleLM::WritePlotFile() {
}
}
#ifdef PELELM_USE_SPRAY
if (spray_derive_vars.size() > 0) {
if (SprayParticleContainer::spray_derive_vars.size() > 0) {
// We need virtual particles for the lower levels
setupVirtualParticles(0);
for (int ivar = 0; ivar < spray_derive_vars.size(); ivar++) {
plt_VarsName.push_back(spray_derive_vars[ivar]);
for (int ivar = 0; ivar < SprayParticleContainer::spray_derive_vars.size();
ivar++) {
plt_VarsName.push_back(SprayParticleContainer::spray_derive_vars[ivar]);
}
}
#endif
Expand Down Expand Up @@ -276,16 +277,15 @@ void PeleLM::WritePlotFile() {
cnt += mf->nComp();
}
#ifdef PELELM_USE_SPRAY
if (spray_derive_vars.size() > 0) {
int num_spray_derive = spray_derive_vars.size();
if (SprayParticleContainer::spray_derive_vars.size() > 0) {
int num_spray_derive = SprayParticleContainer::spray_derive_vars.size();
mf_plt[lev].setVal(0., cnt, num_spray_derive);
theSprayPC()->computeDerivedVars(
mf_plt[lev], lev, cnt, spray_derive_vars, spray_fuel_names);
theSprayPC()->computeDerivedVars(mf_plt[lev], lev, cnt);
if (lev < finest_level) {
MultiFab tmp_plt(grids[lev], dmap[lev], num_spray_derive, 0, MFInfo(), Factory(lev));
MultiFab tmp_plt(
grids[lev], dmap[lev], num_spray_derive, 0, MFInfo(), Factory(lev));
tmp_plt.setVal(0.);
theVirtPC()->computeDerivedVars(
tmp_plt, lev, 0, spray_derive_vars, spray_fuel_names);
theVirtPC()->computeDerivedVars(tmp_plt, lev, 0);
MultiFab::Add(mf_plt[lev], tmp_plt, 0, cnt, num_spray_derive, 0);
}
cnt += num_spray_derive;
Expand Down Expand Up @@ -321,7 +321,7 @@ void PeleLM::WritePlotFile() {
bool is_spraycheck = false;
for (int lev = 0; lev <= finest_level; ++lev) {
theSprayPC()->SprayParticleIO(
lev, is_spraycheck, write_spray_ascii_files, plotfilename, spray_fuel_names);
lev, is_spraycheck, write_spray_ascii_files, plotfilename);
// Remove virtual particles that were made for derived variables
removeVirtualParticles(lev);
}
Expand Down Expand Up @@ -435,7 +435,7 @@ void PeleLM::WriteCheckPointFile()
bool is_spraycheck = true;
for (int lev = 0; lev <= finest_level; ++lev) {
theSprayPC()->SprayParticleIO(
lev, is_spraycheck, write_ascii, checkpointname, spray_fuel_names);
lev, is_spraycheck, write_ascii, checkpointname);
}
}
#endif
Expand Down
37 changes: 3 additions & 34 deletions Source/Spray/PeleLMSprayParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ int PeleLM::num_spray_src = AMREX_SPACEDIM + 2 + SPRAY_FUEL_NUM;

int PeleLM::write_spray_ascii_files = 0;
int PeleLM::plot_spray_src = 0;
std::string PeleLM::spray_fuel_names[SPRAY_FUEL_NUM];
Vector<std::string> PeleLM::spray_derive_vars;

SprayParticleContainer*
PeleLM::theSprayPC()
Expand Down Expand Up @@ -114,8 +112,7 @@ PeleLM::SprayReadParameters()
sprayData.dtmod = 1.;
SprayParticleContainer::readSprayParams(
spray_verbose, max_spray_cfl, wall_temp, write_spray_ascii_files,
plot_spray_src, init_function, init_file, sprayData, spray_fuel_names,
spray_derive_vars, temp_cfl);
plot_spray_src, init_function, init_file, sprayData, temp_cfl);
}

void
Expand All @@ -129,35 +126,7 @@ PeleLM::SpraySetup()
if (SPRAY_FUEL_NUM > NUM_SPECIES) {
amrex::Abort("Cannot have more spray fuel species than fluid species");
}
#if NUM_SPECIES > 1
Vector<std::string> spec_names;
pele::physics::eos::speciesNames<pele::physics::PhysicsType::eos_type>(
spec_names);
for (int i = 0; i < SPRAY_FUEL_NUM; ++i) {
for (int ns = 0; ns < NUM_SPECIES; ++ns) {
std::string gas_spec = spec_names[ns];
if (gas_spec == spray_fuel_names[i]) {
sprayData.indx[i] = ns;
}
}
if (sprayData.indx[i] < 0) {
amrex::Print() << "Fuel " << spray_fuel_names[i]
<< " not found in species list" << std::endl;
amrex::Abort();
}
}
#else
for (int ns = 0; ns < SPRAY_FUEL_NUM; ++ns) {
sprayData.indx[ns] = 0;
}
#endif
amrex::Vector<Real> fuelEnth(NUM_SPECIES);
auto eos = pele::physics::PhysicsType::eos();
eos.T2Hi(sprayData.ref_T, fuelEnth.data());
for (int ns = 0; ns < SPRAY_FUEL_NUM; ++ns) {
const int fspec = sprayData.indx[ns];
sprayData.latent[ns] -= fuelEnth[fspec] * 1.E-4;
}
SprayParticleContainer::spraySetup(sprayData);
// Component indices for conservative variables
scomps.rhoIndx = DENSITY;
scomps.momIndx = VELX;
Expand Down Expand Up @@ -370,7 +339,7 @@ PeleLM::SprayAddSource(const int level)
extsource, source, scomps.momSrcIndx, scomps.momIndx, AMREX_SPACEDIM,
eghosts);
for (int n = 0; n < SPRAY_FUEL_NUM; ++n) {
const int dstcomp = scomps.specIndx + sprayData.indx[n];
const int dstcomp = scomps.specIndx + sprayData.dep_indx[n];
MultiFab::Add(
extsource, source, scomps.specSrcIndx + n, dstcomp, 1, eghosts);
}
Expand Down