diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index cba010f5c50f58cb7db636e4c5116bbf6779032d..2c0f91dae931173f44c3f69c891a0e841f9f56e3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1134,18 +1134,55 @@ void setCouplingInfo if (isA<mappedWallPolyPatch>(pp)) { - newPatches[patchi] = new mappedWallPolyPatch - ( - pp.name(), - pp.size(), - pp.start(), - patchi, - sampleRegion, // sampleRegion - mode, // sampleMode - pp.name(), // samplePatch - offsets[zoneI], // offset - patches - ); + const boundBox bb(pp.points(), pp.meshPoints(), true); + const vector avgOffset = gAverage(offsets[zoneI]); + const scalar mergeSqrDist = + gMax(magSqr(offsets[zoneI]-avgOffset)); + + // Verify uniformity of offset + // (same check as blockMesh geom merge) + if (mergeSqrDist < magSqr(10*SMALL*bb.span())) + { + Info<< "Adding on " << mesh.name() + << " coupling patch " << pp.name() + << " with uniform offset " << avgOffset << endl; + + // Uniform offset + newPatches[patchi] = new mappedWallPolyPatch + ( + pp.name(), + pp.size(), + pp.start(), + patchi, + sampleRegion, // sampleRegion + mode, // sampleMode + pp.name(), // samplePatch + + avgOffset, // uniform offset + patches + ); + } + else + { + Info<< "Adding on " << mesh.name() + << " coupling patch " << pp.name() + << " with non-uniform offset" << endl; + + // Uniform offset + newPatches[patchi] = new mappedWallPolyPatch + ( + pp.name(), + pp.size(), + pp.start(), + patchi, + sampleRegion, // sampleRegion + mode, // sampleMode + pp.name(), // samplePatch + + offsets[zoneI], // non-uniform offsets + patches + ); + } } } }