Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
62fb5fc
1. Added a new index for reading molecular mass from table. 2. Update…
SreejithNREL Sep 5, 2025
56e0cd8
Removed fixing Wbar to -1
SreejithNREL Sep 5, 2025
330b2a6
Added functionalities to 1. read a generic qty from manifold table gi…
SreejithNREL Sep 6, 2025
81115b8
merging
SreejithNREL Sep 6, 2025
2b1259d
fixed a bug so that GenericReadManifoldData is called only when manif…
SreejithNREL Sep 8, 2025
0faf78d
clang tidyied
SreejithNREL Sep 8, 2025
8126415
changed 'varn' to more meaningful variables names
SreejithNREL Sep 8, 2025
a22d34d
Changed function name to Y2GenericManifodlData based on PR review
SreejithNREL Sep 9, 2025
ea2002b
used get_values instead of get_value in Y2GenericManifodlData
SreejithNREL Sep 9, 2025
04f4ba3
removed unnecessary string definition
SreejithNREL Sep 9, 2025
08e76fa
merging with dev
SreejithNREL Sep 9, 2025
86e6e07
Error compiling..
SreejithNREL Sep 10, 2025
4899bea
still errors
SreejithNREL Sep 10, 2025
b21b986
Added functionality to read species molecular weights from a metadata…
SreejithNREL Sep 11, 2025
55bf45f
works only with metadata file generated from cmlm. Refer PR#12 in cml…
SreejithNREL Sep 11, 2025
bf49d1b
add some checks, reorganize code a bit in spray manifold stuff
baperry2 Sep 11, 2025
c2a8d69
fix clang-tidy errors
baperry2 Sep 15, 2025
fa12941
Merge branch 'development' into Incl_Mol_Weight
baperry2 Sep 15, 2025
552cd8e
remove unneeded function declaration in SprayInterpolation
baperry2 Sep 17, 2025
9b9d63e
Do body force stuff no matter what EOS for SpraySetup
baperry2 Sep 17, 2025
a783f11
Manifold EOS species index/lookup funcs
baperry2 Sep 17, 2025
d76ed01
update approach for relationship between gas phase and liquid species
baperry2 Sep 17, 2025
65fd559
further refinements for spray setup for manifold
baperry2 Sep 17, 2025
bc9769c
further incremental changes
baperry2 Sep 17, 2025
2765188
fix some clang-tidy warnings
baperry2 Sep 19, 2025
b970142
removing error from get_func not defined as const
SreejithNREL Sep 23, 2025
93d2943
added a templated struct with functor for calcVaporState
SreejithNREL Sep 23, 2025
942d4e4
Completed Step 6 of spray documentation. Code compiles without errors…
SreejithNREL Sep 24, 2025
ccc0091
Completed step 6
SreejithNREL Sep 24, 2025
8672353
added function to read in mixture cp and calculate thermal conductivity
SreejithNREL Sep 24, 2025
6e64f36
Removed Wij
SreejithNREL Sep 24, 2025
7c8b27d
A running version on singledropeval case. Make sure to set massfrac[N…
SreejithNREL Sep 24, 2025
453bc2d
changed mw_mix to be calculated from manifold function
SreejithNREL Sep 24, 2025
41e653c
Merge branch 'development' into Incl_Mol_Weight
baperry2 Sep 25, 2025
62c0301
spelling error fix
baperry2 Sep 25, 2025
873d242
dont const Y2WBAR function
baperry2 Sep 25, 2025
3631b20
addressing changes from PR
SreejithNREL Sep 25, 2025
21e1b5a
delete commented code
baperry2 Sep 25, 2025
f0fea78
fix some clang-tidy issues
baperry2 Sep 25, 2025
407e3b4
Merge branch 'development' into Incl_Mol_Weight
baperry2 Sep 26, 2025
5ed2f5a
partial changes toward heat equation for manifold EOS
baperry2 Sep 26, 2025
db0ee28
cleanup of manifold calcVaporState
baperry2 Sep 26, 2025
b58c80d
temporary hack for fuel Cp for manifold EOS
baperry2 Sep 26, 2025
597f3ce
cp in table for spray manifold eos
baperry2 Sep 26, 2025
743a881
more refinement of cp indexing or lookups in spray manifold
baperry2 Sep 26, 2025
2cec508
return manifold RTY2Cp dummy function
baperry2 Sep 26, 2025
2a2175d
merging bruce's commit on heat eqn
SreejithNREL Sep 26, 2025
dc1260e
formatting ..
SreejithNREL Sep 26, 2025
fbbc7ea
reverting some statements to earlier commit
SreejithNREL Sep 26, 2025
41193a3
initiaize mi_dot variable to 0 in spray
baperry2 Sep 29, 2025
aac8e0c
bring back in EOS ifdef for cp_fuel calc
baperry2 Sep 29, 2025
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
62 changes: 62 additions & 0 deletions Source/Eos/EOS.H
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ speciesNames(
CKSYMS_STR(spn);
}

template <typename EOSType>
void
varNames(
amrex::Vector<std::string>& allvarnames,
const EosParm<EOSType>* /*eparm*/ = nullptr)
{
CKSYMS_STR(allvarnames);
}

template <typename EOSType>
void
chemSpeciesNames(
amrex::Vector<std::string>& chemspn,
const EosParm<EOSType>* /*eparm*/ = nullptr)
{
CKSYMS_STR(chemspn);
}

#ifndef AMREX_USE_SYCL
template <>
inline void
Expand All @@ -152,6 +170,50 @@ speciesNames<Manifold>(
}
#endif

#ifndef AMREX_USE_SYCL
template <>
inline void
varNames<Manifold>(
amrex::Vector<std::string>& allvarnames, const EosParm<Manifold>* eparm)
{
if (eparm == nullptr) {
amrex::Abort(
"Manifold EOS requires an EosParm input in order to determine "
"species names");
}
const auto* mani_data = eparm->manf_data;
allvarnames.resize(mani_data->Nvar);

for (int n = 0; n < mani_data->Nvar; n++) {
std::string nametmp = std::string(
&(mani_data->varnames)[n * mani_data->len_str], mani_data->len_str);
allvarnames[n] = amrex::trim(nametmp);
}
}
#endif

#ifndef AMREX_USE_SYCL
template <>
inline void
chemSpeciesNames<Manifold>(
amrex::Vector<std::string>& chemspn, const EosParm<Manifold>* eparm)
{
if (eparm == nullptr) {
amrex::Abort(
"Manifold EOS requires an EosParm input in order to determine "
"species names");
}
const auto* mani_data = eparm->manf_data;
for (int n = 0; n < mani_data->Nvar; n++) {
std::string nametmp = std::string(
&(mani_data->varnames)[n * mani_data->len_str], mani_data->len_str);
if (nametmp.substr(0, 2) == "Y-") {
chemspn.push_back(amrex::trim(nametmp.substr(2U, std::string::npos)));
}
}
}
#endif

} // namespace eos
} // namespace pele::physics
#endif
59 changes: 59 additions & 0 deletions Source/Eos/EosParams.H
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ struct EosParm<Manifold>
int idx_Wbar{0};
int idx_T{0};
int idx_Wdot[MANIFOLD_DIM];
int idx_Cp{-1};
int is_variance_of[MANIFOLD_DIM];
int verbose{1};
bool has_mani_src{true};
bool has_species_mw{false};
amrex::Real* chemSpecies_Mwt;
int* idx_chemspecies;
int num_chemspecies;
};
#endif

