mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extrudeMesh: allow flipNormals for extrude-from-patch
This commit is contained in:
@ -251,10 +251,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (mode == PATCH || mode == MESH)
|
||||
{
|
||||
if (flipNormals)
|
||||
if (flipNormals && mode == MESH)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Flipping normals not supported for extrusions from patch."
|
||||
<< "Flipping normals not supported for extrusions from mesh."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -297,6 +297,60 @@ int main(int argc, char *argv[])
|
||||
addPatchCellLayer layerExtrude(mesh, (mode == MESH));
|
||||
|
||||
const labelList meshFaces(patchFaces(patches, sourcePatches));
|
||||
|
||||
if (mode == PATCH && flipNormals)
|
||||
{
|
||||
// Cheat. Flip patch faces in mesh. This invalidates the
|
||||
// mesh (open cells) but does produce the correct extrusion.
|
||||
polyTopoChange meshMod(mesh);
|
||||
forAll(meshFaces, i)
|
||||
{
|
||||
label meshFaceI = meshFaces[i];
|
||||
|
||||
label patchI = patches.whichPatch(meshFaceI);
|
||||
label own = mesh.faceOwner()[meshFaceI];
|
||||
label nei = -1;
|
||||
if (patchI == -1)
|
||||
{
|
||||
nei = mesh.faceNeighbour()[meshFaceI];
|
||||
}
|
||||
|
||||
label zoneI = mesh.faceZones().whichZone(meshFaceI);
|
||||
bool zoneFlip = false;
|
||||
if (zoneI != -1)
|
||||
{
|
||||
label index = mesh.faceZones()[zoneI].whichFace(meshFaceI);
|
||||
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
|
||||
}
|
||||
|
||||
meshMod.modifyFace
|
||||
(
|
||||
mesh.faces()[meshFaceI].reverseFace(), // modified face
|
||||
meshFaceI, // label of face
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
true, // face flip
|
||||
patchI, // patch for face
|
||||
zoneI, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
);
|
||||
}
|
||||
|
||||
// Change the mesh. No inflation.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
indirectPrimitivePatch extrudePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
@ -471,11 +525,6 @@ int main(int argc, char *argv[])
|
||||
displacement[pointI] = extrudePt - layer0Points[pointI];
|
||||
}
|
||||
|
||||
if (flipNormals)
|
||||
{
|
||||
Info<< "Flipping faces." << nl << endl;
|
||||
displacement = -displacement;
|
||||
}
|
||||
|
||||
// Check if wedge (has layer0 different from original patch points)
|
||||
// If so move the mesh to starting position.
|
||||
|
||||
@ -31,7 +31,8 @@ exposedPatchName movingWall;
|
||||
// If construct from surface:
|
||||
surface "movingWall.stl";
|
||||
|
||||
// Flip surface normals before usage.
|
||||
// Flip surface normals before usage. Valid only for extrude from surface or
|
||||
// patch.
|
||||
flipNormals false;
|
||||
|
||||
//- Linear extrusion in point-normal direction
|
||||
|
||||
Reference in New Issue
Block a user