OpenFOAM-topoSet

参考

OF版本:(Waller)OpenFOAM v6

topoSet

doxygen手册中的定义:

General set of labels of mesh quantity (points, cells, faces).

即 网格数量(点、单元、面)的常规标签集。

topoSetDict

对应的字典配置文件:topoSetDict。以$FOAM_ETC/caseDicts/mesh/manipulation/refineRegion/topoSetDict为例:

1
2
3
4
5
6
7
8
9
10
11
12
13
17 actions
18 (
19 {
20 name c0; // 集合的名称
21 type cellSet; // 集合的类型
22 action new; // 作用在集合上的动作
23 source boxToCell;
24 sourceInfo
25 {
26 box (-1 -1 -1) (1 1 1); // Edit box bounds as required
27 }
28 }
29 );

可以看出,相关操作都放到actions(...)中。
相关参数的具体信息可以参考字典文件:/opt/openfoam6/etc/caseDicts/annotated/topoSetDict
name为集合的名称;
type为集合的类型;
action为作用到集合上的动作,可以分为需要source不需要source

  • require source: clear/invert/remove
    • clear 清除set或zone
    • invert 选择所有当前没有被选择的部分
    • remove 移除set或zone
  • require source: new/add/delete/subset
    • new 从source创建新的set或zone
    • add 将source添加到当前内容中
    • delete 从当前内容中删除source
    • subset 保留既在当前内容中,也在source中的部分(交集)

source

source的内容根据set类型的不同而有所不同。

cellSet

labelToCell

通过显式地指定网格的label来选择

1
2
3
4
5
6
// Select by explicitly providing cell labels
source labelToCell;
sourceInfo
{
value (12 13 56); // labels of cells
}

cellToCell

从cellSet复制

1
2
3
4
5
6
// Copy elements from cellSet
source cellToCell;
sourceInfo
{
set c1;
}

zoneToCell

在网格zone中的网格

1
2
3
4
5
6
7
// Cells in cell zone
source zoneToCell;
sourceInfo
{
name ".*Zone"; // Name of cellZone, regular expressions allowed
}

faceZoneToCell

选择faceZone中的master或slave网格

1
2
3
4
5
6
7
// Cells on master or slave side of faceZone
source faceZoneToCell;
sourceInfo
{
name ".*Zone"; // Name of faceZone, regular expressions allowed
option master; // master/slave
}

faceToCell

基于faceSet选择

1
2
3
4
5
6
7
8
9
10
11
// Select based on faceSet
source faceToCell;
sourceInfo
{
set f0; // Name of faceSet

// option neighbour; // cell with neighbour in faceSet
// option owner; // ,, owner
option any; // cell with any face in faceSet
// option all; // cell with all faces in faceSet
}

pointToCell

基于pointSet选择

1
2
3
4
5
6
7
8
// Select based on pointSet
source pointToCell;
sourceInfo
{
set p0;
option any; // cell with any point in pointSet
// option edge; // cell with an edge with both points in pointSet
}

shapeToCell

基于cellShape选择

1
2
3
4
5
6
// Select based on cellShape
source shapeToCell;
sourceInfo
{
type hex; // hex/wedge/prism/pyr/tet/tetWedge/splitHex
}

boxToCell

选择网格中心在box或多个boxs内的网格

1
2
3
4
5
6
7
// Cells with cell centre within box ('box') or multiple boxes ('boxes')
source boxToCell;
sourceInfo
{
box (0 0 0) (1 1 1);
// boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11));
}

rotatedBoxToCell

选择网格中心在box内的网格:指定原点和三个方向

1
2
3
4
5
6
7
8
9
10
// Cells with cell centre within box
// Is skewed, rotated box. Given as origin and three spanning vectors.
source rotatedBoxToCell;
sourceInfo
{
origin (0.2 0.2 -10);
i (0.2 0.2 0);
j (-0.2 0.2 0);
k (10 10 10);
}

cylinderToCell

选择网格网格中心在圆柱内的网格

1
2
3
4
5
6
7
8
9
// Cells with centre within cylinder
source cylinderToCell;
sourceInfo
{
p1 (0.2 0.2 -10); // start point on cylinder axis
p2 (0.2 0.2 0); // end point on cylinder axis
radius 5.0;
}

sphereToCell

选择网格中心在球内的网格

