55 void Foam::radiation::solarLoad::updateReflectedRays
60 if (!reflectedFaces_ && hitFaces_)
69 spectralDistribution_,
75 reflectedFaces_->correct();
79 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
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]
114 bool Foam::radiation::solarLoad::updateHitFaces()
118 const boundaryRadiationProperties& boundaryRadiation =
121 const labelList activeFaceZoneIds(boundaryRadiation.faceZoneIds());
123 if (!activeFaceZoneIds.size())
125 hitFaces_.reset(
new faceShading(mesh_, solarCalc_.direction()));
136 solarCalc_.direction()
145 switch (solarCalc_.sunDirectionModel())
154 const label updateIndex = label
156 mesh_.time().value()/solarCalc_.sunTrackingUpdateInterval()
159 if (updateIndex > updateTimeIndex_)
161 Info <<
"Updating Sun position..." <<
endl;
162 updateTimeIndex_ = updateIndex;
163 solarCalc_.correctSunDirection();
164 hitFaces_->direction() = solarCalc_.direction();
165 hitFaces_->correct();
177 void Foam::radiation::solarLoad::updateAbsorptivity
182 const boundaryRadiationProperties& boundaryRadiation =
185 for (
const label
patchID : includePatches)
187 absorptivity_[
patchID].setSize(nBands_);
188 for (label bandi = 0; bandi < nBands_; ++bandi)
190 absorptivity_[
patchID][bandi] =
191 boundaryRadiation.absorptivity(
patchID, bandi);
197 void Foam::radiation::solarLoad::updateDirectHitRadiation
203 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
210 for (label bandi = 0; bandi < nBands_; ++bandi)
213 qprimaryRad_[bandi].boundaryFieldRef();
219 const label facei = hitFacesId[i];
228 const label localFaceI = facei - pp.start();
231 solarCalc_.directSolarRad()*solarCalc_.direction()
237 qprimaryBf[
patchID][localFaceI] +=
238 (qPrim &
n[localFaceI])
239 * spectralDistribution_[bandi]
240 * absorptivity_[
patchID][bandi]()[localFaceI];
243 if (includeMappedPatchBasePatches[
patchID])
250 const label celli = pp.faceCells()[localFaceI];
253 (qPrim & sf[localFaceI])
254 * spectralDistribution_[bandi]
255 * absorptivity_[
patchID][bandi]()[localFaceI]
263 void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
269 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
273 switch(solarCalc_.sunLoadModel())
278 for (
const label
patchID : includePatches)
284 const labelList& cellids = pp.faceCells();
288 tmp<scalarField> tdiffuseSolarRad =
289 solarCalc_.diffuseSolarRad(
n);
290 const scalarField& diffuseSolarRad = tdiffuseSolarRad.cref();
294 const label celli = cellids[facei];
295 if (includeMappedPatchBasePatches[
patchID])
297 for (label bandi = 0; bandi < nBands_; ++bandi)
300 diffuseSolarRad[facei]
301 * spectralDistribution_[bandi]
302 * absorptivity_[
patchID][bandi]()[facei];
307 for (label bandi = 0; bandi < nBands_; ++bandi)
310 diffuseSolarRad[facei]
311 * spectralDistribution_[bandi]
312 * absorptivity_[
patchID][bandi]()[facei]
313 * sf[facei]/V[celli];
324 for (
const label
patchID : includePatches)
329 const labelList& cellids = pp.faceCells();
332 const label celli = cellids[facei];
333 if (includeMappedPatchBasePatches[
patchID])
335 for (label bandi = 0; bandi < nBands_; ++bandi)
338 solarCalc_.diffuseSolarRad()
339 * spectralDistribution_[bandi]
340 * absorptivity_[
patchID][bandi]()[facei];
345 for (label bandi = 0; bandi < nBands_; ++bandi)
349 spectralDistribution_[bandi]
350 * absorptivity_[
patchID][bandi]()[facei]
351 * solarCalc_.diffuseSolarRad()
352 )*sf[facei]/V[celli];
363 void Foam::radiation::solarLoad::initialise(
const dictionary& coeffs)
365 spectralDistributions_.reset
367 Function1<scalarField>::New
369 "spectralDistribution",
375 spectralDistribution_ =
376 spectralDistributions_->value(mesh_.time().timeOutputValue());
378 nBands_ = spectralDistribution_.size();
380 spectralDistribution_ =
381 spectralDistribution_/
sum(spectralDistribution_);
383 qprimaryRad_.setSize(nBands_);
385 forAll(qprimaryRad_, bandi)
395 mesh_.time().timeName(),
406 coeffs.readIfPresent(
"solidCoupled", solidCoupled_);
407 coeffs.readIfPresent(
"wallCoupled", wallCoupled_);
408 coeffs.readIfPresent(
"updateAbsorptivity", updateAbsorptivity_);
409 coeffs.readEntry(
"useReflectedRays", useReflectedRays_);
411 (void) updateHitFaces();
718 solarCalc_(coeffs_, mesh_),
749 spectralDistribution_(),
750 spectralDistributions_(),
756 updateAbsorptivity_(false),
757 useReflectedRays_(false),
764 Foam::radiation::solarLoad::solarLoad
772 solarCalc_(
dict, mesh_),
803 spectralDistribution_(),
804 spectralDistributions_(),
810 updateAbsorptivity_(false),
811 useReflectedRays_(false),
838 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
840 includePatches.
insert(patchI);
847 const polyPatch& pp =
patches[patchI];
850 (isA<mappedPatchBase>(pp) && solidCoupled_)
851 || (isA<wallPolyPatch>(pp) && wallCoupled_)
854 includeMappedPatchBasePatches.insert(patchI);
858 if (updateAbsorptivity_ || firstIter_)
860 updateAbsorptivity(includePatches);
863 const bool facesChanged = updateHitFaces();
865 const bool timeDependentLoad =
868 if (firstIter_ || facesChanged || timeDependentLoad)
873 solarCalc_.correctDirectSolarRad();
874 solarCalc_.correctDiffuseSolarRad();
876 spectralDistribution_ =
877 spectralDistributions_->value(mesh_.time().value());
879 spectralDistribution_ =
880 spectralDistribution_/
sum(spectralDistribution_);
883 const labelList& hitFacesId = hitFaces_->rayStartFaces();
884 updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches);
887 updateSkyDiffusiveRadiation
890 includeMappedPatchBasePatches
894 if (useReflectedRays_)
896 updateReflectedRays(includeMappedPatchBasePatches);
904 if (mesh_.time().writeTime())
919 mesh_.time().timeName(),
Different types of constants.
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
A solar calculator model providing models for the solar direction and solar loads.
Base class for solarLoad models.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static const boundaryRadiationProperties & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
bool read()
Read radiationProperties dictionary.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ignore writing from objectRegistry::writeObject()
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
virtual const solarCalculator & solarCalculatorRef() const
Return const reference to the solar calculator.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual bool read()=0
Read radiationProperties dictionary.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Top level model for radiation modelling.
Helper class to calculate visible faces for global, sun-like illumination.
virtual const faceShading & faceShadingRef() const
Return const reference to the face shading calculator.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
static labelList nonCoupledPatches(const polyMesh &mesh)
Helper: return all uncoupled patches.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void calculate()
Solve radiation equations.
const polyBoundaryMesh & patches
dimensionedScalar pow4(const dimensionedScalar &ds)
Automatically write from objectRegistry::writeObject()
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
List< label > labelList
A List of labels.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
Defines the attributes of an object for which implicit objectRegistry management is supported...
#define addToRadiationRunTimeSelectionTables(model)
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
static constexpr const zero Zero
Global zero (0)