Skip to content
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
6 changes: 4 additions & 2 deletions doc/source/reference/idefix.ini.rst
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ This section describes the outputs *Idefix* produces. For more details about eac
+================+=========================+==================================================================================================+
| log | integer | | Time interval between log outputs, in code steps (default 100). |
+----------------+-------------------------+--------------------------------------------------------------------------------------------------+
| dmp | float | | Time interval between dump outputs, in code units. |
| | | | If negative, periodic dump outputs are disabled. |
| dmp | float, float+char | | 1st parameter: Code time interval between dump outputs, in code units. |
| | | | If negative, the first parameter is ignored. |
| | | | 2nd parameter (optional): Wallclock time interval between two dumps. The ending character |
| | | | can be "s" (seconds) "m" (minutes) "h" (hours) or "d" (days) |
+----------------+-------------------------+--------------------------------------------------------------------------------------------------+
| dmp_dir | string | | directory for dump file outputs. Default to "./" |
| | | | The directory is automatically created if it does not exist. |
Expand Down
9 changes: 7 additions & 2 deletions src/output/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ Output::Output(Input &input, DataBlock &data)
dumpPeriod = input.Get<real>("Output","dmp",0);
dumpLast = data.t - dumpPeriod; // dump something in the next CheckForWrite()
if(input.CheckEntry("Output","dmp")>1) {
dumpTimePeriod = input.Get<real>("Output","dmp",1);
std::string dumpTimeExtension = input.Get<std::string>("Output","dmp",2);
std::string dumpString = input.Get<std::string>("Output","dmp",1);
try {
dumpTimePeriod = std::stod(dumpString.substr(0, dumpString.size()-1), NULL);
} catch(const std::exception& e) {
IDEFIX_ERROR("The dump time period should be a number followed by a unit (s, m, h or d)");
}
std::string dumpTimeExtension = dumpString.substr(dumpString.size()-1,1);
if(dumpTimeExtension.compare("s")==0) {
dumpTimePeriod *= 1.0; // Dump time period is in seconds by default
} else if (dumpTimeExtension.compare("m")==0) {
Expand Down