solarLoad.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015 OpenFOAM Foundation
9  Copyright (C) 2016-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "solarLoad.H"
30 #include "surfaceFields.H"
31 #include "vectorList.H"
34 #include "gravityMeshObject.H"
35 #include "cyclicAMIPolyPatch.H"
36 #include "mappedPatchBase.H"
37 #include "wallPolyPatch.H"
38 #include "constants.H"
39 
40 
41 using namespace Foam::constant;
42 
43 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47  namespace radiation
48  {
49  defineTypeNameAndDebug(solarLoad, 0);
51  }
52 }
53 
54 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
55 
56 void Foam::radiation::solarLoad::updateReflectedRays
57 (
58  const labelHashSet& includePatches
59 )
60 {
61  if (!reflectedFaces_ && hitFaces_)
62  {
63  reflectedFaces_.reset
64  (
65  new faceReflecting
66  (
67  mesh_,
68  hitFaces_(),
69  solarCalc_,
70  spectralDistribution_,
71  dict_
72  )
73  );
74  }
75 
76  reflectedFaces_->correct();
77 
78  volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
79  const scalarField& V = mesh_.V();
80  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
81 
82  forAll(qrBf, patchID)
83  {
84  if (includePatches[patchID])
85  {
86  for (label bandI = 0; bandI < nBands_; bandI++)
87  {
88  qrBf[patchID] +=
89  reflectedFaces_->qreflective(bandI).boundaryField()[patchID];
90  }
91  }
92  else
93  {
94  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
95  const labelUList& cellIs = patches[patchID].faceCells();
96 
97  for (label bandI = 0; bandI < nBands_; bandI++)
98  {
99  forAll(cellIs, i)
100  {
101  const label cellI = cellIs[i];
102 
103  Ru_[cellI] +=
104  (
105  reflectedFaces_->qreflective(bandI).
106  boundaryField()[patchID][i] * sf[i]
107  )/V[cellI];
108  }
109  }
110  }
111  }
112 
113 
114 
115 }
116 
117 
118 bool Foam::radiation::solarLoad::updateHitFaces()
119 {
120  if (!hitFaces_)
121  {
122  hitFaces_.reset(new faceShading(mesh_, solarCalc_.direction()));
123  return true;
124  }
125  else
126  {
127  switch (solarCalc_.sunDirectionModel())
128  {
130  {
131  return false;
132  break;
133  }
135  {
136  label updateIndex = label
137  (
138  mesh_.time().value()/solarCalc_.sunTrackingUpdateInterval()
139  );
140 
141  if (updateIndex > updateTimeIndex_)
142  {
143  Info << "Updating Sun position..." << endl;
144  updateTimeIndex_ = updateIndex;
145  solarCalc_.correctSunDirection();
146  hitFaces_->direction() = solarCalc_.direction();
147  hitFaces_->correct();
148  return true;
149  }
150  break;
151  }
152  }
153  }
154 
155  return false;
156 }
157 
158 
159 void Foam::radiation::solarLoad::updateAbsorptivity
160 (
161  const labelHashSet& includePatches
162 )
163 {
164  const boundaryRadiationProperties& boundaryRadiation =
166 
167  for (const label patchID : includePatches)
168  {
169  absorptivity_[patchID].setSize(nBands_);
170  for (label bandI = 0; bandI < nBands_; bandI++)
171  {
172  absorptivity_[patchID][bandI] =
173  boundaryRadiation.absorptivity(patchID, bandI);
174  }
175  }
176 }
177 
178 
179 void Foam::radiation::solarLoad::updateDirectHitRadiation
180 (
181  const labelList& hitFacesId,
182  const labelHashSet& includeMappedPatchBasePatches
183 )
184 {
185  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
186  const scalarField& V = mesh_.V();
187  volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
188 
189  // Reset qr and qrPrimary
190  qrBf = 0.0;
191 
192  for (label bandI = 0; bandI < nBands_; bandI++)
193  {
194  volScalarField::Boundary& qprimaryBf =
195  qprimaryRad_[bandI].boundaryFieldRef();
196 
197  qprimaryBf = 0.0;
198 
199  forAll(hitFacesId, i)
200  {
201  const label faceI = hitFacesId[i];
202  label patchID = patches.whichPatch(faceI);
203  const polyPatch& pp = patches[patchID];
204  const label localFaceI = faceI - pp.start();
205  const vector qPrim =
206  solarCalc_.directSolarRad()*solarCalc_.direction();
207 
208  const vectorField& n = pp.faceNormals();
209 
210  {
211  qprimaryBf[patchID][localFaceI] +=
212  (qPrim & n[localFaceI])
213  * spectralDistribution_[bandI]
214  * absorptivity_[patchID][bandI]()[localFaceI];
215  }
216 
217  if (includeMappedPatchBasePatches[patchID])
218  {
219  qrBf[patchID][localFaceI] += qprimaryBf[patchID][localFaceI];
220  }
221  else
222  {
223  const vectorField& sf = mesh_.Sf().boundaryField()[patchID];
224  const label cellI = pp.faceCells()[localFaceI];
225 
226  Ru_[cellI] +=
227  (qPrim & sf[localFaceI])
228  * spectralDistribution_[bandI]
229  * absorptivity_[patchID][bandI]()[localFaceI]
230  / V[cellI];
231  }
232  }
233  }
234 }
235 
236 
237 void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
238 (
239  const labelHashSet& includePatches,
240  const labelHashSet& includeMappedPatchBasePatches
241 )
242 {
243  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
244  const scalarField& V = mesh_.V();
245  volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
246 
247  switch(solarCalc_.sunLoadModel())
248  {
251  {
252  for (const label patchID : includePatches)
253  {
254  const polyPatch& pp = patches[patchID];
255  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
256 
257  const vectorField n = pp.faceNormals();
258  const labelList& cellIds = pp.faceCells();
259 
260  forAll(n, faceI)
261  {
262  const scalar cosEpsilon(verticalDir_ & -n[faceI]);
263 
264  scalar Ed(0.0);
265  scalar Er(0.0);
266  const scalar cosTheta(solarCalc_.direction() & -n[faceI]);
267 
268  {
269  // Above the horizon
270  if (cosEpsilon == 0.0)
271  {
272  // Vertical walls
273  scalar Y(0);
274 
275  if (cosTheta > -0.2)
276  {
277  Y = 0.55+0.437*cosTheta + 0.313*sqr(cosTheta);
278  }
279  else
280  {
281  Y = 0.45;
282  }
283 
284  Ed = solarCalc_.C()*Y*solarCalc_.directSolarRad();
285  }
286  else
287  {
288  //Other than vertical walls
289  Ed =
290  solarCalc_.C()
291  * solarCalc_.directSolarRad()
292  * (1.0 + cosEpsilon)/2.0;
293  }
294 
295  // Ground reflected
296  Er =
297  solarCalc_.directSolarRad()
298  * (solarCalc_.C() + Foam::sin(solarCalc_.beta()))
299  * solarCalc_.groundReflectivity()
300  * (1.0 - cosEpsilon)/2.0;
301  }
302 
303  const label cellI = cellIds[faceI];
304  if (includeMappedPatchBasePatches[patchID])
305  {
306  for (label bandI = 0; bandI < nBands_; bandI++)
307  {
308  qrBf[patchID][faceI] +=
309  (Ed + Er)
310  * spectralDistribution_[bandI]
311  * absorptivity_[patchID][bandI]()[faceI];
312  }
313  }
314  else
315  {
316  for (label bandI = 0; bandI < nBands_; bandI++)
317  {
318  Ru_[cellI] +=
319  (Ed + Er)
320  * spectralDistribution_[bandI]
321  * absorptivity_[patchID][bandI]()[faceI]
322  * sf[faceI]/V[cellI];
323  }
324  }
325  }
326  }
327  }
328  break;
329 
331  {
332  for (const label patchID : includePatches)
333  {
334  const polyPatch& pp = patches[patchID];
335  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
336 
337  const labelList& cellIds = pp.faceCells();
338  forAll(pp, faceI)
339  {
340  const label cellI = cellIds[faceI];
341  if (includeMappedPatchBasePatches[patchID])
342  {
343  for (label bandI = 0; bandI < nBands_; bandI++)
344  {
345  qrBf[patchID][faceI] +=
346  solarCalc_.diffuseSolarRad()
347  * spectralDistribution_[bandI]
348  * absorptivity_[patchID][bandI]()[faceI];
349  }
350  }
351  else
352  {
353  for (label bandI = 0; bandI < nBands_; bandI++)
354  {
355  Ru_[cellI] +=
356  (
357  spectralDistribution_[bandI]
358  * absorptivity_[patchID][bandI]()[faceI]
359  * solarCalc_.diffuseSolarRad()
360  )*sf[faceI]/V[cellI];
361  }
362  }
363  }
364  }
365  break;
366  }
367  }
368 }
369 
370 
371 void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
372 {
373  coeffs.readEntry("spectralDistribution", spectralDistribution_);
374 
375  nBands_ = spectralDistribution_.size();
376 
377  qprimaryRad_.setSize(nBands_);
378 
379  if (coeffs.readIfPresent("gridUp", verticalDir_))
380  {
381  verticalDir_.normalise();
382  }
383  else
384  {
386  meshObjects::gravity::New(mesh_.time());
387  verticalDir_ = (-g/mag(g)).value();
388  }
389 
390  coeffs.readEntry("useReflectedRays", useReflectedRays_);
391 
392  spectralDistribution_ =
393  spectralDistribution_/sum(spectralDistribution_);
394 
395  forAll(qprimaryRad_, bandI)
396  {
397  qprimaryRad_.set
398  (
399  bandI,
400  new volScalarField
401  (
402  IOobject
403  (
404  "qprimaryRad_" + Foam::name(bandI) ,
405  mesh_.time().timeName(),
406  mesh_,
409  ),
410  mesh_,
412  )
413  );
414  }
415 
416  coeffs.readIfPresent("solidCoupled", solidCoupled_);
417  coeffs.readIfPresent("wallCoupled", wallCoupled_);
418  coeffs.readIfPresent("updateAbsorptivity", updateAbsorptivity_);
419 }
420 
421 /*
422 void Foam::radiation::solarLoad::calculateQdiff
423 (
424  const labelHashSet& includePatches,
425  const labelHashSet& includeMappedPatchBasePatches
426 )
427 {
428  scalarListIOList FmyProc
429  (
430  IOobject
431  (
432  "F",
433  mesh_.facesInstance(),
434  mesh_,
435  IOobject::MUST_READ,
436  IOobject::NO_WRITE,
437  false
438  )
439  );
440 
441 
442  if (!coarseMesh_ && !finalAgglom_.empty())
443  {
444  coarseMesh_.reset
445  (
446  new singleCellFvMesh
447  (
448  IOobject
449  (
450  "coarse:" + mesh_.name(),
451  mesh_.polyMesh::instance(),
452  mesh_.time(),
453  IOobject::NO_READ,
454  IOobject::NO_WRITE
455  ),
456  mesh_,
457  finalAgglom_
458  )
459  );
460  }
461 
462  label nLocalVFCoarseFaces = 0;
463  forAll(includePatches_, i)
464  {
465  const label patchI = includePatches_[i];
466  nLocalVFCoarseFaces += coarseMesh_->boundaryMesh()[patchI].size();
467  }
468 
469  label totalFVNCoarseFaces = nLocalVFCoarseFaces;
470  reduce(totalFVNCoarseFaces, sumOp<label>());
471 
472  // Calculate weighted absorptivity on coarse patches
473  List<scalar> localCoarseEave(nLocalVFCoarseFaces);
474  List<scalar> localTave(nLocalVFCoarseFaces);
475  List<scalar> localCoarsePartialArea(nLocalVFCoarseFaces);
476  List<vector> localCoarseNorm(nLocalVFCoarseFaces);
477 
478  scalarField compactCoarseEave(map_->constructSize(), 0.0);
479  scalarField compactCoarseTave(map_->constructSize(), 0.0);
480 
481  scalarField compactCoarsePartialArea(map_->constructSize(), 0.0);
482 
483  vectorList compactCoarseNorm(map_->constructSize(), Zero);
484 
485  const boundaryRadiationProperties& boundaryRadiation =
486  boundaryRadiationProperties::New(mesh_);
487 
488  coarseToFine_.setSize(includePatches_.size());
489 
490  const labelList& hitFacesId = hitFaces_->rayStartFaces();
491 
492  label startI = 0;
493  label compactI = 0;
494  forAll(includePatches_, i)
495  {
496  const label patchID = includePatches_[i];
497  const polyPatch& pp = mesh_.boundaryMesh()[patchID];
498 
499  const polyPatch& cpp = coarseMesh_->boundaryMesh()[patchID];
500 
501  const labelList& agglom = finalAgglom_[patchID];
502 
503  if (agglom.size() > 0)
504  {
505  label nAgglom = max(agglom) + 1;
506  coarseToFine_[i] = invertOneToMany(nAgglom, agglom);
507  }
508 
509  // Weight emissivity by spectral distribution
510  scalarField e(pp.size(), 0.0);
511 
512  for (label bandI = 0; bandI < nBands_; bandI++)
513  {
514  const tmp<scalarField> te =
515  spectralDistribution_[bandI]
516  *boundaryRadiation.diffReflectivity(patchID, bandI);
517  e += te();
518  }
519 
520  scalarList Eave(cpp.size(), 0.0);
521  scalarList Tave(cpp.size(), 0.0);
522 
523  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
524  const scalarField& Tf = T_.boundaryField()[patchID];
525 
526  const labelList& coarsePatchFace=coarseMesh_->patchFaceMap()[patchID];
527 
528  forAll(cpp, coarseI)
529  {
530  const label coarseFaceID = coarsePatchFace[coarseI];
531  const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
532 
533  UIndirectList<scalar> fineSf(sf, fineFaces);
534  scalar fineArea = sum(fineSf());
535 
536  scalar fullArea = 0.0;
537  forAll(fineFaces, j)
538  {
539  label faceI = fineFaces[j];
540  label globalFaceI = faceI + pp.start();
541 
542  if (hitFacesId.found(globalFaceI))
543  {
544  fullArea += sf[faceI];
545  }
546  Eave[coarseI] += (e[faceI]*sf[faceI])/fineArea;
547  Tave[coarseI] += (pow4(Tf[faceI])*sf[faceI])/fineArea;
548  }
549  localCoarsePartialArea[compactI++] = fullArea/fineArea;
550  }
551 
552  SubList<scalar>
553  (
554  localCoarseEave,
555  Eave.size(),
556  startI
557  ) = Eave;
558 
559  SubList<scalar>
560  (
561  localTave,
562  Tave.size(),
563  startI
564  ) = Tave;
565 
566  const vectorList coarseNSf = cpp.faceNormals();
567  SubList<vector>
568  (
569  localCoarseNorm,
570  cpp.size(),
571  startI
572  ) = coarseNSf;
573 
574  startI += cpp.size();
575  }
576 
577 
578  SubList<scalar>(compactCoarsePartialArea, nLocalVFCoarseFaces) =
579  localCoarsePartialArea;
580 
581  SubList<scalar>(compactCoarseEave, nLocalVFCoarseFaces) =
582  localCoarseEave;
583 
584  SubList<scalar>(compactCoarseTave, nLocalVFCoarseFaces) =
585  localTave;
586 
587  SubList<vector>(compactCoarseNorm, nLocalVFCoarseFaces) =
588  localCoarseNorm;
589 
590  map_->distribute(compactCoarsePartialArea);
591  map_->distribute(compactCoarseEave);
592  map_->distribute(compactCoarseTave);
593  map_->distribute(compactCoarseNorm);
594 
595 
596  // Calculate coarse hitFaces and Sun direct hit heat fluxes
597  scalarList localqDiffusive(nLocalVFCoarseFaces, Zero);
598 
599  label locaFaceI = 0;
600  forAll(includePatches_, i)
601  {
602  const label patchID = includePatches_[i];
603  const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID];
604  const polyPatch& ppf = mesh_.boundaryMesh()[patchID];
605 
606  const labelList& coarsePatchFace = coarseMesh_->patchFaceMap()[patchID];
607  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
608 
609 
610  scalarField a(ppf.size(), Zero);
611 
612  for (label bandI = 0; bandI < nBands_; bandI++)
613  {
614  const tmp<scalarField> ta =
615  spectralDistribution_[bandI]
616  * absorptivity_[patchID][bandI]();
617  a += ta();
618  }
619 
620  forAll(pp, coarseI)
621  {
622  const label coarseFaceID = coarsePatchFace[coarseI];
623  const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
624  UIndirectList<scalar> fineSf(sf, fineFaces);
625  scalar fineArea = sum(fineSf());
626 
627  // // Weighting absorptivity per area on secondary diffussive flux
628  scalar aAve = 0.0;
629  forAll(fineFaces, j)
630  {
631  label faceI = fineFaces[j];
632  aAve += (a[faceI]*sf[faceI])/fineArea;
633  }
634 
635  const scalarList& vf = FmyProc[locaFaceI];
636  const labelList& compactFaces = visibleFaceFaces_[locaFaceI];
637 
638  forAll(compactFaces, j)
639  {
640  label compactI = compactFaces[j];
641 
642  scalar qin =
643  (
644  solarCalc_.directSolarRad()*solarCalc_.direction()
645  & compactCoarseNorm[compactI]
646  )*compactCoarsePartialArea[compactI];
647 
648  // q emission
649  scalar qem =
650  compactCoarseEave[compactI]
651  *physicoChemical::sigma.value()
652  *compactCoarseTave[compactI];
653 
654  // compactCoarseEave is the diffussive reflected coeff
655  scalar qDiff = (compactCoarseEave[compactI])*qin;
656 
657  localqDiffusive[locaFaceI] += (qDiff)*aAve*vf[j];
658  }
659  locaFaceI++;
660  }
661  }
662 
663  volScalarField::Boundary& qsBf = qsecondRad_.boundaryFieldRef();
664 
665  // Fill qsecondRad_
666  label compactId = 0;
667  forAll(includePatches_, i)
668  {
669  const label patchID = includePatches_[i];
670  const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID];
671 
672  if (pp.size() > 0)
673  {
674  scalarField& qrp = qsBf[patchID];
675 
676  const labelList& coarsePatchFace =
677  coarseMesh_->patchFaceMap()[patchID];
678 
679  forAll(pp, coarseI)
680  {
681  const label coarseFaceID = coarsePatchFace[coarseI];
682  const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
683  forAll(fineFaces, k)
684  {
685  label faceI = fineFaces[k];
686  qrp[faceI] = localqDiffusive[compactId];
687  }
688  compactId ++;
689  }
690  }
691  }
692 
693  const scalarField& V = mesh_.V();
694  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
695  volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
696 
697  for (const label patchID : includePatches)
698  {
699  const scalarField& qSecond = qsecondRad_.boundaryField()[patchID];
700  if (includeMappedPatchBasePatches[patchID])
701  {
702  qrBf[patchID] += qSecond;
703  }
704  else
705  {
706  const polyPatch& pp = patches[patchID];
707  const labelList& cellIds = pp.faceCells();
708  const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
709  forAll(pp, faceI)
710  {
711  const label cellI = cellIds[faceI];
712  Ru_[cellI] += qSecond[faceI]*sf[faceI]/V[cellI];
713  }
714  }
715  }
716 }
717 */
718 
719 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
720 
721 Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
722 :
723  radiationModel(typeName, T),
724  dict_(coeffs_),
725  qr_
726  (
727  IOobject
728  (
729  "qr",
730  mesh_.time().timeName(),
731  mesh_,
732  IOobject::READ_IF_PRESENT,
733  IOobject::AUTO_WRITE
734  ),
735  mesh_,
737  ),
738  hitFaces_(),
739  reflectedFaces_(),
740  Ru_
741  (
742  IOobject
743  (
744  "Ru",
745  mesh_.time().timeName(),
746  mesh_,
747  IOobject::NO_READ,
748  IOobject::NO_WRITE
749  ),
750  mesh_,
752  ),
753  solarCalc_(coeffs_, mesh_),
754  verticalDir_(Zero),
755  useReflectedRays_(false),
756  spectralDistribution_(),
757  nBands_(0),
758  qprimaryRad_(0),
759  solidCoupled_(true),
760  absorptivity_(mesh_.boundaryMesh().size()),
761  updateAbsorptivity_(false),
762  firstIter_(true),
763  updateTimeIndex_(0)
764 {
765  initialise(coeffs_);
766 }
767 
768 
769 Foam::radiation::solarLoad::solarLoad
770 (
771  const dictionary& dict,
772  const volScalarField& T
773 )
774 :
775  radiationModel(typeName, dict, T),
776  dict_(dict),
777  qr_
778  (
779  IOobject
780  (
781  "qr",
782  mesh_.time().timeName(),
783  mesh_,
786  ),
787  mesh_,
789  ),
790  hitFaces_(),
791  reflectedFaces_(),
792  Ru_
793  (
794  IOobject
795  (
796  "Ru",
797  mesh_.time().timeName(),
798  mesh_,
801  ),
802  mesh_,
804  ),
805  solarCalc_(dict, mesh_),
806  verticalDir_(Zero),
807  useReflectedRays_(false),
808  spectralDistribution_(),
809  nBands_(0),
810  qprimaryRad_(0),
811  solidCoupled_(true),
812  wallCoupled_(false),
813  absorptivity_(mesh_.boundaryMesh().size()),
814  updateAbsorptivity_(false),
815  firstIter_(true),
816  updateTimeIndex_(0)
817 {
818  initialise(dict);
819 }
820 
821 
822 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
823 
825 {
826  return nBands_;
827 }
828 
829 
831 {
832  if (radiationModel::read())
833  {
834  return true;
835  }
836 
837  return false;
838 }
839 
840 
842 {
843  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
844  labelHashSet includePatches;
845  forAll(patches, patchI)
846  {
847  const polyPatch& pp = patches[patchI];
848  if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
849  {
850  includePatches.insert(patchI);
851  }
852  }
853 
854  labelHashSet includeMappedPatchBasePatches;
855  forAll(patches, patchI)
856  {
857  const polyPatch& pp = patches[patchI];
858  if
859  (
860  (isA<mappedPatchBase>(pp) && solidCoupled_)
861  || (isA<wallPolyPatch>(pp) && wallCoupled_)
862  )
863  {
864  includeMappedPatchBasePatches.insert(patchI);
865  }
866  }
867 
868  if (updateAbsorptivity_ || firstIter_)
869  {
870  updateAbsorptivity(includePatches);
871  }
872 
873  bool facesChanged = updateHitFaces();
874 
875  if (facesChanged)
876  {
877  // Reset Ru
879 
880  // Add direct hit radiation
881  const labelList& hitFacesId = hitFaces_->rayStartFaces();
882  updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches);
883 
884  // Add sky diffusive radiation
885  updateSkyDiffusiveRadiation
886  (
887  includePatches,
888  includeMappedPatchBasePatches
889  );
890 
891  // Add specular reflected radiation
892  if (useReflectedRays_)
893  {
894  updateReflectedRays(includeMappedPatchBasePatches);
895  }
896 
897  firstIter_ = false;
898  }
899 
900  if (debug)
901  {
902  if (mesh_.time().writeTime())
903  {
904  Ru_.write();
905  }
906  }
907 }
908 
909 
911 {
913  (
914  IOobject
915  (
916  "Rp",
917  mesh_.time().timeName(),
918  mesh_,
921  false
922  ),
923  mesh_,
925  (
927  Zero
928  )
929  );
930 }
931 
932 
935 {
936  return Ru_;
937 }
938 
939 
940 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::radiation::solarLoad::nBands
label nBands() const
Number of bands.
Definition: solarLoad.C:824
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
solarLoad.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
vectorList.H
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
Foam::radiation::radiationModel::coeffs_
dictionary coeffs_
Radiation model dictionary.
Definition: radiationModel.H:112
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::constant
Different types of constants.
Definition: atomicConstants.C:38
Foam::sin
dimensionedScalar sin(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:264
Foam::polyPatch::coupled
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:329
Foam::MeshObject< fvMesh, Foam::GeometricMeshObject, boundaryRadiationProperties >::New
static const boundaryRadiationProperties & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
Definition: MeshObject.C:48
gravityMeshObject.H
wallPolyPatch.H
Foam::solarCalculator::mSunLoadFairWeatherConditions
Definition: solarCalculator.H:122
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
surfaceFields.H
Foam::surfaceFields.
Foam::HashSet< label, Hash< label > >
Foam::radiation::solarLoad::Ru
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
Definition: solarLoad.C:934
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::pow4
dimensionedScalar pow4(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:100
Foam::radiation::radiationModel::read
virtual bool read()=0
Read radiationProperties dictionary.
Definition: radiationModel.C:210
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::uniformDimensionedVectorField
UniformDimensionedField< vector > uniformDimensionedVectorField
Definition: uniformDimensionedFields.H:50
patchID
label patchID
Definition: boundaryProcessorFaPatchPoints.H:5
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:122
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
radiation
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned< scalar >
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:24
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::solarCalculator::mSunDirConstant
Definition: solarCalculator.H:114
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::radiation::solarLoad::calculate
void calculate()
Solve.
Definition: solarLoad.C:841
cyclicAMIPolyPatch.H
constants.H
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::solarCalculator::mSunLoadTheoreticalMaximum
Definition: solarCalculator.H:123
Foam::List< label >
Foam::radiation::radiationModel
Top level model for radiation modelling.
Definition: radiationModel.H:75
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:181
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:55
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
addToRadiationRunTimeSelectionTables
#define addToRadiationRunTimeSelectionTables(model)
Definition: radiationModel.H:288
Foam::labelUList
UList< label > labelUList
A UList of labels.
Definition: UList.H:80
Foam::radiation::solarLoad::read
bool read()
Read radiation properties dictionary.
Definition: solarLoad.C:830
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys and label hasher.
Definition: HashSet.H:409
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
boundaryRadiationProperties.H
Foam::solarCalculator::mSunDirTracking
Definition: solarCalculator.H:115
Foam::meshObjects::gravity::New
static const gravity & New(const Time &runTime)
Construct on Time.
Definition: gravityMeshObject.H:93
Foam::radiation::solarLoad::Rp
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Definition: solarLoad.C:910
mappedPatchBase.H
Foam::solarCalculator::mSunLoadConstant
Definition: solarCalculator.H:121