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.valid() || !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])
332 for (
direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
336 ((pt[cmpt] + span[cmpt]) < bb.min()[cmpt])
337 || (pt[cmpt] > bb.max()[cmpt])
350 for (
direction cmpt=0; cmpt < vector::nComponents; ++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 PDRobstacle& obs = iproxy.t_;
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.
static const Foam::faceList & hexFaces()
The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces() ...
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
List< face > faceList
A List of faces.
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.
An enumeration wrapper for classification of a location as being inside/outside of a volume...
static const List< face > & null()
Return a null List.
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
bool read(const char *buf, int32_t &val)
Same as readInt32.
constexpr scalar paToBar(const scalar pa) noexcept
Conversion from Pa to bar.
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
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
OBJstream os(runTime.globalPath()/outputName)
void readProperties(const dictionary &dict)
Read the 'name' identifier if present.
vector point
Point is a vector.
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
static const Field< vector > & null()
Return nullObject reference Field.
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.
meshedSurface surface() const
Surface (points, faces) representation.
static constexpr const zero Zero
Global zero (0)