Loading...
Searching...
No Matches
addPatchCellLayer Class Reference

Adds layers of cells to outside (or inside) of polyMesh. Can optionally create stand-alone extruded mesh (addToMesh=false). More...

#include <addPatchCellLayer.H>

Public Member Functions

 ClassName ("addPatchCellLayer")
 Runtime type information.
 addPatchCellLayer (const polyMesh &, const bool addToMesh=true, const bool extrude=true)
 Construct from mesh.
const labelListListaddedPoints () const
 Added points per patch point.
const labelListListlayerFaces () const
 Layer faces per patch face. See above.
labelListList addedCells () const
 Added cells given current mesh & layerfaces.
void setRefinement (const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const bitSet &flip, const labelList &sidePatchID, const labelList &sideZoneID, const boolList &sideFlip, const labelList &inflateFaceID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
 Play commands into polyTopoChange to create layers on top.
void setRefinement (const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const label nLayers, const indirectPrimitivePatch &pp, const labelList &sidePatchID, const vectorField &overallDisplacement, polyTopoChange &meshMod)
 Add with constant expansion ratio and same nLayers everywhere.
void updateMesh (const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
 Update any locally stored mesh information. Gets additional.

Static Public Member Functions

static labelListList addedCells (const polyMesh &, const labelListList &layerFaces)
 Helper: get added cells per patch face.
static labelListList globalEdgeFaces (const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp, const bitSet &orientation)
 Per patch edge the pp faces (in global indices) using it.
static labelListList globalEdgeFaces (const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
 Per patch edge the pp faces (in global indices) using it.
static void calcExtrudeInfo (const bool zoneFromAnyFace, const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
 Determine extrude information per patch edge:
static void findDuplicatedPoints (const polyMesh &mesh, const indirectPrimitivePatch &pp, const bitSet &ppFlip, const bitSet &isBlockedFace, const bitSet &isDupPatchPoint, const bool extrude, faceList &isDupMeshPoint)
 Helper: given patch and points on patch that are extruded.

Detailed Description

Adds layers of cells to outside (or inside) of polyMesh. Can optionally create stand-alone extruded mesh (addToMesh=false).

Call setRefinement with offset vector for every patch point and number of layers per patch face and number of layers per patch point.

  • offset vector should be zero for any non-manifold point and synchronised on coupled points before calling this.
  • offset vector of zero will not add any points.
  • gets supplied the number of extruded layers both per face and per point. Usually the point nlayers is the max of surrounding face nlayers.

    point nlayers:

    • 0 : no extrusion. Any surrounding face being extruded becomes 'prism'
    • >0 : should be max of surrounding face nlayers.
  • differing face nlayers: 'termination' : (e.g. from 2 to 4 layers) match at original patch face side.

    E.g. 2 boundary faces on patches a,b. 2 layers for a, 3 for b.

    Was:

           a      b         <- patch of boundary face
        +------+------+
        |      |      |     <- original cells
        +------+------+

    Extrusion:


                        added   added
                        face    cell
                        ----    ----
           a      b                     <- patch of boundary face
        +------+------+  3
        |      |      |         2
        +      +------+  2
        |      |      |         1
        +------+------+  1
        |      |      |         0
        +------+------+  0              <- original boundary faces
        |      |      |                 <- original cells
        +------+------+



    Intrusion:

                        face    cell
                        ----    ----
           a      b                     <- patch of boundary face
        +------+------+  0
        |      |      |         0
        +------+------+  1
        |      |      |         1
        +      +------+  2
        |      |      |         2
        +------+------+  3
        |      |      |                 <- original cells
        +------+------+
  • 'side' faces (i.e. on the edge of pp) get the patchID/zoneID of the other patch/zone they are connected to (hopefully only 1)

E.g. 3 boundary faces on patches a,b. b gets extruded, a doesn't.

       a      b      b        <- patch of boundary face
    +------+------+------+
    |      |      |      |
    |      |      |      |    <- cells
    |      |      |      |
    +------+------+------+


    (shown for extrusion mode only):


           ^      ^           <- wanted extrusion vector (none at far right)
       a   |  b   |  b        <- patch of boundary face
    +------+------+------+
    |      |      |      |    <- cells
    +------+------+------+

              b
           +------+\ b        1. prism cell added onto second b face since
       a  a|      | ----\          only one side gets extruded.
    +------+------+------+    2. side-face gets patch a, not b.
    |      |      |      |
    +------+------+------+
Source files

Definition at line 152 of file addPatchCellLayer.H.

Constructor & Destructor Documentation

◆ addPatchCellLayer()

addPatchCellLayer ( const polyMesh & mesh,
const bool addToMesh = true,
const bool extrude = true )
explicit

Construct from mesh.

Definition at line 612 of file addPatchCellLayer.C.

References mesh.

Member Function Documentation

◆ ClassName()

ClassName ( "addPatchCellLayer" )

Runtime type information.

◆ addedPoints()

const labelListList & addedPoints ( ) const
inline

Added points per patch point.

Definition at line 359 of file addPatchCellLayer.H.

◆ layerFaces()

const labelListList & layerFaces ( ) const
inline

Layer faces per patch face. See above.

Definition at line 367 of file addPatchCellLayer.H.

Referenced by addedCells().

Here is the caller graph for this function:

◆ addedCells() [1/2]

Foam::labelListList addedCells ( const polyMesh & mesh,
const labelListList & layerFaces )
static

Helper: get added cells per patch face.

addedCells[patchFace] is list of cells added. extrude : first element : next to original cell last element : is the top cell (i.e. the boundary cell) intrude : first element : top cell last element : next to original cell

Definition at line 629 of file addPatchCellLayer.C.

References faceLabels(), forAll, layerFaces(), mesh, and List< T >::setSize().

Referenced by addedCells(), and setRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addedCells() [2/2]

Foam::labelListList addedCells ( ) const

Added cells given current mesh & layerfaces.

Definition at line 656 of file addPatchCellLayer.C.

References addedCells().

Here is the call graph for this function:

◆ globalEdgeFaces() [1/2]

Foam::labelListList globalEdgeFaces ( const polyMesh & mesh,
const globalIndex & globalFaces,
const indirectPrimitivePatch & pp,
const bitSet & orientation )
static

Per patch edge the pp faces (in global indices) using it.

Uses ListOps::uniqueEqOp to remove duplicates. On coupled faces only selects the one with the correct orientation/flip (assumes the orientation is opposite on a coupled face pair)

Definition at line 662 of file addPatchCellLayer.C.

References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), PackedList< Width >::empty(), forAll, globalEdgeFaces(), mesh, pp(), syncTools::syncEdgeList(), and globalIndex::toGlobal().

Referenced by snappyLayerDriver::addLayers(), snappyLayerDriver::addLayersSinglePass(), calcExtrudeInfo(), globalEdgeFaces(), globalEdgeFaces(), setRefinement(), and setRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalEdgeFaces() [2/2]

Foam::labelListList globalEdgeFaces ( const polyMesh & mesh,
const globalIndex & globalFaces,
const indirectPrimitivePatch & pp )
static

Per patch edge the pp faces (in global indices) using it.

Uses ListOps::uniqueEqOp to remove duplicates.

Definition at line 720 of file addPatchCellLayer.C.

References globalEdgeFaces(), mesh, bitSet::null(), and pp().

Here is the call graph for this function:

◆ calcExtrudeInfo()

void calcExtrudeInfo ( const bool zoneFromAnyFace,
const polyMesh & mesh,
const globalIndex & globalFaces,
const labelListList & globalEdgeFaces,
const indirectPrimitivePatch & pp,
labelList & edgePatchID,
label & nPatches,
Map< label > & nbrProcToPatch,
Map< label > & patchToNbrProc,
labelList & edgeZoneID,
boolList & edgeFlip,
labelList & inflateFaceID )
static

Determine extrude information per patch edge:

  • zoneID, zoneFlip : picks one of the faces that connects to the edge. For boundary edge only looks at boundary faces. For internal edge it looks at internal faces only (zoneFromAnyFace = false) or at any face (zoneFromAnyFace = true). zoneFlip is consistent with ordering of pp edge. Face selected gets stored in inflateFaceID
  • patchID : get patch from any boundary face connected to the edge. The patch might be a to-be-created processor patch (patchI >= mesh.boundaryMesh().size()) in which case the nbrProcToPatch, patchToNbrProc give the correspondence. nPatches is the new number of patches.

Definition at line 1138 of file addPatchCellLayer.C.

References HashTable< T, Key, Hash >::clear(), globalMeshData::coupledPatch(), e, Foam::endl(), forAll, globalEdgeFaces(), globalMeshData::globalEdgeSlaves(), globalMeshData::globalEdgeSlavesMap(), globalMeshData::globalEdgeTransformedSlaves(), globalMeshData::globalTransforms(), HashTable< T, Key, Hash >::insert(), globalIndex::isLocal(), k, HashTable< T, Key, Hash >::lookup(), PatchTools::matchEdges(), mesh, PrimitivePatch< FaceList, PointField >::nEdges(), nPatches, UPstream::parRun(), patches, pp(), processorTopology::procPatchLookup(), List< T >::setSize(), UList< T >::size(), globalMeshData::syncData(), globalIndex::toLocal(), globalMeshData::topology(), WarningInFunction, and globalIndex::whichProcID().

Referenced by snappyLayerDriver::determineSidePatches().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRefinement() [1/2]

void setRefinement ( const globalIndex & globalFaces,
const labelListList & globalEdgeFaces,
const scalarField & expansionRatio,
const indirectPrimitivePatch & pp,
const bitSet & flip,
const labelList & sidePatchID,
const labelList & sideZoneID,
const boolList & sideFlip,
const labelList & inflateFaceID,
const labelList & exposedPatchID,
const labelList & nFaceLayers,
const labelList & nPointLayers,
const vectorField & firstLayerDisp,
polyTopoChange & meshMod )

Play commands into polyTopoChange to create layers on top.

of indirectPrimitivePatch (have to be outside faces). Gets displacement per patch point.

  • exposedPatchID : only used if creating a new mesh (addToMesh=false) gives per pp face the patch the exposed face should get.
  • nPointLayers : number of layers per (patch)point.
  • nFaceLayers : number of layers per (patch) face.
  • firstDisplacement : displacement per point for first layer of points (i.e. nearest to original mesh). If zero do not add point. Layer thicknesses are calculated to constant geometric expansion. Use expansionRatio 1 for constant size. Sets addedPoints_ which is per pp point a list of points added. Note: firstDisplacement has to be parallel synchronised before calling this routine. Only if all procs sharing a point get a cell should firstDisplacement be <> 0 Note: cells get added from owner cells of patch faces (instead of e.g. from patch faces)

Definition at line 1468 of file addPatchCellLayer.C.

References Foam::abort(), addedCells(), bitSet::count(), e, UList< T >::empty(), Foam::endl(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, findDuplicatedPoints(), faceZone::flipMap(), forAll, forAllReverse, globalEdgeFaces(), Foam::gMax(), HashSet< Key, Hash >::insert(), isBlockedFace(), UList< T >::last(), Foam::mag(), Foam::max(), VectorSpace< Form, Cmpt, Ncmpts >::max, polyTopoChange::modifyFace(), polyTopoChange::modifyPoint(), n, Foam::nl, patches, patchID, polyTopoChange::points(), Foam::Pout, pp(), face::reverseFace(), bitSet::set(), polyTopoChange::setAction(), List< T >::setSize(), PackedList< Width >::size(), UList< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncEdgeList(), syncTools::syncPointList(), globalIndex::toGlobal(), bitSet::unset(), faceZone::whichFace(), Foam::Zero, and VectorSpace< Form, Cmpt, Ncmpts >::zero.

Referenced by snappyLayerDriver::addLayers(), and setRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRefinement() [2/2]

void setRefinement ( const globalIndex & globalFaces,
const labelListList & globalEdgeFaces,
const label nLayers,
const indirectPrimitivePatch & pp,
const labelList & sidePatchID,
const vectorField & overallDisplacement,
polyTopoChange & meshMod )
inline

Add with constant expansion ratio and same nLayers everywhere.

Definition at line 507 of file addPatchCellLayer.H.

References globalEdgeFaces(), pp(), and setRefinement().

Here is the call graph for this function:

◆ updateMesh()

void updateMesh ( const mapPolyMesh & morphMap,
const labelList & faceMap,
const labelList & pointMap )

Update any locally stored mesh information. Gets additional.

map from new to old patch (since patch needs to be recreated since has to be on outside).

Definition at line 3190 of file addPatchCellLayer.C.

References Foam::faceMap(), forAll, newPointi, mapPolyMesh::reverseFaceMap(), mapPolyMesh::reversePointMap(), List< T >::setSize(), and UList< T >::size().

Referenced by snappyLayerDriver::addLayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findDuplicatedPoints()

void findDuplicatedPoints ( const polyMesh & mesh,
const indirectPrimitivePatch & pp,
const bitSet & ppFlip,
const bitSet & isBlockedFace,
const bitSet & isDupPatchPoint,
const bool extrude,
faceList & isDupMeshPoint )
static

Helper: given patch and points on patch that are extruded.

(to slave side or master side) find the affected points. Calculates by walking across faces which vertices on which face are affected. isDupMeshPoint: -1 : unaffected >=0 : should use local duplicate of point (though it does not tell us whether it should use slave side or master side)

Definition at line 3253 of file addPatchCellLayer.C.

References HashTable< T, Key, Hash >::clear(), List< T >::clear(), bitSet::count(), Foam::endl(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, HashTable< T, Key, Hash >::find(), forAll, HashTable< T, Key, Hash >::insert(), isBlockedFace(), mesh, Foam::Pout, pp(), List< T >::resize_nocopy(), Foam::returnReduceOr(), bitSet::set(), List< T >::setSize(), PackedList< Width >::size(), and syncTools::syncBoundaryFaceList().

Referenced by setRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: