PDRblockBlockMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "PDRblock.H"
29 #include "ListOps.H"
30 #include "cellModeller.H"
31 #include "gradingDescriptors.H"
32 #include "objectRegistry.H"
33 #include "Time.H"
34 #include "IOdictionary.H"
35 #include "Fstream.H"
36 #include "OTstream.H"
37 #include "edgeHashes.H"
38 
39 #include "cellModel.H"
40 #include "blockMesh.H"
41 #include "polyMesh.H"
42 #include "searchableSphere.H"
43 
44 // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Name for the projection geometry
50 static const word projKeyword("project");
51 
52 // Name for the projection geometry
53 static const word projGeomName("sphere");
54 
55 
56 //- Calculate geometric ratio from relative ratio
57 inline scalar relativeToGeometricRatio
58 (
59  const scalar expRatio,
60  const label nDiv
61 )
62 {
63  return nDiv > 1 ? pow(expRatio, (nDiv - 1)) : 1.0;
64 }
65 
66 
67 // Output space-separated flat list. No size prefix.
68 template<class T>
69 static Ostream& outputFlatList(Ostream& os, const UList<T>& list)
70 {
71  os << token::BEGIN_LIST;
72  label i = 0;
73  for (const label val : list)
74  {
75  if (i++) os << token::SPACE;
76  os << val;
77  }
78  os << token::END_LIST;
79 
80  return os;
81 }
82 
83 
84 // Begin indent list
85 static inline Ostream& begIndentList(Ostream& os)
86 {
87  os << indent << incrIndent << token::BEGIN_LIST << nl;
88  return os;
89 }
90 
91 // End indent list
92 static inline Ostream& endIndentList(Ostream& os)
93 {
94  os << decrIndent << indent << token::END_LIST;
95  return os;
96 }
97 
98 
99 // Output list contents (newline separated) indented.
100 template<class T>
101 static Ostream& outputIndent(Ostream& os, const UList<T>& list)
102 {
103  for (const T& val : list)
104  {
105  os << indent << val << nl;
106  }
107  return os;
108 }
109 
110 
111 //
112 static Ostream& serializeHex
113 (
114  Ostream& os,
115  const labelUList& hexVerts,
116  const labelVector& hexCount,
117  const Vector<gradingDescriptors> hexGrade,
118  const word& zoneName = word::null
119 )
120 {
122  outputFlatList(os, hexVerts);
123 
124  if (!zoneName.empty())
125  {
126  os << token::SPACE << zoneName;
127  }
128 
129  os << token::SPACE << hexCount << nl
130  << indent << word("edgeGrading") << nl;
131 
132  begIndentList(os);
133 
134  // Grading (x/y/z)
135  for (const gradingDescriptors& gds : hexGrade)
136  {
137  begIndentList(os);
138  outputIndent(os, gds);
139  endIndentList(os) << nl;
140  }
141 
142  endIndentList(os) << nl;
143  return os;
144 }
145 
146 
147 // Generate list with entries:
148 //
149 // project (x y z) (geometry)
150 //
151 static Ostream& serializeProjectPoints
152 (
153  Ostream& os,
154  const UList<point>& list
155 )
156 {
157  for (const point& p : list)
158  {
159  os << indent << projKeyword << token::SPACE
160  << p
161  << token::SPACE
163  }
164 
165  return os;
166 }
167 
168 
169 // Generate entry:
170 //
171 // project (beg end) (geometry)
172 //
173 static Ostream& serializeProjectEdge
174 (
175  Ostream& os,
176  const edge& e
177 )
178 {
179  os << indent << projKeyword << token::SPACE;
180 
181  if (e.sorted())
182  {
183  os << e.first() << token::SPACE << e.second();
184  }
185  else
186  {
187  os << e.second() << token::SPACE << e.first();
188  }
189 
190  os << token::SPACE
192 
193  return os;
194 }
195 
196 
197 // Generate entry:
198 //
199 // (0 1 2 ..)
200 //
201 static Ostream& serializeFace
202 (
203  Ostream& os,
204  const face& list
205 )
206 {
207  os << indent;
208  outputFlatList(os, list);
209  os << nl;
210  return os;
211 }
212 
213 
214 // Generate entry:
215 //
216 // project (0 1 2 ..) geometry
217 //
218 static Ostream& serializeProjectFace
219 (
220  Ostream& os,
221  const face& list
222 )
223 {
224  os << indent << projKeyword << token::SPACE;
225  outputFlatList(os, list);
226  os << token::SPACE << projGeomName << nl;
227 
228  return os;
229 }
230 
231 } // namespace Foam
232 
233 
234 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
235 
237 (
238  Ostream& os,
239  const bool withHeader
240 ) const
241 {
242  if (withHeader)
243  {
244  // Use dummy time for fake objectRegistry
245  autoPtr<Time> dummyTimePtr(Time::New());
246 
247  IOdictionary iodict
248  (
249  IOobject
250  (
251  "blockMeshDict",
252  dummyTimePtr->system(),
253  *dummyTimePtr,
254  IOobject::NO_READ,
255  IOobject::NO_WRITE,
256  false // no register
257  )
258  );
259 
260  iodict.writeHeader(os);
261  }
262 
263  const cellModel& hex = cellModel::ref(cellModel::HEX);
264 
265  // The mesh topology will normally be an O-grid with a central (inner)
266  // block and 6 outer blocks.
267  // The inner block is described by (0 1 2 3 4 5 6 7).
268  // The additional points for the outer region: (8 9 19 11 12 13 14 15)
269 
270  // The outer blocks will be addressed according to their
271  // placement w.r.t. the inner block, and defined such that they retain
272  // the same global orientation as the inner block.
273  // For example, face 0 of all blocks will be on the logical x-min side
274  // of the mesh.
275 
276  // List of hex vertices, ordered with outer blocks first to allow
277  // direct addressing by their logical position.
279  hexVerts
280  ({
281  {8, 0, 3, 11, 12, 4, 7, 15}, // x-min block (face 0)
282  {1, 9, 10, 2, 5, 13, 14, 6}, // x-max block (face 1)
283  {8, 9, 1, 0, 12, 13, 5, 4}, // y-min block (face 2)
284  {3, 2, 10, 11, 7, 6, 14, 15}, // y-max block (face 3)
285  {8, 9, 10, 11, 0, 1, 2, 3}, // z-min block (face 4)
286  {4, 5, 6, 7, 12, 13, 14, 15}, // z-max block (face 5)
287  {0, 1, 2, 3, 4, 5, 6, 7}, // Inner box description
288  {8, 9, 10, 11, 12, 13, 14, 15}, // Outer box description
289  });
290 
291  // The face or the logical block index (for the O-grid)
292  enum faceIndex
293  {
294  X_Min = 0,
295  X_Max = 1,
296  Y_Min = 2,
297  Y_Max = 3,
298  Z_Min = 4,
299  Z_Max = 5,
300  Inner_Block = 6, // Inner block description
301  Outer_Block = 7, // Outer bounding box description
302  };
303 
304  // Lists of block/face for outside and ground faces
305  DynamicList<labelPair> outerFaces(8);
306  DynamicList<labelPair> groundFaces(8);
307 
308  // We handle a few fixed topology configurations
309 
310  enum blockTopologyType
311  {
312  INNER_ONLY = 0, // No outer region
313  EXTENDED = 1, // Outer created by extending inner region
314  CLIP_BOTTOM = 5, // Outer O-grid on 5 sides
315  FULL_OUTER = 6 // Outer O-grid on 6 sides
316  };
317 
318 
319 
320  // Expansion ratios need conversion from relative to geometric
321  const bool useRelToGeom =
322  (expansionType::EXPAND_RATIO == outer_.expandType_);
323 
324 
325  // Physical dimensions
326 
327  Vector<gridControl> ctrl(control_);
328  boundBox innerCorners(bounds(ctrl.x(), ctrl.y(), ctrl.z()));
329 
330  boundBox outerCorners;
331 
332 
333  point radialCentre(innerCorners.centre());
334  vector radialSizes(0.5*innerCorners.span());
335 
336  blockTopologyType outerTopology = INNER_ONLY;
337 
338 
339  if (outer_.active())
340  {
341  outerTopology = FULL_OUTER;
342 
343  // Convert from relative size
344  radialSizes.x() *= outer_.relSize_.x();
345  radialSizes.y() *= outer_.relSize_.y();
346  radialSizes.z() *= min(outer_.relSize_.x(), outer_.relSize_.y());
347 
348  if (outer_.onGround())
349  {
350  outerTopology = CLIP_BOTTOM;
351  radialCentre.z() = innerCorners.min().z();
352  radialSizes.z() *= 2;
353  }
354 
355  // Corners for a box
356  outerCorners.min() = radialCentre - radialSizes;
357  outerCorners.max() = radialCentre + radialSizes;
358 
359  if (outer_.onGround())
360  {
361  outerCorners.min().z() = innerCorners.min().z();
362  }
363 
364 
365  if (outer_.isSphere())
366  {
367  // For spheroid projection, don't trust that blockMesh does it
368  // properly. Give some reasonable estimates of the corners.
369 
370  // Use dummy Time for objectRegistry
371  autoPtr<Time> dummyTimePtr(Time::New());
372 
373  const IOobject io
374  (
375  "sphere",
376  *dummyTimePtr,
377  IOobject::NO_READ,
378  IOobject::NO_WRITE,
379  false // do not register
380  );
381 
382  searchableSphere sphere(io, radialCentre, radialSizes);
383 
384  pointField queries(2);
385  queries[0] = outerCorners.min();
386  queries[1] = outerCorners.max();
387 
388  List<pointIndexHit> hits;
389  sphere.findNearest
390  (
391  queries,
392  scalarField(2, GREAT),
393  hits
394  );
395 
396  outerCorners.min() = hits[0].hitPoint();
397  outerCorners.max() = hits[1].hitPoint();
398  }
399  else if (outerControl::OUTER_EXTEND == outer_.type_)
400  {
401  outerTopology = EXTENDED;
402 
403  // Extend the inner block
404  label outerCount;
405  scalar expRatio;
406 
407  outerCount = outer_.nCells_.x();
408  expRatio = outer_.expansion_.x();
409  if (useRelToGeom)
410  {
411  expRatio = relativeToGeometricRatio(expRatio, outerCount);
412  }
413 
414  ctrl.x().prepend(outerCorners.min().x(), outerCount, -expRatio);
415  ctrl.x().append(outerCorners.max().x(), outerCount, expRatio);
416 
417 
418  outerCount = outer_.nCells_.y();
419  expRatio = outer_.expansion_.y();
420  if (useRelToGeom)
421  {
422  expRatio = relativeToGeometricRatio(expRatio, outerCount);
423  }
424 
425  ctrl.y().prepend(outerCorners.min().y(), outerCount, -expRatio);
426  ctrl.y().append(outerCorners.max().y(), outerCount, expRatio);
427 
428  outerCount = max(outer_.nCells_.x(), outer_.nCells_.y());
429  expRatio = min(outer_.expansion_.x(), outer_.expansion_.y());
430  if (useRelToGeom)
431  {
432  expRatio = relativeToGeometricRatio(expRatio, outerCount);
433  }
434 
435  if (!outer_.onGround())
436  {
437  ctrl.z().prepend(outerCorners.min().z(), outerCount, -expRatio);
438  }
439  ctrl.z().append(outerCorners.max().z(), outerCount, expRatio);
440 
441  // Update corners
442  innerCorners = bounds(ctrl.x(), ctrl.y(), ctrl.z());
443  outerCorners = innerCorners;
444  }
445  }
446 
447 
448  const Vector<gradingDescriptors> innerGrading(grading(ctrl));
449  const labelVector innerCount(sizes(ctrl));
450 
451  labelVector hexCount;
453 
454 
455  const label radialCount = outer_.nCells_.x();
456  scalar expRatio = outer_.expansion_.x();
457 
458  if (useRelToGeom)
459  {
460  expRatio = relativeToGeometricRatio(expRatio, radialCount);
461  }
462 
463  const gradingDescriptors radialInward
464  (
465  gradingDescriptor{-expRatio}
466  );
467 
468  const gradingDescriptors radialOutward
469  (
470  gradingDescriptor{expRatio}
471  );
472 
473 
474  if (EXTENDED == outerTopology)
475  {
476  // The inner block is extended to become the outer faces
477  outerFaces.append
478  ({
479  labelPair(Inner_Block, X_Min),
480  labelPair(Inner_Block, X_Max),
481  labelPair(Inner_Block, Y_Min),
482  labelPair(Inner_Block, Y_Max),
483  labelPair(Inner_Block, Z_Max)
484  });
485 
486  // The ground faces vs outside faces
487  if (outer_.onGround())
488  {
489  groundFaces.append
490  (
491  labelPair(Inner_Block, Z_Min)
492  );
493  }
494  else
495  {
496  outerFaces.append
497  (
498  labelPair(Inner_Block, Z_Min)
499  );
500  }
501  }
502  else if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
503  {
504  // The outside faces
505  outerFaces.append
506  ({
507  labelPair(X_Min, X_Min),
508  labelPair(X_Max, X_Max),
509  labelPair(Y_Min, Y_Min),
510  labelPair(Y_Max, Y_Max),
511  labelPair(Z_Max, Z_Max)
512  });
513 
514  // The ground faces
515  if (CLIP_BOTTOM == outerTopology)
516  {
517  groundFaces.append
518  ({
519  labelPair(X_Min, Z_Min),
520  labelPair(X_Max, Z_Min),
521  labelPair(Y_Min, Z_Min),
522  labelPair(Y_Max, Z_Min),
523  // Note: {Z_Min, Z_Min} will not exist
524  labelPair(Inner_Block, Z_Min)
525  });
526  }
527  else
528  {
529  outerFaces.append
530  (
531  labelPair(Z_Min, Z_Min)
532  );
533  }
534  }
535 
536 
537  if (outer_.isSphere())
538  {
539  os.beginBlock("geometry");
540  {
542  {
543  os.writeEntry("type", "sphere");
544  os.writeEntry("origin", radialCentre);
545  os.writeEntry("radius", radialSizes);
546  }
547  os.endBlock();
548  }
549  os.endBlock();
550  }
551 
552  // vertices
553  {
554  os << nl << word("vertices") << nl;
555  begIndentList(os);
556 
557  pointField corners(innerCorners.points());
558 
559  // inner
560  outputIndent(os, corners);
561 
562  // outer
563  if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
564  {
565  corners = outerCorners.points();
566 
567  if (outer_.isSphere())
568  {
569  serializeProjectPoints(os, corners);
570  }
571  else
572  {
573  outputIndent(os, corners);
574  }
575  }
576 
577  endIndentList(os) << token::END_STATEMENT << nl;
578  }
579 
580 
581  // blocks
582  {
583  word innerZoneName = "inner";
584  if (INNER_ONLY == outerTopology || EXTENDED == outerTopology)
585  {
586  innerZoneName.clear();
587  }
588 
589  os << nl << word("blocks") << nl;
590  begIndentList(os);
591 
592  // Inner block
593  hexCount = innerCount;
594 
596  (
597  os,
598  hexVerts[Inner_Block],
599  hexCount,
600  innerGrading,
601  innerZoneName
602  );
603 
604  // outer
605  if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
606  {
607  // Radial direction = X
608  hexCount = innerCount;
609  hexGrade = innerGrading;
610 
611  hexCount.x() = radialCount;
612 
613  // Face 0: x-min
614  {
615  hexGrade.x() = radialInward;
616  serializeHex(os, hexVerts[X_Min], hexCount, hexGrade);
617  }
618  // Face 1: x-max
619  {
620  hexGrade.x() = radialOutward;
621  serializeHex(os, hexVerts[X_Max], hexCount, hexGrade);
622  }
623 
624 
625  // Radial direction = Y
626  hexCount = innerCount;
627  hexGrade = innerGrading;
628 
629  hexCount.y() = radialCount;
630 
631  // Face 2: y-min
632  {
633  hexGrade.y() = radialInward;
634  serializeHex(os, hexVerts[Y_Min], hexCount, hexGrade);
635  }
636  // Face 3: y-max
637  {
638  hexGrade.y() = radialOutward;
639  serializeHex(os, hexVerts[Y_Max], hexCount, hexGrade);
640  }
641 
642 
643  // Radial direction = Z
644  hexCount = innerCount;
645  hexGrade = innerGrading;
646 
647  hexCount.z() = radialCount;
648 
649  // Face 4: z-min
650  if (!outer_.onGround())
651  {
652  hexGrade.z() = radialInward;
653  serializeHex(os, hexVerts[Z_Min], hexCount, hexGrade);
654  }
655  // Face 5: z-max
656  {
657  hexGrade.z() = radialOutward;
658  serializeHex(os, hexVerts[Z_Max], hexCount, hexGrade);
659  }
660  }
661 
662  endIndentList(os) << token::END_STATEMENT << nl;
663  }
664 
665 
666  // edges
667  {
668  os << nl << word("edges") << nl;
669  begIndentList(os);
670 
671  if (outer_.isSphere() && outerFaces.size())
672  {
673  // Edges for the outer face of the block
674  edgeHashSet projEdges(32);
675 
676  for (const labelPair& pr : outerFaces)
677  {
678  projEdges.insert
679  (
680  hex.face(pr.second(), hexVerts[pr.first()]).edges()
681  );
682  }
683 
684  for (const edge& e : projEdges.sortedToc())
685  {
686  serializeProjectEdge(os, e);
687  }
688  }
689 
690  endIndentList(os) << token::END_STATEMENT << nl;
691  }
692 
693 
694  // faces
695  {
696  os << nl << word("faces") << nl;
697  begIndentList(os);
698 
699  if (outer_.isSphere() && outerFaces.size())
700  {
701  for (const labelPair& pr : outerFaces)
702  {
704  (
705  os,
706  hex.face(pr.second(), hexVerts[pr.first()])
707  );
708  }
709  }
710 
711  endIndentList(os) << token::END_STATEMENT << nl;
712  }
713 
714 
715  // boundary
716  {
717  os << nl << word("boundary") << nl;
718  begIndentList(os);
719 
720  // outer
721  {
722  os.beginBlock("outer");
723  os.writeEntry("type", word("patch"));
724 
725  os << indent << word("faces") << nl;
726  begIndentList(os);
727 
728  for (const labelPair& pr : outerFaces)
729  {
731  (
732  os,
733  hex.face(pr.second(), hexVerts[pr.first()])
734  );
735  }
736 
737  endIndentList(os) << token::END_STATEMENT << nl;
738 
739  os.endBlock();
740  }
741 
742  if (outer_.onGround())
743  {
744  os.beginBlock("ground");
745  os.writeEntry("type", word("wall"));
746 
747  os << indent << word("faces") << nl;
748  begIndentList(os);
749 
750  for (const labelPair& pr : groundFaces)
751  {
753  (
754  os,
755  hex.face(pr.second(), hexVerts[pr.first()])
756  );
757  }
758 
759  endIndentList(os) << token::END_STATEMENT << nl;
760  os.endBlock();
761  }
762 
763  endIndentList(os) << token::END_STATEMENT << nl;
764  }
765 
766 
767  if (withHeader)
768  {
769  IOobject::writeEndDivider(os);
770  }
771 
772  return os;
773 }
774 
775 
777 {
778  OTstream os;
779  blockMeshDict(os);
780 
781  ITstream is("blockMeshDict", tokenList());
782  is.transfer(os.tokens());
783 
784  return dictionary(is);
785 }
786 
787 
789 {
790  IOdictionary iodict
791  (
792  IOobject
793  (
794  io.name(),
795  io.db().time().system(),
796  io.local(),
797  io.db(),
800  false // no register
801  )
802  );
803 
804  OFstream os(iodict.objectPath());
805 
806  Info<< nl
807  << "Generate blockMeshDict: "
808  << iodict.db().time().relativePath(os.name()) << endl;
809 
810  // Set precision for points to 10
812 
813  iodict.writeHeader(os);
814 
815  // Just like writeData, but without copying beforehand
816  this->blockMeshDict(os);
817 
818  iodict.writeEndDivider(os);
819 }
820 
821 
823 Foam::PDRblock::createBlockMesh(const IOobject& io) const
824 {
825  IOdictionary iodict
826  (
827  IOobject
828  (
829  "blockMeshDict.PDRblockMesh",
830  io.db().time().system(),
831  io.local(),
832  io.db(),
835  false // no register
836  ),
837  blockMeshDict()
838  );
839 
840  return autoPtr<blockMesh>::New(iodict);
841 }
842 
843 
845 Foam::PDRblock::meshBlockMesh(const IOobject& io) const
846 {
847  const bool oldVerbose = blockMesh::verboseOutput;
848  blockMesh::verboseOutput = false;
849 
850  autoPtr<polyMesh> meshPtr(createBlockMesh(io)->mesh(io));
851 
852  blockMesh::verboseOutput = oldVerbose;
853 
854  // This is a bit ugly.
855  // For extend, we still wish to have an 'inner' cellZone,
856  // but we meshed the entirety.
857 
858  if
859  (
860  outerControl::OUTER_EXTEND == outer_.type_
861  && meshPtr->cellZones().empty()
862  )
863  {
864  const boundBox innerBox
865  (
866  bounds(control_.x(), control_.y(), control_.z())
867  );
868 
869  const label nZoneCellsMax =
870  (
871  control_.x().nCells()
872  * control_.y().nCells()
873  * control_.z().nCells()
874  );
875 
876 
877  polyMesh& pmesh = *meshPtr;
878 
879  List<cellZone*> cz(1);
880  cz[0] = new cellZone
881  (
882  "inner",
883  labelList(nZoneCellsMax),
884  0, // zonei
885  pmesh.cellZones()
886  );
887 
888  cellZone& innerZone = *(cz[0]);
889 
890  const vectorField& cc = pmesh.cellCentres();
891 
892  label nZoneCells = 0;
893 
894  for
895  (
896  label celli = 0;
897  celli < cc.size() && nZoneCells < nZoneCellsMax;
898  ++celli
899  )
900  {
901  if (innerBox.contains(cc[celli]))
902  {
903  innerZone[nZoneCells] = celli;
904  ++nZoneCells;
905  }
906  }
907 
908  innerZone.resize(nZoneCells);
909 
910  pmesh.pointZones().clear();
911  pmesh.faceZones().clear();
912  pmesh.cellZones().clear();
913  pmesh.addZones(List<pointZone*>(), List<faceZone*>(), cz);
914  }
915 
916  return meshPtr;
917 }
918 
919 
920 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
hex
const cellModel & hex
Definition: createBlockMesh.H:1
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
meshPtr
Foam::autoPtr< Foam::fvMesh > meshPtr(nullptr)
Foam::projKeyword
static const word projKeyword("project")
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
searchableSphere.H
Foam::cellModel::modelNames
static const Enum< modelType > modelNames
Names of commonly used cellModels corresponding to modelType.
Definition: cellModel.H:92
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::cellModel::HEX
hex
Definition: cellModel.H:81
Foam::IOobject::writeEndDivider
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
Definition: IOobjectWriteHeader.C:109
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:186
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
objectRegistry.H
Foam::serializeProjectEdge
static Ostream & serializeProjectEdge(Ostream &os, const edge &e)
Definition: PDRblockBlockMesh.C:174
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const
Return cell zone mesh.
Definition: polyMesh.H:492
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::boundBox::max
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
Foam::Ostream::beginBlock
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:91
ref
rDeltaT ref()
Foam::gradingDescriptors
List of gradingDescriptor for the sections of a block with additional IO functionality.
Definition: gradingDescriptors.H:58
blockMesh.H
polyMesh.H
Foam::HashSet< edge, Hash< edge > >
Foam::incrIndent
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:327
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::projGeomName
static const word projGeomName("sphere")
Foam::boundBox::min
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:91
Foam::Ostream::precision
virtual int precision() const =0
Get precision of output field.
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
gradingDescriptors.H
Foam::IOobject::db
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:457
Foam::labelPair
Pair< label > labelPair
A pair of labels.
Definition: Pair.H:54
Foam::boundBox::span
vector span() const
The bounding box span (from minimum to maximum)
Definition: boundBoxI.H:127
sphere
Specialization of rigidBody to construct a sphere given the mass and radius.
Foam::endIndentList
static Ostream & endIndentList(Ostream &os)
Definition: PDRblockBlockMesh.C:92
Foam::TimePaths::relativePath
fileName relativePath(const fileName &input, const bool caseTag=false) const
Definition: TimePathsI.H:79
Foam::IOobject::local
const fileName & local() const
Definition: IOobjectI.H:203
cellModeller.H
Foam::Field< vector >
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:55
cellModel.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::boundBox::centre
point centre() const
The centre (midpoint) of the bounding box.
Definition: boundBoxI.H:115
Foam::DynamicList::append
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Definition: DynamicListI.H:474
Foam::begIndentList
static Ostream & begIndentList(Ostream &os)
Definition: PDRblockBlockMesh.C:85
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:459
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::IOstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.C:39
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
PDRblock.H
Foam::Ostream::endBlock
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:109
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::serializeHex
static Ostream & serializeHex(Ostream &os, const labelUList &hexVerts, const labelVector &hexCount, const Vector< gradingDescriptors > hexGrade, const word &zoneName=word::null)
Definition: PDRblockBlockMesh.C:113
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::relativeToGeometricRatio
scalar relativeToGeometricRatio(const scalar expRatio, const label nDiv)
Calculate geometric ratio from relative ratio.
Definition: PDRblock.C:65
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::decrIndent
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:334
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:320
Foam::HashTable::sortedToc
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Definition: HashTable.C:136
Foam::serializeProjectFace
static Ostream & serializeProjectFace(Ostream &os, const face &list)
Definition: PDRblockBlockMesh.C:219
Foam::tokenList
List< token > tokenList
List of tokens, used for a IOdictionary entry.
Definition: tokenList.H:44
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
IOdictionary.H
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePathsI.H:94
edgeHashes.H
Foam::gradingDescriptor
Handles the specification for grading within a section of a block.
Definition: gradingDescriptor.H:72
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::Pair< label >
Foam::OTstream
A simple output token stream that can be used to build token lists. Always UNCOMPRESSED.
Definition: OTstream.H:56
Fstream.H
Foam::IOstream::defaultPrecision
static unsigned int defaultPrecision()
Return the default precision.
Definition: IOstream.H:333
Foam::Vector< label >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::OTstream::tokens
const DynamicList< token > & tokens() const
The tokens.
Definition: OTstream.H:113
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::token::SPACE
Space [isspace].
Definition: token.H:117
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:181
Foam::serializeProjectPoints
static Ostream & serializeProjectPoints(Ostream &os, const UList< point > &list)
Definition: PDRblockBlockMesh.C:152
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::outputFlatList
static Ostream & outputFlatList(Ostream &os, const UList< T > &list)
Definition: PDRblockBlockMesh.C:69
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:123
Foam::PDRblock::writeBlockMeshDict
void writeBlockMeshDict(const IOobject &io) const
Write an equivalent blockMeshDict.
Definition: PDRblockBlockMesh.C:788
Foam::outputIndent
static Ostream & outputIndent(Ostream &os, const UList< T > &list)
Definition: PDRblockBlockMesh.C:101
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::IOobject::writeHeader
bool writeHeader(Ostream &os) const
Write header.
Definition: IOobjectWriteHeader.C:156
ListOps.H
Various functions to operate on Lists.
Foam::cellModel
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:72
Foam::serializeFace
static Ostream & serializeFace(Ostream &os, const face &list)
Definition: PDRblockBlockMesh.C:202
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:209
Foam::boundBox::points
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
Definition: boundBox.C:118
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:122
OTstream.H
Foam::PDRblock::blockMeshDict
dictionary blockMeshDict() const
Content for an equivalent blockMeshDict.
Definition: PDRblockBlockMesh.C:776
Foam::blockMesh::verboseOutput
static bool verboseOutput
The default verbosity (true)
Definition: blockMesh.H:295
Foam::searchableSphere
Searching on general spheroid.
Definition: searchableSphere.H:92