Skip to content

Commit

Permalink
minimum number of digits in plotfile and checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
hklion committed Dec 9, 2024
1 parent 51f38b1 commit fecaee9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,18 @@ Examples of Usage
**remora.init_shrink** :math:`\neq 1` then the first time step will in
fact be **remora.init_shrink** \* **remora.fixed_dt**.
File Output
===========

+-------------------------------+-----------------------------------+----------------+----------------------------+
| Parameter | Definition | Acceptable | Default |
| | | Values | |
+===============================+===================================+================+============================+
| **remora.file_min_digits** | Minimum number of digits | Integer >= 0 | 5 |
| | in iteration number appended to | | |
| | plotfile and checkpoint files | | |
+-------------------------------+-----------------------------------+----------------+----------------------------+

Restart Capability
==================

Expand Down
2 changes: 1 addition & 1 deletion Source/IO/REMORA_Checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ REMORA::WriteCheckpointFile ()
// etc. these subdirectories will hold the MultiFab data at each level of refinement

// checkpoint file name, e.g., chk00010
const std::string& checkpointname = amrex::Concatenate(check_file,istep[0],5);
const std::string& checkpointname = amrex::Concatenate(check_file,istep[0],file_min_digits);

amrex::Print() << "Writing checkpoint " << checkpointname << "\n";

Expand Down
2 changes: 1 addition & 1 deletion Source/IO/REMORA_NCPlotFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void REMORA::WriteNCPlotFile(int which_step) {
if (REMORA::write_history_file) {
plotfilename = plot_file_name + "_his";
} else {
plotfilename = Concatenate(plot_file_name, which_step, 5);
plotfilename = Concatenate(plot_file_name, which_step, file_min_digits);
}

// Set the full IO path for NetCDF output
Expand Down
2 changes: 1 addition & 1 deletion Source/IO/REMORA_Plotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ REMORA::WritePlotFile ()

} // lev

std::string plotfilename = Concatenate(plot_file_name, istep[0], 5);
std::string plotfilename = Concatenate(plot_file_name, istep[0], file_min_digits);

if (finest_level == 0)
{
Expand Down
3 changes: 3 additions & 0 deletions Source/REMORA.H
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,9 @@ private:
static int sum_interval;
static amrex::Real sum_per;

// Minimum number of digits in plotfile name
static int file_min_digits;

// Native or NetCDF
static PlotfileType plotfile_type;

Expand Down
8 changes: 8 additions & 0 deletions Source/REMORA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ int REMORA::verbose = 0;
int REMORA::sum_interval = -1;
amrex::Real REMORA::sum_per = -1.0_rt;

// Minimum number of digits in plotfile name
int REMORA::file_min_digits = 5;

// Native AMReX vs NetCDF
PlotfileType REMORA::plotfile_type = PlotfileType::amrex;

Expand Down Expand Up @@ -726,6 +729,11 @@ REMORA::ReadParameters ()
// Frequency of diagnostic output
pp.query("sum_interval", sum_interval);
pp.query("sum_period" , sum_per);
pp.query("file_min_digits", file_min_digits);

if (file_min_digits < 0) {
amrex::Abort("remora.file_min_digits must be non-negative")
}

// Time step controls
pp.query("cfl", cfl);
Expand Down

0 comments on commit fecaee9

Please sign in to comment.