From 8b67521d4948adf08cc45a2ffa6d938c91d62007 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 21 Feb 2024 12:42:48 +0000 Subject: [PATCH] fvMeshMovers::multiValveEngine: Added support for pointZones frozen with respect specific moving object for example it is now possible to freeze the cylinder head points with respect to the piston motion but still move with respect to the valve motion by specifying the cylinderHead pointZone only in the piston specification, e.g.: piston { patches (piston); axis (0 0 1); motion { type crankConnectingRodMotion; conRodLength 0.147; stroke 0.08423; } // Move the points in the piston bowl with the piston movingZones (pistonBowl); // Freeze the points in the cylinder head frozenZones (cylinderHead); // There is no need to update the motion weights fractionalTravelInterval 1; } --- .../multiValveEngine/movingObject.C | 62 +++++++++++++++++++ .../multiValveEngine/multiValveEngine.C | 32 ---------- .../multiValveEngine/multiValveEngine.H | 14 ++++- src/fvMeshMovers/multiValveEngine/piston.C | 2 +- src/fvMeshMovers/multiValveEngine/valve.C | 2 +- .../XiFluid/kivaTest/constant/dynamicMeshDict | 6 +- 6 files changed, 78 insertions(+), 40 deletions(-) diff --git a/src/fvMeshMovers/multiValveEngine/movingObject.C b/src/fvMeshMovers/multiValveEngine/movingObject.C index 8da4dc20df..4d72c02b46 100644 --- a/src/fvMeshMovers/multiValveEngine/movingObject.C +++ b/src/fvMeshMovers/multiValveEngine/movingObject.C @@ -211,6 +211,64 @@ Foam::fvMeshMovers::multiValveEngine::movingObject::movingPointZones() const } +Foam::labelHashSet +Foam::fvMeshMovers::multiValveEngine::movingObject::staticPointZones() const +{ + labelHashSet staticPointZones; + + if (frozenPointZones_.size()) + { + forAll(frozenPointZones_, i) + { + const labelList indices + ( + meshMover_.mesh().pointZones().findIndices(frozenPointZones_[i]) + ); + + if (indices.size()) + { + staticPointZones.insert(indices); + Info<< " pointZone " << frozenPointZones_[i] + << " is frozen (stationary)" << endl; + } + else + { + Info<< " frozenZone " << frozenPointZones_[i] + << " not found in pointZones" << endl; + } + } + } + + if (meshMover_.frozenPointZones_.size()) + { + forAll(meshMover_.frozenPointZones_, i) + { + const labelList indices + ( + meshMover_.mesh().pointZones().findIndices + ( + meshMover_.frozenPointZones_[i] + ) + ); + + if (indices.size()) + { + staticPointZones.insert(indices); + Info<< " pointZone " << meshMover_.frozenPointZones_[i] + << " is frozen (stationary)" << endl; + } + else + { + Info<< " frozenZone " << meshMover_.frozenPointZones_[i] + << " not found in pointZones" << endl; + } + } + } + + return staticPointZones; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::fvMeshMovers::multiValveEngine::movingObject::movingObject @@ -241,6 +299,10 @@ Foam::fvMeshMovers::multiValveEngine::movingObject::movingObject ( dict.lookupOrDefault("movingZones", wordReList::null()) ), + frozenPointZones_ + ( + dict.lookupOrDefault("frozenZones", wordReList::null()) + ), scale_ ( IOobject diff --git a/src/fvMeshMovers/multiValveEngine/multiValveEngine.C b/src/fvMeshMovers/multiValveEngine/multiValveEngine.C index b73d55bcb6..0f6efb4a10 100644 --- a/src/fvMeshMovers/multiValveEngine/multiValveEngine.C +++ b/src/fvMeshMovers/multiValveEngine/multiValveEngine.C @@ -95,38 +95,6 @@ Foam::labelHashSet Foam::fvMeshMovers::multiValveEngine::findStaticPatchSet() } -Foam::labelHashSet -Foam::fvMeshMovers::multiValveEngine::staticPointZones() const -{ - labelHashSet staticPointZones; - - if (frozenPointZones_.size()) - { - forAll(frozenPointZones_, i) - { - const labelList indices - ( - mesh().pointZones().findIndices(frozenPointZones_[i]) - ); - - if (indices.size()) - { - staticPointZones.insert(indices); - Info<< " pointZone " << frozenPointZones_[i] - << " is frozen (stationary)" << endl; - } - else - { - Info<< " frozenZone " << frozenPointZones_[i] - << " not found in pointZones" << endl; - } - } - } - - return staticPointZones; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::fvMeshMovers::multiValveEngine::multiValveEngine(fvMesh& mesh) diff --git a/src/fvMeshMovers/multiValveEngine/multiValveEngine.H b/src/fvMeshMovers/multiValveEngine/multiValveEngine.H index f1f1d5633a..134a9ebe4b 100644 --- a/src/fvMeshMovers/multiValveEngine/multiValveEngine.H +++ b/src/fvMeshMovers/multiValveEngine/multiValveEngine.H @@ -45,7 +45,7 @@ Description slide mesh nodes while piston is moving. - frozenZones: list of pointZones the points of which are frozen, - i.e. do not move. + i.e. do not move with respect to any moving object. - Run-time clearance estimation based on patch-to-patch distances printed. @@ -67,6 +67,9 @@ Description - movingZones: list of pointZones the points of which move with the object. + - frozenZones: list of pointZones the points of which are frozen, + i.e. do not move with respect to this moving object. + - maxMotionDistance: a distance away from the moving object after nodes are not allowed to move. (Default inf.) @@ -152,6 +155,9 @@ Description // Move the points in the piston bowl with the piston movingZones (pistonBowl); + // Freeze the points in the cylinder head + frozenZones (cylinderHead); + // Optional maxMotionDistance 1e30; movingFrozenLayerThickness 0; @@ -295,6 +301,8 @@ public: wordReList movingPointZones_; + wordReList frozenPointZones_; + //- Points to move when cell zone is supplied labelList pointIDs_; @@ -344,6 +352,8 @@ public: labelHashSet movingPointZones() const; + labelHashSet staticPointZones() const; + public: @@ -551,8 +561,6 @@ private: //- Find and return the static patch set labelHashSet findStaticPatchSet(); - labelHashSet staticPointZones() const; - public: diff --git a/src/fvMeshMovers/multiValveEngine/piston.C b/src/fvMeshMovers/multiValveEngine/piston.C index ef76ddb992..21c213dd98 100644 --- a/src/fvMeshMovers/multiValveEngine/piston.C +++ b/src/fvMeshMovers/multiValveEngine/piston.C @@ -182,7 +182,7 @@ void Foam::fvMeshMovers::multiValveEngine::pistonObject::updatePoints ( pMesh, staticPatchSet_, - meshMover_.staticPointZones(), + staticPointZones(), points, maxMotionDistance_ ); diff --git a/src/fvMeshMovers/multiValveEngine/valve.C b/src/fvMeshMovers/multiValveEngine/valve.C index 00577a3b64..353129071f 100644 --- a/src/fvMeshMovers/multiValveEngine/valve.C +++ b/src/fvMeshMovers/multiValveEngine/valve.C @@ -119,7 +119,7 @@ void Foam::fvMeshMovers::multiValveEngine::valveObject::updatePoints ( pMesh, staticPatchSet_, - meshMover_.staticPointZones(), + staticPointZones(), points, maxMotionDistance_ ); diff --git a/tutorials/XiFluid/kivaTest/constant/dynamicMeshDict b/tutorials/XiFluid/kivaTest/constant/dynamicMeshDict index 3d319dadd1..1c94918bb6 100644 --- a/tutorials/XiFluid/kivaTest/constant/dynamicMeshDict +++ b/tutorials/XiFluid/kivaTest/constant/dynamicMeshDict @@ -24,9 +24,6 @@ mover slidingPatches (liner); linerPatches (liner); - // Freeze the points in the cylinder head - frozenZones (cylinderHead); - piston { patches (piston); @@ -43,6 +40,9 @@ mover // Move the points in the piston bowl with the piston movingZones (pistonBowl); + // Freeze the points in the cylinder head + frozenZones (cylinderHead); + // There is no need to update the motion weights fractionalTravelInterval 1; }