98 identifier = std::move(obsName);
145 slat_width *= factor;
160 vol = 0.25 * mathematical::pi *
sqr(dia()) * len();
164 vol = wa * wb * len();
192 if ((0.25 * dia() *
sqrt(mathematical::pi)) <= minWidth)
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();
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];
407 box.min() =
vector(0, -0.5*obs.
wa, -0.5*obs.
wb);
414 box.min() =
vector(-0.5*obs.
wb, 0, -0.5*obs.
wa);
421 box.min() =
vector(-0.5*obs.
wa, -0.5*obs.
wb, 0);
452 constexpr int nDiv = 12;
477 org[e3] += obs.
len();
480 const scalar radius = 0.5*obs.
dia();
482 for (label i=0; i < nDiv; ++i)
484 const scalar angle = (i * mathematical::twoPi) / nDiv;
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)
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;
651Foam::Ostream& Foam::operator<<
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()
676 os <<
"diag { point " << obs.
pt
677 <<
"; length " << obs.
len()
678 <<
"; width (" << obs.
wa <<
' ' << obs.
wb <<
')'
685 os <<
"wallbeam { point " << obs.
pt
686 <<
" size " << obs.
span
691 os <<
"grate { point " << obs.
pt
692 <<
"; size " << obs.
span
698 os <<
"louver { point " << obs.
pt
699 <<
"; size " << obs.
span
705 os <<
"patch { " << obs.
pt
706 <<
"; size " << obs.
span
714 os <<
"/* ignored: " << obs.
typeId <<
" */";
718 os <<
"/* unknown: " << obs.
typeId <<
" */";
Macros for easy insertion into member function selection tables.
radiation::radiationModel & rad
static const Field< vector > & null() noexcept
A helper class for outputting values to Ostream.
void resize(const label len)
Adjust allocated size of list.
static const List< face > & null() noexcept
void transfer(pointField &pointLst, List< Face > &faceLst)
Transfer the components.
const List< Face > & surfFaces() const
Return const access to the faces.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Obstacle definitions for PDR.
scalar volume() const
Volume of the obstacle.
static label addPieces(vtk::surfaceWriter &surfWriter, const UList< PDRobstacle > &list, label pieceId=0)
Add pieces to vtp output.
scalar sortBias
Bias for position sorting.
point pt
The obstacle location.
direction orient
The x/y/z orientation (0,1,2).
volumeType trim(const boundBox &bb)
Trim obstacle to ensure it is within the specified bounding box and return the intersection type.
static void generateVtk(const fileName &outputDir, const UList< PDRobstacle > &obslist, const UList< PDRobstacle > &cyllist)
Generate multi-piece VTK (vtp) file of obstacles.
bool tooSmall(const scalar minWidth) const
True if the obstacle is considered to be too small.
meshedSurface surface() const
Surface (points, faces) representation.
label groupId
The group-id.
void readProperties(const dictionary &dict)
Read the 'name' identifier if present.
void clear()
Reset to a zero obstacle.
vector span
The obstacle dimensions (for boxes).
@ OLD_BLOWOFF
ignored (old)
int typeId
The obstacle type-id.
void scale(const scalar factor)
Scale obstacle dimensions by specified scaling factor.
PDRobstacle()
Construct zero-initialized.
const Field< point_type > & points() const noexcept
Return reference to global points.
A non-owning sub-view of a List (allocated or unallocated storage).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
static const char *const componentNames[]
static constexpr direction nComponents
Number of components in this vector space.
const Cmpt & x() const noexcept
Access to the vector x component.
A bounding box defined in terms of min/max extrema points.
static const Foam::faceList & hexFaces()
The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces().
const point & max() const noexcept
Maximum describing the bounding box.
const point & min() const noexcept
Minimum describing the bounding box.
bool good() const
Bounding box is non-inverted.
A coordinateRotation specified by a rotation axis and a rotation angle about that axis.
Base class for coordinate system specification, the default coordinate system type is cartesian .
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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...
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
type
Volume classification types.
@ OUTSIDE
A location outside the volume.
@ MIXED
A location that is partly inside and outside.
@ INSIDE
A location inside the volume.
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
void writeUniform(const word &fieldName, const Type &val)
Write a uniform field of Cell (Poly) or Point values.
void piece(const pointField &points, const faceList &faces)
Reset point/face references to begin a new piece.
virtual bool writeGeometry()
Write patch topology.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
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))
#define defineMemberFunctionSelectionTable(baseType, funcName, argNames)
Define run-time selection table.
const dimensionedScalar c
Speed of light in a vacuum.
Different types of constants.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sin(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensionedScalar sqrt(const dimensionedScalar &ds)
constexpr scalar radToDeg() noexcept
Multiplication factor for radians to degrees conversion.
MeshedSurface< face > meshedSurface
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...
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
vectorField pointField
pointField is a vectorField.
constexpr scalar paToBar(const scalar pa) noexcept
Conversion from Pa to bar.
dimensionedScalar cos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
Unit conversion functions.