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,23 +202,27 @@ WedgePointPatchField
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) )
{ {
// In order to ensure that the wedge patch is always flat, take the // ZT, 26/02/2017: Size of the patch could be zero in parallel runs
// normal vector from the first point if (this->patch().meshPoints().size())
const vector& nHat = this->patch().pointNormals()[0];
tmp<Field<Type> > tvalues =
transform(I - nHat*nHat, this->patchInternalField());
const Field<Type>& values = tvalues();
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
// Get addressing
const labelList& meshPoints = this->patch().meshPoints();
forAll (meshPoints, pointI)
{ {
iF[meshPoints[pointI]] = values[pointI]; // In order to ensure that the wedge patch is always flat, take the
// normal vector from the first point
const vector& nHat = this->patch().pointNormals()[0];
tmp<Field<Type> > tvalues =
transform(I - nHat*nHat, this->patchInternalField());
const Field<Type>& values = tvalues();
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
// Get addressing
const labelList& meshPoints = this->patch().meshPoints();
forAll (meshPoints, pointI)
{
iF[meshPoints[pointI]] = values[pointI];
}
} }
} }