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

updates needed for peleparams for PMF and transport #387

Merged
merged 4 commits into from
Jun 7, 2024
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: 1 addition & 1 deletion Exec/RegTests/EB_EnclosedVortex/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
pp.query("forcevort", PeleLM::prob_parm->forcevort);

if (m_incompressible == 0) {
auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
amrex::ParmParse pptr("transport");
pp.query("const_viscosity", trans_parm.const_viscosity);
pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/EB_FlowPastCylinder/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
pp.query("meanFlowMag", prob_parm->meanFlowMag);

// if (!m_incompressible) {
// auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
// auto& trans_parm = PeleLM::trans_parms.host_parm();
// amrex::ParmParse pptr("transport");
// pp.query("const_viscosity", trans_parm.const_viscosity);
// pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/EB_PipeFlow/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)

/*
if (!m_incompressible) {
auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
amrex::ParmParse pptr("transport");
pp.query("const_viscosity", trans_parm.const_viscosity);
pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/HotBubble/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
pp.query("use_symmetry", prob_parm->is_sym);
pp.query("use_mix_bubble", prob_parm->bubble_is_mix);

auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
amrex::ParmParse pptr("transport");
pp.query("const_viscosity", trans_parm.const_viscosity);
pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/PeriodicCases/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
}

if (m_incompressible == 0) {
auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
amrex::ParmParse pptr("transport");
pp.query("const_viscosity", trans_parm.const_viscosity);
pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/TaylorGreen/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
// Transport
amrex::Real cpmix_cgs;
eos.TY2Cp(prob_parm->T_mean, massfrac, cpmix_cgs);
auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
trans_parm.const_bulk_viscosity = 0.0;
trans_parm.const_diffusivity = 0.0;
trans_parm.const_viscosity =
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/TurbInflow/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)

/*
if (!m_incompressible) {
auto& trans_parm = PeleLM::trans_parms.host_trans_parm();
auto& trans_parm = PeleLM::trans_parms.host_parm();
amrex::ParmParse pptr("transport");
pp.query("const_viscosity", trans_parm.const_viscosity);
pp.query("const_bulk_viscosity", trans_parm.const_bulk_viscosity);
Expand Down
6 changes: 2 additions & 4 deletions Source/Efield/PeleLMeX_EFUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ void
PeleLM::fillPatchNLnE(Real a_time, Vector<MultiFab*> const& a_nE, int a_nGrow)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

int lev = 0;
{
Expand Down Expand Up @@ -324,8 +323,7 @@ PeleLM::fillPatchNLphiV(
Real a_time, Vector<MultiFab*> const& a_phiV, int a_nGrow)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

int lev = 0;
{
Expand Down
8 changes: 5 additions & 3 deletions Source/PeleLMeX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1742,11 +1742,13 @@ public:
amrex::Vector<amrex::Real> m_ctrl_cntl_pts;

// PMF parameters
pele::physics::PMF::PmfData pmf_data;
pele::physics::PeleParams<pele::physics::PMF::PmfData::DataContainer>
pmf_data;

// Transport pointer
static pele::physics::transport::TransportParams<
pele::physics::PhysicsType::transport_type>
static pele::physics::PeleParams<pele::physics::transport::TransParm<
pele::physics::PhysicsType::eos_type,
pele::physics::PhysicsType::transport_type>>
trans_parms;

// Reactor pointer
Expand Down
5 changes: 3 additions & 2 deletions Source/PeleLMeX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

using namespace amrex;

pele::physics::transport::TransportParams<
pele::physics::PhysicsType::transport_type>
pele::physics::PeleParams<pele::physics::transport::TransParm<
pele::physics::PhysicsType::eos_type,
pele::physics::PhysicsType::transport_type>>
PeleLM::trans_parms;

PeleLM::PeleLM() = default;
Expand Down
21 changes: 7 additions & 14 deletions Source/PeleLMeX_BC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ PeleLM::fillpatch_state(
int lev, const amrex::Real a_time, amrex::MultiFab& a_state, int nGhost)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

int nCompState = (m_incompressible) != 0 ? AMREX_SPACEDIM : NVAR;

Expand Down Expand Up @@ -404,8 +403,7 @@ PeleLM::fillpatch_density(
int nGhost)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();
if (lev == 0) {

// Density
Expand Down Expand Up @@ -451,8 +449,7 @@ PeleLM::fillpatch_species(
int nGhost)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();
if (lev == 0) {

// Species
Expand Down Expand Up @@ -497,8 +494,7 @@ PeleLM::fillpatch_temp(
int nGhost)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();
if (lev == 0) {
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirTemp>> bndry_func(
geom[lev], fetchBCRecArray(TEMP, 1),
Expand Down Expand Up @@ -541,8 +537,7 @@ PeleLM::fillpatch_phiV(
int nGhost)
{
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();
if (lev == 0) {
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirPhiV>> bndry_func(
geom[lev], fetchBCRecArray(PHIV, 1),
Expand Down Expand Up @@ -745,8 +740,7 @@ PeleLM::fillcoarsepatch_state(
{
AMREX_ASSERT(lev > 0);
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

int nCompState = (m_incompressible) != 0 ? AMREX_SPACEDIM : NVAR;

Expand Down Expand Up @@ -882,8 +876,7 @@ PeleLM::setInflowBoundaryVel(MultiFab& a_vel, int lev, TimeStamp a_time)
fillTurbInflow(a_vel, 0, lev, time);

ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> bndry_func(
geom[lev], dummyVelBCRec,
PeleLMCCFillExtDirState{
Expand Down
6 changes: 3 additions & 3 deletions Source/PeleLMeX_DeriveFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ pelelmex_dervisc(
auto const& rhoY = statefab.const_array(FIRSTSPEC);
auto const& T = statefab.array(TEMP);
auto der = derfab.array(dcomp);
auto const* ltransparm = a_pelelm->trans_parms.device_trans_parm();
auto const* ltransparm = a_pelelm->trans_parms.device_parm();
amrex::ParallelFor(
bx, [rhoY, T, der,
ltransparm] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
Expand Down Expand Up @@ -1370,7 +1370,7 @@ pelelmex_derdiffc(
auto rhoD = derfab.array(dcomp);
auto lambda = dummies.array(0);
auto mu = dummies.array(1);
auto const* ltransparm = a_pelelm->trans_parms.device_trans_parm();
auto const* ltransparm = a_pelelm->trans_parms.device_parm();
auto rhotheta = do_soret ? derfab.array(dcomp + NUM_SPECIES)
: dummies.array(2); // dummy for no soret
amrex::Real LeInv = a_pelelm->m_Lewis_inv;
Expand Down Expand Up @@ -1417,7 +1417,7 @@ pelelmex_derlambda(
auto lambda = derfab.array(dcomp);
auto mu = dummies.array(0);
auto rhotheta = dummies.array(NUM_SPECIES + 1);
auto const* ltransparm = a_pelelm->trans_parms.device_trans_parm();
auto const* ltransparm = a_pelelm->trans_parms.device_parm();
amrex::Real LeInv = a_pelelm->m_Lewis_inv;
amrex::Real PrInv = a_pelelm->m_Prandtl_inv;
amrex::ParallelFor(
Expand Down
3 changes: 1 addition & 2 deletions Source/PeleLMeX_FlowController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ PeleLM::initActiveControl()

// Extract data from BC: assumes flow comes in from lo side of ctrl_flameDir
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

Gpu::DeviceVector<Real> s_ext_v(NVAR);
Real* s_ext_d = s_ext_v.data();
Expand Down
3 changes: 1 addition & 2 deletions Source/PeleLMeX_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ PeleLM::initLevelData(int lev)

// Prob/PMF data
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata =
pmf_data.getDeviceData();
auto const* lpmfdata = pmf_data.device_parm();

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMeX_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ PeleLM::Setup()
// Initialize EOS and others
if (m_incompressible == 0) {
amrex::Print() << " Initialization of Transport ... \n";
trans_parms.allocate();
trans_parms.initialize();
if ((m_les_verbose != 0) and m_do_les) { // Say what transport model we're
// going to use
amrex::Print() << " Using LES in transport with Sc = "
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMeX_SprayParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ PeleLM::SprayMKDLevel(const int level, const Real time, const Real dt)

// Advance the particle velocities to the half-time and the positions to
// the new time
auto const* ltransparm = PeleLM::trans_parms.device_trans_parm();
auto const* ltransparm = PeleLM::trans_parms.device_parm();

MultiFab& state = *(m_spraystate[level]);
MultiFab& source = *(m_spraysource[level]);
Expand Down
4 changes: 2 additions & 2 deletions Source/PeleLMeX_TransportProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ PeleLM::calcViscosity(const TimeStamp& a_time)
} else {

// Transport data pointer
auto const* ltransparm = trans_parms.device_trans_parm();
auto const* ltransparm = trans_parms.device_parm();

// MultiArrays
auto const& sma = ldata_p->state.const_arrays();
Expand Down Expand Up @@ -291,7 +291,7 @@ PeleLM::calcDiffusivity(const TimeStamp& a_time)
auto* ldata_p = getLevelDataPtr(lev, a_time);

// Transport data pointer
auto const* ltransparm = trans_parms.device_trans_parm();
auto const* ltransparm = trans_parms.device_parm();

// MultiArrays
auto const& sma = ldata_p->state.const_arrays();
Expand Down
Loading