Bugfix: Finite Area bugfixes + WedgePointPatchField bugfix. Vanja Skuric

This commit is contained in:
Hrvoje Jasak 2017-09-21 14:09:46 +01:00
commit 3b612e6748
5 changed files with 253 additions and 233 deletions

View file

@ -422,12 +422,13 @@ void faMatrix<Type>::setValues
} }
else else
{ {
label patchi = mesh.boundary().whichPatch(edgei); const label& curEdgeIndex = mesh.edgeIndex()[edgei];
label patchi = mesh.boundary().whichPatch(curEdgeIndex);
if (internalCoeffs_[patchi].size()) if (internalCoeffs_[patchi].size())
{ {
label patchEdgei = label patchEdgei =
mesh.boundary()[patchi].whichEdge(edgei); mesh.boundary()[patchi].whichEdge(curEdgeIndex);
internalCoeffs_[patchi][patchEdgei] = internalCoeffs_[patchi][patchEdgei] =
pTraits<Type>::zero; pTraits<Type>::zero;

View file

@ -71,6 +71,7 @@ void Foam::faMesh::setPrimitiveMeshData()
// Set faMesh edges // Set faMesh edges
edges_.setSize(bp.nEdges()); edges_.setSize(bp.nEdges());
edgeIndex_.setSize(bp.nEdges());
label edgeI = -1; label edgeI = -1;
@ -80,6 +81,7 @@ void Foam::faMesh::setPrimitiveMeshData()
for (label curEdge = 0; curEdge < nIntEdges; curEdge++) for (label curEdge = 0; curEdge < nIntEdges; curEdge++)
{ {
edges_[++edgeI] = bp.edges()[curEdge]; edges_[++edgeI] = bp.edges()[curEdge];
edgeIndex_[curEdge] = edgeI;
} }
forAll (boundary(), patchI) forAll (boundary(), patchI)
@ -89,6 +91,7 @@ void Foam::faMesh::setPrimitiveMeshData()
forAll (curP, eI) forAll (curP, eI)
{ {
edges_[++edgeI] = bp.edges()[curP[eI]]; edges_[++edgeI] = bp.edges()[curP[eI]];
edgeIndex_[curP[eI]] = edgeI;
} }
} }

View file

@ -82,6 +82,9 @@ class faMesh
//- Boundary mesh //- Boundary mesh
faBoundaryMesh boundary_; faBoundaryMesh boundary_;
//- Edge index
labelList edgeIndex_;
// Primitive mesh data // Primitive mesh data
@ -397,6 +400,11 @@ public:
return faceLabels_; return faceLabels_;
} }
//- Return faMesh edge indices
const labelList& edgeIndex() const
{
return edgeIndex_;
}
//- Return parallel info //- Return parallel info
const faGlobalMeshData& globalData() const; const faGlobalMeshData& globalData() const;

View file

@ -1185,7 +1185,11 @@ void faMesh::calcPointAreaNormals() const
// Processor patch points correction // Processor patch points correction
forAll (boundary(), patchI) forAll (boundary(), patchI)
{ {
if(boundary()[patchI].type() == processorFaPatch::typeName) if
(
Pstream::parRun()
&& boundary()[patchI].type() == processorFaPatch::typeName
)
{ {
const processorFaPatch& procPatch = const processorFaPatch& procPatch =
refCast<const processorFaPatch>(boundary()[patchI]); refCast<const processorFaPatch>(boundary()[patchI]);

View file

@ -202,6 +202,9 @@ WedgePointPatchField
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) )
{ {
// ZT, 26/02/2017: Size of the patch could be zero in parallel runs
if (this->patch().meshPoints().size())
{
// In order to ensure that the wedge patch is always flat, take the // In order to ensure that the wedge patch is always flat, take the
// normal vector from the first point // normal vector from the first point
const vector& nHat = this->patch().pointNormals()[0]; const vector& nHat = this->patch().pointNormals()[0];
@ -220,6 +223,7 @@ WedgePointPatchField
{ {
iF[meshPoints[pointI]] = values[pointI]; iF[meshPoints[pointI]] = values[pointI];
} }
}
} }