Skip to content

Commit

Permalink
Add write_diagonstics_on_restart input option (ECP-WarpX#4091)
Browse files Browse the repository at this point in the history
* Add write_diagonstics_on_restart input option

* Add doc to new variable

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* Use correct time step

---------

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
  • Loading branch information
dpgrote and ax3l authored Aug 9, 2023
1 parent 66058aa commit 5313c5d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3129,6 +3129,9 @@ The checkpoint capability can be turned with regular diagnostics: ``<diag_name>.
Name of the checkpoint file to restart from. Returns an error if the folder does not exist
or if it is not properly formatted.

* ``warpx.write_diagonstics_on_restart`` (`bool`) optional (default `false`)
When `true`, write the diagnostics after restart at the time of the restart.

Intervals parser
----------------

Expand Down
8 changes: 5 additions & 3 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,17 @@ WarpX::InitData ()
// looks at field values will see the composite of the field
// solution and any external field
AddExternalFields();
}

if (restart_chkfile.empty() || write_diagonstics_on_restart) {
// Write full diagnostics before the first iteration.
multi_diags->FilterComputePackFlush( -1 );
multi_diags->FilterComputePackFlush(istep[0] - 1);

// Write reduced diagnostics before the first iteration.
if (reduced_diags->m_plot_rd != 0)
{
reduced_diags->ComputeDiags(-1);
reduced_diags->WriteToFile(-1);
reduced_diags->ComputeDiags(istep[0] - 1);
reduced_diags->WriteToFile(istep[0] - 1);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,9 @@ private:

std::string restart_chkfile;

/** When `true`, write the diagnostics after restart at the time of the restart. */
bool write_diagonstics_on_restart = false;

amrex::VisMF::Header::Version plotfile_headerversion = amrex::VisMF::Header::Version_v1;
amrex::VisMF::Header::Version slice_plotfile_headerversion = amrex::VisMF::Header::Version_v1;

Expand Down
2 changes: 2 additions & 0 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ WarpX::ReadParameters ()
}
}

pp_warpx.query("write_diagonstics_on_restart", write_diagonstics_on_restart);

pp_warpx.queryarr("checkpoint_signals", signals_in);
#if defined(__linux__) || defined(__APPLE__)
for (const std::string &str : signals_in) {
Expand Down

0 comments on commit 5313c5d

Please sign in to comment.