58 const scalar expRatio,
62 return nDiv > 1 ?
pow(expRatio, (nDiv - 1)) : 1.0;
72 for (
const label val : list)
102 for (
const T& val : list)
116 const Vector<gradingDescriptors> hexGrade,
123 if (!zoneName.empty())
129 <<
indent << word(
"edgeGrading") <<
nl;
134 for (
const gradingDescriptors& gds : hexGrade)
156 for (
const point&
p : list)
238 const bool withHeader
251 dummyTimePtr->system(),
280 {8, 0, 3, 11, 12, 4, 7, 15},
281 {1, 9, 10, 2, 5, 13, 14, 6},
282 {8, 9, 1, 0, 12, 13, 5, 4},
283 {3, 2, 10, 11, 7, 6, 14, 15},
284 {8, 9, 10, 11, 0, 1, 2, 3},
285 {4, 5, 6, 7, 12, 13, 14, 15},
286 {0, 1, 2, 3, 4, 5, 6, 7},
287 {8, 9, 10, 11, 12, 13, 14, 15},
309 enum blockTopologyType
320 const bool useRelToGeom =
321 (expansionType::EXPAND_RATIO == outer_.expandType_);
335 blockTopologyType outerTopology = INNER_ONLY;
340 outerTopology = FULL_OUTER;
343 radialSizes.
x() *= outer_.relSize_.x();
344 radialSizes.
y() *= outer_.relSize_.y();
345 radialSizes.
z() *=
min(outer_.relSize_.x(), outer_.relSize_.y());
347 if (outer_.onGround())
349 outerTopology = CLIP_BOTTOM;
350 radialCentre.
z() = innerCorners.
min().
z();
351 radialSizes.
z() *= 2;
355 outerCorners.
min() = radialCentre - radialSizes;
356 outerCorners.
max() = radialCentre + radialSizes;
358 if (outer_.onGround())
360 outerCorners.
min().
z() = innerCorners.
min().
z();
364 if (outer_.isSphere())
384 queries[0] = outerCorners.
min();
385 queries[1] = outerCorners.
max();
395 outerCorners.
min() = hits[0].hitPoint();
396 outerCorners.
max() = hits[1].hitPoint();
398 else if (outerControl::OUTER_EXTEND == outer_.type_)
400 outerTopology = EXTENDED;
406 outerCount = outer_.nCells_.x();
407 expRatio = outer_.expansion_.x();
413 ctrl.
x().
prepend(outerCorners.
min().
x(), outerCount, -expRatio);
414 ctrl.
x().
append(outerCorners.
max().
x(), outerCount, expRatio);
417 outerCount = outer_.nCells_.y();
418 expRatio = outer_.expansion_.y();
424 ctrl.
y().
prepend(outerCorners.
min().
y(), outerCount, -expRatio);
425 ctrl.
y().
append(outerCorners.
max().
y(), outerCount, expRatio);
427 outerCount =
max(outer_.nCells_.x(), outer_.nCells_.y());
428 expRatio =
min(outer_.expansion_.x(), outer_.expansion_.y());
434 if (!outer_.onGround())
436 ctrl.
z().
prepend(outerCorners.
min().
z(), outerCount, -expRatio);
438 ctrl.
z().
append(outerCorners.
max().
z(), outerCount, expRatio);
441 innerCorners =
bounds(ctrl.
x(), ctrl.
y(), ctrl.
z());
442 outerCorners = innerCorners;
454 const label radialCount = outer_.nCells_.x();
455 scalar expRatio = outer_.expansion_.x();
473 if (EXTENDED == outerTopology)
486 if (outer_.onGround())
501 else if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
514 if (CLIP_BOTTOM == outerTopology)
536 if (outer_.isSphere())
538 os.beginBlock(
"geometry");
542 os.writeEntry(
"type",
"sphere");
543 os.writeEntry(
"origin", radialCentre);
544 os.writeEntry(
"radius", radialSizes);
562 if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
564 corners = outerCorners.
points();
566 if (outer_.isSphere())
582 word innerZoneName =
"inner";
583 if (INNER_ONLY == outerTopology || EXTENDED == outerTopology)
585 innerZoneName.clear();
592 hexCount = innerCount;
597 hexVerts[Inner_Block],
604 if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
607 hexCount = innerCount;
608 hexGrade = innerGrading;
610 hexCount.
x() = radialCount;
614 hexGrade.
x() = radialInward;
619 hexGrade.
x() = radialOutward;
625 hexCount = innerCount;
626 hexGrade = innerGrading;
628 hexCount.
y() = radialCount;
632 hexGrade.
y() = radialInward;
637 hexGrade.
y() = radialOutward;
643 hexCount = innerCount;
644 hexGrade = innerGrading;
646 hexCount.
z() = radialCount;
649 if (!outer_.onGround())
651 hexGrade.
z() = radialInward;
656 hexGrade.
z() = radialOutward;
670 if (outer_.isSphere() && outerFaces.size())
679 hex.face(pr.second(), hexVerts[pr.first()]).edges()
683 for (
const edge&
e : projEdges.sortedToc())
698 if (outer_.isSphere() && outerFaces.size())
705 hex.face(pr.second(), hexVerts[pr.first()])
721 os.beginBlock(
"outer");
722 os.writeEntry(
"type",
word(
"patch"));
732 hex.face(pr.second(), hexVerts[pr.first()])
741 if (outer_.onGround())
743 os.beginBlock(
"ground");
744 os.writeEntry(
"type",
word(
"wall"));
754 hex.face(pr.second(), hexVerts[pr.first()])
806 <<
"Generate blockMeshDict: "
807 << iodict.db().time().relativePath(
os.
name()) <<
endl;
812 iodict.writeHeader(
os);
815 this->blockMeshDict(
os);
817 iodict.writeEndDivider(
os);
822 Foam::PDRblock::createBlockMesh(
const IOobject& io)
const
828 "blockMeshDict.PDRblockMesh",
829 io.db().time().system(),
844 Foam::PDRblock::meshBlockMesh(
const IOobject& io)
const
849 autoPtr<polyMesh>
meshPtr(createBlockMesh(io)->
mesh(io));
859 outerControl::OUTER_EXTEND == outer_.type_
863 const boundBox innerBox
865 bounds(control_.x(), control_.y(), control_.z())
868 const label nZoneCellsMax =
870 control_.x().nCells()
871 * control_.y().nCells()
872 * control_.z().nCells()
878 List<cellZone*> cz(1);
887 cellZone& innerZone = *(cz[0]);
891 label nZoneCells = 0;
896 celli < cc.size() && nZoneCells < nZoneCellsMax;
900 if (innerBox.contains(cc[celli]))
902 innerZone[nZoneCells] = celli;
907 innerZone.resize(nZoneCells);
909 pmesh.pointZones().clear();
910 pmesh.faceZones().clear();
911 pmesh.cellZones().clear();
912 pmesh.addZones(List<pointZone*>(), List<faceZone*>(), cz);