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

Fix fill crse patch turb inflow #49

Merged
merged 4 commits into from
Feb 3, 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: 1 addition & 1 deletion Exec/RegTests/TurbInflow/pelelm_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void PeleLM::readProbParm()
AMREX_ASSERT_WITH_MESSAGE(PeleLM::prob_parm->tp.tph == nullptr,"Can only be one TurbParmHost");
PeleLM::prob_parm->tp.tph = new TurbParmHost;

amrex::Vector<amrex::Real> turb_center = {0.0};
amrex::Vector<amrex::Real> turb_center(2,0.0);
if ( prob_parm->meanFlowDir == 0 ) {
turb_center[0] = 0.5 * (probhi[1] + problo[1]);
turb_center[1] = 0.5 * (probhi[2] + problo[2]);
Expand Down
6 changes: 5 additions & 1 deletion Source/PeleLMBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,14 @@ void PeleLM::fillcoarsepatch_state(int lev,
const amrex::Real a_time,
amrex::MultiFab &a_state,
int nGhost) {
AMREX_ASSERT(lev>0);
ProbParm const* lprobparm = prob_parm_d;
pele::physics::PMF::PmfData::DataContainer const* lpmfdata = pmf_data.getDeviceData();

#ifdef PELE_USE_TURBINFLOW
fillTurbInflow(a_state, VELX, lev, a_time);
#endif

// Interpolator
auto* mapper = getInterpolator();

Expand Down Expand Up @@ -897,7 +902,6 @@ void PeleLM::fillTurbInflow(MultiFab &a_vel,

// Copy problem parameter structs back to device
amrex::Gpu::copy(amrex::Gpu::hostToDevice, probparmDH, probparmDH + 1, probparmDD);

}
}
#endif
8 changes: 6 additions & 2 deletions Source/PeleLMBCfill.H
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ struct PeleLMCCFillExtDirState
#ifdef PELE_USE_TURBINFLOW
// If using TurbInflow, pass in the turbulent data. User can overwrite if needed
if ( n >= VELX && n < DENSITY ) {
s_ext[VELX+n] = state(iv,VELX+n);
if ( !isnan(state(iv,VELX+n)) ) { // During fillcoarsepatch, get here with nan. TODO: find a better fix
s_ext[VELX+n] = state(iv,VELX+n);
}
}
#endif
// bcnormal() is defined in pelelm_prob.H in problem directory in /Exec
Expand All @@ -79,7 +81,9 @@ struct PeleLMCCFillExtDirState
#ifdef PELE_USE_TURBINFLOW
// If using TurbInflow, pass in the turbulent data. User can overwrite if needed
if ( n >= VELX && n < DENSITY ) {
s_ext[VELX+n] = state(iv,VELX+n);
if ( !isnan(state(iv,VELX+n)) ) { // During fillcoarsepatch, get here with nan. TODO: find a better fix
s_ext[VELX+n] = state(iv,VELX+n);
}
}
#endif
// bcnormal() is defined in pelelm_prob.H in problem directory in /Exec
Expand Down
6 changes: 3 additions & 3 deletions Source/PeleLMRegrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void PeleLM::MakeNewLevelFromCoarse( int lev,
m_nAux, m_nGrowState));

// Fill the leveldata_new
fillcoarsepatch_state(lev, time, n_leveldata_new->state, 0);
fillcoarsepatch_state(lev, time, n_leveldata_new->state, m_nGrowState);
fillcoarsepatch_gradp(lev, time, n_leveldata_new->gp, 0);
n_leveldata_new->press.setVal(0.0);

Expand All @@ -49,8 +49,8 @@ void PeleLM::MakeNewLevelFromCoarse( int lev,
fillcoarsepatch_divu(lev, time, n_leveldata_new->divu,0);
}
#ifdef PELE_USE_EFIELD
fillcoarsepatch_phiV(lev, time, n_leveldata_new->phiV,0);
fillcoarsepatch_nE(lev, time, n_leveldata_new->nE,0);
fillcoarsepatch_phiV(lev, time, n_leveldata_new->phiV,m_nGrowState);
fillcoarsepatch_nE(lev, time, n_leveldata_new->nE,m_nGrowState);
#endif
}

Expand Down