BUG: viewFactor: smoothing when zero visible faces. Fixes #2622

This commit is contained in:
mattijs
2022-10-27 11:58:36 +01:00
parent 37e90dbad7
commit ac25608fbd

View File

@ -419,6 +419,9 @@ void Foam::radiation::viewFactor::initialise()
{ {
scalar maxDelta = 0; scalar maxDelta = 0;
scalar totalDelta = 0; scalar totalDelta = 0;
if (myF.size())
{
forAll (myF, i) forAll (myF, i)
{ {
scalar sumF = 0.0; scalar sumF = 0.0;
@ -439,6 +442,7 @@ void Foam::radiation::viewFactor::initialise()
} }
} }
totalDelta /= myF.size(); totalDelta /= myF.size();
}
reduce(totalDelta, sumOp<scalar>()); reduce(totalDelta, sumOp<scalar>());
reduce(maxDelta, maxOp<scalar>()); reduce(maxDelta, maxOp<scalar>());
Info << "Smoothing average delta : " << totalDelta << endl; Info << "Smoothing average delta : " << totalDelta << endl;
@ -1122,7 +1126,7 @@ void Foam::radiation::viewFactor::calculate()
if (debug) if (debug)
{ {
forAll(qrBf, patchID) for (const label patchID : selectedPatches_)
{ {
const scalarField& qrp = qrBf[patchID]; const scalarField& qrp = qrBf[patchID];
const scalarField& magSf = mesh_.magSf().boundaryField()[patchID]; const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];