diff --git a/src/autoMesh/Make/files b/src/autoMesh/Make/files index 20e68a05fe..c562ee5c6d 100644 --- a/src/autoMesh/Make/files +++ b/src/autoMesh/Make/files @@ -10,7 +10,6 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C $(autoHexMesh)/meshRefinement/meshRefinementMerge.C $(autoHexMesh)/meshRefinement/meshRefinementRefine.C $(autoHexMesh)/refinementSurfaces/refinementSurfaces.C -$(autoHexMesh)/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C $(autoHexMesh)/trackedParticle/trackedParticle.C $(autoHexMesh)/trackedParticle/trackedParticleCloud.C diff --git a/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C b/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C deleted file mode 100644 index 0c63d4398f..0000000000 --- a/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C +++ /dev/null @@ -1,199 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "offsetTriSurfaceMesh.H" -#include "Random.H" -#include "addToRunTimeSelectionTable.H" -#include "triSurfaceTools.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -defineTypeNameAndDebug(offsetTriSurfaceMesh, 0); -addToRunTimeSelectionTable(searchableSurface, offsetTriSurfaceMesh, dict); - -} - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh -( - const IOobject& io, - const triSurface& s, - const scalar offset) -: - triSurfaceMesh(io, s), - offset_(offset) -{} - - -Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh -( - const IOobject& io, - const scalar offset -) -: - triSurfaceMesh(io), - offset_(offset) -{} - - -Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh -( - const word& name, - const objectRegistry& obj, - const dictionary& dict -) -: - triSurfaceMesh(name, obj, dict), - offset_(readScalar(dict.lookup("offset"))) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::offsetTriSurfaceMesh::~offsetTriSurfaceMesh() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearest -( - const point& sample, - const scalar nearestDistSqr -) const -{ - // Find nearest (add offset to search span) - pointIndexHit surfNearest = triSurfaceMesh::findNearest - ( - sample, - nearestDistSqr + Foam::sqr(offset_) - ); - - // Shift back onto surface - if (surfNearest.hit()) - { - vector n(sample-surfNearest.hitPoint()); - n /= mag(n)+VSMALL; - surfNearest.setPoint(surfNearest.hitPoint() + offset_*n); - } - return surfNearest; -} - - -Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearestOnEdge -( - const point& sample, - const scalar nearestDistSqr -) const -{ - // Find nearest (add offset to search span) - pointIndexHit surfNearest = triSurfaceMesh::findNearestOnEdge - ( - sample, - nearestDistSqr + Foam::sqr(offset_) - ); - - // Shift back onto surface - if (surfNearest.hit()) - { - vector n = sample-surfNearest.hitPoint(); - n /= mag(n)+VSMALL; - surfNearest.setPoint(surfNearest.hitPoint() + offset_*n); - } - return surfNearest; -} - - -Foam::searchableSurface::volumeType Foam::offsetTriSurfaceMesh::getVolumeType -( - const point& sample -) const -{ - // Find the nearest point on background surface - pointIndexHit surfNearest = triSurfaceMesh::findNearest - ( - sample, - Foam::sqr(GREAT) - ); - - if (!surfNearest.hit()) - { - FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)") - << "treeBb:" << tree().bb() - << " sample:" << sample - << " surfNearest:" << surfNearest - << abort(FatalError); - } - - // Offset sample to the point. - vector n(surfNearest.hitPoint()-sample); - n /= mag(n)+VSMALL; - - triSurfaceTools::sideType t = triSurfaceTools::surfaceSide - ( - *this, - sample+offset_*n, - surfNearest.index(), - surfNearest.hitPoint() - ); - - if (t == triSurfaceTools::UNKNOWN) - { - return searchableSurface::UNKNOWN; - } - else if (t == triSurfaceTools::INSIDE) - { - return searchableSurface::INSIDE; - } - else if (t == triSurfaceTools::OUTSIDE) - { - return searchableSurface::OUTSIDE; - } - else - { - FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)") - << "problem" << abort(FatalError); - return searchableSurface::UNKNOWN; - } -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - -// ************************************************************************* // diff --git a/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.H b/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.H deleted file mode 100644 index 9e9add77f6..0000000000 --- a/src/autoMesh/autoHexMesh/offsetTriSurfaceMesh/offsetTriSurfaceMesh.H +++ /dev/null @@ -1,167 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - offsetTriSurfaceMesh - -Description - triSurfaceMesh with offset. Used to define refinement boxes as a region - within certain distance to the refinement surface. - Note: reloads surface. - -SourceFiles - offsetTriSurfaceMesh.C - -\*---------------------------------------------------------------------------*/ - -#ifndef offsetTriSurfaceMesh_H -#define offsetTriSurfaceMesh_H - -#include "triSurfaceMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class offsetTriSurfaceMesh Declaration -\*---------------------------------------------------------------------------*/ - -class offsetTriSurfaceMesh -: - public triSurfaceMesh -{ - // Private data - - const scalar offset_; - -public: - - //- Runtime type information - TypeName("offsetTriSurfaceMesh"); - - - // Constructors - - //- Construct from triSurface and offset - offsetTriSurfaceMesh(const IOobject&, const triSurface&, const scalar); - - //- Construct read and offset - offsetTriSurfaceMesh(const IOobject& io, const scalar); - - //- Construct as searchableSurface - offsetTriSurfaceMesh - ( - const word& name, - const objectRegistry& obj, - const dictionary& dict - ); - - - // Destructor - - virtual ~offsetTriSurfaceMesh(); - - - // Member Functions - - // searchableSurface implementation - - //- Calculate nearest point on surface. Returns - // - bool : any point found nearer than nearestDistSqr - // - label: relevant index in surface - // - point: actual nearest point found - virtual pointIndexHit findNearest - ( - const point& sample, - const scalar nearestDistSqr - ) const; - - //- Calculate nearest point on edge. Returns - // - bool : any point found nearer than nearestDistSqr - // - label: relevant index in surface - // - point: actual nearest point found - virtual pointIndexHit findNearestOnEdge - ( - const point& sample, - const scalar nearestDistSqr - ) const; - - //- Find nearest to line. Returns - // - bool : any point found? - // - label: relevant index in shapes - // - point: actual nearest point found - // sets: - // - tightest : bounding box - // - linePoint : corresponding nearest point on line - virtual pointIndexHit findNearest - ( - const linePointRef& ln, - treeBoundBox& tightest, - point& linePoint - ) const - { - notImplemented("offsetTriSurfaceMesh::findNearest(..)"); - return pointIndexHit(); - } - - //- Find nearest intersection of line between start and end. - virtual pointIndexHit findLine - ( - const point& start, - const point& end - ) const - { - notImplemented("offsetTriSurfaceMesh::findLine(..)"); - return pointIndexHit(); - } - - //- Find any intersection of line between start and end. - virtual pointIndexHit findLineAny - ( - const point& start, - const point& end - ) const - { - notImplemented("offsetTriSurfaceMesh::findLine(..)"); - return pointIndexHit(); - } - - //- Determine type (inside/outside/mixed) for point. unknown if - // cannot be determined (e.g. non-manifold surface) - virtual volumeType getVolumeType(const point&) const; - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C index 3b0c92f0f4..53c1abaf4d 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.C +++ b/src/dynamicMesh/motionSmoother/motionSmoother.C @@ -1096,6 +1096,9 @@ void Foam::motionSmoother::updateMesh() isInternalPoint_.set(meshPoints[i], 0); } + // Calculate master edge addressing + isMasterEdge_ = syncTools::getMasterEdges(mesh_); + makePatchPatchAddressing(); } diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H index 499a60a54a..38f45008f5 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.H +++ b/src/dynamicMesh/motionSmoother/motionSmoother.H @@ -160,6 +160,10 @@ class motionSmoother //- Is mesh point on boundary or not PackedList<1> isInternalPoint_; + //- Is edge master (always except if on coupled boundary and on + // lower processor) + PackedList<1> isMasterEdge_; + //- 2-D motion corrector twoDPointCorrector twoDCorrector_; @@ -171,31 +175,6 @@ class motionSmoother // Private Member Functions - ////- (unweighted) average of all values on points connected via edges - //// to pointI - //template - //static Type avg - //( - // const GeometricField&, - // const edgeList& edges, - // const pointField& points, - // const labelList& edgeLabels, - // const label pointI - //); - // - ////- Distance weighted average. Is average with inverse distance - //// weighting and varying edge-diffusivity. - //template - //static Type avg - //( - // const GeometricField&, - // const scalarField& edgeGamma, - // const edgeList& edges, - // const pointField& points, - // const labelList& edgeLabels, - // const label pointI - //); - //- Average of connected points. template tmp > avg @@ -481,13 +460,6 @@ public: // Helper functions to manipulate displacement vector. - ////- Point-jacobi smoothing of internal points - //template - //void smooth - //( - // GeometricField& - //) const; - //- Fully explicit smoothing of internal points with varying // diffusivity. template diff --git a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C index ee9435b9c9..7d9eb0db31 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C @@ -227,8 +227,8 @@ bool Foam::motionSmoother::checkMesh label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp