77 Info <<
"Updating Sun position..." <<
endl;
109 const label patchID = iter.key();
110 absorptivity_[patchID].setSize(nBands_);
111 for (
label bandI = 0; bandI < nBands_; bandI++)
113 absorptivity_[patchID][bandI] =
131 const label faceI = hitFacesId[i];
136 solarCalc_.directSolarRad()
137 * solarCalc_.direction();
146 for (
label bandI = 0; bandI < nBands_; bandI++)
154 Qr_.boundaryField()[patchID][localFaceI] +=
155 (qPrim &
n[localFaceI])
156 * spectralDistribution_[bandI]
157 * absorptivity_[patchID][bandI]()[localFaceI];
165 for (
label bandI = 0; bandI < nBands_; bandI++)
170 (qPrim &
sf[localFaceI])
171 * spectralDistribution_[bandI]
172 * absorptivity_[patchID][bandI]()[localFaceI]
191 switch(solarCalc_.sunLoadModel())
198 const label patchID = iter.key();
200 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
207 const scalar cosEpsilon(verticalDir_ & -
n[faceI]);
211 const scalar cosTheta(solarCalc_.direction() & -
n[faceI]);
215 if (cosEpsilon == 0.0)
222 Y = 0.55+0.437*cosTheta + 0.313*
sqr(cosTheta);
229 Ed = solarCalc_.C()*
Y*solarCalc_.directSolarRad();
236 * solarCalc_.directSolarRad()
237 * (1.0 + cosEpsilon)/2.0;
242 solarCalc_.directSolarRad()
243 * (solarCalc_.C() +
Foam::sin(solarCalc_.beta()))
244 * solarCalc_.groundReflectivity()
245 * (1.0 - cosEpsilon)/2.0;
248 const label cellI = cellIds[faceI];
252 for (
label bandI = 0; bandI < nBands_; bandI++)
255 QdiffRad_.boundaryField()[patchID][faceI] +=
257 * spectralDistribution_[bandI]
258 * absorptivity_[patchID][bandI]()[faceI];
266 for (
label bandI = 0; bandI < nBands_; bandI++)
270 * spectralDistribution_[bandI]
271 * absorptivity_[patchID][bandI]()[faceI]
272 *
sf[faceI]/V[cellI];
287 const label patchID = iter.key();
289 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
294 const label cellI = cellIds[faceI];
297 for (
label bandI = 0; bandI < nBands_; bandI++)
300 QdiffRad_.boundaryField()[patchID][faceI] +=
301 solarCalc_.diffuseSolarRad()
302 * spectralDistribution_[bandI]
303 * absorptivity_[patchID][bandI]()[faceI];
308 for (
label bandI = 0; bandI < nBands_; bandI++)
312 spectralDistribution_[bandI]
313 * absorptivity_[patchID][bandI]()[faceI]
314 * solarCalc_.diffuseSolarRad()
315 )*
sf[faceI]/V[cellI];
332 if (coeffs.
found(
"gridUp"))
334 coeffs.
lookup(
"gridUp") >> verticalDir_;
335 verticalDir_ /=
mag(verticalDir_);
341 verticalDir_ = (-
g/
mag(
g)).value();
344 includePatches_ = mesh_.boundaryMesh().findIndices(viewFactorWalls);
346 coeffs.
lookup(
"useVFbeamToDiffuse") >> useVFbeamToDiffuse_;
348 coeffs.
lookup(
"spectralDistribution") >> spectralDistribution_;
349 spectralDistribution_ =
350 spectralDistribution_/
sum(spectralDistribution_);
352 nBands_ = spectralDistribution_.size();
354 if (useVFbeamToDiffuse_)
363 mesh_.facesInstance(),
372 if (coeffs.
found(
"solidCoupled"))
374 coeffs.
lookup(
"solidCoupled") >> solidCoupled_;
377 if (coeffs.
found(
"wallCoupled"))
379 coeffs.
lookup(
"wallCoupled") >> wallCoupled_;
382 if (coeffs.
found(
"updateAbsorptivity"))
384 coeffs.
lookup(
"updateAbsorptivity") >> updateAbsorptivity_;
401 mesh_.facesInstance(),
410 if (finalAgglom_.size() > 0 && coarseMesh_.empty())
418 "coarse." + mesh_.name(),
419 mesh_.polyMesh::instance(),
430 label nLocalVFCoarseFaces = 0;
431 forAll(includePatches_, i)
433 const label patchI = includePatches_[i];
434 nLocalVFCoarseFaces +=
435 coarseMesh_->boundaryMesh()[patchI].size();
438 label totalFVNCoarseFaces = nLocalVFCoarseFaces;
443 List<scalar> localCoarsePartialArea(nLocalVFCoarseFaces);
446 scalarField compactCoarseRave(map_->constructSize(), 0.0);
447 scalarField compactCoarsePartialArea(map_->constructSize(), 0.0);
453 coarseToFine_.setSize(includePatches_.size());
455 const labelList& hitFacesId = hitFaces_->rayStartFaces();
459 forAll (includePatches_, i)
461 const label patchID = includePatches_[i];
466 const labelList& agglom = finalAgglom_[patchID];
468 if (agglom.
size() > 0)
475 for (
label bandI = 0; bandI < nBands_; bandI++)
478 spectralDistribution_[bandI]
486 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
489 coarseMesh_->patchFaceMap()[patchID];
493 const label coarseFaceID = coarsePatchFace[coarseI];
495 coarseToFine_[i][coarseFaceID];
502 scalar fineArea =
sum(fineSf());
504 scalar fullArea = 0.0;
507 label faceI = fineFaces[j];
510 if (
findIndex(hitFacesId, globalFaceI) != -1)
512 fullArea +=
sf[faceI];
514 Rave[coarseI] += (r[faceI]*
sf[faceI])/fineArea;
516 localCoarsePartialArea[compactI++] = fullArea/fineArea;
534 startI += cpp.size();
540 localCoarsePartialArea
553 map_->distribute(compactCoarsePartialArea);
554 map_->distribute(compactCoarseRave);
555 map_->distribute(compactCoarseNorm);
559 scalarList localqDiffusive(nLocalVFCoarseFaces, 0.0);
562 forAll (includePatches_, i)
564 const label patchID = includePatches_[i];
569 coarseMesh_->patchFaceMap()[patchID];
570 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
573 for (
label bandI = 0; bandI < nBands_; bandI++)
576 spectralDistribution_[bandI]
577 * absorptivity_[patchID][bandI]();
583 const label coarseFaceID = coarsePatchFace[coarseI];
584 const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
590 scalar fineArea =
sum(fineSf());
595 label faceI = fineFaces[j];
596 aAve += (a[faceI]*
sf[faceI])/fineArea;
601 const labelList& compactFaces = visibleFaceFaces_[locaFaceI];
606 label compactI = compactFaces[j];
608 localqDiffusive[locaFaceI] +=
609 compactCoarsePartialArea[compactI]
611 * (solarCalc_.directSolarRad()*solarCalc_.direction())
612 & compactCoarseNorm[compactI]
614 * compactCoarseRave[compactI];
623 forAll (includePatches_, i)
625 const label patchID = includePatches_[i];
630 scalarField& Qrp = QrefecFormOtherWallRad_.boundaryField()[patchID];
633 coarseMesh_->patchFaceMap()[patchID];
637 const label coarseFaceID = coarsePatchFace[coarseI];
638 const labelList& fineFaces = coarseToFine_[i][coarseFaceID];
641 label faceI = fineFaces[
k];
642 Qrp[faceI] = localqDiffusive[compactId];
654 const label patchID = iter.key();
655 const scalarField& qSecond = QrefecFormOtherWallRad_.boundaryField()[patchID];
659 QdiffRad_.boundaryField()[patchID] += qSecond;
665 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
668 const label cellI = cellIds[faceI];
669 Ru_[cellI] += qSecond[faceI]*
sf[faceI]/V[cellI];
689 mesh_.facesInstance(),
710 QrefecFormOtherWallRad_
763 solarCalc_(this->subDict(typeName +
"Coeffs"), mesh_),
765 useVFbeamToDiffuse_(false),
766 includePatches_(mesh_.
boundary().size(), -1),
769 spectralDistribution_(nBands_),
776 mesh_.facesInstance(),
785 updateAbsorptivity_(false),
805 mesh_.facesInstance(),
818 mesh_.time().timeName(),
826 QrefecFormOtherWallRad_
831 mesh_.time().timeName(),
844 mesh_.time().timeName(),
857 mesh_.time().timeName(),
871 mesh_.time().timeName(),
879 solarCalc_(coeffs_, mesh_),
881 useVFbeamToDiffuse_(
false),
882 includePatches_(mesh_.boundary().size(), -1),
885 spectralDistribution_(nBands_),
892 mesh_.facesInstance(),
901 absorptivity_(mesh_.boundaryMesh().size()),
902 updateAbsorptivity_(
false),
914 const word radWallFieldName
923 mesh_.facesInstance(),
936 mesh_.time().timeName(),
944 QrefecFormOtherWallRad_
949 mesh_.time().timeName(),
962 mesh_.time().timeName(),
975 mesh_.time().timeName(),
989 mesh_.time().timeName(),
997 solarCalc_(
dict, mesh_),
999 useVFbeamToDiffuse_(
false),
1000 includePatches_(mesh_.boundary().size(), -1),
1003 spectralDistribution_(nBands_),
1010 mesh_.facesInstance(),
1017 solidCoupled_(
true),
1018 wallCoupled_(
false),
1019 absorptivity_(mesh_.boundaryMesh().size()),
1020 updateAbsorptivity_(
false),
1061 if (!pp.
coupled() && !isA<cyclicAMIPolyPatch>(pp))
1063 includePatches.
insert(patchI);
1073 if (isA<wallPolyPatch>(pp))
1075 includeWallGetRadiationPatches.
insert(patchI);
1081 if (updateAbsorptivity_ || firstIter_)
1083 updateAbsorptivity(includePatches);
1086 bool facesChanged = updateHitFaces();
1094 Qr_.boundaryField() = 0.0;
1095 QdiffRad_.boundaryField() = 0.0;
1098 const labelList& hitFacesId = hitFaces_->rayStartFaces();
1099 updateDirectHitRadiation(hitFacesId,includeWallGetRadiationPatches);
1102 updateSkyDiffusiveRadiation
1105 includeWallGetRadiationPatches
1109 if (useVFbeamToDiffuse_)
1111 calculateQdiff(includePatches,includeWallGetRadiationPatches);
1117 QtotalRad_ = Qr_ + QdiffRad_;
1123 if (mesh_.time().outputTime())
1140 mesh_.time().timeName(),