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

Add option to plot external sources #468

Merged
merged 2 commits into from
Jan 24, 2025
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
6 changes: 4 additions & 2 deletions Docs/sphinx/manual/LMeXControls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ IO parameters
amr.file_stepDigits = 6 # [OPT, DEF=5] Number of digits when adding nsteps to plt and chk names
amr.derive_plot_vars = avg_pressure ...# [OPT, DEF=""] List of derived variable included in the plot files
amr.plot_speciesState = 0 # [OPT, DEF=0] Force adding state rhoYs to the plot files
peleLM.plot_extSource = false # [OPT, DEF=false] Force adding state external sources to the plot files

amr.restart = chk00100 # [OPT, DEF=""] Checkpoint from which to restart the simulation
amr.initDataPlt = plt01000 # [OPT, DEF=""] Provide a plotfile from which to extract initial data
Expand Down Expand Up @@ -229,8 +230,9 @@ The following list of derived variables are available in PeleLMeX:

Note that `mixture_fraction` and `progress_variable` requires additional inputs from the users as described below.
The `derUserDefined` allow the user to define its own derived variable which can comprise several components. To do
so, the user need to copy the Source/DeriveUserDefined.cpp file into his run folder and update the file. The number of
components is defined based on the size of the vector returned by pelelmex_setuserderives().
so, the user need to copy the Source/DeriveUserDefined.cpp file into their run folder and update the file. The number of
components is defined based on the size of the vector returned by `pelelmex_setuserderives()`. Be sure to add the
user derived variables to the input file via `amr.derive_plot_vars`.

PeleLMeX algorithm
------------------
Expand Down
1 change: 1 addition & 0 deletions Source/PeleLMeX.H
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ public:
//-----------------------------------------------------------------------------
// External Sources
bool m_user_defined_ext_sources;
bool m_plot_extSource;
bool m_ext_sources_SDC;
void getExternalSources(
int is_initIter,
Expand Down
18 changes: 18 additions & 0 deletions Source/PeleLMeX_Plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ PeleLM::WritePlotFile()
ncomp += 1;
}

if (m_plot_extSource) {
// Plot state
ncomp += NVAR;
}

//----------------------------------------------------------------
// Plot MultiFabs
Vector<MultiFab> mf_plt(finest_level + 1);
Expand Down Expand Up @@ -288,6 +293,13 @@ PeleLM::WritePlotFile()
}
#endif

// External source terms
if (m_plot_extSource) {
for (int ivar = 0; ivar < NVAR; ++ivar) {
plt_VarsName.push_back("extsource_" + stateVariableName(ivar));
}
}

//----------------------------------------------------------------
// Fill the plot MultiFabs
for (int lev = 0; lev <= finest_level; ++lev) {
Expand Down Expand Up @@ -438,6 +450,12 @@ PeleLM::WritePlotFile()
Gpu::streamSynchronize();
}

cnt += 1;

if (m_plot_extSource) {
MultiFab::Copy(mf_plt[lev], *m_extSource[lev], 0, cnt, NVAR, 0);
}

#ifdef AMREX_USE_EB
if (m_plot_zeroEBcovered != 0) {
EB_set_covered(mf_plt[lev], 0.0);
Expand Down
2 changes: 2 additions & 0 deletions Source/PeleLMeX_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,9 @@ PeleLM::readParameters()
// -----------------------------------------
m_user_defined_ext_sources = false;
m_ext_sources_SDC = false; // TODO: add capability to update ext_srcs in SDC
m_plot_extSource = false;
pp.query("user_defined_ext_sources", m_user_defined_ext_sources);
pp.query("plot_extSource", m_plot_extSource);
}

void
Expand Down
Loading