From a86860430a6af27a315f50f39b2c26dbd1044350 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 13 Jul 2020 13:00:13 +0100 Subject: [PATCH] BUG: checkMesh: index into surfaceScalarField. Fixes #1771. --- .../mesh/manipulation/checkMesh/writeFields.C | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/writeFields.C b/applications/utilities/mesh/manipulation/checkMesh/writeFields.C index f58db28de7..dfc825a817 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/writeFields.C +++ b/applications/utilities/mesh/manipulation/checkMesh/writeFields.C @@ -616,6 +616,17 @@ void Foam::writeFields } if (selectedFields.found("faceZone")) { + // Determine for each face the zone index (scalar for ease of + // manipulation) + scalarField zoneID(mesh.nFaces(), -1); + const faceZoneMesh& czs = mesh.faceZones(); + for (const auto& zone : czs) + { + UIndirectList(zoneID, zone) = zone.index(); + } + + + // Split into internal and boundary values surfaceScalarField faceZone ( IOobject @@ -632,10 +643,13 @@ void Foam::writeFields calculatedFvsPatchScalarField::typeName ); - const faceZoneMesh& czs = mesh.faceZones(); - for (const auto& zone : czs) + faceZone.primitiveFieldRef() = + SubField(zoneID, mesh.nInternalFaces()); + surfaceScalarField::Boundary& bfld = faceZone.boundaryFieldRef(); + for (auto& pfld : bfld) { - UIndirectList(faceZone, zone) = zone.index(); + const fvPatch& fvp = pfld.patch(); + pfld == SubField(zoneID, fvp.size(), fvp.start()); } //faceZone.correctBoundaryConditions(); -- GitLab