1
2
3
4
5
6
7
// Cells with centre within sphere
source sphereToCell;
sourceInfo
{
centre (0.2 0.2 -10);
radius 5.0;
}

nearestToCell

选择距离坐标点最近的网格

1
2
3
4
5
6
// Cells with cellCentre nearest to coordinates
source nearestToCell;
sourceInfo
{
points ((0 0 0) (1 1 1)(2 2 2));
}

surfaceToCell

基于面选择网格

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Select based on surface
source surfaceToCell;
sourceInfo
{
file "www.avl.com-geometry.stl";
useSurfaceOrientation false; // use closed surface inside/outside
// test (ignores includeCut,
// outsidePoints)
outsidePoints ((-99 -99 -59)); // definition of outside
includeCut false; // cells cut by surface
includeInside false; // cells not on outside of surf
includeOutside false; // cells on outside of surf
nearDistance -1; // cells with centre near surf
// (set to -1 if not used)
curvature 0.9; // cells within nearDistance
// and near surf curvature
// (set to -100 if not used)
}

fieldToCell

选择场值在特定范围的网格

1
2
3
4
5
6
7
8
// values of field within certain range
source fieldToCell;
sourceInfo
{
fieldName U; // Note: uses mag(U) since volVectorField
min 0.1;
max 0.5;
}

regionToCell

网格区域

1
2
3
4
5
6
7
8
9
// Mesh region (non-face connected part of (subset of)mesh)
source regionToCell;
sourceInfo
{
set c0; // optional name of cellSet giving mesh subset
insidePoints ((1 2 3)); // points inside region to select
nErode 0; // optional number of layers to erode
// selection
}

targetVolumeToCell

指定目标体积

1
2
3
4
5
6
7
8
// Cells underneath plane such that volume is reached. E.g. for use
// in setFields to set the level given a wanted volume.
source targetVolumeToCell;
sourceInfo
{
volume 2e-05;
normal (0 1 0); // usually in direction of gravity
}

faceSet

faceToFace

1
2
3
4
5
6
// Copy elements from faceSet
source faceToFace;
sourceInfo
{
set f1;
}

cellToFace

1
2
3
4
5
6
7
8
// Select based on cellSet
source cellToFace;
sourceInfo
{
set c0;
option all; // All faces of cells
// option both; // Only faces whose owner&neighbour are in cellSet
}

pointToFace

1
2
3
4
5
6
7
8
9
// Select based on pointSet
source pointToFace;
sourceInfo
{
set p0;
option any; // Faces using any point in pointSet
// option all // Faces with all points in pointSet
// option edge // Faces with two consecutive points in pointSet
}

labelToFace

1
2
3
4
5
6
//  Select by explicitly providing face labels
source labelToFace;
sourceInfo
{
value (12 13 56); // labels of faces
}

patchToFace

1
2
3
4
5
6
7
// All faces of patch
source patchToFace;
sourceInfo
{
name ".*Wall"; // Name of patch or patch group,
// (regular expressions allowed)
}

boundaryToFace

1
2
3
4
5
// All boundary faces
source boundaryToFace;
sourceInfo
{
}

zoneToFace

1
2
3
4
5
6
// All faces of faceZone
source zoneToFace;
sourceInfo
{
name ".*Zone1"; // Name of faceZone, regular expressions allowed
}

boxToFace

1
2
3
4
5
6
7
// Faces with face centre within box ('box') or multiple boxes ('boxes')
source boxToFace;
sourceInfo
{
box (0 0 0) (1 1 1);
// boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11));
}

normalToFace

1
2
3
4
5
6
7
// Faces with normal to within certain angle aligned with vector.
source normalToFace;
sourceInfo
{
normal (0 0 1); // Vector
cos 0.01; // Tolerance (max cos of angle)
}

regionToFace

1
2
3
4
5
6
7
// Walk on faces in faceSet, starting from face nearest given position
source regionToFace;
sourceInfo
{
set f0;
nearPoint (0.1 0.1 0.005);
}

pointSet

pointToPoint

1
2
3
4
5
6
// Copy elements from pointSet
source pointToPoint;
sourceInfo
{
set p1;
}

cellToPoint

1
2
3
4
5
6
7
// Select based on cellSet
source cellToPoint;
sourceInfo
{
set c0;
option all; // all points of cell
}

faceToPoint

