Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime and buildnml-time checks on output frequency #2919

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/eamxx/cime_config/eamxx_buildnml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,23 @@ def do_cime_vars_on_yaml_output_files(case, caseroot):
print (" - setting skip_t0_output=true\n")
print (" - setting freq and freq_units to HIST_N and HIST_OPTION respectively\n")

# If frequency_units is not nsteps, verify that we don't request
# a frequency faster than the model timestep
if content['output_control']['frequency_units'] in ['nsecs','nmins','nhours']:
freq = content['output_control']['Frequency']
units = content['output_control']['frequency_units']
dt_out = 1 if units=="nsecs" else 60 if units=="nmins" else 3600
dt_out = dt_out*int(freq)

dt_atm = 86400 / case.get_value("ATM_NCPL")
expect (dt_atm<=dt_out,
"Cannot have output frequency faster than atm timestep.\n"
f" yaml file: {fn.strip()}\n"
f" Frequency: {freq}\n"
f" frequency_units: {units}\n"
f" ATM_NCPL: {case.get_value('ATM_NCPL')}\n"
f" This yields dt_atm={dt_atm} > dt_output={dt_out}. Please, adjust 'Frequency' and/or 'frequency_units'\n")

ordered_dump(content, open(dst_yaml, "w"))

output_yaml_files.append(dst_yaml)
Expand Down
11 changes: 11 additions & 0 deletions components/eamxx/src/share/io/scream_output_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,17 @@ void OutputManager::run(const util::TimeStamp& timestamp)
return;
}

// Ensure we did not go past the scheduled write time without hitting it
EKAT_REQUIRE_MSG (
(m_output_control.frequency_units=="nsteps"
? timestamp.get_num_steps()<=m_output_control.next_write_ts.get_num_steps()
: timestamp<=m_output_control.next_write_ts),
"Error! The input timestamp is past the next scheduled write timestamp.\n"
" - current time stamp : " + timestamp.to_string() + "\n"
" - next write time stamp: " + m_output_control.next_write_ts.to_string() + "\n"
"The most likely cause is an output frequency that is faster than the atm timestep.\n"
"Try to increase 'Frequency' and/or 'frequency_units' in your output yaml file.\n");

// Update counters
++m_output_control.nsamples_since_last_write;
++m_checkpoint_control.nsamples_since_last_write;
Expand Down