Skip to content

Commit

Permalink
Feature overwrite plt file (#406)
Browse files Browse the repository at this point in the history
* Add option to overwrite plotfiles

* Add option to overwrite checkfiles

* Update doc
  • Loading branch information
EnnaDelfen authored Aug 28, 2024
1 parent fcaf815 commit 8218bc0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Docs/sphinx/manual/LMeXControls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ IO parameters

#--------------------------IO CONTROL--------------------------
amr.plot_int = 20 # [OPT, DEF=-1] Frequency (as step #) for writing plot file
amr.plot_overwrite = false # [OPT, DEF=false] Overwrite plot files with same name if present
amr.plot_per = 0.002 # [OPT, DEF=-1] Period (time in s) for writing plot file
amr.plot_per_exact = 1 # [OPT, DEF=0] Flag to enforce exactly plt_per by shortening dt
amr.plot_file = "plt_" # [OPT, DEF="plt_"] Plot file prefix
amr.check_int = 100 # [OPT, DEF=-1] Frequency (as step #) for writing checkpoint file
amr.check_overwrite = false # [OPT, DEF=false] Overwrite checkpoint files with same name if present
amr.check_per = 0.05 # [OPT, DEF=-1] Period (time in s) for writing checkpoint file
amr.check_file = "chk" # [OPT, DEF="chk"] Checkpoint file prefix
amr.file_stepDigits = 6 # [OPT, DEF=5] Number of digits when adding nsteps to plt and chk names
Expand Down
2 changes: 2 additions & 0 deletions Source/PeleLMeX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1774,10 +1774,12 @@ public:
int m_plotHeatRelease = 0;
int m_plotStateSpec = 0;
int m_plot_int = 0;
bool m_plot_overwrite = false;
int m_plot_zeroEBcovered = 1;
amrex::Real m_plot_per_approx = -1.;
amrex::Real m_plot_per_exact = -1.;
int m_check_int = 0;
bool m_check_overwrite = false;
amrex::Real m_check_per = -1.;
int m_message_int = 10;
int m_evaluatePlotVarCount = 0;
Expand Down
20 changes: 20 additions & 0 deletions Source/PeleLMeX_Plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ PeleLM::WritePlotFile()
amrex::Print() << "\n Writing plotfile: " << plotfilename << "\n";
}

//----------------------------------------------------------------
// Delete plotfiles if present and requested (and have same name)
if (m_plot_overwrite) {
if (amrex::ParallelContext::IOProcessorSub()) {
if (amrex::FileExists(plotfilename)) {
amrex::FileSystem::RemoveAll(plotfilename);
}
}
}

VisMF::SetNOutFiles(m_nfiles);

//----------------------------------------------------------------
Expand Down Expand Up @@ -525,6 +535,16 @@ PeleLM::WriteCheckPointFile()
amrex::Print() << "\n Writing checkpoint file: " << checkpointname << "\n";
}

//----------------------------------------------------------------
// Delete checkfiles if present and requested (and have same name)
if (m_check_overwrite) {
if (amrex::ParallelContext::IOProcessorSub()) {
if (amrex::FileExists(checkpointname)) {
amrex::FileSystem::RemoveAll(checkpointname);
}
}
}

VisMF::SetNOutFiles(m_nfiles);

amrex::PreBuildDirectorHierarchy(
Expand Down
2 changes: 2 additions & 0 deletions Source/PeleLMeX_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,14 @@ PeleLM::readIOParameters()

pp.query("check_file", m_check_file);
pp.query("check_int", m_check_int);
pp.query("check_overwrite", m_check_overwrite);
pp.query("check_per", m_check_per);
pp.query("restart", m_restart_chkfile);
pp.query("initDataPlt", m_restart_pltfile);
pp.query("initDataPltSource", pltfileSource);
pp.query("plot_file", m_plot_file);
pp.query("plot_int", m_plot_int);
pp.query("plot_overwrite", m_plot_overwrite);
if (pp.contains("plot_per")) {
int do_exact = 0;
pp.query("plot_per_exact", do_exact);
Expand Down

0 comments on commit 8218bc0

Please sign in to comment.