Expand Down Expand Up @@ -87,6 +92,12 @@ struct InitParm<eos::EosParm<eos::Manifold>>
static void host_initialize(PeleParams<eos::EosParm<eos::Manifold>>* parm_in)
{
amrex::ParmParse pp("manifold");
std::string metadata_filename;
pp.query("metadata_filename", metadata_filename);
if (!metadata_filename.empty()) {
pp.addfile(metadata_filename);
}

std::string manifold_model;
pp.get("model", manifold_model);
parm_in->m_host_only_parm.manfunc_par =
Expand All @@ -110,6 +121,50 @@ struct InitParm<eos::EosParm<eos::Manifold>>
pp.query("has_mani_src", parm_in->m_h_parm.has_mani_src);
pp.get("compute_temperature", parm_in->m_h_parm.compute_temperature);

#ifdef PELE_USE_SPRAY
parm_in->m_h_parm.idx_Cp = get_var_index("CP", h_manf_data_in);
#else
parm_in->m_h_parm.idx_Cp = get_var_index("CP", h_manf_data_in, false);
#endif

// Molecular weights and indices of chemical species if requested
pp.query("has_species_mw", parm_in->m_h_parm.has_species_mw);
if (parm_in->m_h_parm.has_species_mw) {
const auto* mani_data = parm_in->m_h_parm.manf_data;
// First find the total number of chemical species in the table
amrex::Vector<int> spec_idx_vect;
for (int n = 0; n < mani_data->Nvar; n++) {
std::string nametmp = std::string(
&(mani_data->varnames)[n * mani_data->len_str], mani_data->len_str);
if (nametmp.substr(0, 2) == "Y-") {
spec_idx_vect.emplace_back(n);
}
}
const int num_of_chemspecies = static_cast<int>(spec_idx_vect.size());
parm_in->m_h_parm.num_chemspecies = num_of_chemspecies;

// Dynamically allocate memory for chemSpecies_Mwt;
constexpr std::streamsize real_size = sizeof(amrex::Real);
parm_in->m_h_parm.chemSpecies_Mwt = static_cast<amrex::Real*>(
amrex::The_Pinned_Arena()->alloc(num_of_chemspecies * real_size));
constexpr std::streamsize int_size = sizeof(int);
parm_in->m_h_parm.idx_chemspecies = static_cast<int*>(
amrex::The_Pinned_Arena()->alloc(num_of_chemspecies * int_size));

// Loop through table to find species names. Search these species names in
// the metadata file and read molecular weights from the metadata file
for (int i = 0; i < num_of_chemspecies; i++) {
const int n = spec_idx_vect[i];
parm_in->m_h_parm.idx_chemspecies[i] = n;
std::string nametmp = std::string(
&(mani_data->varnames)[n * mani_data->len_str], mani_data->len_str);
std::string speciesname_search =
amrex::trim(nametmp.substr(2U, std::string::npos)) + "_mw";
pp.get(
speciesname_search.c_str(), parm_in->m_h_parm.chemSpecies_Mwt[i]);
}
}

// Setup density lookups
std::string density_lookup_type_string{"linear"};
pp.query("density_lookup_type", density_lookup_type_string);
Expand Down Expand Up @@ -226,6 +281,10 @@ struct InitParm<eos::EosParm<eos::Manifold>>
{
parm_in->m_host_only_parm.manfunc_par->deallocate();
parm_in->m_host_only_parm.manfunc_par = nullptr;
if (parm_in->m_h_parm.has_species_mw) {
amrex::The_Pinned_Arena()->free(parm_in->m_h_parm.chemSpecies_Mwt);
amrex::The_Pinned_Arena()->free(parm_in->m_h_parm.idx_chemspecies);
}
}
};
#endif
Expand Down
69 changes: 49 additions & 20 deletions Source/Eos/Manifold.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct Manifold

