Skip to content
Snippets Groups Projects
Commit ae49b511 authored by mattijs's avatar mattijs Committed by Mark OLESEN
Browse files

ENH: improve offsets handling in extrudeToRegionMesh (#1933)

- non-uniform offsets are generated due to truncation errors,
  which can lead to problems later on (e.g. redistributePar).

  Detect if the offsets are close to being uniform.
parent 89ea0115
Branches
Tags
No related merge requests found
......@@ -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
);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment