Skip to content

Commit 657d9d2

Browse files
committed
Fix an issue in EAMxx with incorrect metadata in rhist file
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
1 parent 25a9e14 commit 657d9d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/eamxx/src/share/io/scream_output_manager.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,14 @@ void OutputManager::run(const util::TimeStamp& timestamp)
494494
if (filespecs.ftype==FileType::HistoryRestart) {
495495
// Update the date of last write and sample size
496496
write_timestamp (filespecs.filename,"last_write",m_output_control.last_write_ts,true);
497-
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename",m_output_file_specs.filename);
498497
scorpio::set_attribute (filespecs.filename,"GLOBAL","num_snapshots_since_last_write",m_output_control.nsamples_since_last_write);
499-
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps",m_output_file_specs.storage.num_snapshots_in_file);
498+
if (m_output_file_specs.is_open) {
499+
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps",m_output_file_specs.storage.num_snapshots_in_file);
500+
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename",m_output_file_specs.filename);
501+
} else {
502+
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_file_num_snaps", std::numeric_limits<int>::max());
503+
scorpio::set_attribute (filespecs.filename,"GLOBAL","last_output_filename","");
504+
}
500505
}
501506
// Write these in both output and rhist file. The former, b/c we need these info when we postprocess
502507
// output, and the latter b/c we want to make sure these params don't change across restarts

0 commit comments

Comments
 (0)