diff --git a/src/functionObjects/field/mapFields/mapFields.C b/src/functionObjects/field/mapFields/mapFields.C index 02170a93c8..af8f232140 100644 --- a/src/functionObjects/field/mapFields/mapFields.C +++ b/src/functionObjects/field/mapFields/mapFields.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -112,10 +112,105 @@ void Foam::functionObjects::mapFields::createInterpolation else { HashTable patchMap; - wordList cuttingPatches; - dict.readEntry("patchMap", patchMap); - dict.readEntry("cuttingPatches", cuttingPatches); + bool createPatchMap = dict.getOrDefault("createPatchMap", false); + + const entry* ePtr = dict.findEntry("patchMap"); + + if (createPatchMap && ePtr) + { + FatalIOErrorInFunction(dict) + << "Requested 'createPatchMap' but 'patchMap' entry provided. " + << "Please remove one of these entries" + << exit(FatalIOError); + } + + if (!createPatchMap && !ePtr) + { + FatalIOErrorInFunction(dict) + << "Either the 'createPatchMap' or 'patchMap' entry must be " + << "provided when not using the 'consistent' mapping option" + << exit(FatalIOError); + } + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + const polyBoundaryMesh& pbmT = mapRegion.boundaryMesh(); + + if (createPatchMap) + { + Info<< " Creating patchMap" << endl; + + forAll(pbmT, patchiT) + { + const polyPatch& pp = pbmT[patchiT]; + + if (!polyPatch::constraintType(pp.type())) + { + const word& patchName = pp.name(); + const label patchi = pbm.findPatchID(patchName); + const label patchSize = + returnReduce(pp.size(), sumOp