diff --git a/src/functionObjects/field/fluxSummary/fluxSummary.C b/src/functionObjects/field/fluxSummary/fluxSummary.C index c25cd5dd328bfe0243c66a2075305d1ba8d0866a..998fc4eeac18605079ba54e503baaa68da722298 100644 --- a/src/functionObjects/field/fluxSummary/fluxSummary.C +++ b/src/functionObjects/field/fluxSummary/fluxSummary.C @@ -519,6 +519,10 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection label oldFaceID = 0; label regioni = 0; + + // Dummy tracking data + bool dummyData{false}; + while (search) { DynamicList<label> changedEdges; @@ -527,7 +531,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection label seedFacei = labelMax; for (; oldFaceID < patch.size(); oldFaceID++) { - if (allFaceInfo[oldFaceID].data() == -1) + if (!allFaceInfo[oldFaceID].valid<bool>(dummyData)) { seedFacei = globalFaces.toGlobal(oldFaceID); break; @@ -542,21 +546,21 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection if (globalFaces.isLocal(seedFacei)) { - label localFacei = globalFaces.toLocal(seedFacei); + const label localFacei = globalFaces.toLocal(seedFacei); const labelList& fEdges = patch.faceEdges()[localFacei]; - forAll(fEdges, i) + for (const label edgei : fEdges) { - if (allEdgeInfo[fEdges[i]].data() != -1) + if (allEdgeInfo[edgei].valid<bool>(dummyData)) { WarningInFunction << "Problem in edge face wave: attempted to assign a " << "value to an edge that has already been visited. " - << "Edge info: " << allEdgeInfo[fEdges[i]] + << "Edge info: " << allEdgeInfo[edgei] << endl; } - changedEdges.append(fEdges[i]); + changedEdges.append(edgei); changedInfo.append ( edgeTopoDistanceData<label> @@ -604,7 +608,17 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection } // Collect the data per region - label nRegion = regioni; + const label nRegion = regioni; + + #ifdef FULLDEBUG + // May wish to have enabled always + if (nRegion == 0) + { + FatalErrorInFunction + << "Region split failed" << nl + << exit(FatalError); + } + #endif List<DynamicList<label>> regionFaceIDs(nRegion); List<DynamicList<label>> regionFacePatchIDs(nRegion); diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict index ae43a3dba1d62a8a7b943e837ce0c707a46ea259..1eb81c66ff5815b2c7d0409a4fb3e955a20d75f7 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: v1912 | +| \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -50,6 +50,7 @@ runTimeModifiable true; functions { #include "sampling" + #include "fluxSummary" } diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fluxSummary b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fluxSummary new file mode 100644 index 0000000000000000000000000000000000000000..5915a5050ea6bf71d5924632c3a952541ffee5ea --- /dev/null +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fluxSummary @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +fluxSummary +{ + type fluxSummary; + libs (fieldFunctionObjects); + + scaleFactor 1.205; + write yes; + log yes; + mode cellZoneAndDirection; + cellZoneAndDirection + ( + (porosity (1 1 0)) + ); +} + +// ************************************************************************* //