Skip to content

Commit

Permalink
Fix an issue in EAMxx with incorrect metadata in rhist file
Browse files Browse the repository at this point in the history
This commit fixes an issue during restarts that occurs with
averaged type output.  The restart history file (rhist) metadata
was incorrectly setup which could lead EAMxx to reopen files that
already had the max number of snaps in them and continue to fill
them at the restart step.

Fixes #6795
  • Loading branch information
AaronDonahue committed Dec 11, 2024
1 parent 25a9e14 commit 657d9d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/eamxx/src/share/io/scream_output_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,14 @@ void OutputManager::run(const util::TimeStamp& timestamp)
if (filespecs.ftype==FileType::HistoryRestart) {
// Update the date of last write and sample size
write_timestamp (filespecs.filename,"last_write",m_output_control.last_write_ts,true);
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename",m_output_file_specs.filename);
scorpio::set_attribute (filespecs.filename,"GLOBAL","num_snapshots_since_last_write",m_output_control.nsamples_since_last_write);
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps",m_output_file_specs.storage.num_snapshots_in_file);
if (m_output_file_specs.is_open) {
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps",m_output_file_specs.storage.num_snapshots_in_file);
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename",m_output_file_specs.filename);
} else {
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps", std::numeric_limits<int>::max());
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename","");
}
}
// Write these in both output and rhist file. The former, b/c we need these info when we postprocess
// output, and the latter b/c we want to make sure these params don't change across restarts
Expand Down

0 comments on commit 657d9d2

Please sign in to comment.