77 Info <<
"Updating Sun position..." <<
endl;
103 const label patchID = iter.key();
104 absorptivity_[patchID].setSize(nBands_);
105 for (
label bandI = 0; bandI < nBands_; bandI++)
107 absorptivity_[patchID][bandI] =
125 const label faceI = hitFacesId[i];
130 solarCalc_.directSolarRad()
131 * solarCalc_.direction();
133 if (includeMappedPatchBasePatches[patchID])
137 for (
label bandI = 0; bandI < nBands_; bandI++)
139 Qr_.boundaryField()[patchID][localFaceI] +=
140 (qPrim &
n[localFaceI])
141 * spectralDistribution_[bandI]
142 * absorptivity_[patchID][bandI]()[localFaceI];
150 for (
label bandI = 0; bandI < nBands_; bandI++)
153 (qPrim &
sf[localFaceI])
154 * spectralDistribution_[bandI]
155 * absorptivity_[patchID][bandI]()[localFaceI]
171 switch(solarCalc_.sunLoadModel())
178 const label patchID = iter.key();
180 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
187 const scalar cosEpsilon(verticalDir_ & -
n[faceI]);
191 const scalar cosTheta(solarCalc_.direction() & -
n[faceI]);
195 if (cosEpsilon == 0.0)
202 Y = 0.55+0.437*cosTheta + 0.313*
sqr(cosTheta);
209 Ed = solarCalc_.C()*
Y*solarCalc_.directSolarRad();
216 * solarCalc_.directSolarRad()
217 * (1.0 + cosEpsilon)/2.0;
222 solarCalc_.directSolarRad()
223 * (solarCalc_.C() +
Foam::sin(solarCalc_.beta()))
224 * solarCalc_.groundReflectivity()
225 * (1.0 - cosEpsilon)/2.0;
228 const label cellI = cellIds[faceI];
229 if (includeMappedPatchBasePatches[patchID])
231 for (
label bandI = 0; bandI < nBands_; bandI++)
233 Qr_.boundaryField()[patchID][faceI] +=
235 * spectralDistribution_[bandI]
236 * absorptivity_[patchID][bandI]()[faceI];
241 for (
label bandI = 0; bandI < nBands_; bandI++)
245 * spectralDistribution_[bandI]
246 * absorptivity_[patchID][bandI]()[faceI]
247 *
sf[faceI]/V[cellI];
259 const label patchID = iter.key();
261 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
266 const label cellI = cellIds[faceI];
267 if (includeMappedPatchBasePatches[patchID])
269 for (
label bandI = 0; bandI < nBands_; bandI++)
271 Qr_.boundaryField()[patchID][faceI] +=
272 solarCalc_.diffuseSolarRad()
273 * spectralDistribution_[bandI]
274 * absorptivity_[patchID][bandI]()[faceI];
279 for (
label bandI = 0; bandI < nBands_; bandI++)
283 spectralDistribution_[bandI]
284 * absorptivity_[patchID][bandI]()[faceI]
285 * solarCalc_.diffuseSolarRad()
286 )*
sf[faceI]/V[cellI];
300 if (coeffs.
found(
"gridUp"))
302 coeffs.
lookup(
"gridUp") >> verticalDir_;
303 verticalDir_ /=
mag(verticalDir_);
309 verticalDir_ = (-
g/
mag(
g)).value();
312 includePatches_ = mesh_.boundaryMesh().findIndices(viewFactorWalls);
314 coeffs.
lookup(
"useVFbeamToDiffuse") >> useVFbeamToDiffuse_;
316 coeffs.
lookup(
"spectralDistribution") >> spectralDistribution_;
317 spectralDistribution_ =
318 spectralDistribution_/
sum(spectralDistribution_);
320 nBands_ = spectralDistribution_.size();
322 if (useVFbeamToDiffuse_)
331 mesh_.facesInstance(),
340 if (coeffs.
found(
"solidCoupled"))
342 coeffs.
lookup(
"solidCoupled") >> solidCoupled_;
345 if (coeffs.
found(
"wallCoupled"))
347 coeffs.
lookup(
"wallCoupled") >> wallCoupled_;
350 if (coeffs.
found(
"updateAbsorptivity"))
352 coeffs.
lookup(
"updateAbsorptivity") >> updateAbsorptivity_;
369 mesh_.facesInstance(),
378 if (finalAgglom_.size() > 0 && coarseMesh_.empty())
386 "coarse." + mesh_.name(),
387 mesh_.polyMesh::instance(),
398 label nLocalVFCoarseFaces = 0;
399 forAll(includePatches_, i)
401 const label patchI = includePatches_[i];
402 nLocalVFCoarseFaces +=
403 coarseMesh_->boundaryMesh()[patchI].size();
406 label totalFVNCoarseFaces = nLocalVFCoarseFaces;
411 List<scalar> localCoarsePartialArea(nLocalVFCoarseFaces);
414 scalarField compactCoarseRave(map_->constructSize(), 0.0);
415 scalarField compactCoarsePartialArea(map_->constructSize(), 0.0);
421 coarseToFine_.setSize(includePatches_.size());
423 const labelList& hitFacesId = hitFaces_->rayStartFaces();
427 forAll (includePatches_, i)
429 const label patchID = includePatches_[i];
434 const labelList& agglom = finalAgglom_[patchID];
436 if (agglom.
size() > 0)
443 for (
label bandI = 0; bandI < nBands_; bandI++)
446 spectralDistribution_[bandI]
454 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
457 coarseMesh_->patchFaceMap()[patchID];
461 const label coarseFaceID = coarsePatchFace[coarseI];
463 coarseToFine_[i][coarseFaceID];
470 scalar fineArea =
sum(fineSf());
472 scalar fullArea = 0.0;
475 label faceI = fineFaces[j];
478 if (
findIndex(hitFacesId, globalFaceI) != -1)
480 fullArea +=
sf[faceI];
482 Rave[coarseI] += (r[faceI]*
sf[faceI])/fineArea;
484 localCoarsePartialArea[compactI++] = fullArea/fineArea;
502 startI += cpp.size();
508 localCoarsePartialArea
521 map_->distribute(compactCoarsePartialArea);
522 map_->distribute(compactCoarseRave);
523 map_->distribute(compactCoarseNorm);
527 scalarList localqDiffusive(nLocalVFCoarseFaces, 0.0);
530 forAll (includePatches_, i)
532 const label patchID = includePatches_[i];
537 coarseMesh_->patchFaceMap()[patchID];
538 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
541 for (
label bandI = 0; bandI < nBands_; bandI++)
544 spectralDistribution_[bandI]
545 * absorptivity_[patchID][bandI]();
551 const label coarseFaceID = coarsePatchFace[coarseI];
552 const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
558 scalar fineArea =
sum(fineSf());
563 label faceI = fineFaces[j];
564 aAve += (a[faceI]*
sf[faceI])/fineArea;
569 const labelList& compactFaces = visibleFaceFaces_[locaFaceI];
574 label compactI = compactFaces[j];
576 localqDiffusive[locaFaceI] +=
577 compactCoarsePartialArea[compactI]
579 * (solarCalc_.directSolarRad()*solarCalc_.direction())
580 & compactCoarseNorm[compactI]
582 * compactCoarseRave[compactI];
591 forAll (includePatches_, i)
593 const label patchID = includePatches_[i];
598 scalarField& Qrp = QsecondRad_.boundaryField()[patchID];
601 coarseMesh_->patchFaceMap()[patchID];
605 const label coarseFaceID = coarsePatchFace[coarseI];
606 const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
609 label faceI = fineFaces[
k];
610 Qrp[faceI] = localqDiffusive[compactId];
622 const label patchID = iter.key();
623 const scalarField& qSecond = QsecondRad_.boundaryField()[patchID];
624 if (includeMappedPatchBasePatches[patchID])
626 Qr_.boundaryField()[patchID] += qSecond;
632 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
635 const label cellI = cellIds[faceI];
636 Ru_[cellI] += qSecond[faceI]*
sf[faceI]/V[cellI];
653 mesh_.facesInstance(),
701 solarCalc_(this->subDict(typeName +
"Coeffs"), mesh_),
703 useVFbeamToDiffuse_(false),
704 includePatches_(mesh_.
boundary().size(), -1),
707 spectralDistribution_(nBands_),
714 mesh_.facesInstance(),
723 updateAbsorptivity_(false),
743 mesh_.facesInstance(),
756 mesh_.time().timeName(),
769 mesh_.time().timeName(),
783 mesh_.time().timeName(),
791 solarCalc_(coeffs_, mesh_),
793 useVFbeamToDiffuse_(
false),
794 includePatches_(mesh_.boundary().size(), -1),
797 spectralDistribution_(nBands_),
804 mesh_.facesInstance(),
813 absorptivity_(mesh_.boundaryMesh().size()),
814 updateAbsorptivity_(
false),
826 const word radWallFieldName
835 mesh_.facesInstance(),
848 mesh_.time().timeName(),
861 mesh_.time().timeName(),
875 mesh_.time().timeName(),
883 solarCalc_(
dict, mesh_),
885 useVFbeamToDiffuse_(
false),
886 includePatches_(mesh_.boundary().size(), -1),
889 spectralDistribution_(nBands_),
896 mesh_.facesInstance(),
905 absorptivity_(mesh_.boundaryMesh().size()),
906 updateAbsorptivity_(
false),
947 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
949 includePatches.
insert(patchI);
959 (isA<mappedPatchBase>(pp) && solidCoupled_)
960 || (isA<wallPolyPatch>(pp) && wallCoupled_)
963 includeMappedPatchBasePatches.
insert(patchI);
967 if (updateAbsorptivity_ || firstIter_)
969 updateAbsorptivity(includePatches);
972 bool facesChanged = updateHitFaces();
978 Qr_.boundaryField() = 0.0;
981 const labelList& hitFacesId = hitFaces_->rayStartFaces();
982 updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches);
985 updateSkyDiffusiveRadiation
988 includeMappedPatchBasePatches
992 if (useVFbeamToDiffuse_)
994 calculateQdiff(includePatches, includeMappedPatchBasePatches);
1002 if (mesh_.time().outputTime())
1019 mesh_.time().timeName(),