Loading...
Searching...
No Matches
createBlockMesh.H
Go to the documentation of this file.
1cellShapeList cellShapes;
2faceListList boundary;
3pointField points;
4{
5 Info<< "Creating block" << endl;
6
7 block b
8 (
9 cellShape(cellModel::HEX, identity(8)),
10 pointField(boundBox(point::zero, L).hexCorners()),
11 blockEdgeList(),
12 blockFaceList(),
13 N
14 );
15
16 Info<< "Creating cells" << endl;
17 cellShapes = b.shapes();
18
19 Info<< "Creating boundary faces" << endl;
20
21 boundary.setSize(b.boundaryPatches().size());
22 forAll(boundary, patchi)
23 {
24 faceList faces(b.boundaryPatches()[patchi].size());
25 forAll(faces, facei)
26 {
27 faces[facei] = face(b.boundaryPatches()[patchi][facei]);
28 }
29 boundary[patchi].transfer(faces);
30 }
31
32 points.transfer(const_cast<pointField&>(b.points()));
33}
34
35Info<< "Creating patch dictionaries" << endl;
37forAll(patchNames, patchi)
38{
39 patchNames[patchi] = polyPatch::defaultName(patchi);
40}
41
42PtrList<dictionary> boundaryDicts(boundary.size());
44{
45 boundaryDicts.set(patchi, new dictionary());
46 dictionary& patchDict = boundaryDicts[patchi];
47 word nbrPatchName;
48 if (patchi % 2 == 0)
49 {
50 nbrPatchName = polyPatch::defaultName(patchi + 1);
51 }
52 else
53 {
54 nbrPatchName = polyPatch::defaultName(patchi - 1);
55 }
56
57 patchDict.add("type", cyclicPolyPatch::typeName);
58 patchDict.add("neighbourPatch", nbrPatchName);
59}
60
61Info<< "Creating polyMesh" << endl;
62polyMesh mesh
63(
64 IOobject
65 (
66 polyMesh::defaultRegion,
67 runTime.constant(),
68 runTime,
69 IOobject::NO_READ
70 ),
71 std::move(points),
76 "defaultFaces",
77 cyclicPolyPatch::typeName,
78 false
79);
80
81Info<< "Writing polyMesh" << endl;
82mesh.write();
cellShapeList cellShapes
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())
faceListList boundary
dynamicFvMesh & mesh
engineTime & runTime
const pointField & points
List< word > wordList
List of word.
Definition fileName.H:60
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
vectorField pointField
pointField is a vectorField.
wordList patchNames(nPatches)
volScalarField & b
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
const vector L(dict.get< vector >("L"))
const Vector< label > N(dict.get< Vector< label > >("N"))