1
2
3
4
5
6
7
// Select based on faceSet
source faceToPoint;
sourceInfo
{
set f0; // name of faceSet
option all; // all points of face
}

labelToPoint

1
2
3
4
5
6
// Select by explicitly providing point labels
source labelToPoint;
sourceInfo
{
value (12 13 56); // labels of points
}

zoneToPoint

1
2
3
4
5
6
// All points in pointzone
source zoneToPoint;
sourceInfo
{
name ".*Zone"; // name of pointZone, regular expressions allowed
}

nearestToPoint

1
2
3
4
5
6
// Points nearest to coordinates
source nearestToPoint;
sourceInfo
{
points ((0 0 0) (1 1 1));
}

boxToPoint

1
2
3
4
5
6
7
// Points with coordinate within box ('box') or multiple boxes ('boxes')
source boxToPoint;
sourceInfo
{
box (0 0 0) (1 1 1);
// boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11));
}

surfaceToPoint

1
2
3
4
5
6
7
8
9
10
11
// Select based on surface
source surfaceToPoint;
sourceInfo
{
file "www.avl.com-geometry.stl";
nearDistance 0.1; // points near to surface
includeInside false; // points on inside of surface
// (requires closed surface with consistent
// normals)
includeOutside false; // ,, outside ,,
}

cellZoneSet

Manipulates a cellZone (as well as a cellSet)
Takes any cellSet source. The difference with a cellSet is

  • reads the cells from the cellZone, not the cellSet
  • write to the cellZone as well as the cellSet

For backwards compatibility:

1
2
3
4
5
6
// Select based on cellSet
source setToCellZone;
sourceInfo
{
set c0; // name of cellSet
}

faceZoneSet

Manipulates a faceZone (as well as a faceSet). It can only be used with two special sources:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Select based on faceSet without orientation
source setToFaceZone;
sourceInfo
{
faceSet f0; // name of faceSet
}

// Select based on faceSet, using cellSet to determine orientation
source setsToFaceZone;
sourceInfo
{
faceSet f0; // name of faceSet
cellSet c0; // name of cellSet of slave side
flip false; // optional: flip the faceZone (so now the cellSet
// is the master side)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Select based on surface. Orientation from normals on surface
{
name fz0;
type faceZoneSet;
action new;
source searchableSurfaceToFaceZone;
sourceInfo
{
surface searchableSphere;
centre (0.05 0.05 0.005);
radius 0.025;
// name sphere.stl; // Optional name if surface triSurfaceMesh
}
}

pointZoneSet

Manipulates a pointZone (as well as a pointSet)
Takes any pointSet source. The difference with a pointSet is

  • reads the cells from the pointZone, not the pointSet
  • write to the pointZone as well as the pointSet

For backwards compatibility:

1
2
3
4
5
6
// Select based on pointSet
source setToPointZone;
sourceInfo
{
set p0; // name of pointSet
}

参数列表

相关参数可用的值可以通过banana method得知:

  • type关键字可用的值为:
    1
    2
    3
    4
    5
    6
    cellSet
    cellZoneSet
    faceSet
    faceZoneSet
    pointSet
    pointZoneSet
  • action关键字可用的值为:
    1
    2
    3
    4
    5
    6
    7
    8
    clear
    invert
    remove
    list
    subset
    new
    delete
    add
  • source关键字可用的值为:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    boundaryToFace
    boxToCell
    boxToFace
    boxToPoint
    cellToCell
    cellToFace
    cellToPoint
    cylinderAnnulusToCell
    cylinderAnnulusToFace
    cylinderToCell
    cylinderToFace
    faceToCell
    faceToFace
    faceToPoint
    faceZoneToCell
    faceZoneToFaceZone
    fieldToCell
    labelToCell
    labelToFace
    labelToPoint
    nbrToCell
    nearestToCell
    nearestToPoint
    normalToFace
    patchToFace
    pointToCell
    pointToFace
    pointToPoint
    regionToCell
    regionToFace
    rotatedBoxToCell
    searchableSurfaceToFaceZone
    setAndNormalToFaceZone
    setToCellZone
    setToFaceZone
    setToPointZone
    setsToFaceZone
    shapeToCell
    sphereToCell
    surfaceToCell
    surfaceToPoint
    targetVolumeToCell
    zoneToCell
    zoneToFace
    zoneToPoint