48 Foam::extrudePatchMesh::extrudePatchMesh
53 const dictionary&
dict 63 IOobject::READ_IF_PRESENT,
75 Foam::extrudePatchMesh::extrudePatchMesh
86 extrudeMesh(regionPatches);
90 Foam::extrudePatchMesh::extrudePatchMesh
108 Foam::extrudePatchMesh::extrudePatchMesh
123 dicts[bottomPatchID] = dict_.
subDict(
"bottomCoeffs");
124 dicts[sidePatchID] = dict_.
subDict(
"sideCoeffs");
125 dicts[topPatchID] = dict_.
subDict(
"topCoeffs");
129 dicts[patchi].readEntry(
"name",
patchNames[patchi]);
130 dicts[patchi].readEntry(
"type",
patchTypes[patchi]);
133 forAll(regionPatches, patchi)
136 patchDict.
set(
"nFaces", 0);
137 patchDict.set(
"startFace", 0);
152 extrudeMesh(regionPatches);
156 void Foam::extrudePatchMesh::extrudeMesh(
const polyPatchList& regionPatches)
158 if (this->boundaryMesh().empty())
160 const bool columnCells = dict_.get<
bool>(
"columnCells");
161 scalar featAngleCos = -GREAT;
162 scalar featAngle = -1;
163 if (dict_.readIfPresent(
"featureAngle", featAngle))
168 bitSet nonManifoldEdge(extrudedPatch_.nEdges());
169 for (label edgeI = 0; edgeI < extrudedPatch_.nInternalEdges(); edgeI++)
173 nonManifoldEdge.set(edgeI);
177 const auto& fcs = extrudedPatch_.edgeFaces()[edgeI];
183 nonManifoldEdge.set(edgeI);
185 else if (fcs.size() == 2 && featAngleCos >= -1)
187 const auto&
n = extrudedPatch_.faceNormals();
188 if ((
n[fcs[0]] &
n[fcs[1]]) < featAngleCos)
190 nonManifoldEdge.set(edgeI);
204 extrudedPatch_, extrudedPatch_.points()
221 labelList localRegionPoints(localToGlobalRegion.size());
222 forAll(pointLocalRegions, facei)
224 const face&
f = extrudedPatch_.localFaces()[facei];
225 const face& pRegions = pointLocalRegions[facei];
228 localRegionPoints[pRegions[fp]] =
f[fp];
233 pointField localRegionNormals(localToGlobalRegion.size());
237 forAll(pointLocalRegions, facei)
239 const face& pRegions = pointLocalRegions[facei];
242 label localRegionI = pRegions[fp];
243 localSum[localRegionI] +=
244 extrudedPatch_.faceNormals()[facei];
248 Map<point> globalSum(2*localToGlobalRegion.size());
250 forAll(localSum, localRegionI)
252 label globalRegionI = localToGlobalRegion[localRegionI];
253 globalSum.insert(globalRegionI, localSum[localRegionI]);
259 forAll(localToGlobalRegion, localRegionI)
261 label globalRegionI = localToGlobalRegion[localRegionI];
262 localRegionNormals[localRegionI] = globalSum[globalRegionI];
264 localRegionNormals /=
mag(localRegionNormals);
270 forAll(firstDisp, regionI)
273 const point& regionPt = extrudedPatch_.points()
275 extrudedPatch_.meshPoints()
277 localRegionPoints[regionI]
280 const vector&
n = localRegionNormals[regionI];
281 firstDisp[regionI] = model_()(regionPt,
n, 1) - regionPt;
284 const label nNewPatches = regionPatches.size();
287 createShellMesh extruder
294 this->removeFvBoundary();
297 forAll(regionPatches, patchi)
302 regionPatches[patchi].clone(this->boundaryMesh())
305 this->addFvPatches(newRegionPatches,
true);
313 forAll(edgePatches, edgeI)
315 const labelList& eFaces = extrudedPatch_.edgeFaces()[edgeI];
317 if (eFaces.size() != 2 || nonManifoldEdge.test(edgeI))
319 edgePatches[edgeI].
setSize(eFaces.size(), sidePatchID);
323 polyTopoChange meshMod(nNewPatches);
325 extruder.setRefinement
328 model_().expansionRatio(),
330 labelList(extrudedPatch_.size(), topPatchID),
331 labelList(extrudedPatch_.size(), bottomPatchID),
336 autoPtr<mapPolyMesh> map = meshMod.changeMesh
343 extruder.updateMesh(map());
345 this->setInstance(this->thisDb().time().
constant());
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Unit conversion functions.
wordList patchTypes(nPatches)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Mesh at a patch created on the fly. The following entry should be used on the field boundary dictiona...
List< labelList > labelListList
List of labelList.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
#define forAll(list, i)
Loop across all elements in list.
dictionary()
Default construct, a top-level empty dictionary.
List< face > faceList
List of faces.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
A class for handling words, derived from Foam::string.
wordList patchNames(nPatches)
static void mapCombineReduce(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::mapReduce with an in-place cop.
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const bitSet &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
defineTypeNameAndDebug(combustionModel, 0)
static autoPtr< extrudeModel > New(const dictionary &dict)
Select null constructed.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
Expression::UniformListWrap< scalar > constant
Wrap of constant as a list expression.
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
vector point
Point is a vector.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
const std::string patch
OpenFOAM patch number as a std::string.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
List< label > labelList
A List of labels.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
void setSize(label n)
Alias for resize()
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)