mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Proper handling of zero size patches
This commit is contained in:
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
label patchI = pp.index();
|
||||
finalAgglom[patchI].setSize(pp.size(), 0);
|
||||
|
||||
if (pp.size() > 0 && !pp.coupled())
|
||||
if (!pp.coupled())
|
||||
{
|
||||
if (agglomDict.found(pp.name()))
|
||||
{
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
// Pre-size by assuming a certain percentage is visible.
|
||||
|
||||
// Maximum lenght for dynamicList
|
||||
const label maxDynListLenght = 10000;
|
||||
//label lenghtCount = 0;
|
||||
const label maxDynListLength = 10000;
|
||||
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
{
|
||||
@ -22,40 +21,51 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
const pointField& remoteArea = remoteCoarseSf[procI];
|
||||
const pointField& remoteFc = remoteCoarseCf[procI];
|
||||
|
||||
if (myFc.size()*remoteFc.size() > 0)
|
||||
label i = 0;
|
||||
label j = 0;
|
||||
do
|
||||
{
|
||||
forAll(myFc, i)
|
||||
for (; i < myFc.size(); i++)
|
||||
{
|
||||
const point& fc = myFc[i];
|
||||
const vector& fA = myArea[i];
|
||||
|
||||
forAll(remoteFc, j)
|
||||
for (; j < remoteFc.size(); j++)//
|
||||
{
|
||||
if (procI != Pstream::myProcNo() || i != j)
|
||||
{
|
||||
const point& remFc = remoteFc[j];
|
||||
const vector& remA = remoteArea[j];
|
||||
const vector& d = remFc-fc;
|
||||
const vector& d = remFc - fc;
|
||||
|
||||
if (((d & fA) < 0.) && ((d & remA) > 0))
|
||||
{
|
||||
//lenghtCount ++;
|
||||
start.append(fc + 0.0001*d);
|
||||
startIndex.append(i);
|
||||
end.append(fc + 0.9999*d);
|
||||
label globalI = globalNumbering.toGlobal(procI, j);
|
||||
endIndex.append(globalI);
|
||||
|
||||
if (startIndex.size() > maxDynListLenght)
|
||||
if (startIndex.size() > maxDynListLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startIndex.size() > maxDynListLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == remoteFc.size())
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
List<pointIndexHit> hitInfo(startIndex.size());
|
||||
surfacesMesh.findLine
|
||||
(
|
||||
start,
|
||||
end,
|
||||
hitInfo
|
||||
);
|
||||
surfacesMesh.findLine(start, end, hitInfo);
|
||||
|
||||
forAll (hitInfo, rayI)
|
||||
{
|
||||
if (!hitInfo[rayI].hit())
|
||||
@ -64,34 +74,12 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
rayEndFace.append(endIndex[rayI]);
|
||||
}
|
||||
}
|
||||
//lenghtCount = 0;
|
||||
|
||||
start.clear();
|
||||
startIndex.clear();
|
||||
end.clear();
|
||||
endIndex.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!start.empty())
|
||||
{
|
||||
List<pointIndexHit> hitInfo(startIndex.size());
|
||||
surfacesMesh.findLine
|
||||
(
|
||||
start,
|
||||
end,
|
||||
hitInfo
|
||||
);
|
||||
surfacesMesh.findLine(start, end, hitInfo);
|
||||
forAll (hitInfo, rayI)
|
||||
{
|
||||
if (!hitInfo[rayI].hit())
|
||||
{
|
||||
rayStartFace.append(startIndex[rayI]);
|
||||
rayEndFace.append(endIndex[rayI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}while (returnReduce(i < myFc.size(), orOp<bool>()));
|
||||
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ void Foam::pairPatchAgglomeration:: agglomerate()
|
||||
tmp<labelField> finalAgglomPtr(new labelField(patch.size()));
|
||||
|
||||
bool agglomOK = false;
|
||||
while (!agglomOK)
|
||||
while (!agglomOK && patch.size())
|
||||
{
|
||||
finalAgglomPtr = agglomerateOneLevel
|
||||
(
|
||||
|
||||
@ -108,10 +108,10 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
|
||||
label count = 0;
|
||||
forAll(Qrp, patchI)
|
||||
{
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
|
||||
//const polyPatch& pp = mesh_.boundaryMesh()[patchI];
|
||||
const fvPatchScalarField& QrPatchI = Qrp[patchI];
|
||||
|
||||
if ((isA<fixedValueFvPatchScalarField>(QrPatchI)) && (pp.size() > 0))
|
||||
if ((isA<fixedValueFvPatchScalarField>(QrPatchI)))
|
||||
{
|
||||
selectedPatches_[count] = QrPatchI.patch().index();
|
||||
nLocalCoarseFaces_ += coarsePatches[patchI].size();
|
||||
@ -362,14 +362,20 @@ void Foam::radiation::viewFactor::calculate()
|
||||
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID];
|
||||
const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
|
||||
|
||||
scalarList Tave(pp.size(), 0.0);
|
||||
scalarList Eave(Tave.size(), 0.0);
|
||||
scalarList Hoiave(Tave.size(), 0.0);
|
||||
|
||||
if (pp.size() > 0)
|
||||
{
|
||||
const labelList& agglom = finalAgglom_[patchID];
|
||||
label nAgglom = max(agglom) + 1;
|
||||
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
|
||||
scalarList Tave(pp.size(), 0.0);
|
||||
scalarList Eave(Tave.size(), 0.0);
|
||||
scalarList Hoiave(Tave.size(), 0.0);
|
||||
//scalarList Tave(pp.size(), 0.0);
|
||||
//scalarList Eave(Tave.size(), 0.0);
|
||||
//scalarList Hoiave(Tave.size(), 0.0);
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
{
|
||||
@ -390,12 +396,17 @@ void Foam::radiation::viewFactor::calculate()
|
||||
Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area;
|
||||
}
|
||||
|
||||
localCoarseTave.append(Tave[coarseI]);
|
||||
localCoarseEave.append(Eave[coarseI]);
|
||||
localCoarseHoave.append(Hoiave[coarseI]);
|
||||
//localCoarseTave.append(Tave[coarseI]);
|
||||
//localCoarseEave.append(Eave[coarseI]);
|
||||
//localCoarseHoave.append(Hoiave[coarseI]);
|
||||
}
|
||||
}
|
||||
|
||||
localCoarseTave.append(Tave);
|
||||
localCoarseEave.append(Eave);
|
||||
localCoarseHoave.append(Hoiave);
|
||||
}
|
||||
|
||||
// Fill the local values to distribute
|
||||
SubList<scalar>(compactCoarseT,nLocalCoarseFaces_).assign(localCoarseTave);
|
||||
SubList<scalar>(compactCoarseE,nLocalCoarseFaces_).assign(localCoarseEave);
|
||||
@ -494,7 +505,7 @@ void Foam::radiation::viewFactor::calculate()
|
||||
scalar invEj = 1.0/E[j];
|
||||
if (i==j)
|
||||
{
|
||||
CLU_()[i][j] = invEj - (invEj-1.0)*Fmatrix_()[i][j];
|
||||
CLU_()[i][j] = invEj-(invEj-1.0)*Fmatrix_()[i][j];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -540,6 +551,9 @@ void Foam::radiation::viewFactor::calculate()
|
||||
forAll(selectedPatches_, i)
|
||||
{
|
||||
const label patchID = selectedPatches_[i];
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchID];
|
||||
if (pp.size() > 0)
|
||||
{
|
||||
scalarField& Qrp = Qr_.boundaryField()[patchID];
|
||||
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
|
||||
const labelList& agglom = finalAgglom_[patchID];
|
||||
@ -547,7 +561,8 @@ void Foam::radiation::viewFactor::calculate()
|
||||
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
|
||||
const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh_.patchFaceMap()[patchID];
|
||||
|
||||
scalar heatFlux = 0.0;
|
||||
forAll(coarseToFine, coarseI)
|
||||
@ -566,6 +581,7 @@ void Foam::radiation::viewFactor::calculate()
|
||||
globCoarseId ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -634,5 +650,4 @@ Foam::radiation::viewFactor::Ru() const
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user