Skip to content

Output: Don't replace dmp files by default - #3504

Open
bendudson wants to merge 8 commits into
nextfrom
output_replace
Open

bendudson wants to merge 8 commits into
nextfrom
output_replace

Conversation

@bendudson

Copy link
Copy Markdown
Contributor

BOUT++ previously overwrote output (dmp) files unless "append" was specified. This could lead to accidentally deleting previous runs.

This adds a "replace" option that is false by default for dmp files. By default then BOUT++ will throw a BoutException rather than overwrite dump files. Users can either:

  • Add "append" to command line to append existing data
  • Add "replace" to overwrite existing data
  • Manually delete dmp files before running BOUT++.

This is an option, rather than always refusing to overwrite, because restart files need to be overwritten.

BOUT++ previously overwrote output (dmp) files unless "append" was
specified. This could lead to accidentally deleting previous runs.

This adds a "replace" option that is `false` by default for dmp files.
By default then BOUT++ will throw a `BoutException` rather than
overwrite dump files. Users can either:
- Add "append" to command line to append existing data
- Add "replace" to overwrite existing data
- Manually delete dmp files before running BOUT++.

This is an option, rather than always refusing to overwrite, because
restart files need to be overwritten.
ZedThree
ZedThree previously approved these changes Sep 28, 2026

@ZedThree ZedThree left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bendudson, does seem strange we've gone this long without this option!

Does ADIOS need to handle this too?

@bendudson

Copy link
Copy Markdown
Contributor Author

Thanks @ZedThree ! Good point; this should be added to the ADIOS output too. And probably some documentation.

@ZedThree

Copy link
Copy Markdown
Member

Ah, the MMS tests apparently rely on overwriting the previous runs. I suspect some of the integrated tests do too

Behaves similar to NetCDF output: Refuse to overwrite an
existing file unless `replace` is true.

ADIOS2 works on streams so the concepts are a bit different.

The adios2 `write` function is being called multiple times (4?)
per output step. Only checking if we're overwriting on the first call.
These tests run BOUT++ in a loop with different settings, overwriting
the previous output.
Set replace=true by default so files can be overwritten
When running tests don't copy any BOUT.dmp files
Remove dump files. The glob "BOUT.dmp.*" should match both NetCDF
and ADIOS2 outputs; "-r" is needed because ADIOS2 outputs are
directories.

These changes triggered `ruff check` errors that are fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants