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())
156 for (
const point&
p : list)
238 const bool withHeader
251 dummyTimePtr->system(),
277 const FixedList<labelList, 8>
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},
304 DynamicList<labelPair> outerFaces(8);
305 DynamicList<labelPair> groundFaces(8);
309 enum blockTopologyType
320 const bool useRelToGeom =
326 Vector<gridControl> ctrl(control_);
327 boundBox innerCorners(
bounds(ctrl.x(), ctrl.y(), ctrl.z()));
329 boundBox outerCorners;
332 point radialCentre(innerCorners.centre());
333 vector radialSizes(0.5*innerCorners.span());
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())
381 searchableSphere sphere(
io, radialCentre, radialSizes);
384 queries[0] = outerCorners.min();
385 queries[1] = outerCorners.max();
387 List<pointIndexHit> hits;
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;
447 const Vector<gradingDescriptors> innerGrading(
grading(ctrl));
451 Vector<gradingDescriptors> hexGrade;
454 const label radialCount = outer_.nCells_.
x();
455 scalar expRatio = outer_.expansion_.x();
462 const gradingDescriptors radialInward
464 gradingDescriptor{-expRatio}
467 const gradingDescriptors radialOutward
469 gradingDescriptor{expRatio}
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);
553 os <<
nl << word(
"vertices") <<
nl;
562 if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
564 corners = outerCorners.points();
566 if (outer_.isSphere())
583 word innerZoneName =
"inner";
584 if (INNER_ONLY == outerTopology || EXTENDED == outerTopology)
586 innerZoneName.clear();
589 os <<
nl << word(
"blocks") <<
nl;
593 hexCount = innerCount;
598 hexVerts[Inner_Block],
605 if (CLIP_BOTTOM == outerTopology || FULL_OUTER == outerTopology)
608 hexCount = innerCount;
609 hexGrade = innerGrading;
611 hexCount.x() = radialCount;
615 hexGrade.x() = radialInward;
620 hexGrade.x() = radialOutward;
626 hexCount = innerCount;
627 hexGrade = innerGrading;
629 hexCount.y() = radialCount;
633 hexGrade.y() = radialInward;
638 hexGrade.y() = radialOutward;
644 hexCount = innerCount;
645 hexGrade = innerGrading;
647 hexCount.z() = radialCount;
650 if (!outer_.onGround())
652 hexGrade.z() = radialInward;
657 hexGrade.z() = radialOutward;
669 os <<
nl << word(
"edges") <<
nl;
672 if (outer_.isSphere() && outerFaces.size())
681 hex.face(pr.second(), hexVerts[pr.first()]).edges()
685 for (
const edge&
e : projEdges.sortedToc())
698 os <<
nl << word(
"faces") <<
nl;
701 if (outer_.isSphere() && outerFaces.size())
708 hex.face(pr.second(), hexVerts[pr.first()])
720 os <<
nl << word(
"boundary") <<
nl;
725 os.beginBlock(
"outer");
726 os.writeEntry(
"type", word(
"patch"));
736 hex.face(pr.second(), hexVerts[pr.first()])
746 if (outer_.onGround())
748 os.beginBlock(
"ground");
749 os.writeEntry(
"type", word(
"wall"));
759 hex.face(pr.second(), hexVerts[pr.first()])
802 io.db().time().system(),
814 <<
"Generate blockMeshDict: "
815 << iodict.db().time().relativePath(
os.name()) <<
endl;
820 iodict.writeHeader(
os);
823 this->blockMeshDict(
os);
830Foam::PDRblock::createBlockMesh(
const IOobject&
io)
const
836 "blockMeshDict.PDRblockMesh",
837 io.db().time().system(),
851Foam::autoPtr<Foam::polyMesh>
852Foam::PDRblock::meshBlockMesh(
const IOobject&
io)
const
867 outerControl::OUTER_EXTEND == outer_.type_
868 &&
meshPtr->cellZones().empty()
873 bounds(control_.x(), control_.y(), control_.z())
876 const label nZoneCellsMax =
878 control_.x().nCells()
879 * control_.y().nCells()
880 * control_.z().nCells()
899 label nZoneCells = 0;
904 celli < cc.size() && nZoneCells < nZoneCellsMax;
908 if (innerBox.contains(cc[celli]))
910 innerZone[nZoneCells] = celli;
915 innerZone.resize(nZoneCells);
917 pmesh.pointZones().clear();
918 pmesh.faceZones().clear();
919 pmesh.cellZones().clear();
Various functions to operate on Lists.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
A 1D vector of objects of type <T> with a fixed length <N>.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
fileName objectPath() const
The complete path + object name.
bool writeHeader(Ostream &os) const
Write header with current type().
static unsigned int defaultPrecision() noexcept
Return the default precision.
An input stream of tokens.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void resize(const label len)
Adjust allocated size of list.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A simple output token stream that can be used to build token lists. Always UNCOMPRESSED.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & blockMeshDict(Ostream &os, const bool withHeader=false) const
Output content for an equivalent blockMeshDict.
const boundBox & bounds() const noexcept
The mesh bounding box.
Vector< gradingDescriptors > grading() const
Equivalent edge grading descriptors in (x,y,z) directions.
@ EXPAND_RATIO
End/start ratio.
void writeBlockMeshDict(const IOobject &io) const
Write an equivalent blockMeshDict.
dictionary blockMeshDict() const
Content for an equivalent blockMeshDict.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
static bool verboseOutput
The default verbosity (true).
A bounding box defined in terms of min/max extrema points.
const point & max() const noexcept
Maximum describing the bounding box.
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
const point & min() const noexcept
Minimum describing the bounding box.
vector span() const
The bounding box span (from minimum to maximum).
point centre() const
The centre (midpoint) of the bounding box.
Maps a geometry to a set of cell primitives.
static const Enum< modelType > modelNames
Names of commonly used cellModels corresponding to modelType.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
Handles the specification for grading within a section of a block.
List of gradingDescriptor for the sections of a block with additional IO functionality.
const labelVector & sizes() const noexcept
The (i,j,k) addressing dimensions.
const Time & time() const noexcept
Return time registry.
Mesh consisting of general polyhedral cells.
Searching on general spheroid.
Specialization of rigidBody to construct a sphere given the mass and radius.
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
A class for handling words, derived from Foam::string.
static const word null
An empty word.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
OBJstream os(runTime.globalPath()/outputName)
Namespace for bounding specifications. At the moment, mostly for tables.
Pair< label > labelPair
A pair of labels.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
HashSet< edge, Hash< edge > > edgeHashSet
A HashSet with edge for its key. Hashing (and ==) on an edge is symmetric.
List< label > labelList
A List of labels.
Vector< label > labelVector
Vector of labels.
static const word projKeyword("project")
static Ostream & serializeProjectEdge(Ostream &os, const edge &e)
static Ostream & outputIndent(Ostream &os, const UList< T > &list)
static Ostream & serializeFace(Ostream &os, const face &list)
messageStream Info
Information stream (stdout output on master, null elsewhere).
IOstream & hex(IOstream &io)
static Ostream & serializeHex(Ostream &os, const labelUList &hexVerts, const labelVector &hexCount, const Vector< gradingDescriptors > hexGrade, const word &zoneName=word::null)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static const word projGeomName("sphere")
Field< vector > vectorField
Specialisation of Field<T> for vector.
static Ostream & endIndentList(Ostream &os)
vector point
Point is a vector.
static Ostream & serializeProjectPoints(Ostream &os, const UList< point > &list)
static Ostream & serializeProjectFace(Ostream &os, const face &list)
static Ostream & outputFlatList(Ostream &os, const UList< T > &list)
static Ostream & begIndentList(Ostream &os)
vectorField pointField
pointField is a vectorField.
scalar relativeToGeometricRatio(const scalar expRatio, const label nDiv)
Calculate geometric ratio from relative ratio.
UList< label > labelUList
A UList of labels.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).