Skip to content
Snippets Groups Projects
Commit 577babc7 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: reject bad time values for blockMesh -time (closes #1093)

parent 343a3b95
Branches
Tags
No related merge requests found
...@@ -150,6 +150,31 @@ int main(int argc, char *argv[]) ...@@ -150,6 +150,31 @@ int main(int argc, char *argv[])
} }
// Instance for resulting mesh
bool useTime = false;
word meshInstance(runTime.constant());
if
(
args.readIfPresent("time", meshInstance)
&& runTime.constant() != meshInstance
)
{
// Verify that the value is actually good
scalar timeValue;
useTime = readScalar(meshInstance, timeValue);
if (!useTime)
{
FatalErrorInFunction
<< "Bad input value: " << meshInstance
<< "Should be a scalar or 'constant'"
<< nl << endl
<< exit(FatalError);
}
}
// Locate appropriate blockMeshDict // Locate appropriate blockMeshDict
#include "findBlockMeshDict.H" #include "findBlockMeshDict.H"
...@@ -203,13 +228,13 @@ int main(int argc, char *argv[]) ...@@ -203,13 +228,13 @@ int main(int argc, char *argv[])
// Instance for resulting mesh // Instance for resulting mesh
word meshInstance(runTime.constant()); if (useTime)
if (args.readIfPresent("time", meshInstance))
{ {
Info<< "Writing polyMesh to " << meshInstance << nl << endl; Info<< "Writing polyMesh to " << meshInstance << nl << endl;
// Make sure that the time is seen to be the current time. This // Make sure that the time is seen to be the current time. This
// is the logic inside regIOobject which resets the instance to the // is the logic inside regIOobject which resets the instance to the
// current time before writting // current time before writing
runTime.setTime(instant(meshInstance), 0); runTime.setTime(instant(meshInstance), 0);
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment