Skip to content

Commit

Permalink
Merge branch 'AMReX-Combustion:development' into null-deref
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 authored Oct 7, 2024
2 parents d65278e + e371e15 commit 6fc9a3f
Show file tree
Hide file tree
Showing 22 changed files with 193 additions and 95 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,15 @@ jobs:
pip install numpy
ccache -z
make -j ${{env.NPROCS}} Eos_Model=Fuego Chemistry_Model=dodecane_lu TINY_PROFILE=TRUE USE_CCACHE=TRUE ${{matrix.amrex_build_args}}
bash exec_ignDelay.sh
bash exec_ignDelay.sh firstpass
python check_ignDelay.py
if [ $? -ne 0 ]; then exit 1; fi; \
rm log PPreaction.txt inputs/inputs.0d_refine
make realclean
make -j ${{env.NPROCS}} Eos_Model=Manifold Transport_Model=Manifold Manifold_Dim=1 Chemistry_Model=Null TINY_PROFILE=TRUE USE_CCACHE=TRUE ${{matrix.amrex_build_args}}
bash exec_ignDelay.sh manifold
python check_ignDelay.py 0.0766 10
if [ $? -ne 0 ]; then exit 1; fi; \
fi;
make realclean
- name: Ignition delay ccache report
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ jobs:
working-directory: ${{runner.workspace}}/build-docs
run: |
echo "::add-matcher::.github/problem-matchers/sphinx.json"
cmake --build ${{runner.workspace}}/build-docs
echo "::remove-matcher owner=sphinx-problem-matcher-loose-no-severity::"
echo "::remove-matcher owner=sphinx-problem-matcher-loose::"
echo "::remove-matcher owner=sphinx-problem-matcher::"
cmake --build ${{runner.workspace}}/build-docs 2>&1 | tee -a build-output.txt
touch ${{runner.workspace}}/build-docs/sphinx/html/.nojekyll
- name: Report
working-directory: ${{runner.workspace}}/build-docs
run: |
echo "::add-matcher::.github/problem-matchers/sphinx.json"
egrep "WARNING:|Warning:|warning:|ERROR:|Error:|error:" build-output.txt | sort | uniq | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > build-output-warnings.txt
cat build-output-warnings.txt
exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}')
- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/development'
uses: JamesIves/github-pages-deploy-action@releases/v3
Expand Down
4 changes: 2 additions & 2 deletions Mechanisms/Null/mechanism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ void
CKSYME_STR(amrex::Vector<std::string>& ename)
{
ename.resize(1);
ename[0] = "XO";
ename[0] = "X0";
}
void
CKSYMS_STR(amrex::Vector<std::string>& kname)
{
kname.resize(NUM_SPECIES);
for (int i = 0; i < NUM_SPECIES; ++i) {
kname[0] = "X" + std::to_string(i);
kname[i] = "X" + std::to_string(i);
}
}

Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PelePhysics contains C++ source code for the following physics and other modules
* *Reactions*: Routines for substepped integration of stiff chemical systems, including with CVODE
* *Spray*: Lagrangian spray droplet library, formerly part of [PeleMP](https://github.com/AMReX-Combustion/PeleMP)
* *Soot*: An implementation of the Hybrid Method of Moments soot model, formerly part of [PeleMP](https://github.com/AMReX-Combustion/PeleMP)
* *Radiation*: Raidative heat transfer model based on the spherical harmonics method, formerly [PeleRad](https://github.com/AMReX-Combustion/PeleRad)
* *Radiation*: Radiative heat transfer model based on the spherical harmonics method, formerly [PeleRad](https://github.com/AMReX-Combustion/PeleRad)
* *Utility*: Several handy modules for data management across other Pele codes

Additionally, PelePhysics contains a variety of stand-alone tools to aid in Pele simulation workflows, found in the `Support` directory.
Expand Down Expand Up @@ -50,8 +50,11 @@ imperative.

## Citation

To cite PelePhysics as a whole and its use as part of the broader Pele suite, please use the following
[SIAM Parallel Processing article](https://doi.org/10.1137/1.9781611977967.2):
To cite PelePhysics as a whole and its use as part of the broader Pele
suite, please use the following [SIAM Parallel
Processing](https://doi.org/10.1137/1.9781611977967.2) and [Combustion
and Flame](https://doi.org/10.1016/j.combustflame.2024.113740)
articles:

```
@article{PeleSoftware,
Expand All @@ -67,6 +70,18 @@ To cite PelePhysics as a whole and its use as part of the broader Pele suite, pl
year = {2024},
publisher = {Proceedings of the 2024 SIAM Conference on Parallel Processing for Scientific Computing}
}
@article{Hassanaly2024,
author = {Malik Hassanaly and Nicholas T. Wimer and Anne Felden and Lucas Esclapez and Julia Ream and Marc T. {Henry de Frahan} and Jon Rood and Marc Day},
title = {Symbolic construction of the chemical Jacobian of quasi-steady state (QSS) chemistries for Exascale computing platforms},
journal = {Combustion and Flame},
volume = {270},
pages = {113740},
year = {2024},
issn = {0010-2180},
doi = {https://doi.org/10.1016/j.combustflame.2024.113740},
url = {https://www.sciencedirect.com/science/article/pii/S0010218024004498},
}
```

To cite the multi-physics (soot, spray, radiation) capabilities in PelePhysics that were imported from
Expand All @@ -81,7 +96,7 @@ PeleMP and PeleRad, please use the following [Journal of Fluids Engineering arti
}
```

## Getting help, contributing
## Getting help

Do you have a question ? Found an issue ? Please use the [GitHub Discussions](https://github.com/AMReX-Combustion/PelePhysics/discussions) to engage
with the development team or open a new [GitHub issue](https://github.com/AMReX-Combustion/PelePhysics/issues) to report a bug. The development team
Expand All @@ -93,7 +108,7 @@ New contributions to *PelePhysics* are welcome ! Contributing Guidelines are pro

## CEPTR

This `PelePhysics` repository contains the CEPTR source code generation tool in order to support the inclusion of chemical models specified in the Cantera yaml format. CETPR derives from FUEGO, which was originally created by Michael Aivazis at CalTech, and donated to CCSE in 2001. Originally, FUEGO was part of a larger Python-based set of workflow tools Michael developed for managing and publishing simulation-based studies. FUEGO itself was developed as a drop-in replacement for the CHEMKIN library, and provided "hand-coded" replacement routines for evaluation of EOS thermodynamic functions that are considerably more efficient than their CHEMKIN counterparts. Since 2001, CCSE has continued to modify FUEGO independently for its own use so that the current version here bears little resemblance to Michael's original code, or its intentions. CEPTR has adapted FUEGO code to use the Cantera yaml format and is now the preferred way of generating mechanism files.
This `PelePhysics` repository contains the CEPTR source code generation tool in order to support the inclusion of chemical models specified in the Cantera yaml format. CETPR derives from FUEGO, which was originally created by Michael Aivazis at CalTech, and donated to CCSE in 2001. Originally, FUEGO was part of a larger Python-based set of workflow tools Michael developed for managing and publishing simulation-based studies. FUEGO itself was developed as a drop-in replacement for the CHEMKIN library, and provided "hand-coded" replacement routines for evaluation of EOS thermodynamic functions that are considerably more efficient than their CHEMKIN counterparts. Since 2001, CCSE has continued to modify FUEGO independently for its own use so that the current version here bears little resemblance to Michael's original code, or its intentions. CEPTR has adapted FUEGO code to use the Cantera yaml format and is now the preferred way of generating mechanism files. If using CEPTR, please cite the above `Hassanaly2024` journal article.

Typically, Cantera *mechanisms* (combustion models) are transmitted via a set of yaml files, which provide data for
* *Species* - definition of chemical species, as composed by fundamental elements
Expand Down
2 changes: 1 addition & 1 deletion Source/Eos/Manifold.H
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct Manifold
const amrex::Real /*R*/,
const amrex::Real /*T*/,
const amrex::Real* /*Y[]*/,
amrex::Real* /*E*/)
amrex::Real /*E*/)
{
amrex::Error("RTY2E does not have significance for Manifold EOS");
}
Expand Down
17 changes: 17 additions & 0 deletions Source/Reactions/ReactorBase.H
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,28 @@ public:

void set_typ_vals_ode(const std::vector<amrex::Real>& ExtTypVals);

// Manifold EOS needs an eosparm - right now that is only propagated through
// the RK64 reactor
virtual void set_eos_parm(
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
eosparm)
{
auto eos = pele::physics::PhysicsType::eos(eosparm);
if (eos.identifier() == "Manifold") {
amrex::Abort(
"Manifold EOS only supported with ReactorRK64 and ReactorNull for now");
} else {
m_eosparm = eosparm;
}
}

~ReactorBase() override = default;

protected:
int verbose{0};
amrex::GpuArray<amrex::Real, NUM_SPECIES + 1> m_typ_vals = {0.0};
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
m_eosparm;
};
} // namespace pele::physics::reactions
#endif
7 changes: 7 additions & 0 deletions Source/Reactions/ReactorNull.H
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public:
rhoE, frcEExt, FC_in, y_vect, vect_energy, FCunt, dt);
}

void set_eos_parm(
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
eosparm) override
{
m_eosparm = eosparm;
}

private:
utils::FlattenOps<Ordering> flatten_ops;
int m_reactor_type{0};
Expand Down
3 changes: 2 additions & 1 deletion Source/Reactions/ReactorNull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ReactorNull::react(
#endif

int captured_reactor_type = m_reactor_type;
const auto* leosparm = m_eosparm;

ParallelFor(box, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
amrex::Real renergy_loc =
Expand All @@ -60,7 +61,7 @@ ReactorNull::react(
}
amrex::Real energy_loc = renergy_loc / rho_loc;
amrex::Real T_loc = T_in(i, j, k, 0);
auto eos = pele::physics::PhysicsType::eos();
auto eos = pele::physics::PhysicsType::eos(leosparm);
if (captured_reactor_type == ReactorTypes::e_reactor_type) {
eos.REY2T(rho_loc, energy_loc, Y_loc, T_loc);
} else if (captured_reactor_type == ReactorTypes::h_reactor_type) {
Expand Down
7 changes: 7 additions & 0 deletions Source/Reactions/ReactorRK64.H
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ public:
rhoE, frcEExt, FC_in, y_vect, vect_energy, FCunt, dt);
}

void set_eos_parm(
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
eosparm) override
{
m_eosparm = eosparm;
}

private:
amrex::Real absTol{1e-10};
int rk64_nsubsteps_guess{10};
Expand Down
29 changes: 12 additions & 17 deletions Source/Reactions/ReactorRK64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ReactorRK64::react(
const int captured_nsubsteps_min = rk64_nsubsteps_min;
const int captured_nsubsteps_max = rk64_nsubsteps_max;
const amrex::Real captured_abstol = absTol;
const auto* leosparm = m_eosparm;
RK64Params rkp;

amrex::Gpu::DeviceVector<int> v_nsteps(ncells, 0);
Expand Down Expand Up @@ -103,7 +104,7 @@ ReactorRK64::react(
for (int stage = 0; stage < rkp.nstages_rk64; stage++) {
utils::fKernelSpec<Ordering>(
0, 1, current_time - time_init, captured_reactor_type, soln_reg, ydot,
rhoe_init, rhoesrc_ext, rYsrc_ext);
rhoe_init, rhoesrc_ext, rYsrc_ext, leosparm);

for (int sp = 0; sp < neq; sp++) {
error_reg[sp] += rkp.err_rk64[stage] * dt_rk * ydot[sp];
Expand Down Expand Up @@ -131,9 +132,9 @@ ReactorRK64::react(
rkp.betaerr_rk64 * pow((captured_abstol / max_err), rkp.exp2_rk64);
dt_rk = amrex::max<amrex::Real>(dt_rk_min, dt_rk * change_factor);
}
// Don't overstep the integration time
dt_rk = amrex::min<amrex::Real>(dt_rk, time_out - current_time);
}
// Don't overstep the integration time
dt_rk = amrex::min<amrex::Real>(dt_rk, time_out - current_time);
d_nsteps[icell] = nsteps;
// copy data back
for (int sp = 0; sp < neq; sp++) {
Expand Down Expand Up @@ -192,6 +193,7 @@ ReactorRK64::react(
const int captured_nsubsteps_min = rk64_nsubsteps_min;
const int captured_nsubsteps_max = rk64_nsubsteps_max;
const amrex::Real captured_abstol = absTol;
const auto* leosparm = m_eosparm;
RK64Params rkp;

int ncells = static_cast<int>(box.numPts());
Expand All @@ -210,21 +212,18 @@ ReactorRK64::react(
amrex::Real current_time = time_init;
const int neq = (NUM_SPECIES + 1);

amrex::Real rho = 0.0;
auto eos = pele::physics::PhysicsType::eos(leosparm);
for (int sp = 0; sp < NUM_SPECIES; sp++) {
soln_reg[sp] = rY_in(i, j, k, sp);
carryover_reg[sp] = soln_reg[sp];
rho += rY_in(i, j, k, sp);
}
amrex::Real rho_inv = 1.0 / rho;
amrex::Real rho = 0.0, rho_inv = 0.0;
amrex::Real mass_frac[NUM_SPECIES] = {0.0};
for (int sp = 0; sp < NUM_SPECIES; sp++) {
mass_frac[sp] = rY_in(i, j, k, sp) * rho_inv;
}
eos.RY2RRinvY(soln_reg, rho, rho_inv, mass_frac);

amrex::Real temp = T_in(i, j, k, 0);

amrex::Real Enrg_loc = rEner_in(i, j, k, 0) * rho_inv;
auto eos = pele::physics::PhysicsType::eos();
if (captured_reactor_type == ReactorTypes::e_reactor_type) {
eos.REY2T(rho, Enrg_loc, mass_frac, temp);
} else if (captured_reactor_type == ReactorTypes::h_reactor_type) {
Expand Down Expand Up @@ -255,7 +254,7 @@ ReactorRK64::react(
for (int stage = 0; stage < rkp.nstages_rk64; stage++) {
utils::fKernelSpec<Ordering>(
0, 1, current_time - time_init, captured_reactor_type, soln_reg, ydot,
rhoe_init, rhoesrc_ext, rYsrc_ext);
rhoe_init, rhoesrc_ext, rYsrc_ext, leosparm);

for (int sp = 0; sp < neq; sp++) {
error_reg[sp] += rkp.err_rk64[stage] * dt_rk * ydot[sp];
Expand Down Expand Up @@ -290,15 +289,11 @@ ReactorRK64::react(
// copy data back
int icell = (k - lo.z) * len.x * len.y + (j - lo.y) * len.x + (i - lo.x);
d_nsteps[icell] = nsteps;
rho = 0.0;
for (int sp = 0; sp < NUM_SPECIES; sp++) {
rY_in(i, j, k, sp) = soln_reg[sp];
rho += rY_in(i, j, k, sp);
}
rho_inv = 1.0 / rho;
for (int sp = 0; sp < NUM_SPECIES; sp++) {
mass_frac[sp] = rY_in(i, j, k, sp) * rho_inv;
}
eos.RY2RRinvY(soln_reg, rho, rho_inv, mass_frac);

temp = soln_reg[NUM_SPECIES];
rEner_in(i, j, k, 0) = rhoe_init[0] + dt_react * rhoesrc_ext[0];
Enrg_loc = rEner_in(i, j, k, 0) * rho_inv;
Expand Down
23 changes: 11 additions & 12 deletions Source/Reactions/ReactorUtils.H
Original file line number Diff line number Diff line change
Expand Up @@ -369,29 +369,27 @@ fKernelSpec(
amrex::Real* ydot_d, // NOLINT(readability-non-const-parameter)
const amrex::Real* rhoe_init,
const amrex::Real* rhoesrc_ext,
const amrex::Real* rYs)
const amrex::Real* rYs,
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
eosparm = nullptr)
{
amrex::Real rho_pt = 0.0;
amrex::GpuArray<amrex::Real, NUM_SPECIES> massfrac = {0.0};
auto eos = pele::physics::PhysicsType::eos(eosparm);
amrex::Real rho_pt = 0.0, rho_pt_inv = 0.0;
amrex::GpuArray<amrex::Real, NUM_SPECIES> massfrac = {0.0}, massdens = {0.0};
for (int n = 0; n < NUM_SPECIES; n++) {
massfrac[n] = yvec_d[vec_index<OrderType>(n, icell, ncells)];
rho_pt += massfrac[n];
}
const amrex::Real rho_pt_inv = 1.0 / rho_pt;

for (int n = 0; n < NUM_SPECIES; n++) {
massfrac[n] *= rho_pt_inv;
massdens[n] = yvec_d[vec_index<OrderType>(n, icell, ncells)];
}
eos.RY2RRinvY(massdens.data(), rho_pt, rho_pt_inv, massfrac.data());

const amrex::Real nrg_pt =
(rhoe_init[icell] + rhoesrc_ext[icell] * dt_save) * rho_pt_inv;

amrex::Real temp_pt =
yvec_d[vec_index<OrderType>(NUM_SPECIES, icell, ncells)];

amrex::Real Cv_pt = 0.0;
amrex::Real Cv_pt = 1.0;
amrex::GpuArray<amrex::Real, NUM_SPECIES> ei_pt = {0.0};
auto eos = pele::physics::PhysicsType::eos();
#ifndef USE_MANIFOLD_EOS
if (reactor_type == ReactorTypes::e_reactor_type) {
eos.REY2T(rho_pt, nrg_pt, massfrac.arr, temp_pt);
eos.RTY2Ei(rho_pt, temp_pt, massfrac.arr, ei_pt.arr);
Expand All @@ -403,6 +401,7 @@ fKernelSpec(
} else {
amrex::Abort("Wrong reactor type. Choose between 1 (e) or 2 (h).");
}
#endif

amrex::GpuArray<amrex::Real, NUM_SPECIES> cdots_pt = {0.0};
eos.RTY2WDOT(rho_pt, temp_pt, massfrac.arr, cdots_pt.arr);
Expand Down
2 changes: 1 addition & 1 deletion Submodules/amrex
Submodule amrex updated 64 files
+10 −14 .github/workflows/gcc.yml
+3 −3 .github/workflows/hip.yml
+5 −5 .github/workflows/intel.yml
+1 −1 .github/workflows/smoke.yml
+1 −1 .github/workflows/style/check_tabs.sh
+1 −1 .github/workflows/style/check_trailing_whitespaces.sh
+78 −0 CHANGES
+2 −2 Docs/sphinx_documentation/source/Basics.rst
+16 −3 Docs/sphinx_documentation/source/EB.rst
+2 −2 Docs/sphinx_documentation/source/RuntimeParameters.rst
+105 −0 Src/AmrCore/AMReX_FillPatchUtil.H
+120 −27 Src/AmrCore/AMReX_FillPatchUtil_I.H
+6 −0 Src/Base/AMReX_Arena.H
+24 −2 Src/Base/AMReX_Arena.cpp
+22 −12 Src/Base/AMReX_CTOParallelForImpl.H
+76 −2 Src/Base/AMReX_CoordSys.cpp
+2 −2 Src/Base/AMReX_DistributionMapping.cpp
+83 −21 Src/Base/AMReX_Enum.H
+14 −1 Src/Base/AMReX_Geometry.H
+51 −0 Src/Base/AMReX_IOFormat.H
+3 −0 Src/Base/AMReX_IntVect.H
+67 −0 Src/Base/AMReX_Math.H
+7 −0 Src/Base/AMReX_NonLocalBC.H
+265 −30 Src/Base/AMReX_ParmParse.H
+60 −32 Src/Base/AMReX_ParmParse.cpp
+50 −0 Src/Base/AMReX_PhysBCFunct.H
+2 −1 Src/Base/AMReX_RKIntegrator.H
+24 −0 Src/Base/AMReX_Stack.H
+1 −0 Src/Base/AMReX_TinyProfiler.H
+55 −28 Src/Base/AMReX_TinyProfiler.cpp
+3 −5 Src/Base/AMReX_VisMF.cpp
+5 −0 Src/Base/AMReX_iMultiFab.H
+45 −0 Src/Base/AMReX_iMultiFab.cpp
+2 −0 Src/Base/CMakeLists.txt
+3 −0 Src/Base/Make.package
+2 −13 Src/Base/Parser/AMReX_IParser_Exe.H
+2 −13 Src/Base/Parser/AMReX_Parser_Exe.H
+8 −12 Src/Base/Parser/AMReX_Parser_Y.H
+1 −2 Src/EB/AMReX_EB2_2D_C.cpp
+3 −1 Src/EB/AMReX_EB2_3D_C.cpp
+5 −0 Src/F_Interfaces/Base/AMReX_boxarray_fi.cpp
+19 −2 Src/F_Interfaces/Base/AMReX_boxarray_mod.F90
+5 −0 Src/F_Interfaces/Base/AMReX_distromap_fi.cpp
+17 −1 Src/F_Interfaces/Base/AMReX_distromap_mod.F90
+8 −2 Src/F_Interfaces/Base/AMReX_multifabutil_fi.cpp
+25 −1 Src/F_Interfaces/Base/AMReX_multifabutil_mod.F90
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H
+111 −73 Src/LinearSolvers/MLMG/AMReX_MLALaplacian.H
+2 −2 Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H
+10 −5 Src/LinearSolvers/MLMG/AMReX_MLLinOp.H
+111 −73 Src/LinearSolvers/MLMG/AMReX_MLPoisson.H
+20 −0 Src/Particle/AMReX_Particle_mod_K.H
+4 −2 Src/Particle/AMReX_WriteBinaryParticleData.H
+1 −1 Tests/CMakeLists.txt
+1 −2 Tests/Enum/inputs
+45 −0 Tests/Enum/main.cpp
+9 −0 Tests/ParmParse/CMakeLists.txt
+24 −0 Tests/ParmParse/GNUmakefile
+1 −0 Tests/ParmParse/Make.package
+64 −0 Tests/ParmParse/inputs
+143 −0 Tests/ParmParse/main.cpp
+1 −1 Tools/CMake/AMReXSetDefines.cmake
+1 −1 Tools/F_scripts/dep.py
+2 −2 Tools/GNUMake/Make.defs
Binary file added Support/CMLM/autoignition.ctb
Binary file not shown.
2 changes: 2 additions & 0 deletions Testing/Exec/EosEval/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ main(int argc, char* argv[])
amrex::WriteSingleLevelPlotfile(
outfile, VarPlt, plt_VarsName, geom, 0.0, 0);
}

eos_parms.deallocate();
}

amrex::Finalize();
Expand Down
20 changes: 13 additions & 7 deletions Testing/Exec/IgnitionDelay/GPU_misc.H
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ initialize_data(
amrex::Real t0,
amrex::Real equiv_ratio,
amrex::Real p,
amrex::GeometryData const& geomdata) noexcept
amrex::GeometryData const& geomdata,
const pele::physics::eos::EosParm<pele::physics::PhysicsType::eos_type>*
eosparm) noexcept
{
const amrex::Real* plo = geomdata.ProbLo();
const amrex::Real* phi = geomdata.ProbHi();
Expand All @@ -50,26 +52,30 @@ initialize_data(
P[n] = L[n] / 4.0;
}
// Y
auto eos = pele::physics::PhysicsType::eos(eosparm);

#ifndef USE_MANIFOLD_EOS
for (int n = 0; n < NUM_SPECIES; n++) {
X[n] = 0.0;
}
// X[O2_ID] = 0.7;
// X[fuel_id] = 0.3;
// Assumes n-Dodecane
X[O2_ID] = 1.0 / (equiv_ratio / 18.5 + 1 + 0.79 / 0.21);
X[N2_ID] = 0.79 * X[O2_ID] / 0.21;
X[fuel_id] = 1.0 - X[O2_ID] - X[N2_ID];

auto eos = pele::physics::PhysicsType::eos();

eos.X2Y(&X[0], &Y[0]);
#else
Y[0] = 0.0; // Progress variable
Y[1] = 1.0; // Density
#endif

// T
temp = t0;
// temp = Temp_lo + (Temp_hi-Temp_lo)*y/L[1] + dTemp *
// std::sin(2.0*pi*y/P[1]);
if (energy_type == 1) {
// get rho and E
eos.PYT2RE(pressure, &Y[0], temp, density, energy);
eos.PYT2R(pressure, &Y[0], temp, density);
eos.RTY2E(density, temp, &Y[0], energy);
} else {
// get rho and H
eos.PYT2R(pressure, &Y[0], temp, density);
Expand Down
Loading

0 comments on commit 6fc9a3f

Please sign in to comment.