static std::string identifier() { return "Manifold"; }

// ReallArrayLike can be anything with an [] operator that returns
// RealArrayLike can be anything with an [] operator that returns
// amrex::Real&
template <typename RealArrayLike>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static void
Expand All @@ -42,7 +42,7 @@ struct Manifold
R = RY[first + NUM_SPECIES - 1];
}

// ReallArrayLike can be anything with an [] operator that returns
// RealArrayLike can be anything with an [] operator that returns
// amrex::Real&
template <typename RealArrayLike1, typename RealArrayLike2>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static void RY2RRinvY(
Expand All @@ -60,11 +60,17 @@ struct Manifold

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
static void molecular_weight(amrex::Real* /*mw[]*/)
void molecular_weight(amrex::Real* mw)
{
amrex::Error(
"molecular_weight for species does not have significance for "
"Manifold EOS");
if (eosparm->has_species_mw) {
for (int n = 0; n < eosparm->num_chemspecies; n++) {
mw[n] = eosparm->chemSpecies_Mwt[n];
}
} else {
amrex::Error(
"molecular_weight for species does not have significance "
"for Manifold EOS");
}
}

AMREX_GPU_HOST_DEVICE
Expand All @@ -87,6 +93,29 @@ struct Manifold
}
}

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
void Y2GenericManifoldData(
const amrex::Real* Y, // manifold variables (z,c etc)
int* table_idx, // Indices of the table columns
amrex::Real* out_vars,
int num_of_indices // len of table_idx
)
{
manfunc.get_func()->get_values(num_of_indices, table_idx, Y, out_vars);
}

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
void Y2ChemSpecies(
const amrex::Real* Y, // manifold variables (z,c etc)
const int spec_index,
amrex::Real& chem_spec)
{
manfunc.get_func()->get_value(
eosparm->idx_chemspecies[spec_index], Y, chem_spec);
}

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
static void RTY2Ei(
Expand Down Expand Up @@ -156,33 +185,33 @@ struct Manifold
AMREX_FORCE_INLINE
static void T2Cpi(const amrex::Real /*T*/, amrex::Real* /*Cpi[NUM_SPECIES]*/)
{
// TODO: FIXME (T2Cpi need to be implemented for manifold model)
amrex::Abort("\nT2Cpi is not yet implemented for Maniold model");
}

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
static void
TY2Cp(const amrex::Real /*T*/, const amrex::Real* /*Y[]*/, amrex::Real& Cp)
void TY2Cp(
const amrex::Real /*T*/, const amrex::Real Y[NUM_SPECIES], amrex::Real& Cp)
{
// TODO: FIXME (need to remove enthalpy calculations from
// PeleLM)
Cp = 100.0;
// amrex::Error("TY2Cp is not yet implemented for Manifold EOS");
if (eosparm->idx_Cp >= 0) {
manfunc.get_func()->get_value(eosparm->idx_Cp, Y, Cp);
} else {
// TODO: FIXME (need to remove enthalpy calculations from
// PeleLM)
Cp = 1.234e56;
// amrex::Error("TY2Cp is not yet implemented for Manifold EOS");
}
}

AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
static void RTY2Cp(
void RTY2Cp(
const amrex::Real /*R*/,
const amrex::Real /*T*/,
const amrex::Real* /*Y[]*/,
const amrex::Real T,
const amrex::Real Y[NUM_SPECIES],
amrex::Real& Cp)
{
// TODO: FIXME (need to remove enthalpy calculations from
// PeleLM)
Cp = 100.0;
// amrex::Error("TY2Cp is not yet implemented for Manifold EOS");
TY2Cp(T, Y, Cp);
}

AMREX_GPU_HOST_DEVICE
Expand Down
8 changes: 4 additions & 4 deletions Source/Spray/BreakupSplash/WallFilm.H
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ calculateFilmSource(
amrex::Real mw_skin = 0.; // Average molar mass of skin phase
amrex::Real B_M = 0.; // Mass Spalding number
amrex::Real sumXVap = 0.; // Sum of X_v
calcVaporState(
fdat, gpv, rule, T_film, C_eps, mw_film, Y_film.data(), h_film.data(),
cp_n.data(), cBoilT, Y_skin.data(), X_vapor.data(), L_fuel.data(), B_M,
sumXVap, cp_skin, mw_skin);
calcVaporState<pele::physics::PhysicsType::eos_type>()(
fdat, gpv, rule, T_film, C_eps, mw_film, Y_film.data(), T_skin, cBoilT,
Y_skin.data(), X_vapor.data(), L_fuel.data(), B_M, sumXVap, cp_skin,
mw_skin);
amrex::Real lambda_skin = 0.;
amrex::Real mu_skin = 0.;
amrex::Real xi_skin = 0.;
Expand Down
Loading
Loading