55void Foam::radiation::solarLoad::updateReflectedRays
60 if (!reflectedFaces_ && hitFaces_)
69 spectralDistribution_,
75 reflectedFaces_->correct();
85 for (label bandI = 0; bandI < nBands_; ++bandI)
88 reflectedFaces_->qreflective(bandI).boundaryField()[
patchID];
96 for (label bandI = 0; bandI < nBands_; ++bandI)
100 const label cellI = cellIs[i];
104 reflectedFaces_->qreflective(bandI).
105 boundaryField()[
patchID][i] * sf[i]
114bool Foam::radiation::solarLoad::updateHitFaces()
118 hitFaces_.reset(
new faceShading(mesh_, solarCalc_.direction()));
123 switch (solarCalc_.sunDirectionModel())
132 const label updateIndex = label
134 mesh_.time().value()/solarCalc_.sunTrackingUpdateInterval()
137 if (updateIndex > updateTimeIndex_)
139 Info <<
"Updating Sun position..." <<
endl;
140 updateTimeIndex_ = updateIndex;
141 solarCalc_.correctSunDirection();
142 hitFaces_->direction() = solarCalc_.direction();
143 hitFaces_->correct();
155void Foam::radiation::solarLoad::updateAbsorptivity
163 for (
const label
patchID : includePatches)
165 absorptivity_[
patchID].setSize(nBands_);
166 for (label bandI = 0; bandI < nBands_; ++bandI)
168 absorptivity_[
patchID][bandI] =
175void Foam::radiation::solarLoad::updateDirectHitRadiation
188 for (label bandI = 0; bandI < nBands_; ++bandI)
191 qprimaryRad_[bandI].boundaryFieldRef();
197 const label faceI = hitFacesId[i];
200 const label localFaceI = faceI - pp.
start();
202 solarCalc_.directSolarRad()*solarCalc_.direction();
207 qprimaryBf[
patchID][localFaceI] +=
208 (qPrim &
n[localFaceI])
209 * spectralDistribution_[bandI]
210 * absorptivity_[
patchID][bandI]()[localFaceI];
213 if (includeMappedPatchBasePatches[
patchID])
220 const label cellI = pp.
faceCells()[localFaceI];
223 (qPrim & sf[localFaceI])
224 * spectralDistribution_[bandI]
225 * absorptivity_[
patchID][bandI]()[localFaceI]
233void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
243 switch(solarCalc_.sunLoadModel())
248 for (
const label
patchID : includePatches)
258 const scalar cosEpsilon(verticalDir_ & -
n[faceI]);
262 const scalar cosTheta(solarCalc_.direction() & -
n[faceI]);
266 if (cosEpsilon == 0.0)
273 Y = 0.55+0.437*cosTheta + 0.313*
sqr(cosTheta);
280 Ed = solarCalc_.C()*
Y*solarCalc_.directSolarRad();
287 * solarCalc_.directSolarRad()
288 * (1.0 + cosEpsilon)/2.0;
293 solarCalc_.directSolarRad()
294 * (solarCalc_.C() +
Foam::sin(solarCalc_.beta()))
295 * solarCalc_.groundReflectivity()
296 * (1.0 - cosEpsilon)/2.0;
299 const label cellI = cellIds[faceI];
300 if (includeMappedPatchBasePatches[
patchID])
302 for (label bandI = 0; bandI < nBands_; ++bandI)
306 * spectralDistribution_[bandI]
307 * absorptivity_[
patchID][bandI]()[faceI];
312 for (label bandI = 0; bandI < nBands_; ++bandI)
316 * spectralDistribution_[bandI]
317 * absorptivity_[
patchID][bandI]()[faceI]
318 * sf[faceI]/V[cellI];
329 for (
const label
patchID : includePatches)
337 const label cellI = cellIds[faceI];
338 if (includeMappedPatchBasePatches[
patchID])
340 for (label bandI = 0; bandI < nBands_; ++bandI)
343 solarCalc_.diffuseSolarRad()
344 * spectralDistribution_[bandI]
345 * absorptivity_[
patchID][bandI]()[faceI];
350 for (label bandI = 0; bandI < nBands_; ++bandI)
354 spectralDistribution_[bandI]
355 * absorptivity_[
patchID][bandI]()[faceI]
356 * solarCalc_.diffuseSolarRad()
357 )*sf[faceI]/V[cellI];
370 spectralDistributions_.reset
374 "spectralDistribution",
380 spectralDistribution_ =
381 spectralDistributions_->value(mesh_.time().timeOutputValue());
383 nBands_ = spectralDistribution_.size();
385 spectralDistribution_ =
386 spectralDistribution_/
sum(spectralDistribution_);
388 qprimaryRad_.setSize(nBands_);
390 forAll(qprimaryRad_, bandI)
400 mesh_.time().timeName(),
413 verticalDir_.normalise();
419 verticalDir_ = (-
g/
mag(
g)).value();
424 coeffs.
readIfPresent(
"updateAbsorptivity", updateAbsorptivity_);
425 coeffs.
readEntry(
"useReflectedRays", useReflectedRays_);
731 solarCalc_(coeffs_, mesh_),
762 spectralDistribution_(),
763 spectralDistributions_(),
770 updateAbsorptivity_(false),
771 useReflectedRays_(false),
785 solarCalc_(
dict, mesh_),
816 spectralDistribution_(),
817 spectralDistributions_(),
824 updateAbsorptivity_(false),
825 useReflectedRays_(false),
852 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
854 includePatches.
insert(patchI);
864 (isA<mappedPatchBase>(pp) && solidCoupled_)
865 || (isA<wallPolyPatch>(pp) && wallCoupled_)
868 includeMappedPatchBasePatches.
insert(patchI);
872 if (updateAbsorptivity_ || firstIter_)
874 updateAbsorptivity(includePatches);
877 const bool facesChanged = updateHitFaces();
879 const bool timeDependentLoad =
882 if (facesChanged || timeDependentLoad)
887 solarCalc_.correctDirectSolarRad();
888 solarCalc_.correctDiffuseSolarRad();
890 spectralDistribution_ =
891 spectralDistributions_->value(mesh_.time().value());
893 spectralDistribution_ =
894 spectralDistribution_/
sum(spectralDistribution_);
897 const labelList& hitFacesId = hitFaces_->rayStartFaces();
898 updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches);
901 updateSkyDiffusiveRadiation
904 includeMappedPatchBasePatches
908 if (useReflectedRays_)
910 updateReflectedRays(includeMappedPatchBasePatches);
918 if (mesh_.time().writeTime())
933 mesh_.time().timeName(),
Macros for easy insertion into run-time selection tables.
const uniformDimensionedVectorField & g
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
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
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Calculates the reflecting faces from specular surfaces. It only takes into account the first reflecti...
faceShading uses the transmissivity value in the boundaryRadiationProperties in order to evaluate whi...
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
UPtrList< const labelUList > faceCells() const
Return a list of faceCells for each patch.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
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 labelUList & faceCells() const
Return face-cell addressing.
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.
Top level model for radiation modelling.
const fvMesh & mesh_
Reference to the mesh database.
virtual bool read()=0
Read radiationProperties dictionary.
dictionary coeffs_
Radiation model dictionary.
The solarLoad radiation model includes Sun primary hits, their reflective fluxes and diffusive sky ra...
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
bool read()
Read radiationProperties dictionary.
void calculate()
Solve radiation equations.
@ mSunLoadFairWeatherConditions
@ mSunLoadTheoreticalMaximum
A class for managing temporary objects.
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.
PtrList< volScalarField > & Y
const polyBoundaryMesh & patches
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Different types of constants.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
dimensionedScalar sin(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedScalar pow4(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
#define addToRadiationRunTimeSelectionTables(model)
#define forAll(list, i)
Loop across all elements in list.