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()
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);
822 Foam::PDRblock::createBlockMesh(
const IOobject&
io)
const 828 "blockMeshDict.PDRblockMesh",
844 Foam::PDRblock::meshBlockMesh(
const IOobject&
io)
const 859 outerControl::OUTER_EXTEND == outer_.type_
860 &&
meshPtr->cellZones().empty()
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);
void size(const label n)
Older name for setAddressableSize.
scalar relativeToGeometricRatio(const scalar expRatio, const label nDiv)
Calculate geometric ratio from relative ratio.
Ostream & indent(Ostream &os)
Indent stream.
static bool verboseOutput
The default verbosity (true)
A face is a list of labels corresponding to mesh vertices.
virtual int precision() const
Get precision of output field.
A 1D vector of objects of type <T> with a fixed length <N>.
void resize(const label len)
Adjust allocated size of list.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
IOstream & hex(IOstream &io)
void prepend(const scalar p, label nDiv, scalar expRatio=1)
Add point/divisions/expand to front of list (push_front)
const word & name() const noexcept
Return the object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static Ostream & serializeProjectFace(Ostream &os, const face &list)
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Begin list [isseparator].
A simple output token stream that can be used to build token lists. Always UNCOMPRESSED.
A bounding box defined in terms of min/max extrema points.
const Cmpt & y() const noexcept
Access to the vector y component.
Ignore writing from objectRegistry::writeObject()
const point & min() const noexcept
Minimum describing the bounding box.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
static const word projKeyword("project")
static Ostream & outputFlatList(Ostream &os, const UList< T > &list)
bool writeHeader(Ostream &os) const
Write header with current type()
static Ostream & serializeFace(Ostream &os, const face &list)
static Ostream & serializeHex(Ostream &os, const labelUList &hexVerts, const labelVector &hexCount, const Vector< gradingDescriptors > hexGrade, const word &zoneName=word::null)
static Ostream & begIndentList(Ostream &os)
static Ostream & outputIndent(Ostream &os, const UList< T > &list)
UList< label > labelUList
A UList of labels.
Various functions to operate on Lists.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
dictionary blockMeshDict() const
Content for an equivalent blockMeshDict.
void writeBlockMeshDict(const IOobject &io) const
Write an equivalent blockMeshDict.
const point & max() const noexcept
Maximum describing the bounding box.
static Ostream & serializeProjectPoints(Ostream &os, const UList< point > &list)
const dimensionedScalar e
Elementary charge.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Time & time() const noexcept
Return time registry.
static const word projGeomName("sphere")
const labelVector & sizes() const
The (i,j,k) addressing dimensions.
const word & system() const noexcept
Return system name.
Handles the specification for grading within a section of a block.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
static const word null
An empty word.
void append(const T &val)
Copy append an element to the end of this list.
static Ostream & endIndentList(Ostream &os)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross-product operators.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Vector< gradingDescriptors > grading() const
Equivalent edge grading descriptors in (x,y,z) directions.
const Cmpt & x() const noexcept
Access to the vector x component.
void append(const scalar p, label nDiv, scalar expRatio=1)
Add point/divisions/expand to end of list (push_back)
Pair< label > labelPair
A pair of labels.
Specialization of rigidBody to construct a sphere given the mass and radius.
OBJstream os(runTime.globalPath()/outputName)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual const fileName & name() const
Read/write access to the name of the stream.
Searching on general spheroid.
static Ostream & serializeProjectEdge(Ostream &os, const edge &e)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const Cmpt & z() const noexcept
Access to the vector z component.
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Maps a geometry to a set of cell primitives.
vector span() const
The bounding box span (from minimum to maximum)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Vector< label > labelVector
Vector of labels.
static const Enum< modelType > modelNames
Names of commonly used cellModels corresponding to modelType.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
point centre() const
The centre (midpoint) of the bounding box.
const fileName & local() const noexcept
Read access to local path component.
List of gradingDescriptor for the sections of a block with additional IO functionality.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const boundBox & bounds() const noexcept
The mesh bounding box.
Do not request registration (bool: false)
An input stream of tokens.