mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
COMP: resolve conflict
This commit is contained in:
9
applications/utilities/mesh/generation/extrude/Allwclean
Executable file
9
applications/utilities/mesh/generation/extrude/Allwclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wclean libso extrudeModel
|
||||
wclean extrudeMesh
|
||||
wclean extrudeToRegionMesh
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
10
applications/utilities/mesh/generation/extrude/Allwmake
Executable file
10
applications/utilities/mesh/generation/extrude/Allwmake
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake libso extrudeModel
|
||||
wmake extrudeMesh
|
||||
wmake extrudeToRegionMesh
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1,4 @@
|
||||
extrudeMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/extrudeMesh
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-IextrudedMesh \
|
||||
-I../extrudeModel/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lextrudeModel
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
Info<< "Create time\n" << endl;
|
||||
|
||||
Time runTimeExtruded
|
||||
(
|
||||
Time::controlDictName,
|
||||
args.rootPath(),
|
||||
args.caseName()
|
||||
);
|
||||
@ -0,0 +1,700 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Extrude mesh from existing patch (by default outwards facing normals;
|
||||
optional flips faces) or from patch read from file.
|
||||
|
||||
Note: Merges close points so be careful.
|
||||
|
||||
Type of extrusion prescribed by run-time selectable model.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "dimensionedTypes.H"
|
||||
#include "IFstream.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "edgeCollapser.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "perfectInterface.H"
|
||||
#include "addPatchCellLayer.H"
|
||||
#include "fvMesh.H"
|
||||
#include "MeshedSurfaces.H"
|
||||
|
||||
#include "extrudedMesh.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
enum ExtrudeMode
|
||||
{
|
||||
MESH,
|
||||
PATCH,
|
||||
SURFACE
|
||||
};
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<ExtrudeMode, 3>::names[] =
|
||||
{
|
||||
"mesh",
|
||||
"patch",
|
||||
"surface"
|
||||
};
|
||||
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
|
||||
|
||||
|
||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
{
|
||||
// Create dummy system/fv*
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"fvSchemes",
|
||||
mesh.time().system(),
|
||||
regionName,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
Info<< "Testing:" << io.objectPath() << endl;
|
||||
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
dictionary divDict;
|
||||
dummyDict.add("divSchemes", divDict);
|
||||
dictionary gradDict;
|
||||
dummyDict.add("gradSchemes", gradDict);
|
||||
dictionary laplDict;
|
||||
dummyDict.add("laplacianSchemes", laplDict);
|
||||
|
||||
IOdictionary(io, dummyDict).regIOobject::write();
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"fvSolution",
|
||||
mesh.time().system(),
|
||||
regionName,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
IOdictionary(io, dummyDict).regIOobject::write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label findPatchID(const polyBoundaryMesh& patches, const word& name)
|
||||
{
|
||||
const label patchID = patches.findPatchID(name);
|
||||
|
||||
if (patchID == -1)
|
||||
{
|
||||
FatalErrorIn("findPatchID(const polyBoundaryMesh&, const word&)")
|
||||
<< "Cannot find patch " << name
|
||||
<< " in the source mesh.\n"
|
||||
<< "Valid patch names are " << patches.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
return patchID;
|
||||
}
|
||||
|
||||
|
||||
labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
|
||||
{
|
||||
label n = 0;
|
||||
|
||||
forAll(names, i)
|
||||
{
|
||||
const polyPatch& pp = patches[findPatchID(patches, names[i])];
|
||||
|
||||
n += pp.size();
|
||||
}
|
||||
labelList faceLabels(n);
|
||||
n = 0;
|
||||
forAll(names, i)
|
||||
{
|
||||
const polyPatch& pp = patches[findPatchID(patches, names[i])];
|
||||
|
||||
forAll(pp, j)
|
||||
{
|
||||
faceLabels[n++] = pp.start()+j;
|
||||
}
|
||||
}
|
||||
|
||||
return faceLabels;
|
||||
}
|
||||
|
||||
|
||||
void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
|
||||
{
|
||||
const labelList& reverseMap = map.reverseFaceMap();
|
||||
|
||||
labelList newFaceLabels(faceLabels.size());
|
||||
label newI = 0;
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
label oldFaceI = faceLabels[i];
|
||||
|
||||
if (reverseMap[oldFaceI] >= 0)
|
||||
{
|
||||
newFaceLabels[newI++] = reverseMap[oldFaceI];
|
||||
}
|
||||
}
|
||||
newFaceLabels.setSize(newI);
|
||||
faceLabels.transfer(newFaceLabels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTimeExtruded.H"
|
||||
|
||||
// Get optional regionName
|
||||
word regionName;
|
||||
word regionDir;
|
||||
if (args.optionReadIfPresent("region", regionName))
|
||||
{
|
||||
regionDir = regionName;
|
||||
Info<< "Create mesh " << regionName << " for time = "
|
||||
<< runTimeExtruded.timeName() << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionName = fvMesh::defaultRegion;
|
||||
Info<< "Create mesh for time = "
|
||||
<< runTimeExtruded.timeName() << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"extrudeMeshDict",
|
||||
runTimeExtruded.system(),
|
||||
runTimeExtruded,
|
||||
IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
);
|
||||
|
||||
// Point generator
|
||||
autoPtr<extrudeModel> model(extrudeModel::New(dict));
|
||||
|
||||
// Whether to flip normals
|
||||
const Switch flipNormals(dict.lookup("flipNormals"));
|
||||
|
||||
// What to extrude
|
||||
const ExtrudeMode mode = ExtrudeModeNames.read
|
||||
(
|
||||
dict.lookup("constructFrom")
|
||||
);
|
||||
|
||||
|
||||
// Generated mesh (one of either)
|
||||
autoPtr<fvMesh> meshFromMesh;
|
||||
autoPtr<polyMesh> meshFromSurface;
|
||||
|
||||
// Faces on front and back for stitching (in case of mergeFaces)
|
||||
word frontPatchName;
|
||||
labelList frontPatchFaces;
|
||||
word backPatchName;
|
||||
labelList backPatchFaces;
|
||||
|
||||
if (mode == PATCH || mode == MESH)
|
||||
{
|
||||
if (flipNormals)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Flipping normals not supported for extrusions from patch."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fileName sourceCasePath(dict.lookup("sourceCase"));
|
||||
sourceCasePath.expand();
|
||||
fileName sourceRootDir = sourceCasePath.path();
|
||||
fileName sourceCaseDir = sourceCasePath.name();
|
||||
wordList sourcePatches;
|
||||
dict.lookup("sourcePatches") >> sourcePatches;
|
||||
|
||||
if (sourcePatches.size() == 1)
|
||||
{
|
||||
frontPatchName = sourcePatches[0];
|
||||
}
|
||||
|
||||
Info<< "Extruding patches " << sourcePatches
|
||||
<< " on mesh " << sourceCasePath << nl
|
||||
<< endl;
|
||||
|
||||
Time runTime
|
||||
(
|
||||
Time::controlDictName,
|
||||
sourceRootDir,
|
||||
sourceCaseDir
|
||||
);
|
||||
#include "createMesh.H"
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
|
||||
// Topo change container. Either copy an existing mesh or start
|
||||
// with empty storage (number of patches only needed for checking)
|
||||
autoPtr<polyTopoChange> meshMod
|
||||
(
|
||||
(
|
||||
mode == MESH
|
||||
? new polyTopoChange(mesh)
|
||||
: new polyTopoChange(patches.size())
|
||||
)
|
||||
);
|
||||
|
||||
// Extrusion engine. Either adding to existing mesh or
|
||||
// creating separate mesh.
|
||||
addPatchCellLayer layerExtrude(mesh, (mode == MESH));
|
||||
|
||||
indirectPrimitivePatch extrudePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
patchFaces(patches, sourcePatches)
|
||||
),
|
||||
mesh.points()
|
||||
);
|
||||
|
||||
// Only used for addPatchCellLayer into new mesh
|
||||
labelList exposedPatchIDs;
|
||||
if (mode == PATCH)
|
||||
{
|
||||
dict.lookup("exposedPatchName") >> backPatchName;
|
||||
exposedPatchIDs.setSize
|
||||
(
|
||||
extrudePatch.size(),
|
||||
findPatchID(patches, backPatchName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
pointField layer0Points(extrudePatch.nPoints());
|
||||
pointField displacement(extrudePatch.nPoints());
|
||||
forAll(displacement, pointI)
|
||||
{
|
||||
const vector& patchNormal = extrudePatch.pointNormals()[pointI];
|
||||
|
||||
// layer0 point
|
||||
layer0Points[pointI] = model()
|
||||
(
|
||||
extrudePatch.localPoints()[pointI],
|
||||
patchNormal,
|
||||
0
|
||||
);
|
||||
// layerN point
|
||||
point extrudePt = model()
|
||||
(
|
||||
extrudePatch.localPoints()[pointI],
|
||||
patchNormal,
|
||||
model().nLayers()
|
||||
);
|
||||
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.
|
||||
if (gMax(mag(layer0Points-extrudePatch.localPoints())) > SMALL)
|
||||
{
|
||||
Info<< "Moving mesh to layer0 points since differ from original"
|
||||
<< " points - this can happen for wedge extrusions." << nl
|
||||
<< endl;
|
||||
|
||||
pointField newPoints(mesh.points());
|
||||
forAll(extrudePatch.meshPoints(), i)
|
||||
{
|
||||
newPoints[extrudePatch.meshPoints()[i]] = layer0Points[i];
|
||||
}
|
||||
mesh.movePoints(newPoints);
|
||||
}
|
||||
|
||||
|
||||
// Layers per face
|
||||
labelList nFaceLayers(extrudePatch.size(), model().nLayers());
|
||||
// Layers per point
|
||||
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
|
||||
// Displacement for first layer
|
||||
vectorField firstLayerDisp = displacement*model().sumThickness(1);
|
||||
// Expansion ratio not used.
|
||||
scalarField ratio(extrudePatch.nPoints(), 1.0);
|
||||
|
||||
layerExtrude.setRefinement
|
||||
(
|
||||
ratio, // expansion ratio
|
||||
extrudePatch, // patch faces to extrude
|
||||
exposedPatchIDs, // if new mesh: patches for exposed faces
|
||||
nFaceLayers,
|
||||
nPointLayers,
|
||||
firstLayerDisp,
|
||||
meshMod()
|
||||
);
|
||||
|
||||
// Reset points according to extrusion model
|
||||
forAll(layerExtrude.addedPoints(), pointI)
|
||||
{
|
||||
const labelList& pPoints = layerExtrude.addedPoints()[pointI];
|
||||
forAll(pPoints, pPointI)
|
||||
{
|
||||
label meshPointI = pPoints[pPointI];
|
||||
|
||||
point modelPt
|
||||
(
|
||||
model()
|
||||
(
|
||||
extrudePatch.localPoints()[pointI],
|
||||
extrudePatch.pointNormals()[pointI],
|
||||
pPointI+1 // layer
|
||||
)
|
||||
);
|
||||
|
||||
const_cast<DynamicList<point>&>
|
||||
(
|
||||
meshMod().points()
|
||||
)[meshPointI] = modelPt;
|
||||
}
|
||||
}
|
||||
|
||||
// Store faces on front and exposed patch (if mode=patch there are
|
||||
// only added faces so cannot used map to old faces)
|
||||
const labelListList& layerFaces = layerExtrude.layerFaces();
|
||||
backPatchFaces.setSize(layerFaces.size());
|
||||
frontPatchFaces.setSize(layerFaces.size());
|
||||
forAll(backPatchFaces, i)
|
||||
{
|
||||
backPatchFaces[i] = layerFaces[i].first();
|
||||
frontPatchFaces[i] = layerFaces[i].last();
|
||||
}
|
||||
|
||||
// Create dummy fvSchemes, fvSolution
|
||||
createDummyFvMeshFiles(mesh, regionDir);
|
||||
|
||||
// Create actual mesh from polyTopoChange container
|
||||
autoPtr<mapPolyMesh> map = meshMod().makeMesh
|
||||
(
|
||||
meshFromMesh,
|
||||
IOobject
|
||||
(
|
||||
regionName,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
// Calculate face labels for front and back.
|
||||
frontPatchFaces = renumber
|
||||
(
|
||||
map().reverseFaceMap(),
|
||||
frontPatchFaces
|
||||
);
|
||||
backPatchFaces = renumber
|
||||
(
|
||||
map().reverseFaceMap(),
|
||||
backPatchFaces
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read from surface
|
||||
fileName surfName(dict.lookup("surface"));
|
||||
|
||||
Info<< "Extruding surfaceMesh read from file " << surfName << nl
|
||||
<< endl;
|
||||
|
||||
MeshedSurface<face> fMesh(surfName);
|
||||
|
||||
if (flipNormals)
|
||||
{
|
||||
Info<< "Flipping faces." << nl << endl;
|
||||
faceList& faces = const_cast<faceList&>(fMesh.faces());
|
||||
forAll(faces, i)
|
||||
{
|
||||
faces[i] = fMesh[i].reverseFace();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Extruding surface with :" << nl
|
||||
<< " points : " << fMesh.points().size() << nl
|
||||
<< " faces : " << fMesh.size() << nl
|
||||
<< " normals[0] : " << fMesh.faceNormals()[0]
|
||||
<< nl
|
||||
<< endl;
|
||||
|
||||
meshFromSurface.reset
|
||||
(
|
||||
new extrudedMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
extrudedMesh::defaultRegion,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded
|
||||
),
|
||||
fMesh,
|
||||
model()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Get the faces on front and back
|
||||
frontPatchName = "originalPatch";
|
||||
frontPatchFaces = patchFaces
|
||||
(
|
||||
meshFromSurface().boundaryMesh(),
|
||||
wordList(1, frontPatchName)
|
||||
);
|
||||
backPatchName = "otherSide";
|
||||
backPatchFaces = patchFaces
|
||||
(
|
||||
meshFromSurface().boundaryMesh(),
|
||||
wordList(1, backPatchName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
polyMesh& mesh =
|
||||
(
|
||||
meshFromMesh.valid()
|
||||
? meshFromMesh()
|
||||
: meshFromSurface()
|
||||
);
|
||||
|
||||
|
||||
const boundBox& bb = mesh.globalData().bb();
|
||||
const vector span = bb.span();
|
||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
||||
|
||||
Info<< "Mesh bounding box : " << bb << nl
|
||||
<< " with span : " << span << nl
|
||||
<< "Merge distance : " << mergeDim << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
// Collapse edges
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
{
|
||||
Info<< "Collapsing edges < " << mergeDim << " ..." << nl << endl;
|
||||
|
||||
// Edge collapsing engine
|
||||
edgeCollapser collapser(mesh);
|
||||
|
||||
const edgeList& edges = mesh.edges();
|
||||
const pointField& points = mesh.points();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
|
||||
scalar d = e.mag(points);
|
||||
|
||||
if (d < mergeDim)
|
||||
{
|
||||
Info<< "Merging edge " << e << " since length " << d
|
||||
<< " << " << mergeDim << nl;
|
||||
|
||||
// Collapse edge to e[0]
|
||||
collapser.collapseEdge(edgeI, e[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Topo change container
|
||||
polyTopoChange meshMod(mesh);
|
||||
// Put all modifications into meshMod
|
||||
bool anyChange = collapser.setRefinement(meshMod);
|
||||
|
||||
if (anyChange)
|
||||
{
|
||||
// Construct new mesh from polyTopoChange.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
|
||||
// Update stored data
|
||||
updateFaceLabels(map(), frontPatchFaces);
|
||||
updateFaceLabels(map(), backPatchFaces);
|
||||
|
||||
// Move mesh (if inflation used)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Merging front and back patch faces
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Switch mergeFaces(dict.lookup("mergeFaces"));
|
||||
if (mergeFaces)
|
||||
{
|
||||
if (mode == MESH)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot stitch front and back of extrusion since"
|
||||
<< " in 'mesh' mode (extrusion appended to mesh)."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< "Assuming full 360 degree axisymmetric case;"
|
||||
<< " stitching faces on patches "
|
||||
<< frontPatchName << " and "
|
||||
<< backPatchName << " together ..." << nl << endl;
|
||||
|
||||
if (frontPatchFaces.size() != backPatchFaces.size())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Differing number of faces on front ("
|
||||
<< frontPatchFaces.size() << ") and back ("
|
||||
<< backPatchFaces.size() << ")"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
polyTopoChanger stitcher(mesh);
|
||||
stitcher.setSize(1);
|
||||
|
||||
const word cutZoneName("originalCutFaceZone");
|
||||
|
||||
List<faceZone*> fz
|
||||
(
|
||||
1,
|
||||
new faceZone
|
||||
(
|
||||
cutZoneName,
|
||||
frontPatchFaces,
|
||||
boolList(frontPatchFaces.size(), false),
|
||||
0,
|
||||
mesh.faceZones()
|
||||
)
|
||||
);
|
||||
|
||||
mesh.addZones(List<pointZone*>(0), fz, List<cellZone*>(0));
|
||||
|
||||
// Add the perfect interface mesh modifier
|
||||
perfectInterface perfectStitcher
|
||||
(
|
||||
"couple",
|
||||
0,
|
||||
stitcher,
|
||||
cutZoneName,
|
||||
word::null, // dummy patch name
|
||||
word::null // dummy patch name
|
||||
);
|
||||
|
||||
// Topo change container
|
||||
polyTopoChange meshMod(mesh);
|
||||
|
||||
perfectStitcher.setRefinement
|
||||
(
|
||||
indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
frontPatchFaces
|
||||
),
|
||||
mesh.points()
|
||||
),
|
||||
indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
backPatchFaces
|
||||
),
|
||||
mesh.points()
|
||||
),
|
||||
meshMod
|
||||
);
|
||||
|
||||
// Construct new mesh from polyTopoChange.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
|
||||
// Move mesh (if inflation used)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
}
|
||||
|
||||
mesh.setInstance(runTimeExtruded.constant());
|
||||
Info<< "Writing mesh to " << mesh.objectPath() << nl << endl;
|
||||
|
||||
if (!mesh.write())
|
||||
{
|
||||
FatalErrorIn(args.executable()) << "Failed writing mesh"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.6 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object extrudeMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// What to extrude:
|
||||
// patch : from patch of another case ('sourceCase')
|
||||
// mesh : as above but with original case included
|
||||
// surface : from externally read surface
|
||||
|
||||
//constructFrom mesh;
|
||||
constructFrom patch;
|
||||
//constructFrom surface;
|
||||
|
||||
// If construct from patch/mesh:
|
||||
sourceCase "../cavity";
|
||||
sourcePatches (movingWall);
|
||||
// If construct from patch: patch to use for back (can be same as sourcePatch)
|
||||
exposedPatchName movingWall;
|
||||
// If construct from surface:
|
||||
surface "movingWall.stl";
|
||||
|
||||
|
||||
|
||||
// Flip surface normals before usage.
|
||||
flipNormals false;
|
||||
|
||||
|
||||
|
||||
//- Linear extrusion in point-normal direction
|
||||
//extrudeModel linearNormal;
|
||||
|
||||
//- Linear extrusion in specified direction
|
||||
//extrudeModel linearDirection;
|
||||
|
||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||
extrudeModel wedge;
|
||||
|
||||
//- Extrudes into sphere around (0 0 0)
|
||||
//extrudeModel linearRadial;
|
||||
|
||||
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
||||
//extrudeModel sigmaRadial;
|
||||
|
||||
nLayers 10;
|
||||
|
||||
expansionRatio 1.0; //0.9;
|
||||
|
||||
wedgeCoeffs
|
||||
{
|
||||
axisPt (0 0.1 -0.05);
|
||||
axis (-1 0 0);
|
||||
angle 360; // For nLayers=1 assume symmetry so angle/2 on each side
|
||||
}
|
||||
|
||||
linearNormalCoeffs
|
||||
{
|
||||
thickness 0.05;
|
||||
}
|
||||
|
||||
linearDirectionCoeffs
|
||||
{
|
||||
direction (0 1 0);
|
||||
thickness 0.05;
|
||||
}
|
||||
|
||||
linearRadialCoeffs
|
||||
{
|
||||
R 0.1;
|
||||
}
|
||||
|
||||
sigmaRadialCoeffs
|
||||
{
|
||||
RTbyg 1;
|
||||
pRef 1;
|
||||
pStrat 1;
|
||||
}
|
||||
|
||||
|
||||
// Do front and back need to be merged? Usually only makes sense for 360
|
||||
// degree wedges.
|
||||
mergeFaces false; //true;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -0,0 +1,384 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "extrudedMesh.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "meshTools.H"
|
||||
#include "ListOps.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::extrudedMesh::sameOrder(const face& f, const edge& e)
|
||||
{
|
||||
label i = findIndex(f, e[0]);
|
||||
|
||||
label nextI = (i == f.size()-1 ? 0 : i+1);
|
||||
|
||||
return f[nextI] == e[1];
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Face,
|
||||
template<class> class FaceList,
|
||||
class PointField
|
||||
>
|
||||
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
)
|
||||
{
|
||||
const pointField& surfacePoints = extrudePatch.localPoints();
|
||||
const vectorField& surfaceNormals = extrudePatch.pointNormals();
|
||||
|
||||
const label nLayers = model.nLayers();
|
||||
|
||||
pointField ePoints((nLayers + 1)*surfacePoints.size());
|
||||
|
||||
for (label layer=0; layer<=nLayers; layer++)
|
||||
{
|
||||
label offset = layer*surfacePoints.size();
|
||||
|
||||
forAll(surfacePoints, i)
|
||||
{
|
||||
ePoints[offset + i] = model
|
||||
(
|
||||
surfacePoints[i],
|
||||
surfaceNormals[i],
|
||||
layer
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(ePoints);
|
||||
}
|
||||
|
||||
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
)
|
||||
{
|
||||
const pointField& surfacePoints = extrudePatch.localPoints();
|
||||
const List<face>& surfaceFaces = extrudePatch.localFaces();
|
||||
const edgeList& surfaceEdges = extrudePatch.edges();
|
||||
const label nInternalEdges = extrudePatch.nInternalEdges();
|
||||
|
||||
const label nLayers = model.nLayers();
|
||||
|
||||
label nFaces =
|
||||
(nLayers + 1)*surfaceFaces.size() + nLayers*surfaceEdges.size();
|
||||
|
||||
faceList eFaces(nFaces);
|
||||
|
||||
labelList quad(4);
|
||||
label facei = 0;
|
||||
|
||||
// Internal faces
|
||||
for (label layer=0; layer<nLayers; layer++)
|
||||
{
|
||||
label currentLayerOffset = layer*surfacePoints.size();
|
||||
label nextLayerOffset = currentLayerOffset + surfacePoints.size();
|
||||
|
||||
// Vertical faces from layer to layer+1
|
||||
for (label edgeI=0; edgeI<nInternalEdges; edgeI++)
|
||||
{
|
||||
const edge& e = surfaceEdges[edgeI];
|
||||
const labelList& edgeFaces = extrudePatch.edgeFaces()[edgeI];
|
||||
|
||||
face& f = eFaces[facei++];
|
||||
f.setSize(4);
|
||||
|
||||
if
|
||||
(
|
||||
(edgeFaces[0] < edgeFaces[1])
|
||||
== sameOrder(surfaceFaces[edgeFaces[0]], e)
|
||||
)
|
||||
{
|
||||
f[0] = e[0] + currentLayerOffset;
|
||||
f[1] = e[1] + currentLayerOffset;
|
||||
f[2] = e[1] + nextLayerOffset;
|
||||
f[3] = e[0] + nextLayerOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
f[0] = e[1] + currentLayerOffset;
|
||||
f[1] = e[0] + currentLayerOffset;
|
||||
f[2] = e[0] + nextLayerOffset;
|
||||
f[3] = e[1] + nextLayerOffset;
|
||||
}
|
||||
}
|
||||
|
||||
// Faces between layer and layer+1
|
||||
if (layer < nLayers-1)
|
||||
{
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
eFaces[facei++] =
|
||||
face
|
||||
(
|
||||
surfaceFaces[i] //.reverseFace()
|
||||
+ nextLayerOffset
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// External side faces
|
||||
for (label layer=0; layer<nLayers; layer++)
|
||||
{
|
||||
label currentLayerOffset = layer*surfacePoints.size();
|
||||
label nextLayerOffset = currentLayerOffset + surfacePoints.size();
|
||||
|
||||
// Side faces across layer
|
||||
for (label edgeI=nInternalEdges; edgeI<surfaceEdges.size(); edgeI++)
|
||||
{
|
||||
const edge& e = surfaceEdges[edgeI];
|
||||
const labelList& edgeFaces = extrudePatch.edgeFaces()[edgeI];
|
||||
|
||||
face& f = eFaces[facei++];
|
||||
f.setSize(4);
|
||||
|
||||
if (sameOrder(surfaceFaces[edgeFaces[0]], e))
|
||||
{
|
||||
f[0] = e[0] + currentLayerOffset;
|
||||
f[1] = e[1] + currentLayerOffset;
|
||||
f[2] = e[1] + nextLayerOffset;
|
||||
f[3] = e[0] + nextLayerOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
f[0] = e[1] + currentLayerOffset;
|
||||
f[1] = e[0] + currentLayerOffset;
|
||||
f[2] = e[0] + nextLayerOffset;
|
||||
f[3] = e[1] + nextLayerOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom faces
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
eFaces[facei++] = face(surfaceFaces[i]).reverseFace();
|
||||
}
|
||||
|
||||
// Top faces
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
eFaces[facei++] =
|
||||
face
|
||||
(
|
||||
surfaceFaces[i]
|
||||
+ nLayers*surfacePoints.size()
|
||||
);
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eFaces);
|
||||
}
|
||||
|
||||
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
)
|
||||
{
|
||||
const List<face>& surfaceFaces = extrudePatch.localFaces();
|
||||
const edgeList& surfaceEdges = extrudePatch.edges();
|
||||
const label nInternalEdges = extrudePatch.nInternalEdges();
|
||||
|
||||
const label nLayers = model.nLayers();
|
||||
|
||||
cellList eCells(nLayers*surfaceFaces.size());
|
||||
|
||||
// Size the cells
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
const face& f = surfaceFaces[i];
|
||||
|
||||
for (label layer=0; layer<nLayers; layer++)
|
||||
{
|
||||
eCells[i + layer*surfaceFaces.size()].setSize(f.size() + 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Current face count per cell.
|
||||
labelList nCellFaces(eCells.size(), 0);
|
||||
|
||||
|
||||
label facei = 0;
|
||||
|
||||
for (label layer=0; layer<nLayers; layer++)
|
||||
{
|
||||
// Side faces from layer to layer+1
|
||||
for (label i=0; i<nInternalEdges; i++)
|
||||
{
|
||||
// Get patch faces using edge
|
||||
const labelList& edgeFaces = extrudePatch.edgeFaces()[i];
|
||||
|
||||
// Get cells on this layer
|
||||
label cell0 = layer*surfaceFaces.size() + edgeFaces[0];
|
||||
label cell1 = layer*surfaceFaces.size() + edgeFaces[1];
|
||||
|
||||
eCells[cell0][nCellFaces[cell0]++] = facei;
|
||||
eCells[cell1][nCellFaces[cell1]++] = facei;
|
||||
|
||||
facei++;
|
||||
}
|
||||
|
||||
// Faces between layer and layer+1
|
||||
if (layer < nLayers-1)
|
||||
{
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
label cell0 = layer*surfaceFaces.size() + i;
|
||||
label cell1 = (layer+1)*surfaceFaces.size() + i;
|
||||
|
||||
eCells[cell0][nCellFaces[cell0]++] = facei;
|
||||
eCells[cell1][nCellFaces[cell1]++] = facei;
|
||||
|
||||
facei++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// External side faces
|
||||
for (label layer=0; layer<nLayers; layer++)
|
||||
{
|
||||
// Side faces across layer
|
||||
for (label i=nInternalEdges; i<surfaceEdges.size(); i++)
|
||||
{
|
||||
// Get patch faces using edge
|
||||
const labelList& edgeFaces = extrudePatch.edgeFaces()[i];
|
||||
|
||||
// Get cells on this layer
|
||||
label cell0 = layer*surfaceFaces.size() + edgeFaces[0];
|
||||
|
||||
eCells[cell0][nCellFaces[cell0]++] = facei;
|
||||
|
||||
facei++;
|
||||
}
|
||||
}
|
||||
|
||||
// Top faces
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
eCells[i][nCellFaces[i]++] = facei;
|
||||
|
||||
facei++;
|
||||
}
|
||||
|
||||
// Bottom faces
|
||||
forAll(surfaceFaces, i)
|
||||
{
|
||||
label cell0 = (nLayers-1)*surfaceFaces.size() + i;
|
||||
|
||||
eCells[cell0][nCellFaces[cell0]++] = facei;
|
||||
|
||||
facei++;
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eCells);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template
|
||||
<
|
||||
class Face,
|
||||
template<class> class FaceList,
|
||||
class PointField
|
||||
>
|
||||
Foam::extrudedMesh::extrudedMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
)
|
||||
:
|
||||
polyMesh
|
||||
(
|
||||
io,
|
||||
extrudedPoints(extrudePatch, model),
|
||||
extrudedFaces(extrudePatch, model),
|
||||
extrudedCells(extrudePatch, model)
|
||||
),
|
||||
model_(model)
|
||||
{
|
||||
List<polyPatch*> patches(3);
|
||||
|
||||
label facei = nInternalFaces();
|
||||
|
||||
label sz =
|
||||
model_.nLayers()
|
||||
*(extrudePatch.nEdges() - extrudePatch.nInternalEdges());
|
||||
|
||||
patches[0] = new wallPolyPatch
|
||||
(
|
||||
"sides",
|
||||
sz,
|
||||
facei,
|
||||
0,
|
||||
boundaryMesh()
|
||||
);
|
||||
|
||||
facei += sz;
|
||||
|
||||
patches[1] = new polyPatch
|
||||
(
|
||||
"originalPatch",
|
||||
extrudePatch.size(),
|
||||
facei,
|
||||
1,
|
||||
boundaryMesh()
|
||||
);
|
||||
|
||||
facei += extrudePatch.size();
|
||||
|
||||
patches[2] = new polyPatch
|
||||
(
|
||||
"otherSide",
|
||||
extrudePatch.size(),
|
||||
facei,
|
||||
2,
|
||||
boundaryMesh()
|
||||
);
|
||||
|
||||
addPatches(patches);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudedMesh
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
extrudedMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef extrudedMesh_H
|
||||
#define extrudedMesh_H
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class extrudedMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class extrudedMesh
|
||||
:
|
||||
public polyMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
const extrudeModel& model_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Do edge and face use points in same order?
|
||||
static bool sameOrder(const face&, const edge&);
|
||||
|
||||
//- Construct and return the extruded mesh points
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<pointField> extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
);
|
||||
|
||||
//- Construct and return the extruded mesh faces
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<faceList> extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
);
|
||||
|
||||
//- Construct and return the extruded mesh cells
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<cellList> extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
extrudedMesh(const extrudedMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const extrudedMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from the primitivePatch to extrude
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
extrudedMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "extrudedMesh.C"
|
||||
#else
|
||||
# ifdef xlC
|
||||
# pragma implementation("extrudedMesh.C")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
extrudeModel/extrudeModel.C
|
||||
extrudeModel/extrudeModelNew.C
|
||||
linearNormal/linearNormal.C
|
||||
linearDirection/linearDirection.C
|
||||
linearRadial/linearRadial.C
|
||||
sigmaRadial/sigmaRadial.C
|
||||
wedge/wedge.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(extrudeModel, 0);
|
||||
defineRunTimeSelectionTable(extrudeModel, dictionary);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::extrudeModel::extrudeModel
|
||||
(
|
||||
const word& modelType,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nLayers_(readLabel(dict.lookup("nLayers"))),
|
||||
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
|
||||
dict_(dict),
|
||||
coeffDict_(dict.subDict(modelType + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::extrudeModel::~extrudeModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::extrudeModel::nLayers() const
|
||||
{
|
||||
return nLayers_;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::extrudeModel::expansionRatio() const
|
||||
{
|
||||
return expansionRatio_;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
|
||||
{
|
||||
// 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
|
||||
|
||||
if (mag(1.0-expansionRatio_) < SMALL)
|
||||
{
|
||||
return scalar(layer)/nLayers_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
(1.0-pow(expansionRatio_, layer))
|
||||
/ (1.0-pow(expansionRatio_, nLayers_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModel
|
||||
|
||||
Description
|
||||
Top level extrusion model class
|
||||
|
||||
SourceFiles
|
||||
extrudeModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef extrudeModel_H
|
||||
#define extrudeModel_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "point.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class extrudeModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class extrudeModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const label nLayers_;
|
||||
|
||||
const scalar expansionRatio_;
|
||||
|
||||
const dictionary& dict_;
|
||||
|
||||
const dictionary& coeffDict_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
extrudeModel(const extrudeModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const extrudeModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("extrudeModel");
|
||||
|
||||
//- Declare runtime constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
extrudeModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict
|
||||
),
|
||||
(dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
extrudeModel(const word& modelType, const dictionary&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<extrudeModel> New(const dictionary&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~extrudeModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
label nLayers() const;
|
||||
|
||||
scalar expansionRatio() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Helper: calculate cumulative relative thickness for layer.
|
||||
// (layer=0 -> 0; layer=nLayers -> 1)
|
||||
scalar sumThickness(const label layer) const;
|
||||
|
||||
virtual point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::extrudeModel> Foam::extrudeModel::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const word modelType(dict.lookup("extrudeModel"));
|
||||
|
||||
Info<< "Selecting extrudeModel " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"extrudeModel::New(const dictionary&)"
|
||||
) << "Unknown extrudeModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid extrudeModel types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<extrudeModel>(cstrIter()(dict));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "linearDirection.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(linearDirection, 0);
|
||||
|
||||
addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
linearDirection::linearDirection(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
direction_(coeffDict_.lookup("direction")),
|
||||
thickness_(readScalar(coeffDict_.lookup("thickness")))
|
||||
{
|
||||
direction_ /= mag(direction_);
|
||||
|
||||
if (thickness_ <= 0)
|
||||
{
|
||||
FatalErrorIn("linearDirection(const dictionary&)")
|
||||
<< "thickness should be positive : " << thickness_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
linearDirection::~linearDirection()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||
|
||||
point linearDirection::operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const
|
||||
{
|
||||
//scalar d = thickness_*layer/nLayers_;
|
||||
scalar d = thickness_*sumThickness(layer);
|
||||
return surfacePoint + d*direction_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModels::linearDirection
|
||||
|
||||
Description
|
||||
Extrudes by transforming points in a specified direction by a given distance
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linearDirection_H
|
||||
#define linearDirection_H
|
||||
|
||||
#include "point.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linearDirection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class linearDirection
|
||||
:
|
||||
public extrudeModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Extrude direction
|
||||
vector direction_;
|
||||
|
||||
//- layer thickness
|
||||
scalar thickness_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("linearDirection");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
linearDirection(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~linearDirection();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "linearNormal.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(linearNormal, 0);
|
||||
|
||||
addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
linearNormal::linearNormal(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
thickness_(readScalar(coeffDict_.lookup("thickness")))
|
||||
{
|
||||
if (thickness_ <= 0)
|
||||
{
|
||||
FatalErrorIn("linearNormal(const dictionary&)")
|
||||
<< "thickness should be positive : " << thickness_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
linearNormal::~linearNormal()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||
|
||||
point linearNormal::operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const
|
||||
{
|
||||
//scalar d = thickness_*layer/nLayers_;
|
||||
scalar d = thickness_*sumThickness(layer);
|
||||
return surfacePoint + d*surfaceNormal;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModels::linearNormal
|
||||
|
||||
Description
|
||||
Extrudes by transforming points normal to the surface by a given distance
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linearNormal_H
|
||||
#define linearNormal_H
|
||||
|
||||
#include "point.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linearNormal Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class linearNormal
|
||||
:
|
||||
public extrudeModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- layer thickness
|
||||
scalar thickness_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("linearNormal");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
linearNormal(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~linearNormal();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "linearRadial.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(linearRadial, 0);
|
||||
|
||||
addToRunTimeSelectionTable(extrudeModel, linearRadial, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
linearRadial::linearRadial(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
R_(readScalar(coeffDict_.lookup("R"))),
|
||||
Rsurface_(coeffDict_.lookupOrDefault<scalar>("Rsurface", -1))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
linearRadial::~linearRadial()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||
|
||||
point linearRadial::operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const
|
||||
{
|
||||
// radius of the surface
|
||||
scalar rs = mag(surfacePoint);
|
||||
vector rsHat = surfacePoint/rs;
|
||||
if (Rsurface_ >= 0) rs = Rsurface_;
|
||||
|
||||
scalar r = rs + (R_ - rs)*sumThickness(layer);
|
||||
return r*rsHat;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModels::linearRadial
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linearRadial_H
|
||||
#define linearRadial_H
|
||||
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linearRadial Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class linearRadial
|
||||
:
|
||||
public extrudeModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar R_;
|
||||
scalar Rsurface_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("linearRadial");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
linearRadial(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~linearRadial();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sigmaRadial.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(sigmaRadial, 0);
|
||||
|
||||
addToRunTimeSelectionTable(extrudeModel, sigmaRadial, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
sigmaRadial::sigmaRadial(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))),
|
||||
pRef_(readScalar(coeffDict_.lookup("pRef"))),
|
||||
pStrat_(readScalar(coeffDict_.lookup("pStrat")))
|
||||
{
|
||||
if (mag(expansionRatio() - 1.0) > SMALL)
|
||||
{
|
||||
WarningIn("sigmaRadial::sigmaRadial(const dictionary&)")
|
||||
<< "Ignoring expansionRatio setting." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
sigmaRadial::~sigmaRadial()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||
|
||||
point sigmaRadial::operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const
|
||||
{
|
||||
// radius of the surface
|
||||
scalar rs = mag(surfacePoint);
|
||||
vector rsHat = surfacePoint/rs;
|
||||
|
||||
scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers_;
|
||||
scalar r = rs - RTbyg_*log(p/pRef_);
|
||||
|
||||
return r*rsHat;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModels::sigmaRadial
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef sigmaRadial_H
|
||||
#define sigmaRadial_H
|
||||
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sigmaRadial Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class sigmaRadial
|
||||
:
|
||||
public extrudeModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar RTbyg_;
|
||||
scalar pRef_;
|
||||
scalar pStrat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sigmaRadial");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
sigmaRadial(const dictionary& dict);
|
||||
|
||||
|
||||
//-Destructor
|
||||
virtual ~sigmaRadial();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "wedge.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(wedge, 0);
|
||||
|
||||
addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
wedge::wedge(const dictionary& dict)
|
||||
:
|
||||
extrudeModel(typeName, dict),
|
||||
axisPt_(coeffDict_.lookup("axisPt")),
|
||||
axis_(coeffDict_.lookup("axis")),
|
||||
angle_
|
||||
(
|
||||
degToRad(readScalar(coeffDict_.lookup("angle")))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
wedge::~wedge()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||
|
||||
point wedge::operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const
|
||||
{
|
||||
scalar sliceAngle;
|
||||
// For the case of a single layer extrusion assume a
|
||||
// symmetric wedge about the reference plane is required
|
||||
if (nLayers_ == 1)
|
||||
{
|
||||
if (layer == 0)
|
||||
{
|
||||
sliceAngle = -angle_/2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sliceAngle = angle_/2.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//sliceAngle = angle_*layer/nLayers_;
|
||||
sliceAngle = angle_*sumThickness(layer);
|
||||
}
|
||||
|
||||
// Find projection onto axis (or rather decompose surfacePoint
|
||||
// into vector along edge (proj), vector normal to edge in plane
|
||||
// of surface point and surface normal.
|
||||
point d = surfacePoint - axisPt_;
|
||||
|
||||
d -= (axis_ & d)*axis_;
|
||||
|
||||
scalar dMag = mag(d);
|
||||
|
||||
point edgePt = surfacePoint - d;
|
||||
|
||||
// Rotate point around sliceAngle.
|
||||
point rotatedPoint = edgePt;
|
||||
|
||||
if (dMag > VSMALL)
|
||||
{
|
||||
vector n = (d/dMag) ^ axis_;
|
||||
|
||||
rotatedPoint +=
|
||||
+ cos(sliceAngle)*d
|
||||
- sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
|
||||
}
|
||||
|
||||
return rotatedPoint;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extrudeModels::wedge
|
||||
|
||||
Description
|
||||
Extrudes by rotating a surface around an axis
|
||||
- extrusion is opposite the surface/patch normal so inwards the source
|
||||
mesh
|
||||
- axis direction has to be consistent with this.
|
||||
- use -mergeFaces option if doing full 360 and want to merge front and back
|
||||
- note direction of axis. This should be consistent with rotating against
|
||||
the patch normal direction. If you get it wrong you'll see all cells
|
||||
with extreme aspect ratio and internal faces wrong way around in
|
||||
checkMesh
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedge_H
|
||||
#define wedge_H
|
||||
|
||||
#include "extrudeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace extrudeModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wedge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wedge
|
||||
:
|
||||
public extrudeModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Point on axis
|
||||
const point axisPt_;
|
||||
|
||||
//- Normalized direction of axis
|
||||
const vector axis_;
|
||||
|
||||
//- Overall angle (radians)
|
||||
const scalar angle_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("wedge");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
wedge(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~wedge();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
point operator()
|
||||
(
|
||||
const point& surfacePoint,
|
||||
const vector& surfaceNormal,
|
||||
const label layer
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace extrudeModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,7 @@
|
||||
patchPointEdgeCirculator.C
|
||||
createShellMesh.C
|
||||
extrudeToRegionMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/extrudeToRegionMesh
|
||||
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I../extrudeModel/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lextrudeModel \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -0,0 +1,624 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "createShellMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "meshTools.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyAddPoint.H"
|
||||
#include "polyAddFace.H"
|
||||
#include "polyModifyFace.H"
|
||||
#include "polyAddCell.H"
|
||||
#include "patchPointEdgeCirculator.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::createShellMesh, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::createShellMesh::calcPointRegions
|
||||
(
|
||||
const primitiveFacePatch& patch,
|
||||
const PackedBoolList& nonManifoldEdge,
|
||||
faceList& pointRegions,
|
||||
labelList& regionPoints
|
||||
)
|
||||
{
|
||||
pointRegions.setSize(patch.size());
|
||||
forAll(pointRegions, faceI)
|
||||
{
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
pointRegions[faceI].setSize(f.size(), -1);
|
||||
}
|
||||
|
||||
label nRegions = 0;
|
||||
|
||||
forAll(pointRegions, faceI)
|
||||
{
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (pointRegions[faceI][fp] == -1)
|
||||
{
|
||||
// Found unassigned point. Distribute current region.
|
||||
label pointI = f[fp];
|
||||
label edgeI = patch.faceEdges()[faceI][fp];
|
||||
|
||||
patchPointEdgeCirculator circ
|
||||
(
|
||||
patch,
|
||||
nonManifoldEdge,
|
||||
edgeI,
|
||||
findIndex(patch.edgeFaces()[edgeI], faceI),
|
||||
pointI
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
patchPointEdgeCirculator iter = circ.begin();
|
||||
iter != circ.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
label face2 = iter.faceID();
|
||||
|
||||
if (face2 != -1)
|
||||
{
|
||||
const face& f2 = patch.localFaces()[face2];
|
||||
label fp2 = findIndex(f2, pointI);
|
||||
label& region = pointRegions[face2][fp2];
|
||||
if (region != -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"createShellMesh::calcPointRegions(..)"
|
||||
) << "On point " << pointI
|
||||
<< " at:" << patch.localPoints()[pointI]
|
||||
<< " found region:" << region
|
||||
<< abort(FatalError);
|
||||
}
|
||||
region = nRegions;
|
||||
}
|
||||
}
|
||||
|
||||
nRegions++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// From region back to originating point (many to one, a point might
|
||||
// have multiple regions though)
|
||||
regionPoints.setSize(nRegions);
|
||||
forAll(pointRegions, faceI)
|
||||
{
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
regionPoints[pointRegions[faceI][fp]] = f[fp];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const labelListList& pointFaces = patch.pointFaces();
|
||||
forAll(pointFaces, pointI)
|
||||
{
|
||||
label region = -1;
|
||||
const labelList& pFaces = pointFaces[pointI];
|
||||
forAll(pFaces, i)
|
||||
{
|
||||
label faceI = pFaces[i];
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
label fp = findIndex(f, pointI);
|
||||
|
||||
if (region == -1)
|
||||
{
|
||||
region = pointRegions[faceI][fp];
|
||||
}
|
||||
else if (region != pointRegions[faceI][fp])
|
||||
{
|
||||
Pout<< "Non-manifold point:" << pointI
|
||||
<< " at " << patch.localPoints()[pointI]
|
||||
<< " region:" << region
|
||||
<< " otherRegion:" << pointRegions[faceI][fp]
|
||||
<< endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::createShellMesh::createShellMesh
|
||||
(
|
||||
const primitiveFacePatch& patch,
|
||||
const faceList& pointRegions,
|
||||
const labelList& regionPoints
|
||||
)
|
||||
:
|
||||
patch_(patch),
|
||||
pointRegions_(pointRegions),
|
||||
regionPoints_(regionPoints)
|
||||
{
|
||||
if (pointRegions_.size() != patch_.size())
|
||||
{
|
||||
FatalErrorIn("createShellMesh::createShellMesh(..)")
|
||||
<< "nFaces:" << patch_.size()
|
||||
<< " pointRegions:" << pointRegions.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::createShellMesh::setRefinement
|
||||
(
|
||||
const pointField& firstLayerDisp,
|
||||
const scalar expansionRatio,
|
||||
const label nLayers,
|
||||
const labelList& topPatchID,
|
||||
const labelList& bottomPatchID,
|
||||
const labelListList& extrudeEdgePatches,
|
||||
polyTopoChange& meshMod
|
||||
)
|
||||
{
|
||||
if (firstLayerDisp.size() != regionPoints_.size())
|
||||
{
|
||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||
<< "nRegions:" << regionPoints_.size()
|
||||
<< " firstLayerDisp:" << firstLayerDisp.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
topPatchID.size() != patch_.size()
|
||||
&& bottomPatchID.size() != patch_.size()
|
||||
)
|
||||
{
|
||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||
<< "nFaces:" << patch_.size()
|
||||
<< " topPatchID:" << topPatchID.size()
|
||||
<< " bottomPatchID:" << bottomPatchID.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (extrudeEdgePatches.size() != patch_.nEdges())
|
||||
{
|
||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||
<< "nEdges:" << patch_.nEdges()
|
||||
<< " extrudeEdgePatches:" << extrudeEdgePatches.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// From cell to patch (trivial)
|
||||
DynamicList<label> cellToFaceMap(nLayers*patch_.size());
|
||||
// From face to patch+turning index
|
||||
DynamicList<label> faceToFaceMap
|
||||
(
|
||||
(nLayers+1)*(patch_.size()+patch_.nEdges())
|
||||
);
|
||||
// From face to patch edge index
|
||||
DynamicList<label> faceToEdgeMap(nLayers*(patch_.nEdges()+patch_.nEdges()));
|
||||
// From point to patch point index
|
||||
DynamicList<label> pointToPointMap((nLayers+1)*patch_.nPoints());
|
||||
|
||||
|
||||
// Introduce new cell for every face
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
labelList addedCells(nLayers*patch_.size());
|
||||
forAll(patch_, faceI)
|
||||
{
|
||||
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||
{
|
||||
addedCells[nLayers*faceI+layerI] = meshMod.addCell
|
||||
(
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
-1, // masterFaceID
|
||||
cellToFaceMap.size(), // masterCellID
|
||||
-1 // zoneID
|
||||
);
|
||||
cellToFaceMap.append(faceI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Introduce original points
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Original point numbers in local point ordering so no need to store.
|
||||
forAll(patch_.localPoints(), pointI)
|
||||
{
|
||||
//label addedPointI =
|
||||
meshMod.addPoint
|
||||
(
|
||||
patch_.localPoints()[pointI], // point
|
||||
pointToPointMap.size(), // masterPointID
|
||||
-1, // zoneID
|
||||
true // inCell
|
||||
);
|
||||
pointToPointMap.append(pointI);
|
||||
|
||||
//Pout<< "Added bottom point " << addedPointI
|
||||
// << " at " << patch_.localPoints()[pointI]
|
||||
// << " from point " << pointI
|
||||
// << endl;
|
||||
}
|
||||
|
||||
|
||||
// Introduce new points (one for every region)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
labelList addedPoints(nLayers*regionPoints_.size());
|
||||
forAll(regionPoints_, regionI)
|
||||
{
|
||||
label pointI = regionPoints_[regionI];
|
||||
|
||||
point pt = patch_.localPoints()[pointI];
|
||||
point disp = firstLayerDisp[regionI];
|
||||
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||
{
|
||||
pt += disp;
|
||||
|
||||
addedPoints[nLayers*regionI+layerI] = meshMod.addPoint
|
||||
(
|
||||
pt, // point
|
||||
pointToPointMap.size(), // masterPointID - used only addressing
|
||||
-1, // zoneID
|
||||
true // inCell
|
||||
);
|
||||
pointToPointMap.append(pointI);
|
||||
|
||||
disp *= expansionRatio;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add face on bottom side
|
||||
forAll(patch_.localFaces(), faceI)
|
||||
{
|
||||
meshMod.addFace
|
||||
(
|
||||
patch_.localFaces()[faceI].reverseFace(),// vertices
|
||||
addedCells[nLayers*faceI], // own
|
||||
-1, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
faceToFaceMap.size(), // masterFaceID : current faceI
|
||||
true, // flipFaceFlux
|
||||
bottomPatchID[faceI], // patchID
|
||||
-1, // zoneID
|
||||
false // zoneFlip
|
||||
);
|
||||
faceToFaceMap.append(-faceI-1); // points to flipped original face
|
||||
faceToEdgeMap.append(-1);
|
||||
|
||||
//const face newF(patch_.localFaces()[faceI].reverseFace());
|
||||
//Pout<< "Added bottom face "
|
||||
// << newF
|
||||
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
|
||||
// << " own " << addedCells[faceI]
|
||||
// << " patch:" << bottomPatchID[faceI]
|
||||
// << " at " << patch_.faceCentres()[faceI]
|
||||
// << endl;
|
||||
}
|
||||
|
||||
// Add inbetween faces and face on top
|
||||
forAll(patch_.localFaces(), faceI)
|
||||
{
|
||||
// Get face in original ordering
|
||||
const face& f = patch_.localFaces()[faceI];
|
||||
|
||||
face newF(f.size());
|
||||
|
||||
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||
{
|
||||
// Pick up point based on region and layer
|
||||
forAll(f, fp)
|
||||
{
|
||||
label region = pointRegions_[faceI][fp];
|
||||
newF[fp] = addedPoints[region*nLayers+layerI];
|
||||
}
|
||||
|
||||
label own = addedCells[faceI*nLayers+layerI];
|
||||
label nei;
|
||||
label patchI;
|
||||
if (layerI == nLayers-1)
|
||||
{
|
||||
nei = -1;
|
||||
patchI = topPatchID[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
nei = addedCells[faceI*nLayers+layerI+1];
|
||||
patchI = -1;
|
||||
}
|
||||
|
||||
meshMod.addFace
|
||||
(
|
||||
newF, // vertices
|
||||
own, // own
|
||||
nei, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
faceToFaceMap.size(), // masterFaceID : current faceI
|
||||
false, // flipFaceFlux
|
||||
patchI, // patchID
|
||||
-1, // zoneID
|
||||
false // zoneFlip
|
||||
);
|
||||
faceToFaceMap.append(faceI+1); // unflipped
|
||||
faceToEdgeMap.append(-1);
|
||||
|
||||
//Pout<< "Added inbetween face " << newF
|
||||
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
|
||||
// << " at layer " << layerI
|
||||
// << " own " << own
|
||||
// << " nei " << nei
|
||||
// << " at " << patch_.faceCentres()[faceI]
|
||||
// << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add side faces
|
||||
// ~~~~~~~~~~~~~~
|
||||
// Note that we loop over edges multiple times so for edges with
|
||||
// two cyclic faces they get added in two passes (for correct ordering)
|
||||
|
||||
// Pass1. Internal edges and first face of other edges
|
||||
forAll(extrudeEdgePatches, edgeI)
|
||||
{
|
||||
const labelList& eFaces = patch_.edgeFaces()[edgeI];
|
||||
const labelList& ePatches = extrudeEdgePatches[edgeI];
|
||||
|
||||
if (ePatches.size() == 0)
|
||||
{
|
||||
// Internal face
|
||||
if (eFaces.size() != 2)
|
||||
{
|
||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||
<< "edge:" << edgeI
|
||||
<< " not internal but does not have side-patches defined."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eFaces.size() != ePatches.size())
|
||||
{
|
||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||
<< "external/feature edge:" << edgeI
|
||||
<< " has " << eFaces.size() << " connected extruded faces "
|
||||
<< " but only " << ePatches.size()
|
||||
<< " boundary faces defined." << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Make face pointing in to eFaces[0] so out of new master face
|
||||
const face& f = patch_.localFaces()[eFaces[0]];
|
||||
const edge& e = patch_.edges()[edgeI];
|
||||
|
||||
label fp0 = findIndex(f, e[0]);
|
||||
label fp1 = f.fcIndex(fp0);
|
||||
|
||||
if (f[fp1] != e[1])
|
||||
{
|
||||
fp1 = fp0;
|
||||
fp0 = f.rcIndex(fp1);
|
||||
}
|
||||
|
||||
face newF(4);
|
||||
|
||||
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||
{
|
||||
label region0 = pointRegions_[eFaces[0]][fp0];
|
||||
label region1 = pointRegions_[eFaces[0]][fp1];
|
||||
|
||||
if (layerI == 0)
|
||||
{
|
||||
newF[0] = f[fp0];
|
||||
newF[1] = f[fp1];
|
||||
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||
}
|
||||
else
|
||||
{
|
||||
newF[0] = addedPoints[nLayers*region0+layerI-1];
|
||||
newF[1] = addedPoints[nLayers*region1+layerI-1];
|
||||
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||
}
|
||||
|
||||
label minCellI = addedCells[nLayers*eFaces[0]+layerI];
|
||||
label maxCellI;
|
||||
label patchI;
|
||||
if (ePatches.size() == 0)
|
||||
{
|
||||
maxCellI = addedCells[nLayers*eFaces[1]+layerI];
|
||||
if (minCellI > maxCellI)
|
||||
{
|
||||
// Swap
|
||||
Swap(minCellI, maxCellI);
|
||||
newF = newF.reverseFace();
|
||||
}
|
||||
patchI = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxCellI = -1;
|
||||
patchI = ePatches[0];
|
||||
}
|
||||
|
||||
//{
|
||||
// Pout<< "Adding from face:" << patch_.faceCentres()[eFaces[0]]
|
||||
// << " from edge:"
|
||||
// << patch_.localPoints()[f[fp0]]
|
||||
// << patch_.localPoints()[f[fp1]]
|
||||
// << " at layer:" << layerI
|
||||
// << " with new points:" << newF
|
||||
// << " locations:"
|
||||
// << UIndirectList<point>(meshMod.points(), newF)
|
||||
// << " own:" << minCellI
|
||||
// << " nei:" << maxCellI
|
||||
// << endl;
|
||||
//}
|
||||
|
||||
|
||||
// newF already outwards pointing.
|
||||
meshMod.addFace
|
||||
(
|
||||
newF, // vertices
|
||||
minCellI, // own
|
||||
maxCellI, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
faceToFaceMap.size(), // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
patchI, // patchID
|
||||
-1, // zoneID
|
||||
false // zoneFlip
|
||||
);
|
||||
faceToFaceMap.append(0);
|
||||
faceToEdgeMap.append(edgeI);
|
||||
}
|
||||
}
|
||||
|
||||
// Pass2. Other faces of boundary edges
|
||||
forAll(extrudeEdgePatches, edgeI)
|
||||
{
|
||||
const labelList& eFaces = patch_.edgeFaces()[edgeI];
|
||||
const labelList& ePatches = extrudeEdgePatches[edgeI];
|
||||
|
||||
if (ePatches.size() >= 2)
|
||||
{
|
||||
for (label i = 1; i < ePatches.size(); i++)
|
||||
{
|
||||
// Extrude eFaces[i]
|
||||
label minFaceI = eFaces[i];
|
||||
|
||||
// Make face pointing in to eFaces[0] so out of new master face
|
||||
const face& f = patch_.localFaces()[minFaceI];
|
||||
|
||||
const edge& e = patch_.edges()[edgeI];
|
||||
label fp0 = findIndex(f, e[0]);
|
||||
label fp1 = f.fcIndex(fp0);
|
||||
|
||||
if (f[fp1] != e[1])
|
||||
{
|
||||
fp1 = fp0;
|
||||
fp0 = f.rcIndex(fp1);
|
||||
}
|
||||
|
||||
face newF(4);
|
||||
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||
{
|
||||
label region0 = pointRegions_[minFaceI][fp0];
|
||||
label region1 = pointRegions_[minFaceI][fp1];
|
||||
|
||||
if (layerI == 0)
|
||||
{
|
||||
newF[0] = f[fp0];
|
||||
newF[1] = f[fp1];
|
||||
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||
}
|
||||
else
|
||||
{
|
||||
newF[0] = addedPoints[nLayers*region0+layerI-1];
|
||||
newF[1] = addedPoints[nLayers*region1+layerI-1];
|
||||
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||
}
|
||||
|
||||
////if (ePatches.size() == 0)
|
||||
//{
|
||||
// Pout<< "Adding from MULTI face:"
|
||||
// << patch_.faceCentres()[minFaceI]
|
||||
// << " from edge:"
|
||||
// << patch_.localPoints()[f[fp0]]
|
||||
// << patch_.localPoints()[f[fp1]]
|
||||
// << " at layer:" << layerI
|
||||
// << " with new points:" << newF
|
||||
// << " locations:"
|
||||
// << UIndirectList<point>(meshMod.points(), newF)
|
||||
// << endl;
|
||||
//}
|
||||
|
||||
// newF already outwards pointing.
|
||||
meshMod.addFace
|
||||
(
|
||||
newF, // vertices
|
||||
addedCells[nLayers*minFaceI+layerI], // own
|
||||
-1, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
faceToFaceMap.size(), // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
ePatches[i], // patchID
|
||||
-1, // zoneID
|
||||
false // zoneFlip
|
||||
);
|
||||
faceToFaceMap.append(0);
|
||||
faceToEdgeMap.append(edgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cellToFaceMap_.transfer(cellToFaceMap);
|
||||
faceToFaceMap_.transfer(faceToFaceMap);
|
||||
faceToEdgeMap_.transfer(faceToEdgeMap);
|
||||
pointToPointMap_.transfer(pointToPointMap);
|
||||
}
|
||||
|
||||
|
||||
void Foam::createShellMesh::updateMesh(const mapPolyMesh& map)
|
||||
{
|
||||
inplaceReorder(map.reverseCellMap(), cellToFaceMap_);
|
||||
inplaceReorder(map.reverseFaceMap(), faceToFaceMap_);
|
||||
inplaceReorder(map.reverseFaceMap(), faceToEdgeMap_);
|
||||
inplaceReorder(map.reversePointMap(), pointToPointMap_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,179 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::createShellMesh
|
||||
|
||||
Description
|
||||
Creates mesh by extruding a patch.
|
||||
|
||||
SourceFiles
|
||||
createShellMesh.C
|
||||
|
||||
Extrudes into thickness direction.
|
||||
- bottom faces originate from reversed original faces (have turning index)
|
||||
- top faces originate from original faces (no turning index)
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createShellMesh_H
|
||||
#define createShellMesh_H
|
||||
|
||||
#include "primitiveFacePatch.H"
|
||||
#include "PackedBoolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class mapPolyMesh;
|
||||
class polyTopoChange;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class createShellMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class createShellMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to patch to extrude
|
||||
const primitiveFacePatch& patch_;
|
||||
|
||||
//- Per point on face the region
|
||||
const faceList& pointRegions_;
|
||||
|
||||
//- From region to original patch point
|
||||
const labelList& regionPoints_;
|
||||
|
||||
|
||||
labelList cellToFaceMap_;
|
||||
|
||||
labelList faceToFaceMap_;
|
||||
|
||||
labelList faceToEdgeMap_;
|
||||
|
||||
labelList pointToPointMap_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
createShellMesh(const createShellMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const createShellMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("createShellMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh.
|
||||
createShellMesh
|
||||
(
|
||||
const primitiveFacePatch& patch,
|
||||
const faceList& pointRegions,
|
||||
const labelList& regionPoints
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- From region cell to patch face. Consecutively added so
|
||||
// cell at layerI is at patchFaceI*nLayers+layerI
|
||||
const labelList& cellToFaceMap() const
|
||||
{
|
||||
return cellToFaceMap_;
|
||||
}
|
||||
|
||||
//- From region face to patch face. Contains turning index:
|
||||
// > 0 : face in same orientation as patch face. face will
|
||||
// be in top patch
|
||||
// < 0 : face in opposite orientation as patch face. face will
|
||||
// be in bottom patch
|
||||
// = 0 : for all side and internal faces
|
||||
const labelList& faceToFaceMap() const
|
||||
{
|
||||
return faceToFaceMap_;
|
||||
}
|
||||
|
||||
//- From region side-face to patch edge. -1 for non-edge faces.
|
||||
const labelList& faceToEdgeMap() const
|
||||
{
|
||||
return faceToEdgeMap_;
|
||||
}
|
||||
|
||||
//- From region point to patch point.
|
||||
const labelList& pointToPointMap() const
|
||||
{
|
||||
return pointToPointMap_;
|
||||
}
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
//- Helper: calculate point regions
|
||||
static void calcPointRegions
|
||||
(
|
||||
const primitiveFacePatch& patch,
|
||||
const PackedBoolList& nonManifoldEdge,
|
||||
faceList& pointRegions,
|
||||
labelList& regionPoints
|
||||
);
|
||||
|
||||
//- Play commands into polyTopoChange to create layer mesh.
|
||||
void setRefinement
|
||||
(
|
||||
const pointField& firstLayerThickness,
|
||||
const scalar expansionRatio,
|
||||
const label nLayers,
|
||||
const labelList& topPatchID,
|
||||
const labelList& bottomPatchID,
|
||||
const labelListList& extrudeEdgePatches,
|
||||
polyTopoChange& meshMod
|
||||
);
|
||||
|
||||
//- Update any locally stored mesh information.
|
||||
void updateMesh(const mapPolyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,78 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object extrudeToRegionMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Name of region to create
|
||||
region liquidFilm;
|
||||
|
||||
// faceZones to extrude
|
||||
faceZones (f0);
|
||||
|
||||
// Extrude 1D-columns of cells?
|
||||
oneD false;
|
||||
|
||||
//- Extrusion model to use. The only logical choice is linearNormal?
|
||||
|
||||
//- Linear extrusion in normal direction
|
||||
extrudeModel linearNormal;
|
||||
|
||||
//- Linear extrusion in specified direction
|
||||
//extrudeModel linearDirection;
|
||||
|
||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||
// extrudeModel wedge;
|
||||
|
||||
//- Extrudes into sphere around (0 0 0)
|
||||
//extrudeModel linearRadial;
|
||||
|
||||
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
||||
//extrudeModel sigmaRadial;
|
||||
|
||||
nLayers 10;
|
||||
|
||||
expansionRatio 0.9;
|
||||
|
||||
linearNormalCoeffs
|
||||
{
|
||||
thickness 0.05;
|
||||
}
|
||||
|
||||
wedgeCoeffs
|
||||
{
|
||||
axisPt (0 0.1 -0.05);
|
||||
axis (-1 0 0);
|
||||
angle 360; // For nLayers=1 assume symmetry so angle/2 on each side
|
||||
}
|
||||
|
||||
linearDirectionCoeffs
|
||||
{
|
||||
direction (0 1 0);
|
||||
thickness 0.05;
|
||||
}
|
||||
|
||||
linearRadialCoeffs
|
||||
{
|
||||
R 0.1;
|
||||
}
|
||||
|
||||
sigmaRadialCoeffs
|
||||
{
|
||||
RTbyg 1;
|
||||
pRef 1;
|
||||
pStrat 1;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "patchPointEdgeCirculator.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::patchPointEdgeCirculator
|
||||
Foam::patchPointEdgeCirculator::endConstIter
|
||||
(
|
||||
*reinterpret_cast<primitiveFacePatch*>(0), // primitiveFacePatch
|
||||
*reinterpret_cast<PackedBoolList*>(0), // PackedBoolList
|
||||
-1, // edgeID
|
||||
-1, // index
|
||||
-1 // pointID
|
||||
);
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const InfoProxy<patchPointEdgeCirculator>& ip
|
||||
)
|
||||
{
|
||||
const patchPointEdgeCirculator& c = ip.t_;
|
||||
|
||||
const pointField& pts = c.patch_.localPoints();
|
||||
const edge& e = c.patch_.edges()[c.edgeID_];
|
||||
label faceI = c.faceID();
|
||||
|
||||
os << "around point:" << c.pointID_
|
||||
<< " coord:" << pts[c.pointID_]
|
||||
<< " at edge:" << c.edgeID_
|
||||
<< " coord:" << pts[e.otherVertex(c.pointID_)]
|
||||
<< " in direction of face:" << faceI;
|
||||
|
||||
if (faceI != -1)
|
||||
{
|
||||
os << " fc:" << c.patch_.localFaces()[faceI].centre(pts);
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,205 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::patchPointEdgeCirculator
|
||||
|
||||
Description
|
||||
Walks from starting edge/face around point on patch.
|
||||
|
||||
-# Use in-place: \n
|
||||
@code
|
||||
patchPointEdgeCirculator circ(..);
|
||||
|
||||
// Walk
|
||||
do
|
||||
{
|
||||
Info<< "edge:" << circ.edgeID() << endl;
|
||||
++circ;
|
||||
}
|
||||
while (circ != circ.end());
|
||||
@endcode
|
||||
|
||||
-# Use like STL iterator: \n
|
||||
@code
|
||||
patchPointEdgeCirculator circ(..);
|
||||
for
|
||||
(
|
||||
patchPointEdgeCirculator iter = circ.begin();
|
||||
iter != circ.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
Info<< "edge:" << iter.edgeID() << endl;
|
||||
}
|
||||
@endcode
|
||||
|
||||
|
||||
SourceFiles
|
||||
patchPointEdgeCirculator.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef patchPointEdgeCirculator_H
|
||||
#define patchPointEdgeCirculator_H
|
||||
|
||||
#include "face.H"
|
||||
#include "ListOps.H"
|
||||
#include "primitiveFacePatch.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "InfoProxy.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class patchPointEdgeCirculator Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class patchPointEdgeCirculator
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- end iterator
|
||||
static const patchPointEdgeCirculator endConstIter;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Patch
|
||||
const primitiveFacePatch& patch_;
|
||||
|
||||
const PackedBoolList& nonManifoldEdge_;
|
||||
|
||||
//- Current edge
|
||||
label edgeID_;
|
||||
|
||||
//- Current direction (face, expressed as index into edgeFaces()[edgeID]
|
||||
label index_;
|
||||
|
||||
//- Point
|
||||
label pointID_;
|
||||
|
||||
//- Starting edge so we know when to stop.
|
||||
label startEdgeID_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Set to end() iterator
|
||||
inline void setEnd();
|
||||
|
||||
//- Set edgeID_ to be the other edge on the face that uses the
|
||||
// point.
|
||||
inline void otherEdge(const label cellI);
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline patchPointEdgeCirculator
|
||||
(
|
||||
const primitiveFacePatch&,
|
||||
const PackedBoolList& nonManifoldEdge,
|
||||
const label edgeID,
|
||||
const label index,
|
||||
const label pointID
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
inline patchPointEdgeCirculator(const patchPointEdgeCirculator&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
inline label edgeID() const;
|
||||
|
||||
inline label index() const;
|
||||
|
||||
inline label pointID() const;
|
||||
|
||||
//- Helper: get face according to the index.
|
||||
// Returns -1 if on end.
|
||||
inline label faceID() const;
|
||||
|
||||
//- Walk back until non-manifold edge (if any) or minimum edge.
|
||||
inline void setCanonical();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
inline void operator=(const patchPointEdgeCirculator& iter);
|
||||
|
||||
inline bool operator==(const patchPointEdgeCirculator& iter) const;
|
||||
|
||||
inline bool operator!=(const patchPointEdgeCirculator& iter) const;
|
||||
|
||||
//- Step to next face.
|
||||
inline patchPointEdgeCirculator& operator++();
|
||||
|
||||
//- iterator set to the beginning face. For internal edges this is
|
||||
// the current face. For boundary edges this is the first boundary face
|
||||
// reached from walking back (i.e. in opposite direction to ++)
|
||||
inline patchPointEdgeCirculator begin() const;
|
||||
inline patchPointEdgeCirculator cbegin() const;
|
||||
|
||||
//- iterator set to beyond the end of the walk.
|
||||
inline const patchPointEdgeCirculator& end() const;
|
||||
inline const patchPointEdgeCirculator& cend() const;
|
||||
|
||||
// Info
|
||||
|
||||
//- Return info proxy.
|
||||
// Used to print token information to a stream
|
||||
InfoProxy<patchPointEdgeCirculator> info() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const InfoProxy<patchPointEdgeCirculator>&
|
||||
);
|
||||
};
|
||||
|
||||
Ostream& operator<<(Ostream&, const InfoProxy<patchPointEdgeCirculator>&);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "patchPointEdgeCirculatorI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,308 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::patchPointEdgeCirculator::setEnd()
|
||||
{
|
||||
edgeID_ = -1;
|
||||
pointID_ = -1;
|
||||
}
|
||||
|
||||
|
||||
// Cross face to other edge on point
|
||||
void Foam::patchPointEdgeCirculator::otherEdge(const label faceI)
|
||||
{
|
||||
const labelList& fEdges = patch_.faceEdges()[faceI];
|
||||
const face& f = patch_.localFaces()[faceI];
|
||||
label fp = findIndex(f, pointID_);
|
||||
|
||||
if (fEdges[fp] == edgeID_)
|
||||
{
|
||||
edgeID_ = fEdges[f.rcIndex(fp)];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for now
|
||||
if (fEdges[f.rcIndex(fp)] != edgeID_)
|
||||
{
|
||||
FatalErrorIn("patchPointEdgeCirculator::otherEdge(const label)")
|
||||
<< "face:" << faceI
|
||||
<< " verts:" << f
|
||||
<< " edges:" << fEdges
|
||||
<< " looking for other edge than " << edgeID_
|
||||
<< abort(FatalError);
|
||||
}
|
||||
edgeID_ = fEdges[fp];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from components
|
||||
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
|
||||
(
|
||||
const primitiveFacePatch& patch,
|
||||
const PackedBoolList& nonManifoldEdge,
|
||||
const label edgeID,
|
||||
const label index,
|
||||
|
||||
const label pointID
|
||||
)
|
||||
:
|
||||
patch_(patch),
|
||||
nonManifoldEdge_(nonManifoldEdge),
|
||||
edgeID_(edgeID),
|
||||
index_(index),
|
||||
pointID_(pointID),
|
||||
startEdgeID_(edgeID_)
|
||||
{
|
||||
if (edgeID_ != -1)
|
||||
{
|
||||
const edge& e = patch_.edges()[edgeID_];
|
||||
|
||||
if (pointID_ != e[0] && pointID_ != e[1])
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"patchPointEdgeCirculator::patchPointEdgeCirculator(..)"
|
||||
) << "edge " << edgeID_ << " verts " << e
|
||||
<< " does not contain point " << pointID_ << abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Construct copy
|
||||
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
|
||||
(
|
||||
const patchPointEdgeCirculator& circ
|
||||
)
|
||||
:
|
||||
patch_(circ.patch_),
|
||||
nonManifoldEdge_(circ.nonManifoldEdge_),
|
||||
edgeID_(circ.edgeID_),
|
||||
index_(circ.index_),
|
||||
pointID_(circ.pointID_),
|
||||
startEdgeID_(circ.startEdgeID_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::patchPointEdgeCirculator::edgeID() const
|
||||
{
|
||||
return edgeID_;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::patchPointEdgeCirculator::index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::patchPointEdgeCirculator::pointID() const
|
||||
{
|
||||
return pointID_;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::patchPointEdgeCirculator::faceID() const
|
||||
{
|
||||
if (edgeID_ != -1 && index_ != -1)
|
||||
{
|
||||
return patch_.edgeFaces()[edgeID_][index_];
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::patchPointEdgeCirculator::operator=
|
||||
(
|
||||
const patchPointEdgeCirculator& circ
|
||||
)
|
||||
{
|
||||
edgeID_ = circ.edgeID_;
|
||||
index_ = circ.index_;
|
||||
pointID_ = circ.pointID_;
|
||||
startEdgeID_ = circ.startEdgeID_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::patchPointEdgeCirculator::operator==
|
||||
(
|
||||
const patchPointEdgeCirculator& circ
|
||||
) const
|
||||
{
|
||||
// Do just enough to have setEnd() produce an iterator equal to end().
|
||||
// Could include the direction(i.e. index_) to make sure that two
|
||||
// circulators around same point but in different direction are not equal.
|
||||
return edgeID_ == circ.edgeID_ && pointID_ == circ.pointID_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::patchPointEdgeCirculator::operator!=
|
||||
(
|
||||
const patchPointEdgeCirculator& circ
|
||||
) const
|
||||
{
|
||||
return !(*this == circ);
|
||||
}
|
||||
|
||||
|
||||
void Foam::patchPointEdgeCirculator::setCanonical()
|
||||
{
|
||||
if (edgeID_ == -1)
|
||||
{
|
||||
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
|
||||
<< "Already reached end(). Cannot walk any further."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
label minEdgeID = edgeID_;
|
||||
label minIndex = index_;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (nonManifoldEdge_[edgeID_])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Step back
|
||||
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
|
||||
|
||||
if (eFaces.size() != 2)
|
||||
{
|
||||
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
|
||||
<< "problem eFaces:" << eFaces << abort(FatalError);
|
||||
}
|
||||
|
||||
label faceI = (index_ == 0 ? eFaces[1] : eFaces[0]);
|
||||
|
||||
// Step to other edge on face
|
||||
otherEdge(faceI);
|
||||
|
||||
// Update index
|
||||
index_ = findIndex(patch_.edgeFaces()[edgeID_], faceI);
|
||||
|
||||
if (edgeID_ < minEdgeID)
|
||||
{
|
||||
minEdgeID = edgeID_;
|
||||
minIndex = index_;
|
||||
}
|
||||
|
||||
if (edgeID_ == startEdgeID_)
|
||||
{
|
||||
edgeID_ = minEdgeID;
|
||||
index_ = minIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
startEdgeID_ = edgeID_;
|
||||
}
|
||||
|
||||
|
||||
//- Step to next edge.
|
||||
Foam::patchPointEdgeCirculator&
|
||||
Foam::patchPointEdgeCirculator::operator++()
|
||||
{
|
||||
if (index_ == -1)
|
||||
{
|
||||
setEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Step to other edge on face
|
||||
label faceI = patch_.edgeFaces()[edgeID_][index_];
|
||||
otherEdge(faceI);
|
||||
|
||||
if (edgeID_ == startEdgeID_)
|
||||
{
|
||||
setEnd();
|
||||
}
|
||||
else if (nonManifoldEdge_[edgeID_])
|
||||
{
|
||||
// Reached non-manifold edge. Cannot walk further.
|
||||
// Mark so it gets set to end next time.
|
||||
index_ = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
|
||||
|
||||
if (eFaces.size() != 2)
|
||||
{
|
||||
FatalErrorIn("patchPointEdgeCirculator:::operator++()")
|
||||
<< "problem eFaces:" << eFaces << abort(FatalError);
|
||||
}
|
||||
// Point to the face that is not faceI
|
||||
index_ = (eFaces[0] != faceI ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::begin() const
|
||||
{
|
||||
patchPointEdgeCirculator iter(*this);
|
||||
iter.setCanonical();
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::cbegin() const
|
||||
{
|
||||
patchPointEdgeCirculator iter(*this);
|
||||
iter.setCanonical();
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::end()
|
||||
const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::cend()
|
||||
const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user