createBlockMesh.H
Go to the documentation of this file.
1const cellModel& hex = cellModel::ref(cellModel::HEX);
2
3cellShapeList cellShapes;
4faceListList boundary;
5pointField points;
6{
7 Info<< "Creating block" << endl;
8
9 block b
10 (
11 cellShape(hex, identity(8)),
12 pointField
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 ),
27 N
28 );
29
30 Info<< "Creating cells" << endl;
31 cellShapes = b.shapes();
32
33 Info<< "Creating boundary faces" << endl;
34
35 boundary.setSize(b.boundaryPatches().size());
36 forAll(boundary, patchi)
37 {
38 faceList faces(b.boundaryPatches()[patchi].size());
39 forAll(faces, facei)
40 {
41 faces[facei] = face(b.boundaryPatches()[patchi][facei]);
42 }
43 boundary[patchi].transfer(faces);
44 }
45
46 points.transfer(const_cast<pointField&>(b.points()));
47}
48
49Info<< "Creating patch dictionaries" << endl;
51forAll(patchNames, patchi)
52{
53 patchNames[patchi] = polyPatch::defaultName(patchi);
54}
55
56PtrList<dictionary> boundaryDicts(boundary.size());
58{
59 boundaryDicts.set(patchi, new dictionary());
60 dictionary& patchDict = boundaryDicts[patchi];
61 word nbrPatchName;
62 if (patchi % 2 == 0)
63 {
64 nbrPatchName = polyPatch::defaultName(patchi + 1);
65 }
66 else
67 {
68 nbrPatchName = polyPatch::defaultName(patchi - 1);
69 }
70
71 patchDict.add("type", cyclicPolyPatch::typeName);
72 patchDict.add("neighbourPatch", nbrPatchName);
73}
74
75Info<< "Creating polyMesh" << endl;
76polyMesh mesh
77(
78 IOobject
79 (
80 polyMesh::defaultRegion,
81 runTime.constant(),
82 runTime,
83 IOobject::NO_READ
84 ),
85 std::move(points),
90 "defaultFaces",
91 cyclicPolyPatch::typeName,
92 false
93);
94
95Info<< "Writing polyMesh" << endl;
96mesh.write();
const cellModel & hex
pointField points
Info<< "Creating cells"<< endl;cellShapes=b.shapes();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())
cellShapeList cellShapes
faceListList boundary
dynamicFvMesh & mesh
engineTime & runTime
List< word > wordList
A List of words.
Definition: fileName.H:63
PtrList< blockFace > blockFaceList
A PtrList of blockFaces.
Definition: blockFaceList.H:47
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
Definition: blockEdgeList.H:47
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
wordList patchNames(nPatches)
volScalarField & b
Definition: createFields.H:27
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
const vector L(dict.get< vector >("L"))
const Vector< label > N(dict.get< Vector< label > >("N"))