98 identifier = std::move(obsName);
145 slat_width *= factor;
164 vol = wa * wb * len();
203 (len() <= minWidth && wa <= minWidth)
204 || (len() <= minWidth && wb <= minWidth)
205 || (wa <= minWidth && wb <= minWidth)
222 (span.x() <= minWidth && span.y() <= minWidth)
223 || (span.y() <= minWidth && span.z() <= minWidth)
224 || (span.z() <= minWidth && span.x() <= minWidth)
242 if (!bb.good() || !typeId)
251 const scalar
rad = 0.5*dia();
257 if (orient == vector::X)
276 (pt[e1] +
rad <= bb.min()[e1])
277 || (pt[e2] +
rad <= bb.min()[e2])
278 || (pt[e3] + len() <= bb.min()[e3])
279 || (pt[e1] -
rad >= bb.max()[e1])
280 || (pt[e2] -
rad >= bb.max()[e2])
281 || (pt[e3] >= bb.max()[e3])
291 if (pt[e3] < bb.min()[e3])
294 len() -= bb.min()[e3] - pt[e3];
295 pt[e3] = bb.min()[e3];
298 if (pt[e3] + len() > bb.max()[e3])
301 len() = bb.max()[e3] - pt[e3];
307 (pt[e1] -
rad < bb.min()[e1]) || (pt[e1] +
rad > bb.max()[e1])
308 || (pt[e2] -
rad < bb.min()[e2]) || (pt[e2] +
rad > bb.max()[e2])
336 ((pt[cmpt] + span[cmpt]) < bb.min()[cmpt])
337 || (pt[cmpt] > bb.max()[cmpt])
352 if (pt[cmpt] < bb.min()[cmpt])
357 span[cmpt] -= bb.min()[cmpt] - pt[cmpt];
359 pt[cmpt] = bb.min()[cmpt];
363 if (pt[cmpt] + span[cmpt] > bb.max()[cmpt])
366 span[cmpt] -= bb.max()[cmpt] - pt[cmpt];
382 const PDRobstacle& obs = *
this;
389 boundBox box(obs.pt, obs.pt + obs.span);
394 surf.transfer(
pts, fcs);
407 box.min() =
vector(0, -0.5*obs.wa, -0.5*obs.wb);
408 box.max() =
vector(obs.len(), 0.5*obs.wa, 0.5*obs.wb);
414 box.min() =
vector(-0.5*obs.wb, 0, -0.5*obs.wa);
415 box.max() =
vector(0.5*obs.wb, obs.len(), 0.5*obs.wa);
421 box.
min() =
vector(-0.5*obs.wa, -0.5*obs.wb, 0);
422 box.max() =
vector(0.5*obs.wa, 0.5*obs.wb, obs.len());
430 coordinateRotations::axisAngle
452 constexpr
int nDiv = 12;
460 if (obs.orient == vector::X)
477 org[e3] += obs.len();
478 SubList<point>(
pts, nDiv, nDiv) = org;
480 const scalar radius = 0.5*obs.dia();
482 for (label i=0; i < nDiv; ++i)
485 const scalar
s = radius *
sin(angle);
486 const scalar
c = radius *
cos(angle);
491 pts[nDiv+i][e1] +=
s;
492 pts[nDiv+i][e2] +=
c;
496 for (label facei=0; facei < nDiv; ++facei)
498 face&
f = fcs[facei];
502 f[3] = (facei + 1) % nDiv;
509 face& f1 = fcs[nDiv];
513 for (label pti=1; pti < nDiv; ++pti)
523 surf.transfer(
pts, fcs);
533 switch (obs.inlet_dirn)
597 vtk::surfaceWriter& surfWriter,
598 const UList<PDRobstacle>& list,
602 for (
const PDRobstacle& obs : list)
608 surfWriter.piece(surf.points(), surf.surfFaces());
610 surfWriter.writeGeometry();
611 surfWriter.beginCellData(2);
612 surfWriter.writeUniform(
"group", label(obs.groupId));
613 surfWriter.writeUniform(
"type", label(obs.typeId));
614 surfWriter.writeUniform(
"obstacle", pieceId);
625 const fileName& outputDir,
626 const UList<PDRobstacle>& obslist,
627 const UList<PDRobstacle>& cyllist
632 vtk::surfaceWriter surfWriter
637 (outputDir /
"Obstacles"),
641 pieceId = addPieces(surfWriter, obslist, pieceId);
642 pieceId = addPieces(surfWriter, cyllist, pieceId);
644 Info<<
"Wrote " << pieceId <<
" obstacles (VTK) to " 645 << outputDir/
"Obstacles" <<
nl;
654 const InfoProxy<PDRobstacle>& iproxy
657 const auto& obs = *iproxy;
663 os <<
"box { point " << obs.pt
664 <<
"; size " << obs.span
669 os <<
"cyl { point " << obs.pt
670 <<
"; length " << obs.len() <<
"; diameter " << obs.dia()
671 <<
"; direction " << vector::componentNames[obs.orient]
676 os <<
"diag { point " << obs.pt
677 <<
"; length " << obs.len()
678 <<
"; width (" << obs.wa <<
' ' << obs.wb <<
')' 679 <<
"; angle " <<
radToDeg(obs.theta())
680 <<
"; direction " << vector::componentNames[obs.orient]
685 os <<
"wallbeam { point " << obs.pt
686 <<
" size " << obs.span
691 os <<
"grate { point " << obs.pt
692 <<
"; size " << obs.span
693 <<
"; slats " << obs.slat_width
698 os <<
"louver { point " << obs.pt
699 <<
"; size " << obs.span
700 <<
"; pressure " <<
paToBar(obs.blowoff_press)
705 os <<
"patch { " << obs.pt
706 <<
"; size " << obs.span
707 <<
"; name " << obs.identifier
714 os <<
"/* ignored: " << obs.typeId <<
" */";
718 os <<
"/* unknown: " << obs.typeId <<
" */";
731 return (a.pt.x() + a.sortBias) < (
b.pt.x() +
b.sortBias);
Different types of constants.
scalar volume() const
Volume of the obstacle.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
type
Volume classification types.
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
static const Field< vector > & null() noexcept
Return a null Field (reference to a nullObject). Behaves like an empty Field.
dimensionedScalar sqrt(const dimensionedScalar &ds)
scalar sortBias
Bias for position sorting.
static label addPieces(vtk::surfaceWriter &surfWriter, const UList< PDRobstacle > &list, label pieceId=0)
Add pieces to vtp output.
void clear()
Reset to a zero obstacle.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
An enumeration wrapper for classification of a location as being inside/outside of a volume...
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
static const Foam::faceList & hexFaces()
The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces() ...
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< face > faceList
List of faces.
constexpr scalar paToBar(const scalar pa) noexcept
Conversion from Pa to bar.
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
constexpr scalar twoPi(2 *M_PI)
MeshedSurface< face > meshedSurface
constexpr scalar pi(M_PI)
label groupId
The group-id.
PDRobstacle()
Construct zero-initialized.
A location inside the volume.
A location outside the volume.
volumeType trim(const boundBox &bb)
Trim obstacle to ensure it is within the specified bounding box and return the intersection type...
A location that is partly inside and outside.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensionedScalar sin(const dimensionedScalar &ds)
static void generateVtk(const fileName &outputDir, const UList< PDRobstacle > &obslist, const UList< PDRobstacle > &cyllist)
Generate multi-piece VTK (vtp) file of obstacles.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
radiation::radiationModel & rad
void readProperties(const dictionary &dict)
Read the 'name' identifier if present.
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
vector point
Point is a vector.
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
PtrList< volScalarField > & Y
vector span
The obstacle dimensions (for boxes)
const dimensionedScalar c
Speed of light in a vacuum.
Macros for easy insertion into member function selection tables.
messageStream Info
Information stream (stdout output on master, null elsewhere)
int typeId
The obstacle type-id.
components
Component labeling enumeration.
List< label > labelList
A List of labels.
bool tooSmall(const scalar minWidth) const
True if the obstacle is considered to be too small.
defineMemberFunctionSelectionTable(edgeMesh, write, fileExtension)
direction orient
The x/y/z orientation (0,1,2)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void scale(const scalar factor)
Scale obstacle dimensions by specified scaling factor.
point pt
The obstacle location.
static const List< face > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
meshedSurface surface() const
Surface (points, faces) representation.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
static constexpr const zero Zero
Global zero (0)