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()
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();
177void Foam::radiation::solarLoad::updateAbsorptivity
185 for (
const label
patchID : includePatches)
187 absorptivity_[
patchID].setSize(nBands_);
188 for (label bandi = 0; bandi < nBands_; ++bandi)
190 absorptivity_[
patchID][bandi] =
197void 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]
263void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
269 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
273 switch(solarCalc_.sunLoadModel())
278 for (
const label
patchID : includePatches)
288 tmp<scalarField> tdiffuseSolarRad =
289 solarCalc_.diffuseSolarRad(
n);
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)
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];
363void 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(),
408 coeffs.
readIfPresent(
"updateAbsorptivity", updateAbsorptivity_);
409 coeffs.
readEntry(
"useReflectedRays", useReflectedRays_);
411 (void) updateHitFaces();
749 spectralDistribution_(),
750 spectralDistributions_(),
756 updateAbsorptivity_(false),
757 useReflectedRays_(false),
764Foam::radiation::solarLoad::solarLoad
772 solarCalc_(
dict, mesh_),
803 spectralDistribution_(),
804 spectralDistributions_(),
810 updateAbsorptivity_(false),
811 useReflectedRays_(false),
840 includePatches.
insert(patchI);
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())
Macros for easy insertion into run-time selection tables.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
label size() const noexcept
The number of elements in list.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
static FOAM_NO_DANGLING_REFERENCE const boundaryRadiationProperties & New(const fvMesh &mesh, Args &&... args)
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 readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
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...
Calculates the reflecting faces from specular surfaces. It only takes into account the first reflecti...
Helper class to calculate visible faces for global, sun-like illumination.
static labelList nonCoupledPatches(const polyMesh &mesh)
Helper: return all uncoupled patches.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
Boundary radiation properties holder.
const labelList faceZoneIds() const
Return identifiers of face zones activated for boundary radiation.
tmp< scalarField > absorptivity(const label patchI, const label bandI=0, const vectorField *incomingDirection=nullptr, const 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.
const volScalarField & T() const noexcept
Return access to the temperature field.
Base class for solarLoad models.
solarLoadBase(const fvMesh &mesh)
Construct.
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).
virtual const solarCalculator & solarCalculatorRef() const
Return const reference to the solar calculator.
virtual const faceShading & faceShadingRef() const
Return const reference to the face shading calculator.
bool read()
Read radiationProperties dictionary.
void calculate()
Solve radiation equations.
A solar calculator model providing models for the solar direction and solar loads.
@ mSunLoadFairWeatherConditions
@ mSunLoadTheoreticalMaximum
A class for managing temporary objects.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
const expr V(m.psi().mesh().V())
Different types of constants.
Namespace for handling debugging switches.
Namespace for radiation modelling.
List< label > labelList
A List of labels.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensionedScalar pow4(const dimensionedScalar &ds)
Field< vector > vectorField
Specialisation of Field<T> for vector.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
#define addToRadiationRunTimeSelectionTables(model)
#define forAll(list, i)
Loop across all elements in list.