diff --git a/src/conversion/ensight/mesh/ensightMesh.C b/src/conversion/ensight/mesh/ensightMesh.C index 26cdd2bcad3ecdb99fc7f41108730d1e3e90324c..79c97b6674acd8a31136209453665840fb7ae4be 100644 --- a/src/conversion/ensight/mesh/ensightMesh.C +++ b/src/conversion/ensight/mesh/ensightMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ License #include "fvMesh.H" #include "globalMeshData.H" #include "PstreamCombineReduceOps.H" +#include "emptyPolyPatch.H" #include "processorPolyPatch.H" #include "mapDistribute.H" #include "stringListOps.H" @@ -209,16 +210,23 @@ void Foam::ensightMesh::correct() if (option().useFaceZones()) { // Mark boundary faces to be excluded from export - bitSet excludeFace(mesh_.nFaces()); // all false + bitSet excludeFace(mesh_.nFaces()); for (const polyPatch& pp : mesh_.boundaryMesh()) { - if - ( - isA<processorPolyPatch>(pp) - && !refCast<const processorPolyPatch>(pp).owner() - ) +#if OPENFOAM >= 1906 + const auto* procPatch = isA<processorPolyPatch>(pp); +#else + const auto* procPatch=dynamic_cast<const processorPolyPatch*>(&pp); +#endif + + if (isA<emptyPolyPatch>(pp)) + { + excludeFace.set(pp.range()); + } + else if (procPatch && !procPatch->owner()) { + // Exclude neighbour-side, retain owner-side only excludeFace.set(pp.range()); } } diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputTemplates.C index 0473312455d887f7e3eb21bc321326d4158e3a9e..5176845e6f1de45b5a35d4d7b41afd4f6db22bed 100644 --- a/src/conversion/ensight/output/ensightOutputTemplates.C +++ b/src/conversion/ensight/output/ensightOutputTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,6 +38,7 @@ License #include "uindirectPrimitivePatch.H" #include "interpolation.H" #include "linear.H" +#include "processorFvPatch.H" // * * * * * * * * * * Static Private Member Functions * * * * * * * * * * * // @@ -119,10 +120,8 @@ bool Foam::ensightOutput::writeFaceField return true; } - else - { - return false; - } + + return false; } @@ -257,37 +256,36 @@ bool Foam::ensightOutput::writeField ); // flat boundary field - // as per volPointInterpolation::flatBoundaryField() + // similar to volPointInterpolation::flatBoundaryField() - Field<Type> flat(mesh.nBoundaryFaces()); + Field<Type> flat(mesh.nBoundaryFaces(), Zero); const fvBoundaryMesh& bm = mesh.boundary(); - forAll(vf.boundaryField(), patchI) + forAll(vf.boundaryField(), patchi) { - const polyPatch& pp = bm[patchI].patch(); - const label bFaceI = pp.start() - mesh.nInternalFaces(); + const polyPatch& pp = bm[patchi].patch(); + const auto& bf = vf.boundaryField()[patchi]; - if - ( - isA<emptyFvPatch>(bm[patchI]) - || vf.boundaryField()[patchI].coupled() - ) + if (isA<processorFvPatch>(bm[patchi])) { + // Use average value for processor faces + // own cell value = patchInternalField + // nei cell value = evaluated boundary values SubList<Type> ( flat, - pp.size(), - bFaceI - ) = Zero; + bf.size(), + pp.offset() + ) = (0.5 * (bf.patchInternalField() + bf)); } - else + else if (!isA<emptyFvPatch>(bm[patchi])) { SubList<Type> ( flat, - vf.boundaryField()[patchI].size(), - bFaceI - ) = vf.boundaryField()[patchI]; + bf.size(), + pp.offset() + ) = bf; } }