diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 2e3a56007b..ee9339d0f9 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,7 @@ Description #include "pairPatchAgglomeration.H" #include "labelListIOList.H" #include "syncTools.H" +#include "globalIndex.H" using namespace Foam; @@ -53,7 +54,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createNamedMesh.H" - const word dictName("faceAgglomerateDict"); + const word dictName("viewFactorsDict"); #include "setConstantMeshDictionaryIO.H" @@ -79,16 +80,16 @@ int main(int argc, char *argv[]) boundary.size() ); - forAll(boundary, patchId) + label nCoarseFaces = 0; + + forAllConstIter(dictionary, agglomDict, iter) { - const polyPatch& pp = boundary[patchId]; - - label patchI = pp.index(); - finalAgglom[patchI].setSize(pp.size(), 0); - - if (!pp.coupled()) + labelList patchIds = boundary.findIndices(iter().keyword()); + forAll(patchIds, i) { - if (agglomDict.found(pp.name())) + label patchI = patchIds[i]; + const polyPatch& pp = boundary[patchI]; + if (!pp.coupled()) { Info << "\nAgglomerating patch : " << pp.name() << endl; pairPatchAgglomeration agglomObject @@ -99,12 +100,11 @@ int main(int argc, char *argv[]) agglomObject.agglomerate(); finalAgglom[patchI] = agglomObject.restrictTopBottomAddressing(); - } - else - { - FatalErrorIn(args.executable()) - << "Patch " << pp.name() << " not found in dictionary: " - << agglomDict.name() << exit(FatalError); + + if (finalAgglom[patchI].size()) + { + nCoarseFaces += max(finalAgglom[patchI] + 1); + } } } } @@ -144,6 +144,7 @@ int main(int argc, char *argv[]) if (writeAgglom) { + globalIndex index(nCoarseFaces); volScalarField facesAgglomeration ( IOobject @@ -158,14 +159,26 @@ int main(int argc, char *argv[]) dimensionedScalar("facesAgglomeration", dimless, 0) ); + label coarsePatchIndex = 0; forAll(boundary, patchId) { - fvPatchScalarField& bFacesAgglomeration = - facesAgglomeration.boundaryField()[patchId]; - - forAll(bFacesAgglomeration, j) + const polyPatch& pp = boundary[patchId]; + if (pp.size() > 0) { - bFacesAgglomeration[j] = finalAgglom[patchId][j]; + fvPatchScalarField& bFacesAgglomeration = + facesAgglomeration.boundaryField()[patchId]; + + forAll(bFacesAgglomeration, j) + { + bFacesAgglomeration[j] = + index.toGlobal + ( + Pstream::myProcNo(), + finalAgglom[patchId][j] + coarsePatchIndex + ); + } + + coarsePatchIndex += max(finalAgglom[patchId]) + 1; } } diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict similarity index 91% rename from applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict rename to applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict index 9c164f1509..931511380f 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict +++ b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict @@ -17,6 +17,12 @@ FoamFile // Write agglomeration as a volScalarField with calculated boundary values writeFacesAgglomeration true; +//Debug option +debug 0; + +//Dump connectivity rays +dumpRays false; + // Per patch (wildcard possible) the coarsening level bottomAir_to_heater { diff --git a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H index a48fd193f1..ed1d9031ec 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H +++ b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H @@ -32,6 +32,19 @@ forAll(patches, patchI) } } +labelList triSurfaceToAgglom(5*nFineFaces); + +const triSurface localSurface = triangulate +( + patches, + includePatches, + finalAgglom, + triSurfaceToAgglom, + globalNumbering, + coarsePatches +); + + distributedTriSurfaceMesh surfacesMesh ( IOobject @@ -43,12 +56,13 @@ distributedTriSurfaceMesh surfacesMesh IOobject::NO_READ, IOobject::NO_WRITE ), - triSurfaceTools::triangulate - ( - patches, - includePatches - ), + localSurface, dict ); + +triSurfaceToAgglom.resize(surfacesMesh.size()); + //surfacesMesh.searchableSurface::write(); + +surfacesMesh.setField(triSurfaceToAgglom); diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index 095436b1a1..9cc1ccbcd3 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -2,7 +2,7 @@ // Pre-size by assuming a certain percentage is visible. // Maximum lenght for dynamicList -const label maxDynListLength = 10000; +const label maxDynListLength = 100000; for (label procI = 0; procI < Pstream::nProcs(); procI++) { @@ -14,12 +14,17 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) DynamicList