createBlockMesh.H
Go to the documentation of this file.
1 const cellModel& hex = cellModel::ref(cellModel::HEX);
2 
6 {
7  Info<< "Creating block" << endl;
8 
9  block b
10  (
11  cellShape(hex, identity(8), false),
13  (
14  {
15  point(0, 0, 0),
16  point(L.x(), 0, 0),
17  point(L.x(), L.y(), 0),
18  point(0, L.y(), 0),
19  point(0, 0, L.z()),
20  point(L.x(), 0, L.z()),
21  point(L.x(), L.y(), L.z()),
22  point(0, L.y(), L.z())
23  }
24  ),
25  blockEdgeList(),
26  blockFaceList(),
27  N,
28  List<gradingDescriptors>(12)
29  );
30 
31  Info<< "Creating cells" << endl;
32 
33  List<FixedList<label, 8>> bCells(b.cells());
34  cellShapes.setSize(bCells.size());
36  {
37  cellShapes[celli] =
38  cellShape(hex, labelList(bCells[celli]), false);
39  }
40 
41  Info<< "Creating boundary faces" << endl;
42 
43  boundary.setSize(b.boundaryPatches().size());
44  forAll(boundary, patchi)
45  {
46  faceList faces(b.boundaryPatches()[patchi].size());
47  forAll(faces, facei)
48  {
49  faces[facei] = face(b.boundaryPatches()[patchi][facei]);
50  }
51  boundary[patchi].transfer(faces);
52  }
53 
54  points.transfer(const_cast<pointField&>(b.points()));
55 }
56 
57 Info<< "Creating patch dictionaries" << endl;
59 forAll(patchNames, patchi)
60 {
61  patchNames[patchi] = polyPatch::defaultName(patchi);
62 }
63 
64 PtrList<dictionary> boundaryDicts(boundary.size());
66 {
67  boundaryDicts.set(patchi, new dictionary());
68  dictionary& patchDict = boundaryDicts[patchi];
69  word nbrPatchName;
70  if (patchi % 2 == 0)
71  {
72  nbrPatchName = polyPatch::defaultName(patchi + 1);
73  }
74  else
75  {
76  nbrPatchName = polyPatch::defaultName(patchi - 1);
77  }
78 
79  patchDict.add("type", cyclicPolyPatch::typeName);
80  patchDict.add("neighbourPatch", nbrPatchName);
81 }
82 
83 Info<< "Creating polyMesh" << endl;
84 polyMesh mesh
85 (
86  IOobject
87  (
88  polyMesh::defaultRegion,
89  runTime.constant(),
90  runTime,
91  IOobject::NO_READ
92  ),
93  std::move(points),
94  cellShapes,
95  boundary,
96  patchNames,
98  "defaultFaces",
99  cyclicPolyPatch::typeName,
100  false
101 );
102 
103 Info<< "Writing polyMesh" << endl;
104 mesh.write();
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
hex
const cellModel & hex
Definition: createBlockMesh.H:1
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
runTime
engineTime & runTime
Definition: createEngineTime.H:13
L
const vector L(dict.get< vector >("L"))
points
pointField points
Definition: createBlockMesh.H:5
Foam::cellShapeList
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Definition: cellShapeList.H:45
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
ref
rDeltaT ref()
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
Foam::blockEdgeList
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
Definition: blockEdgeList.H:47
boundaryDicts
Info<< "Creating boundary faces"<< endl;boundary.setSize(b.boundaryPatches().size());forAll(boundary, patchi) { faceList faces(b.boundaryPatches()[patchi].size());forAll(faces, facei) { faces[facei]=face(b.boundaryPatches()[patchi][facei]);} boundary[patchi].transfer(faces);} points.transfer(const_cast< pointField & >b.points()));}Info<< "Creating patch dictionaries"<< endl;wordList patchNames(boundary.size());forAll(patchNames, patchi){ patchNames[patchi]=polyPatch::defaultName(patchi);}PtrList< dictionary > boundaryDicts(boundary.size())
Definition: createBlockMesh.H:64
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
patchNames
wordList patchNames(nPatches)
Foam::defaultName
static const word defaultName("coeffs")
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::blockFaceList
PtrList< blockFace > blockFaceList
A PtrList of blockFaces.
Definition: blockFaceList.H:47
Foam::faceListList
List< faceList > faceListList
A List of faceList.
Definition: faceListFwd.H:49
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
bCells
Info<< "Creating cells"<< endl;List< FixedList< label, 8 > > bCells(b.cells())
b
block b(cellShape(hex, identity(8), false), pointField({ point(0, 0, 0), point(L.x(), 0, 0), point(L.x(), L.y(), 0), point(0, L.y(), 0), point(0, 0, L.z()), point(L.x(), 0, L.z()), point(L.x(), L.y(), L.z()), point(0, L.y(), L.z()) }), blockEdgeList(), blockFaceList(), N, List< gradingDescriptors >(12))
cellShapes
cellShapeList cellShapes
Definition: createBlockMesh.H:3
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Foam::point
vector point
Point is a vector.
Definition: point.H:43
forAll
forAll(cellShapes, celli)
Definition: createBlockMesh.H:35
boundary
faceListList boundary
Definition: createBlockMesh.H:4