Skip to content
Permalink
Browse files

decomposePar: Corrected flux-flipping for cases renumbered in parallel

  • Loading branch information...
Henry Weller
Henry Weller committed Apr 15, 2019
1 parent aa26ec2 commit bdd6174de673ae057b195d60daa244e8852aff0e
@@ -166,20 +166,42 @@ Foam::fvFieldDecomposer::decomposeField
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
) const
{
labelList mapAddr
labelField mapAddr
(
labelList::subList
(
faceAddressing_,
procMesh_.nInternalFaces()
)
);
// Ignore any flipping
forAll(mapAddr, i)

Field<Type> internalField(procMesh_.nInternalFaces());

if (pTraits<Type>::nComponents == 1)
{
// Assume all scalar surfaceFields are oriented flux fields
// and flip the sign of the flux if necessary

forAll(mapAddr, i)
{
if (mapAddr[i] < 0)
{
internalField[i] = -field[mag(mapAddr[i]) - 1];
}
else
{
internalField[i] = field[mapAddr[i] - 1];
}
}
}
else
{
mapAddr[i] = mag(mapAddr[i])-1;
// Ignore face flipping
internalField.map(field.primitiveField(), mag(mapAddr) - 1);
}

// internalField.map(field.primitiveField(), mag(mapAddr) - 1);

// Problem with addressing when a processor patch picks up both internal
// faces and faces from cyclic boundaries. This is a bit of a hack, but
// I cannot find a better solution without making the internal storage
@@ -236,7 +258,7 @@ Foam::fvFieldDecomposer::decomposeField
),
procMesh_,
field.dimensions(),
Field<Type>(field.primitiveField(), mapAddr),
internalField,
patchFields
)
);
@@ -379,12 +379,12 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
// take care of the face direction offset trick.
labelList curAddr(procInternalField.size());

forAll(procInternalField, addrI)
forAll(procInternalField, i)
{
curAddr[addrI] = mag(faceMap[addrI]) - 1;
if (faceMap[addrI] < 0)
curAddr[i] = mag(faceMap[i]) - 1;
if (faceMap[i] < 0)
{
procInternalField[addrI] = -procInternalField[addrI];
procInternalField[i] = -procInternalField[i];
}
}

0 comments on commit bdd6174

Please sign in to comment.
You can’t perform that action at this time.