fvMeshStitcher: Fixes for cases with multiple NCC-s
A number of bugs have been fixed relating to cases in which multiple NCC patches are locally edge-connected, and/or are edge-connected across a processor boundary.
This commit is contained in:
@ -1122,7 +1122,6 @@ Foam::fvMeshStitcher::calculateOwnerOrigBoundaryEdgeParts
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::fvMeshStitcher::applyOwnerOrigBoundaryEdgeParts
|
void Foam::fvMeshStitcher::applyOwnerOrigBoundaryEdgeParts
|
||||||
(
|
(
|
||||||
surfaceVectorField& SfSf,
|
surfaceVectorField& SfSf,
|
||||||
@ -1159,7 +1158,8 @@ void Foam::fvMeshStitcher::applyOwnerOrigBoundaryEdgeParts
|
|||||||
|
|
||||||
const label patchi =
|
const label patchi =
|
||||||
mesh_.isInternalFace(facei)
|
mesh_.isInternalFace(facei)
|
||||||
? -1 : pbMesh.patchIndices()[facei - mesh_.nInternalFaces()];
|
? -1
|
||||||
|
: pbMesh.patchIndices()[facei - mesh_.nInternalFaces()];
|
||||||
|
|
||||||
if (patchi != -1 && patchIsOwnerOrig[patchi])
|
if (patchi != -1 && patchIsOwnerOrig[patchi])
|
||||||
{
|
{
|
||||||
@ -1428,6 +1428,8 @@ void Foam::fvMeshStitcher::intersect
|
|||||||
|
|
||||||
const nonConformalBoundary& ncb = nonConformalBoundary::New(mesh_);
|
const nonConformalBoundary& ncb = nonConformalBoundary::New(mesh_);
|
||||||
const labelList ownerOrigPatchIndices = ncb.ownerOrigPatchIndices();
|
const labelList ownerOrigPatchIndices = ncb.ownerOrigPatchIndices();
|
||||||
|
const edgeList& ownerOrigBoundaryMeshEdges =
|
||||||
|
ncb.ownerOrigBoundaryMeshEdges();
|
||||||
|
|
||||||
// Alias the boundary geometry fields
|
// Alias the boundary geometry fields
|
||||||
surfaceVectorField::Boundary& SfBf = SfSf.boundaryFieldRef();
|
surfaceVectorField::Boundary& SfBf = SfSf.boundaryFieldRef();
|
||||||
@ -1562,21 +1564,37 @@ void Foam::fvMeshStitcher::intersect
|
|||||||
const label ownerOrigBoundaryEdgei =
|
const label ownerOrigBoundaryEdgei =
|
||||||
origPatchEdgeOwnerOrigBoundaryEdges[origPatchEdgei];
|
origPatchEdgeOwnerOrigBoundaryEdges[origPatchEdgei];
|
||||||
|
|
||||||
|
const label sign =
|
||||||
|
edge::compare
|
||||||
|
(
|
||||||
|
meshEdge(origPatch, origPatchEdgei),
|
||||||
|
ownerOrigBoundaryMeshEdges[ownerOrigBoundaryEdgei]
|
||||||
|
);
|
||||||
|
|
||||||
part errorP =
|
part errorP =
|
||||||
patchEdgeParts[origPatchi][origPatchEdgei];
|
patchEdgeParts[origPatchi][origPatchEdgei];
|
||||||
errorP -= ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei];
|
errorP -=
|
||||||
|
sign > 0
|
||||||
|
? ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei]
|
||||||
|
: -ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei];
|
||||||
|
|
||||||
forAll(origPatch.edgeFaces()[origPatchEdgei], patchEdgeFacei)
|
forAll(origPatch.edgeFaces()[origPatchEdgei], patchEdgeFacei)
|
||||||
{
|
{
|
||||||
const label patchFacei =
|
const label patchFacei =
|
||||||
origPatch.edgeFaces()[origPatchEdgei][patchEdgeFacei];
|
origPatch.edgeFaces()[origPatchEdgei][patchEdgeFacei];
|
||||||
|
|
||||||
|
const label sign =
|
||||||
|
origPatch.localFaces()[patchFacei].edgeDirection
|
||||||
|
(
|
||||||
|
origPatch.edges()[origPatchEdgei]
|
||||||
|
);
|
||||||
|
|
||||||
part p
|
part p
|
||||||
(
|
(
|
||||||
SfBf[origPatchi][patchFacei],
|
SfBf[origPatchi][patchFacei],
|
||||||
CfBf[origPatchi][patchFacei]
|
CfBf[origPatchi][patchFacei]
|
||||||
);
|
);
|
||||||
p += errorP;
|
p += sign > 0 ? errorP : -errorP;
|
||||||
|
|
||||||
SfBf[origPatchi][patchFacei] = p.area;
|
SfBf[origPatchi][patchFacei] = p.area;
|
||||||
CfBf[origPatchi][patchFacei] = p.centre;
|
CfBf[origPatchi][patchFacei] = p.centre;
|
||||||
|
|||||||
@ -25,7 +25,8 @@ License
|
|||||||
|
|
||||||
#include "processorFvPatch.H"
|
#include "processorFvPatch.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "transformField.H"
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,13 +43,26 @@ void Foam::processorFvPatch::makeWeights(scalarField& w) const
|
|||||||
{
|
{
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
coupledFvPatch::makeWeights
|
if (!boundaryMesh().mesh().conformal())
|
||||||
(
|
{
|
||||||
w,
|
coupledFvPatch::makeWeights
|
||||||
procPolyPatch_.neighbFaceAreas(),
|
(
|
||||||
procPolyPatch_.neighbFaceCentres()
|
w,
|
||||||
- procPolyPatch_.neighbFaceCellCentres()
|
- boundaryMesh().mesh().Sf().boundaryField()[index()],
|
||||||
);
|
boundaryMesh().mesh().Cf().boundaryField()[index()]
|
||||||
|
- boundaryMesh().mesh().C().boundaryField()[index()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coupledFvPatch::makeWeights
|
||||||
|
(
|
||||||
|
w,
|
||||||
|
procPolyPatch_.neighbFaceAreas(),
|
||||||
|
procPolyPatch_.neighbFaceCentres()
|
||||||
|
- procPolyPatch_.neighbFaceCellCentres()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -61,12 +75,24 @@ Foam::tmp<Foam::vectorField> Foam::processorFvPatch::delta() const
|
|||||||
{
|
{
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
return
|
if (!boundaryMesh().mesh().conformal())
|
||||||
coupledFvPatch::delta
|
{
|
||||||
(
|
return
|
||||||
procPolyPatch_.neighbFaceCentres()
|
coupledFvPatch::delta
|
||||||
- procPolyPatch_.neighbFaceCellCentres()
|
(
|
||||||
);
|
boundaryMesh().mesh().Cf().boundaryField()[index()]
|
||||||
|
- boundaryMesh().mesh().C().boundaryField()[index()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return
|
||||||
|
coupledFvPatch::delta
|
||||||
|
(
|
||||||
|
procPolyPatch_.neighbFaceCentres()
|
||||||
|
- procPolyPatch_.neighbFaceCellCentres()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -179,28 +179,6 @@ void Foam::nonConformalBoundary::nonConformalOtherPatchIndices
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
const Foam::labelList&
|
|
||||||
Foam::nonConformalBoundary::meshPointOwnerOrigBoundaryPoint() const
|
|
||||||
{
|
|
||||||
if (!meshPointOwnerOrigBoundaryPointPtr_.valid())
|
|
||||||
{
|
|
||||||
meshPointOwnerOrigBoundaryPointPtr_.set
|
|
||||||
(
|
|
||||||
new labelList(mesh().nPoints(), -1)
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(ownerOrigBoundary_.meshPoints(), ownerOrigBoundaryPointi)
|
|
||||||
{
|
|
||||||
meshPointOwnerOrigBoundaryPointPtr_()
|
|
||||||
[ownerOrigBoundary_.meshPoints()[ownerOrigBoundaryPointi]] =
|
|
||||||
ownerOrigBoundaryPointi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meshPointOwnerOrigBoundaryPointPtr_();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::vectorField&
|
const Foam::vectorField&
|
||||||
Foam::nonConformalBoundary::ownerOrigBoundaryPointNormals() const
|
Foam::nonConformalBoundary::ownerOrigBoundaryPointNormals() const
|
||||||
{
|
{
|
||||||
@ -373,20 +351,30 @@ Foam::nonConformalBoundary::ownerOrigBoundaryPointMeshPoint() const
|
|||||||
{
|
{
|
||||||
if (!ownerOrigBoundaryPointMeshPointPtr_.valid())
|
if (!ownerOrigBoundaryPointMeshPointPtr_.valid())
|
||||||
{
|
{
|
||||||
|
// Construct the local maps using the owner-orig primitive patch
|
||||||
ownerOrigBoundaryPointMeshPointPtr_.set
|
ownerOrigBoundaryPointMeshPointPtr_.set
|
||||||
(
|
(
|
||||||
new labelList(ownerOrigBoundary_.meshPoints())
|
new labelList(ownerOrigBoundary_.meshPoints())
|
||||||
);
|
);
|
||||||
|
|
||||||
// ...
|
meshPointOwnerOrigBoundaryPointPtr_.set
|
||||||
meshPointOwnerOrigBoundaryPoint();
|
(
|
||||||
labelList& map = meshPointOwnerOrigBoundaryPointPtr_();
|
new labelList(mesh().nPoints(), -1)
|
||||||
|
);
|
||||||
|
|
||||||
// ...
|
labelList& meshPointOwnerOrigBoundaryPoint =
|
||||||
|
meshPointOwnerOrigBoundaryPointPtr_();
|
||||||
|
|
||||||
|
forAll(ownerOrigBoundary_.meshPoints(), ownerOrigBoundaryPointi)
|
||||||
|
{
|
||||||
|
meshPointOwnerOrigBoundaryPoint
|
||||||
|
[ownerOrigBoundary_.meshPoints()[ownerOrigBoundaryPointi]] =
|
||||||
|
ownerOrigBoundaryPointi;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct the remote map by enumerating newly identified points
|
||||||
label ownerOrigBoundaryPointi = ownerOrigBoundary_.nPoints();
|
label ownerOrigBoundaryPointi = ownerOrigBoundary_.nPoints();
|
||||||
DynamicList<label> remotePoints;
|
DynamicList<label> remoteMeshPoints;
|
||||||
|
|
||||||
// ...
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label ownerOrigBoundaryEdgei = ownerOrigBoundary_.nEdges();
|
label ownerOrigBoundaryEdgei = ownerOrigBoundary_.nEdges();
|
||||||
@ -403,16 +391,17 @@ Foam::nonConformalBoundary::ownerOrigBoundaryPointMeshPoint() const
|
|||||||
{
|
{
|
||||||
const label meshPointi = e[i];
|
const label meshPointi = e[i];
|
||||||
|
|
||||||
if (map[meshPointi] == -1)
|
if (meshPointOwnerOrigBoundaryPoint[meshPointi] == -1)
|
||||||
{
|
{
|
||||||
map[meshPointi] = ownerOrigBoundaryPointi ++;
|
meshPointOwnerOrigBoundaryPoint[meshPointi] =
|
||||||
remotePoints.append(meshPointi);
|
ownerOrigBoundaryPointi ++;
|
||||||
|
remoteMeshPoints.append(meshPointi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...
|
// Append to the point-mesh-point map
|
||||||
ownerOrigBoundaryPointMeshPointPtr_->append(remotePoints);
|
ownerOrigBoundaryPointMeshPointPtr_->append(remoteMeshPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ownerOrigBoundaryPointMeshPointPtr_();
|
return ownerOrigBoundaryPointMeshPointPtr_();
|
||||||
@ -528,10 +517,11 @@ Foam::nonConformalBoundary::ownerOrigBoundaryEdges() const
|
|||||||
new edgeList(ownerOrigBoundary_.edges())
|
new edgeList(ownerOrigBoundary_.edges())
|
||||||
);
|
);
|
||||||
|
|
||||||
const labelList& map = meshPointOwnerOrigBoundaryPoint();
|
ownerOrigBoundaryPointMeshPoint();
|
||||||
|
const labelList& meshPointOwnerOrigBoundaryPoint =
|
||||||
|
meshPointOwnerOrigBoundaryPointPtr_();
|
||||||
|
|
||||||
DynamicList<edge> remoteEdges;
|
DynamicList<edge> remoteEdges;
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label ownerOrigBoundaryEdgei = ownerOrigBoundary_.nEdges();
|
label ownerOrigBoundaryEdgei = ownerOrigBoundary_.nEdges();
|
||||||
@ -544,7 +534,14 @@ Foam::nonConformalBoundary::ownerOrigBoundaryEdges() const
|
|||||||
|
|
||||||
const edge& e = mesh().edges()[meshEdgei];
|
const edge& e = mesh().edges()[meshEdgei];
|
||||||
|
|
||||||
remoteEdges.append(edge(map[e.start()], map[e.end()]));
|
remoteEdges.append
|
||||||
|
(
|
||||||
|
edge
|
||||||
|
(
|
||||||
|
meshPointOwnerOrigBoundaryPoint[e.start()],
|
||||||
|
meshPointOwnerOrigBoundaryPoint[e.end()]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ownerOrigBoundaryEdgesPtr_->append(remoteEdges);
|
ownerOrigBoundaryEdgesPtr_->append(remoteEdges);
|
||||||
@ -594,11 +591,15 @@ Foam::nonConformalBoundary::patchPointOwnerOrigBoundaryPoints
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = mesh().boundaryMesh()[patchi];
|
const polyPatch& pp = mesh().boundaryMesh()[patchi];
|
||||||
|
|
||||||
|
ownerOrigBoundaryPointMeshPoint();
|
||||||
|
const labelList& meshPointOwnerOrigBoundaryPoint =
|
||||||
|
meshPointOwnerOrigBoundaryPointPtr_();
|
||||||
|
|
||||||
const faceList patchOwnerOrigBoundaryLocalFaces
|
const faceList patchOwnerOrigBoundaryLocalFaces
|
||||||
(
|
(
|
||||||
renumber
|
renumber
|
||||||
(
|
(
|
||||||
meshPointOwnerOrigBoundaryPoint(),
|
meshPointOwnerOrigBoundaryPoint,
|
||||||
static_cast<const faceList&>(pp)
|
static_cast<const faceList&>(pp)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,7 +65,7 @@ class nonConformalBoundary
|
|||||||
//- Primitive patch of the owner-orig boundary
|
//- Primitive patch of the owner-orig boundary
|
||||||
indirectPrimitivePatch ownerOrigBoundary_;
|
indirectPrimitivePatch ownerOrigBoundary_;
|
||||||
|
|
||||||
//- A map from owner-orig boundary point to mesh point
|
//- A map from mesh point to owner-orig boundary point
|
||||||
mutable autoPtr<labelList> meshPointOwnerOrigBoundaryPointPtr_;
|
mutable autoPtr<labelList> meshPointOwnerOrigBoundaryPointPtr_;
|
||||||
|
|
||||||
//- A map from owner-orig boundary point to mesh point
|
//- A map from owner-orig boundary point to mesh point
|
||||||
@ -135,10 +135,6 @@ class nonConformalBoundary
|
|||||||
const label side
|
const label side
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Get a map from mesh point to owner-orig boundary points. Non
|
|
||||||
// owner-orig boundary points are indicated by the value -1.
|
|
||||||
const labelList& meshPointOwnerOrigBoundaryPoint() const;
|
|
||||||
|
|
||||||
//- Get point normals for the owner-orig boundary
|
//- Get point normals for the owner-orig boundary
|
||||||
const vectorField& ownerOrigBoundaryPointNormals() const;
|
const vectorField& ownerOrigBoundaryPointNormals() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user