From cb1237dd4c5c2dd4591570807d124095d7a77376 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 27 Jun 2018 22:23:21 +0100 Subject: [PATCH] displacementMotionSolver: Reorganized the updateMesh function It is not clear that the original updateMesh function in displacementLayeredMotionMotionSolver is correct and needs checking and testing. --- .../displacement/displacementMotionSolver.C | 33 ----------------- .../displacement/displacementMotionSolver.H | 3 -- .../displacementLayeredMotionMotionSolver.C | 36 +++++++++++++++++++ .../displacementLayeredMotionMotionSolver.H | 3 ++ 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C index bf7076bdb..ad5f7f3f0 100644 --- a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "displacementMotionSolver.H" -#include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -65,36 +64,4 @@ Foam::displacementMotionSolver::~displacementMotionSolver() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::displacementMotionSolver::updateMesh -( - const mapPolyMesh& mpm -) -{ - displacementMotionSolver::updateMesh(mpm); - - const vectorField displacement(this->newPoints() - points0_); - - forAll(points0_, pointi) - { - label oldPointi = mpm.pointMap()[pointi]; - - if (oldPointi >= 0) - { - label masterPointi = mpm.reversePointMap()[oldPointi]; - - if ((masterPointi != pointi)) - { - // newly inserted point in this cellZone - - // need to set point0 so that it represents the position that - // it would have had if it had existed for all time - points0_[pointi] -= displacement[pointi]; - } - } - } -} - - // ************************************************************************* // diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H index 5746123dc..64071e516 100644 --- a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H @@ -105,9 +105,6 @@ public: { return pointDisplacement_; } - - //- Update topology - virtual void updateMesh(const mapPolyMesh&); }; diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index 7b5c8ca1b..34ba0a242 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -31,6 +31,7 @@ License #include "syncTools.H" #include "interpolationTable.H" #include "pointConstraints.H" +#include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -555,4 +556,39 @@ void Foam::displacementLayeredMotionMotionSolver::solve() } +void Foam::displacementLayeredMotionMotionSolver::updateMesh +( + const mapPolyMesh& mpm +) +{ + FatalErrorInFunction + << "Probably inconsistent with points0MotionSolver" << nl + << " Needs to be updated and tested." + << exit(FatalError); + + displacementMotionSolver::updateMesh(mpm); + + const vectorField displacement(this->newPoints() - points0_); + + forAll(points0_, pointi) + { + const label oldPointi = mpm.pointMap()[pointi]; + + if (oldPointi >= 0) + { + label masterPointi = mpm.reversePointMap()[oldPointi]; + + if ((masterPointi != pointi)) + { + // newly inserted point in this cellZone + + // need to set point0 so that it represents the position that + // it would have had if it had existed for all time + points0_[pointi] -= displacement[pointi]; + } + } + } +} + + // ************************************************************************* // diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index 042144b8b..a9a9d709f 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -148,6 +148,9 @@ public: //- Solve for motion virtual void solve(); + + //- Update topology + virtual void updateMesh(const mapPolyMesh&); };