From 373ad6df0ec9c9135c6c1b24353bcf735f2ca157 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 13 Dec 2019 10:02:46 +0100 Subject: [PATCH] ENH: additional feedback about controlled mesh motion update type - ensure that the updateControl is "non-sticky" on re-read, even if we do not support runtime-modifiable here STYLE: add syntax example (wingMotion), but with updateInterval 1 --- .../dynamicFvMesh/dynamicFvMesh.C | 38 +++++++++++++------ .../constant/dynamicMeshDict | 5 +++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C index b0cbbbc3a9..7562cad50f 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C @@ -41,20 +41,33 @@ namespace Foam void Foam::dynamicFvMesh::readDict() { - IOdictionary dict + IOobject dictHeader ( - IOobject - ( - "dynamicMeshDict", - thisDb().time().constant(), - thisDb(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false // Do not register - ) + "dynamicMeshDict", + thisDb().time().constant(), + thisDb(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false // Do not register ); - timeControl_.read(dict); + if (dictHeader.typeHeaderOk(false, false)) + { + IOdictionary dict(dictHeader); + timeControl_.read(dict); + + if (!timeControl_.always()) + { + // Feedback about the trigger mechanism + Info<< "Controlled mesh update triggered on " + << timeControl_.type() << nl; + } + } + else + { + // Ensure it is pass-through + timeControl_.clear(); + } } @@ -138,7 +151,8 @@ bool Foam::dynamicFvMesh::controlledUpdate() if (!timeControl_.always()) { // Feedback that update has been triggered - Info<< "Mesh update triggered based on " << timeControl_.name() << nl; + Info<< "Mesh update triggered based on " + << timeControl_.type() << nl; } return this->update(); diff --git a/tutorials/incompressible/pimpleFoam/RAS/wingMotion/wingMotion2D_pimpleFoam/constant/dynamicMeshDict b/tutorials/incompressible/pimpleFoam/RAS/wingMotion/wingMotion2D_pimpleFoam/constant/dynamicMeshDict index ff9dc98dac..6b64457ce3 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/wingMotion/wingMotion2D_pimpleFoam/constant/dynamicMeshDict +++ b/tutorials/incompressible/pimpleFoam/RAS/wingMotion/wingMotion2D_pimpleFoam/constant/dynamicMeshDict @@ -20,6 +20,11 @@ motionSolverLibs (sixDoFRigidBodyMotion); motionSolver sixDoFRigidBodyMotion; +// Not necessarily useful here, but can have different motion updates types +updateControl timeStep; +updateInterval 1; + + patches (wing); innerDistance 0.3; outerDistance 1;