Skip to content

Commit

Permalink
manually compute turbulent viscosity rather than waiting until getDif…
Browse files Browse the repository at this point in the history
…fusivity is called
  • Loading branch information
baperry2 committed Dec 18, 2024
1 parent 652f0ea commit 0ed1f9d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Source/PeleLMeX_Advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ PeleLM::Advance(int is_initIter)
poissonSolveEF(AmrOldTime);
#endif
}
if (m_do_les) {
calcTurbViscosity(AmrOldTime);
}

//----------------------------------------------------------------
BL_PROFILE_VAR_STOP(PLM_SETUP);
Expand Down
11 changes: 11 additions & 0 deletions Source/PeleLMeX_Evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ PeleLM::MLevaluate(
finest_level, grids, dmap, m_factory, m_nGrowAdv, m_use_wbar,
m_use_soret);
calcDiffusivity(AmrNewTime);
// If doing LES, need to be able to add in turbulent component
if (m_do_les) {
calcTurbViscosity(AmrNewTime);
}
computeDifferentialDiffusionTerms(AmrNewTime, diffData);
for (int lev = 0; lev <= finest_level; ++lev) {
MultiFab::Copy(
Expand Down Expand Up @@ -215,6 +219,7 @@ PeleLM::MLevaluate(
} else if (a_var == "transportCC") {
// Cell-centered transport coefficients functions go through the level
// data container. Simply copy once the later has been filled.
// No LES component here - this is just moledular transport coeffs
calcViscosity(AmrNewTime);
calcDiffusivity(AmrNewTime);
for (int lev = 0; lev <= finest_level; ++lev) {
Expand Down Expand Up @@ -290,6 +295,9 @@ PeleLM::evaluateChemExtForces(
// compute t^{n} data
calcViscosity(AmrOldTime);
calcDiffusivity(AmrOldTime);
if (m_do_les) {
calcTurbViscosity(AmrOldTime);
}

floorSpecies(AmrOldTime);
setThermoPress(AmrOldTime);
Expand Down Expand Up @@ -392,6 +400,9 @@ PeleLM::evaluateAdvectionTerms(
// compute t^{n} data
calcViscosity(AmrOldTime);
calcDiffusivity(AmrOldTime);
if (m_do_les) {
calcTurbViscosity(AmrOldTime);
}

floorSpecies(AmrOldTime);
setThermoPress(AmrOldTime);
Expand Down
21 changes: 3 additions & 18 deletions Source/PeleLMeX_TransportProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,24 +414,9 @@ PeleLM::getDiffusivity(
// supported
if ((addTurbContrib != 0) and m_do_les) {

// If initializing the simulation, always recompute turbulent viscosity
// otherwise, only recompute once per level per timestep (at old time)
// calcTurbViscosity computes for all levels, so only call from the base
// level
TimeStamp tstamp;
if (getTime(lev, AmrNewTime) == 0.0) {
tstamp = AmrNewTime;
if (lev == 0) {
calcTurbViscosity(tstamp);
}
} else if (lev == 0 and getTime(lev, AmrOldTime) > m_turb_visc_time[lev]) {
tstamp = AmrOldTime;
calcTurbViscosity(tstamp);
m_turb_visc_time[lev] = getTime(lev, AmrOldTime);
} else {
tstamp = AmrOldTime;
}
auto* ldata_p = getLevelDataPtr(lev, tstamp);
// Turbulent viscosity - always in old data
// (not updated because velocity doesn't get updated until end of advance)
auto* ldata_p = getLevelDataPtr(lev, AmrOldTime);

// Identify and add the correct turbulent contribution
for (int idim = 0; idim < AMREX_SPACEDIM; idim++) {
Expand Down

0 comments on commit 0ed1f9d

Please sign in to comment.