From a42fe6c174814ab036ef36ff2367e9cbf95fb160 Mon Sep 17 00:00:00 2001 From: Ping He Date: Fri, 19 Jan 2024 14:42:04 -0600 Subject: [PATCH] Added an option to extract latestTime. (#567) --- .../preProcessing/getFIData/getFIData.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utilities/preProcessing/getFIData/getFIData.C b/src/utilities/preProcessing/getFIData/getFIData.C index ab2fc9fc..9ec7ab3d 100755 --- a/src/utilities/preProcessing/getFIData/getFIData.C +++ b/src/utilities/preProcessing/getFIData/getFIData.C @@ -68,6 +68,14 @@ int main(int argc, char* argv[]) if (args.optionFound("time")) { time = readScalar(args.optionLookup("time")()); + if (time == 9999) + { + Info << "Extract latestTime" << endl; + } + else + { + Info << "Extract time = " << time << endl; + } } else { @@ -93,10 +101,18 @@ int main(int argc, char* argv[]) scalar t = -1.0; if (time == -1.0) { + // read all times t = n * deltaT; } + else if (time == 9999) + { + // read from the latestTime (it is not necessarily the endTime) + instantList timeDirs = runTime.findTimes(runTime.path(), runTime.constant()); + t = timeDirs.last().value(); + } else { + // read from the specified time t = time; } runTime.setTime(t, n);