From 66ba2dd6743315eb53cb949549b2905ba1dd1c97 Mon Sep 17 00:00:00 2001 From: Andrew Heather <a.heather@opencfd.co.uk> Date: Mon, 26 Feb 2018 11:46:03 +0000 Subject: [PATCH] ENH: check case tool - updated command line arguments: -dry-run : perform check only and no writing -dry-run-write: perform check and write to the next time step. This also triggers function objects that fire on the call to write() --- src/OpenFOAM/include/addCheckCaseOptions.H | 9 +++++-- src/OpenFOAM/include/createMesh.H | 31 +++++++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/OpenFOAM/include/addCheckCaseOptions.H b/src/OpenFOAM/include/addCheckCaseOptions.H index e2419ce082c..15caf168b57 100644 --- a/src/OpenFOAM/include/addCheckCaseOptions.H +++ b/src/OpenFOAM/include/addCheckCaseOptions.H @@ -1,5 +1,10 @@ Foam::argList::addBoolOption ( - "check", - "Check set-up only using a single time step" + "dry-run", + "Check case set-up only using a single time step" +); +Foam::argList::addBoolOption +( + "dry-run-write", + "Check case set-up and write only using a single time step" ); diff --git a/src/OpenFOAM/include/createMesh.H b/src/OpenFOAM/include/createMesh.H index 37bb3ecf839..9468e822005 100644 --- a/src/OpenFOAM/include/createMesh.H +++ b/src/OpenFOAM/include/createMesh.H @@ -1,25 +1,30 @@ Foam::autoPtr<Foam::fvMesh> meshPtr(nullptr); -if (args.optionFound("check")) +if (args.optionFound("dry-run") || args.optionFound("dry-run-write")) { - Info<< "Operating in 'check' mode: case will run for 1 time step. " - << "All checks assumed OK on a clean exit" << endl; + Foam::Info + << "Operating in 'dry-run' mode: case will run for 1 time step. " + << "All checks assumed OK on a clean exit" << Foam::endl; - Field<label>::allowConstructFromLargerSize = true; - Field<scalar>::allowConstructFromLargerSize = true; - Field<vector>::allowConstructFromLargerSize = true; - Field<sphericalTensor>::allowConstructFromLargerSize = true; - Field<symmTensor>::allowConstructFromLargerSize = true; - Field<tensor>::allowConstructFromLargerSize = true; + Foam::FieldBase::allowConstructFromLargerSize = true; // Create a simplified 1D mesh and attempt to re-create boundary conditions - meshPtr = dummyFvMesh::equivalent1DMesh(runTime); + meshPtr.reset(Foam::dummyFvMesh::equivalent1DMesh(runTime)); // Stopping after 1 iteration of the simplified mesh - // Note: using saWriteNow to trigger writing/execution of function objects - // - saNoWriteNow will only trigger the function object execute function + // Note: using saNoWriteNow will only trigger the function object execute + // function and not the write function runTime.stopAt(Foam::Time::saNoWriteNow); -// runTime.stopAt(Foam::Time::saWriteNow); + + if (args.optionFound("dry-run-write")) + { + // Stopping after 1 iteration of the simplified mesh + // Note: using saWriteNow to trigger writing/execution of function + // objects + runTime.stopAt(Foam::Time::saWriteNow); + } + + Foam::functionObject::outputPrefix = "postProcessing-dry-run"; } else { -- GitLab