addPatchCellLayer Class Reference

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

Public Member Functions

 ClassName ("addPatchCellLayer")
 Runtime type information. More...
 
 addPatchCellLayer (const polyMesh &, const bool addToMesh=true)
 Construct from mesh. More...
 
const labelListListaddedPoints () const
 Added points per patch point. More...
 
const labelListListlayerFaces () const
 Layer faces per patch face. See above. More...
 
labelListList addedCells () const
 Added cells given current mesh & layerfaces. More...
 
void setRefinement (const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, 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. More...
 
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. More...
 
void updateMesh (const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
 Update any locally stored mesh information. Gets additional. More...
 

Static Public Member Functions

static labelListList addedCells (const polyMesh &, const labelListList &layerFaces)
 Helper: get added cells per patch face. More...
 
static labelListList globalEdgeFaces (const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
 Per patch edge the pp faces (in global indices) using it. More...
 
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: More...
 

Detailed Description

Adds layers of cells to outside of polyPatch. 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
    +------+------+

    Becomes:

       a      b         <- patch of boundary face
    +------+------+
    +      +------+
    +------+------+
    +------+------+
    |      |      |     <- original cells
    +------+------+
  • added faces get same patchID as face they are extruded from
  • '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
    +------+------+------+


           ^      ^           <- 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 128 of file addPatchCellLayer.H.

Constructor & Destructor Documentation

◆ addPatchCellLayer()

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

Construct from mesh.

Definition at line 599 of file addPatchCellLayer.C.

Member Function Documentation

◆ ClassName()

ClassName ( "addPatchCellLayer"  )

Runtime type information.

◆ addedPoints()

const labelListList& addedPoints ( ) const
inline

Added points per patch point.

Definition at line 307 of file addPatchCellLayer.H.

◆ layerFaces()

const labelListList& layerFaces ( ) const
inline

Layer faces per patch face. See above.

Definition at line 313 of file addPatchCellLayer.H.

◆ 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. Last element is the top cells (i.e. the boundary cell)

Definition at line 614 of file addPatchCellLayer.C.

References polyMesh::faceNeighbour(), forAll, mesh, and List< T >::setSize().

Here is the call graph for this function:

◆ addedCells() [2/2]

Foam::labelListList addedCells ( ) const

Added cells given current mesh & layerfaces.

Definition at line 640 of file addPatchCellLayer.C.

◆ globalEdgeFaces()

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 647 of file addPatchCellLayer.C.

References PrimitivePatch< FaceList, PointField >::edgeFaces(), primitiveMesh::edges(), forAll, mesh, PrimitivePatch< FaceList, PointField >::meshEdges(), primitiveMesh::nEdges(), primitiveMesh::pointEdges(), List< T >::setSize(), syncTools::syncEdgeList(), and globalIndex::toGlobal().

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

Here is the call graph for this function:
Here is the caller 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 1090 of file addPatchCellLayer.C.

References polyMesh::boundaryMesh(), globalMeshData::coupledPatch(), Foam::expressions::patchExpr::debug, Foam::constant::electromagnetic::e, PrimitivePatch< FaceList, PointField >::edgeFaces(), primitiveMesh::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), primitiveMesh::edges(), Foam::endl(), forAll, found, polyMesh::globalData(), globalMeshData::globalEdgeSlaves(), globalMeshData::globalEdgeSlavesMap(), globalMeshData::globalEdgeTransformedSlaves(), globalMeshData::globalTransforms(), primitiveMesh::isInternalFace(), globalIndex::isLocal(), k, PatchTools::matchEdges(), mesh, PrimitivePatch< FaceList, PointField >::meshEdges(), PrimitivePatch< FaceList, PointField >::meshPoints(), UPstream::myProcNo(), PrimitivePatch< FaceList, PointField >::nEdges(), nPatches, UPstream::parRun(), patches, primitiveMesh::pointEdges(), PrimitivePatch< FaceList, PointField >::points(), ProcessorTopology< Container, ProcPatch >::procPatchMap(), List< T >::setSize(), globalMeshData::syncData(), globalIndex::toLocal(), WarningInFunction, polyBoundaryMesh::whichPatch(), and globalIndex::whichProcID().

Here is the call graph for this function:

◆ setRefinement() [1/2]

void setRefinement ( const globalIndex globalFaces,
const labelListList globalEdgeFaces,
const scalarField expansionRatio,
const indirectPrimitivePatch pp,
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 1418 of file addPatchCellLayer.C.

References Foam::abort(), Foam::expressions::patchExpr::debug, Foam::constant::electromagnetic::e, PrimitivePatch< FaceList, PointField >::edgeFaces(), PrimitivePatch< FaceList, PointField >::edges(), Foam::endl(), f(), PrimitivePatch< FaceList, PointField >::faceEdges(), Foam::FatalError, FatalErrorInFunction, faceZone::flipMap(), forAll, forAllReverse, Foam::gMax(), PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), VectorSpace< Vector< scalar >, scalar, 3 >::max, Foam::max(), PrimitivePatch< FaceList, PointField >::meshEdges(), PrimitivePatch< FaceList, PointField >::meshPoints(), n, PrimitivePatch< FaceList, PointField >::nEdges(), PrimitivePatch< FaceList, PointField >::nInternalEdges(), Foam::nl, PrimitivePatch< FaceList, PointField >::nPoints(), patches, patchID, PrimitivePatch< FaceList, PointField >::points(), polyTopoChange::points(), Foam::Pout, polyTopoChange::setAction(), List< T >::setSize(), syncTools::syncEdgeList(), syncTools::syncPointList(), globalIndex::toGlobal(), faceZone::whichFace(), polyBoundaryMesh::whichPatch(), and Foam::Zero.

Referenced by snappyLayerDriver::addLayers(), and addPatchCellLayer::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 417 of file addPatchCellLayer.H.

References addPatchCellLayer::globalEdgeFaces(), PrimitivePatch< FaceList, PointField >::nEdges(), PrimitivePatch< FaceList, PointField >::nPoints(), and addPatchCellLayer::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 2379 of file addPatchCellLayer.C.

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

Referenced by snappyLayerDriver::addLayers().

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: