1) Modification to extrudeToRegionMesh to use extrudeModel point distribution function
2) Addition of firstCellThickness option to linearNormal extrude model
This commit is contained in:
Sergio Ferraris
2013-09-12 17:39:32 +01:00
parent 868fbd5ff9
commit c7d1a4b023
3 changed files with 63 additions and 6 deletions

View File

@ -2453,6 +2453,27 @@ int main(int argc, char *argv[])
meshMod
);
// Enforce actual point posititions according to extrudeModel (model)
// (extruder.setRefinement only does fixed expansionRatio)
// The regionPoints and nLayers are looped in the same way as in
// createShellMesh
DynamicList<point>& newPoints = const_cast<DynamicList<point>&>
(
meshMod.points()
);
label meshPointI = extrudePatch.localPoints().size();
forAll(localRegionPoints, regionI)
{
label pointI = localRegionPoints[regionI];
point pt = extrudePatch.localPoints()[pointI];
const vector& n = localRegionNormals[regionI];
for (label layerI = 1; layerI <= model().nLayers(); layerI++)
{
newPoints[meshPointI++] = model()(pt, n, layerI);
}
}
shellMap = meshMod.changeMesh
(
regionMesh, // mesh to change

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,9 @@ addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary);
linearNormal::linearNormal(const dictionary& dict)
:
extrudeModel(typeName, dict),
thickness_(readScalar(coeffDict_.lookup("thickness")))
thickness_(readScalar(coeffDict_.lookup("thickness"))),
firstCellThickness_(0),
layerPoints_(nLayers_)
{
if (thickness_ <= 0)
{
@ -53,6 +55,34 @@ linearNormal::linearNormal(const dictionary& dict)
<< "thickness should be positive : " << thickness_
<< exit(FatalError);
}
coeffDict_.readIfPresent("firstCellThickness", firstCellThickness_);
if (firstCellThickness_ >= thickness_)
{
FatalErrorIn("linearNormal(const dictionary&)")
<< "firstCellThickness is larger than thickness"
<< exit(FatalError);
}
if (firstCellThickness_ > 0)
{
layerPoints_[0] = firstCellThickness_;
for (label layerI = 1; layerI < nLayers_; layerI++)
{
layerPoints_[layerI] =
(thickness_ - layerPoints_[0])
*sumThickness(layerI) + layerPoints_[0];
}
}
else
{
for (label layerI = 0; layerI < nLayers_; layerI++)
{
layerPoints_[layerI] = thickness_*sumThickness(layerI + 1);
}
}
}
@ -71,9 +101,7 @@ point linearNormal::operator()
const label layer
) const
{
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*surfaceNormal;
return surfacePoint + layerPoints_[layer - 1]*surfaceNormal;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,6 +34,7 @@ Description
#include "point.H"
#include "extrudeModel.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,6 +56,13 @@ class linearNormal
//- layer thickness
scalar thickness_;
//- first cell thickness
scalar firstCellThickness_;
//- layer cell distibution
scalarList layerPoints_;
public: