48 forAll(qreflective_, bandI)
72 nRay_ = 4*nPhi_*nTheta_;
73 refDiscAngles_.
resize(nRay_);
74 const scalar deltaPhi =
pi/(2.0*nPhi_);
75 const scalar deltaTheta =
pi/nTheta_;
77 for (label
n = 1;
n <= nTheta_;
n++)
79 for (label m = 1; m <= 4*nPhi_; m++)
81 const scalar thetai = (2*
n - 1)*deltaTheta/2.0;
82 const scalar phii = (2*m - 1)*deltaPhi/2.0;
88 refDiscAngles_[rayI++] =
89 vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
98 refDiscAngles_.
resize(nRay_);
101 const scalar deltaPhi =
pi/(2.0*nPhi_);
102 for (label m = 1; m <= 4*nPhi_; m++)
104 const scalar phii = (2*m - 1)*deltaPhi/2.0;
111 refDiscAngles_[rayI++] =
112 vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
118 <<
"The reflected rays are available in 2D or 3D "
141 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
178 (r[faceI] > 0 && t[faceI] == 0) ||
179 (t[faceI] == 0 && a[faceI] > 0 && r[faceI] == 0)
182 includePatches_.
insert(patchI);
188 shootFacesIds_.reset(
new labelList(dynFacesI));
217 dict.
add(
"mergeDistance", SMALL);
233 "reflectiveSurface.stl",
247 surfacesMesh_->searchableSurface::write();
252void Foam::faceReflecting::calculate()
263 label nBands = spectralDistribution_.
size();
267 const vector sunDir = directHitFaces_.direction();
268 const labelList& directHits = directHitFaces_.rayStartFaces();
279 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
289 label globalID = faceI + pp.
start();
291 if (r[faceI] > 0.0 && directHits.
found(globalID))
294 sunDir + 2.0*(-sunDir &
n[faceI]) *
n[faceI];
299 forAll(refDiscAngles_, iDisc)
301 scalar dotProd = refDir & refDiscAngles_[iDisc];
311 if (refDisDirsIndex[rayIndex] == -1)
313 refDisDirsIndex[rayIndex] = 1;
319 globalNumbering.toGlobal(globalID),
335 scalar maxBounding = 5.0*
mag(mesh_.bounds().max() - mesh_.bounds().min());
351 for (; i < Cfs_->size(); i++)
353 const point& fc = Cfs_()[i];
355 const vector nf = Nfs_()[i];
357 const label myFaceId = shootFacesIds_()[i];
359 forAll(refDisDirsIndex, dirIndex)
361 if (refDisDirsIndex[dirIndex] > -1)
363 if ((nf & refDiscAngles_[dirIndex]) > 0)
369 startIndex.append(myFaceId);
370 dirStartIndex.append(dirIndex);
382 surfacesMesh_->findLine(start, end, hitInfo);
388 surfacesMesh_->localQueries
418 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
420 for (label bandI = 0; bandI < nBands; bandI++)
422 patchr[patchi][bandI] =
430 patcha[patchi][bandI] =
442 for (label bandI = 0; bandI < nBands; bandI++)
451 label trii = triangleIndex[i];
452 label facei = mapTriToGlobal_[trii];
458 if (refFacesDirIndex.
found(globalFace))
460 refDirIndex[i] = refFacesDirIndex.
find(globalFace)();
461 refIndex[i] = globalFace;
463 for (label bandI = 0; bandI < nBands; bandI++)
465 r[bandI][i] = patchr[patchI][bandI][localFaceI];
470 for (label bandI = 0; bandI < nBands; bandI++)
475 for (label bandI = 0; bandI < nBands; bandI++)
478 qreflective_[bandI].boundaryFieldRef();
482 const vector qPrim(solarCalc_.directSolarRad()*solarCalc_.direction());
488 if (hitInfo[rayI].hit())
492 dirStartIndex[rayI] == refDirIndex[rayI]
493 && refFacesDirIndex.
found(refIndex[rayI])
496 for (label bandI = 0; bandI < nBands; bandI++)
499 qreflective_[bandI].boundaryFieldRef();
501 label startFaceId = startIndex[rayI];
505 label localStartFaceI = ppStart.
whichFace(startFaceId);
507 scalar a = patcha[startPatchI][bandI][localStartFaceI];
511 vector rayIn = refDiscAngles_[dirStartIndex[rayI]];
515 qrefBf[startPatchI][localStartFaceI] +=
520 *spectralDistribution_[bandI]
524 & nStart[localStartFaceI]
534 dirStartIndex.clear();
550 nTheta_(
dict.subDict(
"reflecting").getOrDefault<label>(
"nTheta", 10)),
551 nPhi_(
dict.subDict(
"reflecting").getOrDefault<label>(
"nPhi", 10)),
554 spectralDistribution_(spectralDistribution),
555 qreflective_(spectralDistribution_.size()),
556 directHitFaces_(directHiyFaces),
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.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Return true if hashed entry is found in table.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
void resize(const label len)
Adjust allocated size of list.
A HashTable to objects of type <T> with a label key.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
static void mapCombineAllGather(const List< commsStruct > &comms, Container &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void clear()
Clear the PtrList. Delete allocated entries and set size to zero.
SubField is a Field obtained as a section of another Field, without its own allocation....
const word & constant() const
Return constant name.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
bool found(const T &val, label pos=0) const
True if the value if found in the list.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bounding box defined in terms of min/max extrema points.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
IOoject and searching on distributed triSurface. All processor hold (possibly overlapping) part of th...
static const Enum< distributionType > distributionTypeNames_
Calculates the reflecting faces from specular surfaces. It only takes into account the first reflecti...
void correct()
Correct reflected flux.
faceShading uses the transmissivity value in the boundaryRadiationProperties in order to evaluate whi...
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Class containing processor-to-processor mapping information.
void reverseDistribute(const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
label nSolutionD() const
Return the number of valid solved-for dimensions in the mesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh face list.
const vectorField::subField faceCentres() const
Return face centres.
label nFaces() const noexcept
Number of mesh faces.
int myProcNo() const noexcept
Return processor number.
Boundary radiation properties holder.
tmp< scalarField > absorptivity(const label patchI, const label bandI=0, vectorField *incomingDirection=nullptr, scalarField *T=nullptr) const
Access boundary absorptivity on patch.
tmp< scalarField > specReflectivity(const label patchI, const label bandI=0, vectorField *incomingDirection=nullptr, scalarField *T=nullptr) const
Access boundary specular reflectivity on patch.
tmp< scalarField > transmissivity(const label patchI, const label bandI=0, vectorField *incomingDirection=nullptr, scalarField *T=nullptr) const
Access boundary transmissivity on patch.
A solar calculator model providing models for the solar direction and solar loads.
A class for managing temporary objects.
Standard boundBox with extra functionality for use in octree.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
Triangulated surface description with patch information.
void initialise()
Initialise integral-scale box properties.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
constexpr scalar pi(M_PI)
constexpr scalar piByTwo(0.5 *M_PI)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
List< label > labelList
A List of labels.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
dimensionedScalar sin(const dimensionedScalar &ds)
vectorField pointField
pointField is a vectorField.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
dimensionedScalar cos(const dimensionedScalar &ds)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
const triSurface localSurface
#define forAll(list, i)
Loop across all elements in list.