Skip to content
Open
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: 14 additions & 3 deletions core/src/Xios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,13 @@ void Xios::createFile(const std::string& fileId)
cxios_duration outputFreq;
ModelMetadata& metadata = ModelMetadata::getInstance();
if (ioType == INPUT_RESTART || ioType == OUTPUT_RESTART) {
outputFreq = convertDurationToXios(metadata.restartPeriod);
if (metadata.restartPeriod.seconds() == 0) {
outputFreq = convertDurationToXios(metadata.runLength());
} else if (metadata.restartPeriod.seconds() < 0) {
throw std::runtime_error("Xios: Restart period must be non-negative");
} else {
outputFreq = convertDurationToXios(metadata.restartPeriod);
}
} else {
std::string periodStr;
if (ioType == ERA5_FORCING) {
Expand All @@ -1341,11 +1347,16 @@ void Xios::createFile(const std::string& fileId)
} else {
periodStr
= Configured::getConfiguration(keyMap.at(DIAGNOSTIC_PERIOD_KEY), std::string());
cxios_set_file_split_freq(file, convertDurationToXios(Duration(periodStr)));
if (periodStr.empty() || periodStr == "0") {
outputFreq = convertDurationToXios(metadata.runLength());
} else {
outputFreq = convertDurationToXios(Duration(periodStr));
Duration period = periodStr;
if (period.seconds() == 0) {
outputFreq = convertDurationToXios(metadata.runLength());
} else if (period.seconds() < 0) {
throw std::runtime_error("Xios: Diagnostic period must be non-negative");
}
outputFreq = convertDurationToXios(period);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions docs/xios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ building without XIOS. That is, the ``model`` section should include
restart_file = my_restart_file.nc
restart_period = P0-0T02:00:00

Note that the restart period must be non-negative under XIOS. If the restart
period is set to zero then this will be interpreted as the full simulation
lenght. That is, restarts will not be written until the very end.

Information related to fields to be read from and written to files are
configured via the ``XiosInput``, ``XiosOutput``, and ``XiosDiagnostic``
sections, where the first two refer to restarts. Note that all of these sections
Expand Down
Loading