mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: patchDist: renamed to patchPatchDist
This commit is contained in:
@ -41,7 +41,7 @@ $(pWave)/pointEdgePoint.C
|
|||||||
patchWave = $(algorithms)/PatchEdgeFaceWave
|
patchWave = $(algorithms)/PatchEdgeFaceWave
|
||||||
$(patchWave)/PatchEdgeFaceWaveName.C
|
$(patchWave)/PatchEdgeFaceWaveName.C
|
||||||
$(patchWave)/patchEdgeFaceInfo.C
|
$(patchWave)/patchEdgeFaceInfo.C
|
||||||
$(patchWave)/patchDist.C
|
$(patchWave)/patchPatchDist.C
|
||||||
|
|
||||||
meshWave = $(algorithms)/MeshWave
|
meshWave = $(algorithms)/MeshWave
|
||||||
$(meshWave)/MeshWaveName.C
|
$(meshWave)/MeshWaveName.C
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "patchDist.H"
|
#include "patchPatchDist.H"
|
||||||
#include "PatchEdgeFaceWave.H"
|
#include "PatchEdgeFaceWave.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
@ -31,7 +31,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::patchDist::patchDist
|
Foam::patchPatchDist::patchPatchDist
|
||||||
(
|
(
|
||||||
const polyPatch& patch,
|
const polyPatch& patch,
|
||||||
const labelHashSet& nbrPatchIDs
|
const labelHashSet& nbrPatchIDs
|
||||||
@ -41,19 +41,19 @@ Foam::patchDist::patchDist
|
|||||||
nbrPatchIDs_(nbrPatchIDs),
|
nbrPatchIDs_(nbrPatchIDs),
|
||||||
nUnset_(0)
|
nUnset_(0)
|
||||||
{
|
{
|
||||||
patchDist::correct();
|
patchPatchDist::correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::patchDist::~patchDist()
|
Foam::patchPatchDist::~patchPatchDist()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::patchDist::correct()
|
void Foam::patchPatchDist::correct()
|
||||||
{
|
{
|
||||||
// Mark all edge connected to a nbrPatch.
|
// Mark all edge connected to a nbrPatch.
|
||||||
label nBnd = 0;
|
label nBnd = 0;
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,19 +22,19 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::patchDist
|
Foam::patchPatchDist
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Like wallDist but calculates on patch distance to nearest neighbouring
|
Like wallDist but calculates on a patch the distance to nearest neighbouring
|
||||||
patches. Uses PatchEdgeFaceWave to do actual calculation.
|
patches. Uses PatchEdgeFaceWave to do actual calculation.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
patchDist.C
|
patchPatchDist.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef patchDist_H
|
#ifndef patchPatchDist_H
|
||||||
#define patchDist_H
|
#define patchPatchDist_H
|
||||||
|
|
||||||
#include "scalarField.H"
|
#include "scalarField.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -48,10 +48,10 @@ namespace Foam
|
|||||||
class polyPatch;
|
class polyPatch;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class patchDist Declaration
|
Class patchPatchDist Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class patchDist
|
class patchPatchDist
|
||||||
:
|
:
|
||||||
public scalarField
|
public scalarField
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and neighbour patches.
|
//- Construct from patch and neighbour patches.
|
||||||
patchDist
|
patchPatchDist
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const labelHashSet& nbrPatchIDs
|
const labelHashSet& nbrPatchIDs
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~patchDist();
|
virtual ~patchPatchDist();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -523,6 +523,75 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Propagate information from edge to point. Return number of points changed.
|
||||||
|
template <class Type, class TrackingData>
|
||||||
|
Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
|
||||||
|
{
|
||||||
|
// Transfer onto coupled patch
|
||||||
|
const globalMeshData& gmd = mesh_.globalData();
|
||||||
|
const indirectPrimitivePatch& cpp = gmd.coupledPatch();
|
||||||
|
const labelList& meshPoints = cpp.meshPoints();
|
||||||
|
|
||||||
|
const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
|
||||||
|
const labelListList& slaves = gmd.globalPointSlaves();
|
||||||
|
|
||||||
|
List<Type> elems(slavesMap.constructSize());
|
||||||
|
forAll(meshPoints, pointI)
|
||||||
|
{
|
||||||
|
elems[pointI] = allPointInfo_[meshPoints[pointI]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset changed points counter.
|
||||||
|
nChangedPoints_ = 0;
|
||||||
|
|
||||||
|
// Pull slave data onto master. No need to update transformed slots.
|
||||||
|
slavesMap.distribute(elems, false);
|
||||||
|
|
||||||
|
// Combine master data with slave data
|
||||||
|
forAll(slaves, pointI)
|
||||||
|
{
|
||||||
|
Type& elem = elems[pointI];
|
||||||
|
|
||||||
|
const labelList& slavePoints = slaves[pointI];
|
||||||
|
|
||||||
|
label meshPointI = meshPoints[pointI];
|
||||||
|
|
||||||
|
// Combine master with untransformed slave data
|
||||||
|
forAll(slavePoints, j)
|
||||||
|
{
|
||||||
|
updatePoint
|
||||||
|
(
|
||||||
|
meshPointI,
|
||||||
|
elems[slavePoints[j]],
|
||||||
|
elem
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy result back to slave slots
|
||||||
|
forAll(slavePoints, j)
|
||||||
|
{
|
||||||
|
elems[slavePoints[j]] = elem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push slave-slot data back to slaves
|
||||||
|
slavesMap.reverseDistribute(elems.size(), elems, false);
|
||||||
|
|
||||||
|
// Extract back onto mesh
|
||||||
|
forAll(meshPoints, pointI)
|
||||||
|
{
|
||||||
|
allPointInfo_[meshPoints[pointI]] = elems[pointI];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sum nChangedPoints over all procs
|
||||||
|
label totNChanged = nChangedPoints_;
|
||||||
|
|
||||||
|
reduce(totNChanged, sumOp<label>());
|
||||||
|
|
||||||
|
return totNChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Iterate, propagating changedPointsInfo across mesh, until no change (or
|
// Iterate, propagating changedPointsInfo across mesh, until no change (or
|
||||||
@ -861,6 +930,8 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::iterate
|
|||||||
|
|
||||||
label iter = 0;
|
label iter = 0;
|
||||||
|
|
||||||
|
while (iter < maxIter)
|
||||||
|
{
|
||||||
while (iter < maxIter)
|
while (iter < maxIter)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -884,15 +955,11 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::iterate
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Total changed points : " << nPoints << endl;
|
Pout<< "Total changed points : " << nPoints << nl
|
||||||
|
<< "Total evaluations : " << nEvals_ << nl
|
||||||
Pout<< "Total evaluations : " << nEvals_ << endl;
|
<< "Remaining unvisited points: " << nUnvisitedPoints_ << nl
|
||||||
|
<< "Remaining unvisited edges : " << nUnvisitedEdges_ << nl
|
||||||
Pout<< "Remaining unvisited points: " << nUnvisitedPoints_ << endl;
|
<< endl;
|
||||||
|
|
||||||
Pout<< "Remaining unvisited edges : " << nUnvisitedEdges_ << endl;
|
|
||||||
|
|
||||||
Pout<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nPoints == 0)
|
if (nPoints == 0)
|
||||||
@ -903,6 +970,22 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::iterate
|
|||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Enforce collocated points are exactly equal. This might still mean
|
||||||
|
// non-collocated points are not equal though. WIP.
|
||||||
|
label nPoints = handleCollocatedPoints();
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Collocated point sync : " << nPoints << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nPoints == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -205,6 +205,9 @@ class PointEdgeWave
|
|||||||
//- Merge data from across cyclic boundaries
|
//- Merge data from across cyclic boundaries
|
||||||
void handleCyclicPatches();
|
void handleCyclicPatches();
|
||||||
|
|
||||||
|
//- Explicitly sync all collocated points
|
||||||
|
label handleCollocatedPoints();
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
PointEdgeWave(const PointEdgeWave&);
|
PointEdgeWave(const PointEdgeWave&);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -59,10 +59,65 @@ inline bool Foam::pointEdgePoint::update
|
|||||||
|
|
||||||
if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
|
if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
|
||||||
{
|
{
|
||||||
// don't propagate small changes
|
// don't propagate small changes unless origins differ
|
||||||
|
scalar originDiff2 = magSqr(origin_-w2.origin());
|
||||||
|
if
|
||||||
|
(
|
||||||
|
originDiff2 < SMALL
|
||||||
|
|| ((distSqr_ > SMALL) && (originDiff2/distSqr_ < tol))
|
||||||
|
)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Different origin. Choose lexical ordering.
|
||||||
|
bool w2less = false;
|
||||||
|
for (direction cmp = 0; cmp < vector::nComponents; cmp++)
|
||||||
|
{
|
||||||
|
scalar d = w2.origin()[cmp]-origin_[cmp];
|
||||||
|
scalar magD = mag(d);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
magD < SMALL
|
||||||
|
|| ((distSqr_ > SMALL) && (magD/distSqr_ > tol))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Small difference. Test next component.
|
||||||
|
}
|
||||||
|
else if (d < 0)
|
||||||
|
{
|
||||||
|
w2less = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (d > 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w2less)
|
||||||
|
{
|
||||||
|
// update with new values
|
||||||
|
distSqr_ = dist2;
|
||||||
|
origin_ = w2.origin();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pout<< "** same distance. at:" << pt << nl
|
||||||
|
<< " old distance:" << Foam::sqr(distSqr_) << nl
|
||||||
|
<< " new distance:" << Foam::sqr(dist2) << nl
|
||||||
|
<< " old origin:" << origin_ << nl
|
||||||
|
<< " new origin:" << w2.origin() << nl
|
||||||
|
<< endl;
|
||||||
|
Pout<< "** w2 looses." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// update with new values
|
// update with new values
|
||||||
distSqr_ = dist2;
|
distSqr_ = dist2;
|
||||||
|
|||||||
Reference in New Issue
Block a user