From e71788f323bb75544d7368951691e93a1986bd68 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Wed, 9 Apr 2014 09:12:46 +0100 Subject: [PATCH] BUG: solidBodyMotionFvMesh - correct parallel running after commit f3f82ff --- .../solidBodyMotionFvMesh.C | 38 ++++++++++--------- .../solidBodyMotionFvMesh.H | 3 ++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C index 184cbe60875..030fdea85df 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C @@ -76,6 +76,7 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io) ) ), pointIDs_(), + moveAllCells_(false), UName_(dynamicMeshCoeffs_.lookupOrDefault<word>("UName", "U")) { if (undisplacedPoints_.size() != nPoints()) @@ -142,7 +143,14 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io) cellIDs = set.toc(); } - if (cellIDs.size()) + label nCells = returnReduce(cellIDs.size(), sumOp<label>()); + moveAllCells_ = nCells == 0; + + if (moveAllCells_) + { + Info<< "Applying solid body motion to entire mesh" << endl; + } + else { // collect point IDs of points in cell zone @@ -176,10 +184,6 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io) pointIDs_.transfer(ptIDs); } - else - { - Info<< "Applying solid body motion to entire mesh" << endl; - } } @@ -195,7 +199,18 @@ bool Foam::solidBodyMotionFvMesh::update() { static bool hasWarned = false; - if (pointIDs_.size()) + if (moveAllCells_) + { + fvMesh::movePoints + ( + transform + ( + SBMFPtr_().transformation(), + undisplacedPoints_ + ) + ); + } + else { pointField transformedPts(undisplacedPoints_); @@ -208,17 +223,6 @@ bool Foam::solidBodyMotionFvMesh::update() fvMesh::movePoints(transformedPts); } - else - { - fvMesh::movePoints - ( - transform - ( - SBMFPtr_().transformation(), - undisplacedPoints_ - ) - ); - } if (foundObject<volVectorField>(UName_)) diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.H index 3f691381fb3..d7d8bf46808 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.H +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.H @@ -68,6 +68,9 @@ class solidBodyMotionFvMesh //- Points to move when cell zone is supplied labelList pointIDs_; + //- Flag to indicate whether all cells should move + bool moveAllCells_; + //- Name of velocity field word UName_; -- GitLab