mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
extrudeMesh: Add sector extrusion type and specialize wedge and plane
to create single layer extrusions with wedge and empty front and back patches respectively.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,12 +36,9 @@ Description
|
||||
|
||||
#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"
|
||||
@ -52,6 +49,11 @@ Description
|
||||
#include "extrudedMesh.H"
|
||||
#include "extrudeModel.H"
|
||||
|
||||
#include "wedge.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "plane.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -212,6 +214,52 @@ void updateCellSet(const mapPolyMesh& map, labelHashSet& cellLabels)
|
||||
}
|
||||
|
||||
|
||||
template<class PatchType>
|
||||
void changeFrontBackPatches
|
||||
(
|
||||
polyMesh& mesh,
|
||||
const word& frontPatchName,
|
||||
const word& backPatchName
|
||||
)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
label frontPatchI = findPatchID(patches, frontPatchName);
|
||||
label backPatchI = findPatchID(patches, backPatchName);
|
||||
|
||||
DynamicList<polyPatch*> newPatches(patches.size());
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp(patches[patchI]);
|
||||
|
||||
if (patchI == frontPatchI || patchI == backPatchI)
|
||||
{
|
||||
newPatches.append
|
||||
(
|
||||
new PatchType
|
||||
(
|
||||
pp.name(),
|
||||
pp.size(),
|
||||
pp.start(),
|
||||
pp.index(),
|
||||
mesh.boundaryMesh(),
|
||||
PatchType::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
newPatches.append(pp.clone(mesh.boundaryMesh()).ptr());
|
||||
}
|
||||
}
|
||||
|
||||
// Edit patches
|
||||
mesh.removeBoundary();
|
||||
mesh.addPatches(newPatches, true);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
@ -583,8 +631,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
// 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));
|
||||
|
||||
@ -791,6 +841,31 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
|
||||
|
||||
// Change the front and back patch types as required
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
word frontBackType(word::null);
|
||||
|
||||
if (isType<extrudeModels::wedge>(model()))
|
||||
{
|
||||
changeFrontBackPatches<wedgePolyPatch>
|
||||
(
|
||||
mesh,
|
||||
frontPatchName,
|
||||
backPatchName
|
||||
);
|
||||
}
|
||||
else if (isType<extrudeModels::plane>(model()))
|
||||
{
|
||||
changeFrontBackPatches<emptyPolyPatch>
|
||||
(
|
||||
mesh,
|
||||
frontPatchName,
|
||||
backPatchName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Collapse edges
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@ -26,8 +26,10 @@ constructFrom patch;
|
||||
// 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";
|
||||
|
||||
@ -38,10 +40,18 @@ flipNormals false;
|
||||
//- Linear extrusion in point-normal direction
|
||||
//extrudeModel linearNormal;
|
||||
|
||||
//- Single layer linear extrusion in point-normal direction
|
||||
// with empty patches on front and back
|
||||
//extrudeModel plane;
|
||||
|
||||
//- Linear extrusion in specified direction
|
||||
//extrudeModel linearDirection;
|
||||
|
||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||
//- Sector extrusion
|
||||
//extrudeModel sector;
|
||||
|
||||
//- Wedge extrusion of a single layer
|
||||
// with wedge patches on front and back
|
||||
extrudeModel wedge;
|
||||
|
||||
//- Extrudes into sphere around (0 0 0)
|
||||
@ -55,9 +65,9 @@ extrudeModel wedge;
|
||||
|
||||
nLayers 10;
|
||||
|
||||
expansionRatio 1.0; //0.9;
|
||||
expansionRatio 1.0;
|
||||
|
||||
wedgeCoeffs
|
||||
sectorCoeffs
|
||||
{
|
||||
axisPt (0 0.1 -0.05);
|
||||
axis (-1 0 0);
|
||||
@ -88,7 +98,6 @@ radialCoeffs
|
||||
R table ((0 0.01)(3 0.03)(10 0.1));
|
||||
}
|
||||
|
||||
|
||||
sigmaRadialCoeffs
|
||||
{
|
||||
RTbyg 1;
|
||||
@ -98,7 +107,7 @@ sigmaRadialCoeffs
|
||||
|
||||
// Do front and back need to be merged? Usually only makes sense for 360
|
||||
// degree wedges.
|
||||
mergeFaces false; //true;
|
||||
mergeFaces false;
|
||||
|
||||
// Merge small edges. Fraction of bounding box.
|
||||
mergeTol 0;
|
||||
|
||||
Reference in New Issue
Block a user