From 916dcb86851a3b0933c65db2d08648fc1e50df50 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 17 Nov 2015 15:05:05 +0000 Subject: [PATCH] ENH: parallel: overhaul of parallel mapping - redistributePar to have almost (complete) functionality of decomposePar+reconstructPar - low-level distributed Field mapping - support for mapping surfaceFields (including flipping faces) - support for decomposing/reconstructing refinement data --- .../splitMeshRegions/splitMeshRegions.C | 9 +- .../decomposePar/Make/options | 2 + .../decomposePar/decomposePar.C | 90 +- .../decomposePar/decomposeParDict | 55 +- .../decomposePar/domainDecomposition.C | 169 +- .../decomposePar/domainDecomposition.H | 15 +- .../domainDecompositionDistribute.C | 15 +- .../decomposePar/readFields.C | 65 +- .../decomposePar/readFields.H | 12 +- .../reconstructPar/Make/options | 2 + .../reconstructPar/reconstructPar.C | 78 +- .../reconstructParMesh/reconstructParMesh.C | 4 +- .../redistributePar/Make/files | 2 + .../redistributePar/Make/options | 6 +- .../distributedUnallocatedDirectFieldMapper.H | 131 + ...butedUnallocatedDirectFvPatchFieldMapper.H | 71 +- .../redistributePar/loadOrCreateMesh.C | 113 +- .../redistributePar/parFvFieldReconstructor.C | 113 + .../redistributePar/parFvFieldReconstructor.H | 194 ++ ...parFvFieldReconstructorReconstructFields.C | 543 ++++ .../parLagrangianRedistributor.C | 321 ++ .../parLagrangianRedistributor.H | 186 ++ ...agrangianRedistributorRedistributeFields.C | 320 ++ .../redistributePar/redistributePar.C | 2871 ++++++++++++++--- .../unmappedPassiveParticleCloud.H | 112 + .../dataConversion/foamToEnsight/Make/options | 2 + .../foamToTecplot360/Make/options | 2 + .../dataConversion/foamToVTK/Make/options | 2 + .../PV4FoamReader/vtkPV4Foam/Make/options | 2 + .../preProcessing/mapFieldsPar/mapFieldsPar.C | 70 +- bin/tools/CleanFunctions | 49 +- bin/tools/RunFunctions | 34 +- src/OpenFOAM/Make/files | 6 + src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C | 49 +- src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H | 9 +- .../IOstreams/Pstreams/combineGatherScatter.C | 14 +- src/OpenFOAM/db/IOstreams/Pstreams/exchange.C | 7 +- .../db/IOstreams/Pstreams/gatherScatter.C | 6 +- .../db/IOstreams/Pstreams/gatherScatterList.C | 6 +- src/OpenFOAM/db/Time/TimePaths.H | 12 +- src/OpenFOAM/db/dictionary/dictionary.H | 4 +- src/OpenFOAM/db/regIOobject/regIOobjectRead.C | 10 +- .../DimensionedField/DimensionedField.C | 4 +- .../DimensionedField/DimensionedField.H | 11 +- .../DimensionedField/DimensionedFieldIO.C | 22 +- src/OpenFOAM/fields/Fields/Field/Field.C | 156 +- src/OpenFOAM/fields/Fields/Field/Field.H | 29 +- .../fields/Fields/Field/FieldMapper.H | 19 +- .../GeometricField/GeometricField.C | 16 +- .../GeometricField/GeometricField.H | 5 +- src/OpenFOAM/fields/ReadFields/ReadFields.C | 188 +- src/OpenFOAM/fields/ReadFields/ReadFields.H | 36 +- .../fields/ReadFields/ReadFieldsTemplates.C | 314 ++ .../UniformDimensionedField.C | 4 +- src/OpenFOAM/global/argList/argList.C | 50 +- .../mapDistribute/IOmapDistribute.C | 4 +- .../mapPolyMesh/mapDistribute/mapDistribute.C | 945 +----- .../mapPolyMesh/mapDistribute/mapDistribute.H | 268 +- .../mapDistribute/mapDistributeBase.C | 1293 ++++++++ .../mapDistribute/mapDistributeBase.H | 485 +++ .../mapDistributeBaseTemplates.C | 1375 ++++++++ .../mapDistribute/mapDistributePolyMesh.C | 196 +- .../mapDistribute/mapDistributePolyMesh.H | 85 +- .../mapDistribute/mapDistributeTemplates.C | 940 +----- .../primitiveShapes/triangle/triPoints.H | 100 + src/OpenFOAM/primitives/ops/flipOp.C | 76 + src/OpenFOAM/primitives/ops/flipOp.H | 103 + src/dynamicMesh/Make/files | 12 +- .../IOmapDistributePolyMesh.C | 126 + .../IOmapDistributePolyMesh.H | 95 + .../fvMeshDistribute/fvMeshDistribute.C | 527 ++- .../fvMeshDistribute/fvMeshDistribute.H | 31 +- .../fvMeshDistributeTemplates.C | 93 +- .../fvMeshSubset/fvMeshSubset.C | 149 +- .../fvMeshSubset/fvMeshSubset.H | 80 +- .../fvMeshSubset/fvMeshSubsetInterpolate.C | 71 +- src/dynamicMesh/fvMeshTools/fvMeshTools.C | 267 +- src/dynamicMesh/fvMeshTools/fvMeshTools.H | 18 +- .../meshCut/cellLooper/geomCellLooper.H | 6 +- .../multiDirRefinement/multiDirRefinement.C | 10 +- .../polyTopoChange/{ => hexRef8}/hexRef8.C | 3 +- .../polyTopoChange/{ => hexRef8}/hexRef8.H | 0 .../polyTopoChange/hexRef8/hexRef8Data.C | 339 ++ .../polyTopoChange/hexRef8/hexRef8Data.H | 136 + .../{ => hexRef8}/refinementHistory.C | 827 ++++- .../{ => hexRef8}/refinementHistory.H | 160 +- src/finiteVolume/Make/files | 1 - .../fixedFluxPressureFvPatchScalarField.C | 31 +- .../timeVaryingMappedFixedValueFvPatchField.C | 10 +- .../fvPatchFields/fvPatchField/fvPatchField.C | 54 +- .../volPointInterpolate.C | 191 +- .../volPointInterpolation.H | 38 +- .../basic/passiveParticle/passiveParticle.H | 28 +- src/meshTools/AABBTree/AABBTree.C | 531 +++ src/meshTools/AABBTree/AABBTree.H | 197 ++ .../AMIInterpolation/AMIInterpolation.C | 18 +- .../AMIInterpolationParallelOps.C | 36 +- .../AMIMethod/AMIMethod/AMIMethod.C | 4 +- .../AMIMethod/directAMI/directAMI.C | 8 +- .../faceAreaIntersect/faceAreaIntersect.H | 7 +- .../faceAreaIntersect/faceAreaIntersectI.H | 4 +- .../mappedPolyPatch/mappedPatchBase.C | 36 +- .../mappedPatchBaseTemplates.C | 14 +- .../momentOfInertia/momentOfInertia.C | 57 +- .../momentOfInertia/momentOfInertia.H | 18 +- src/meshTools/regionSplit/minData.H | 2 +- src/meshTools/regionSplit/minDataI.H | 2 +- .../tetOverlapVolume/tetOverlapVolume.C | 342 +- .../tetOverlapVolume/tetOverlapVolume.H | 145 +- .../tetOverlapVolumeTemplates.C | 220 ++ src/parallel/decompose/Allwmake | 15 +- src/parallel/decompose/decompose/Make/files | 1 + src/parallel/decompose/decompose/Make/options | 1 + .../decompose/decompose/decompositionModel.C | 164 + .../decompose/decompose/decompositionModel.H | 145 + .../decompose/decompositionMethods/Make/files | 11 + .../decompositionMethods/Make/options | 2 + .../decompositionConstraint.C | 93 + .../decompositionConstraint.H | 155 + .../preserveBafflesConstraint.C | 245 ++ .../preserveBafflesConstraint.H | 116 + .../preserveFaceZonesConstraint.C | 215 ++ .../preserveFaceZonesConstraint.H | 122 + .../preservePatchesConstraint.C | 199 ++ .../preservePatchesConstraint.H | 123 + .../refinementHistoryConstraint.C | 211 ++ .../refinementHistoryConstraint.H | 114 + .../singleProcessorFaceSetsConstraint.C | 318 ++ .../singleProcessorFaceSetsConstraint.H | 124 + .../decompositionMethod/decompositionMethod.C | 543 +++- .../decompositionMethod/decompositionMethod.H | 43 +- .../decompose/ptscotchDecomp/ptscotchDecomp.C | 156 +- .../decompose/scotchDecomp/scotchDecomp.C | 90 +- src/parallel/distributed/Make/options | 1 + .../distributedTriSurfaceMesh.C | 78 +- .../distributedTriSurfaceMesh.H | 4 +- .../reconstruct/reconstruct/processorMeshes.H | 9 +- .../field/streamLine/streamLine.C | 28 +- .../wallBoundedStreamLine.C | 28 +- src/renumber/renumberMethods/Make/options | 2 + src/sampling/Make/files | 1 + src/sampling/Make/options | 2 + .../cellVolumeWeight/cellVolumeWeightMethod.C | 46 +- .../cellVolumeWeight/cellVolumeWeightMethod.H | 12 +- .../correctedCellVolumeWeightMethod.C | 296 ++ .../correctedCellVolumeWeightMethod.H | 119 + .../calcMethod/direct/directMethod.C | 37 +- .../calcMethod/direct/directMethod.H | 12 +- .../calcMethod/mapNearest/mapNearestMethod.C | 8 +- .../calcMethod/mapNearest/mapNearestMethod.H | 12 +- .../meshToMeshMethod/meshToMeshMethod.C | 40 +- .../meshToMeshMethod/meshToMeshMethod.H | 23 +- .../distributedWeightedFvPatchFieldMapper.H | 170 + src/sampling/meshToMesh/meshToMesh.C | 315 +- src/sampling/meshToMesh/meshToMesh.H | 340 +- src/sampling/meshToMesh/meshToMeshI.H | 28 +- .../meshToMesh/meshToMeshParallelOps.C | 43 +- src/sampling/meshToMesh/meshToMeshTemplates.C | 501 ++- tutorials/mesh/parallel/cavity/0/U | 41 + tutorials/mesh/parallel/cavity/0/p | 39 + tutorials/mesh/parallel/cavity/Allclean | 12 + tutorials/mesh/parallel/cavity/Allrun | 35 + .../cavity/constant/polyMesh/blockMeshDict | 75 + .../cavity/constant/transportProperties | 21 + .../mesh/parallel/cavity/system/controlDict | 49 + .../cavity/system/controlDict-latestTime | 49 + .../cavity/system/controlDict-startTime | 49 + .../parallel/cavity/system/decomposeParDict | 143 + .../parallel/cavity/system/decomposeParDict-2 | 143 + .../parallel/cavity/system/decomposeParDict-5 | 143 + .../mesh/parallel/cavity/system/fvSchemes | 57 + .../mesh/parallel/cavity/system/fvSolution | 46 + .../cavity/system/renumberMeshDict-random | 112 + tutorials/mesh/parallel/filter/0.org/G | 73 + tutorials/mesh/parallel/filter/0.org/H2O | 60 + tutorials/mesh/parallel/filter/0.org/N2 | 60 + tutorials/mesh/parallel/filter/0.org/O2 | 60 + tutorials/mesh/parallel/filter/0.org/T | 61 + tutorials/mesh/parallel/filter/0.org/U | 61 + tutorials/mesh/parallel/filter/0.org/alphat | 62 + tutorials/mesh/parallel/filter/0.org/epsilon | 61 + tutorials/mesh/parallel/filter/0.org/k | 61 + tutorials/mesh/parallel/filter/0.org/nut | 45 + tutorials/mesh/parallel/filter/0.org/p | 60 + tutorials/mesh/parallel/filter/Allclean | 15 + tutorials/mesh/parallel/filter/Allrun | 33 + .../filter/constant/chemistryProperties | 41 + .../filter/constant/combustionProperties | 29 + tutorials/mesh/parallel/filter/constant/g | 22 + .../filter/constant/parcelInjectionProperties | 26 + .../filter/constant/particleTrackProperties | 25 + .../filter/constant/polyMesh/blockMeshDict | 123 + .../filter/constant/radiationProperties | 24 + .../filter/constant/reactingCloud1Properties | 188 ++ .../mesh/parallel/filter/constant/reactions | 9 + .../filter/constant/thermo.incompressiblePoly | 115 + .../filter/constant/thermophysicalProperties | 53 + .../filter/constant/turbulenceProperties | 28 + .../mesh/parallel/filter/system/controlDict | 54 + .../parallel/filter/system/createBafflesDict | 81 + .../parallel/filter/system/decomposeParDict | 47 + .../mesh/parallel/filter/system/fvOptions | 124 + .../mesh/parallel/filter/system/fvSchemes | 65 + .../mesh/parallel/filter/system/fvSolution | 112 + .../mesh/parallel/filter/system/topoSetDict | 157 + 205 files changed, 21665 insertions(+), 4196 deletions(-) create mode 100644 applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H rename src/sampling/meshToMesh/weightedFvPatchFieldMapper.H => applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H (60%) create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructor.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructor.H create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.H create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributorRedistributeFields.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/unmappedPassiveParticleCloud.H create mode 100644 src/OpenFOAM/fields/ReadFields/ReadFieldsTemplates.C create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C create mode 100644 src/OpenFOAM/meshes/primitiveShapes/triangle/triPoints.H create mode 100644 src/OpenFOAM/primitives/ops/flipOp.C create mode 100644 src/OpenFOAM/primitives/ops/flipOp.H create mode 100644 src/dynamicMesh/fvMeshDistribute/IOmapDistributePolyMesh.C create mode 100644 src/dynamicMesh/fvMeshDistribute/IOmapDistributePolyMesh.H rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.C (91%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.H (74%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubsetInterpolate.C (89%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.C (99%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.H (100%) create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.C (65%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.H (70%) create mode 100644 src/meshTools/AABBTree/AABBTree.C create mode 100644 src/meshTools/AABBTree/AABBTree.H create mode 100644 src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C create mode 100644 src/parallel/decompose/decompose/decompositionModel.C create mode 100644 src/parallel/decompose/decompose/decompositionModel.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.H create mode 100644 src/sampling/meshToMesh/calcMethod/correctedCellVolumeWeight/correctedCellVolumeWeightMethod.C create mode 100644 src/sampling/meshToMesh/calcMethod/correctedCellVolumeWeight/correctedCellVolumeWeightMethod.H create mode 100644 src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H create mode 100644 tutorials/mesh/parallel/cavity/0/U create mode 100644 tutorials/mesh/parallel/cavity/0/p create mode 100755 tutorials/mesh/parallel/cavity/Allclean create mode 100755 tutorials/mesh/parallel/cavity/Allrun create mode 100644 tutorials/mesh/parallel/cavity/constant/polyMesh/blockMeshDict create mode 100644 tutorials/mesh/parallel/cavity/constant/transportProperties create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict-latestTime create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict-startTime create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict-2 create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict-5 create mode 100644 tutorials/mesh/parallel/cavity/system/fvSchemes create mode 100644 tutorials/mesh/parallel/cavity/system/fvSolution create mode 100644 tutorials/mesh/parallel/cavity/system/renumberMeshDict-random create mode 100644 tutorials/mesh/parallel/filter/0.org/G create mode 100644 tutorials/mesh/parallel/filter/0.org/H2O create mode 100644 tutorials/mesh/parallel/filter/0.org/N2 create mode 100644 tutorials/mesh/parallel/filter/0.org/O2 create mode 100644 tutorials/mesh/parallel/filter/0.org/T create mode 100644 tutorials/mesh/parallel/filter/0.org/U create mode 100644 tutorials/mesh/parallel/filter/0.org/alphat create mode 100644 tutorials/mesh/parallel/filter/0.org/epsilon create mode 100644 tutorials/mesh/parallel/filter/0.org/k create mode 100644 tutorials/mesh/parallel/filter/0.org/nut create mode 100644 tutorials/mesh/parallel/filter/0.org/p create mode 100755 tutorials/mesh/parallel/filter/Allclean create mode 100755 tutorials/mesh/parallel/filter/Allrun create mode 100644 tutorials/mesh/parallel/filter/constant/chemistryProperties create mode 100644 tutorials/mesh/parallel/filter/constant/combustionProperties create mode 100644 tutorials/mesh/parallel/filter/constant/g create mode 100644 tutorials/mesh/parallel/filter/constant/parcelInjectionProperties create mode 100644 tutorials/mesh/parallel/filter/constant/particleTrackProperties create mode 100644 tutorials/mesh/parallel/filter/constant/polyMesh/blockMeshDict create mode 100644 tutorials/mesh/parallel/filter/constant/radiationProperties create mode 100644 tutorials/mesh/parallel/filter/constant/reactingCloud1Properties create mode 100644 tutorials/mesh/parallel/filter/constant/reactions create mode 100644 tutorials/mesh/parallel/filter/constant/thermo.incompressiblePoly create mode 100644 tutorials/mesh/parallel/filter/constant/thermophysicalProperties create mode 100644 tutorials/mesh/parallel/filter/constant/turbulenceProperties create mode 100644 tutorials/mesh/parallel/filter/system/controlDict create mode 100644 tutorials/mesh/parallel/filter/system/createBafflesDict create mode 100644 tutorials/mesh/parallel/filter/system/decomposeParDict create mode 100644 tutorials/mesh/parallel/filter/system/fvOptions create mode 100644 tutorials/mesh/parallel/filter/system/fvSchemes create mode 100644 tutorials/mesh/parallel/filter/system/fvSolution create mode 100644 tutorials/mesh/parallel/filter/system/topoSetDict diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 6565776cdf..9120fd6dd9 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -202,6 +202,7 @@ void subsetSurfaceFields ( const fvMesh& mesh, const fvMesh& subMesh, + const labelList& cellMap, const labelList& faceMap, const labelHashSet& addedPatches ) @@ -225,6 +226,7 @@ void subsetSurfaceFields fld, subMesh, patchMap, + cellMap, faceMap ) ); @@ -830,6 +832,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -837,6 +840,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -844,6 +848,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -851,6 +856,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -858,6 +864,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index 5d5d67f989..cd78de0d1e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude @@ -12,5 +13,6 @@ EXE_LIBS = \ -lgenericPatchFields \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \ -llagrangian \ + -ldynamicMesh \ -lmeshTools \ -lregionModels diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 6020608541..63303d9f8c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,6 +96,7 @@ Usage #include "fvFieldDecomposer.H" #include "pointFieldDecomposer.H" #include "lagrangianFieldDecomposer.H" +#include "decompositionModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -142,6 +143,12 @@ int main(int argc, char *argv[]) ); argList::noParallel(); + Foam::argList::addOption + ( + "decomposeParDict", + "file", + "read decomposePar dictionary from specified location" + ); #include "addRegionOption.H" argList::addBoolOption ( @@ -199,6 +206,17 @@ int main(int argc, char *argv[]) instantList times = timeSelector::selectIfPresent(runTime, args); + // Allow override of decomposeParDict location + fileName decompDictFile; + if (args.optionReadIfPresent("decomposeParDict", decompDictFile)) + { + if (isDir(decompDictFile)) + { + decompDictFile = decompDictFile/"decomposeParDict"; + } + } + + wordList regionNames; wordList regionDirs; if (allRegions) @@ -260,21 +278,27 @@ int main(int argc, char *argv[]) ++nProcs; } - // get requested numberOfSubdomains + // get requested numberOfSubdomains. Note: have no mesh yet so + // cannot use decompositionModel::New const label nDomains = readLabel ( IOdictionary ( - IOobject + decompositionModel::selectIO ( - "decomposeParDict", - runTime.time().system(), - regionDir, // use region if non-standard - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false + IOobject + ( + "decomposeParDict", + runTime.time().system(), + regionDir, // use region if non-standard + runTime, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ), + decompDictFile ) + ).lookup("numberOfSubdomains") ); @@ -288,8 +312,7 @@ int main(int argc, char *argv[]) << nProcs << " domains" << nl << "instead of " << nDomains - << " domains as specified in decomposeParDict" - << nl + << " domains as specified in decomposeParDict" << nl << exit(FatalError); } } @@ -351,7 +374,8 @@ int main(int argc, char *argv[]) IOobject::NO_READ, IOobject::NO_WRITE, false - ) + ), + decompDictFile ); // Decompose the mesh @@ -447,15 +471,15 @@ int main(int argc, char *argv[]) // Construct the vol fields // ~~~~~~~~~~~~~~~~~~~~~~~~ PtrList volScalarFields; - readFields(mesh, objects, volScalarFields); + readFields(mesh, objects, volScalarFields, false); PtrList volVectorFields; - readFields(mesh, objects, volVectorFields); + readFields(mesh, objects, volVectorFields, false); PtrList volSphericalTensorFields; - readFields(mesh, objects, volSphericalTensorFields); + readFields(mesh, objects, volSphericalTensorFields, false); PtrList volSymmTensorFields; - readFields(mesh, objects, volSymmTensorFields); + readFields(mesh, objects, volSymmTensorFields, false); PtrList volTensorFields; - readFields(mesh, objects, volTensorFields); + readFields(mesh, objects, volTensorFields, false); // Construct the dimensioned fields @@ -476,15 +500,15 @@ int main(int argc, char *argv[]) // Construct the surface fields // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PtrList surfaceScalarFields; - readFields(mesh, objects, surfaceScalarFields); + readFields(mesh, objects, surfaceScalarFields, false); PtrList surfaceVectorFields; - readFields(mesh, objects, surfaceVectorFields); + readFields(mesh, objects, surfaceVectorFields, false); PtrList surfaceSphericalTensorFields; - readFields(mesh, objects, surfaceSphericalTensorFields); + readFields(mesh, objects, surfaceSphericalTensorFields, false); PtrList surfaceSymmTensorFields; - readFields(mesh, objects, surfaceSymmTensorFields); + readFields(mesh, objects, surfaceSymmTensorFields, false); PtrList surfaceTensorFields; - readFields(mesh, objects, surfaceTensorFields); + readFields(mesh, objects, surfaceTensorFields, false); // Construct the point fields @@ -492,15 +516,15 @@ int main(int argc, char *argv[]) const pointMesh& pMesh = pointMesh::New(mesh); PtrList pointScalarFields; - readFields(pMesh, objects, pointScalarFields); + readFields(pMesh, objects, pointScalarFields, false); PtrList pointVectorFields; - readFields(pMesh, objects, pointVectorFields); + readFields(pMesh, objects, pointVectorFields, false); PtrList pointSphericalTensorFields; - readFields(pMesh, objects, pointSphericalTensorFields); + readFields(pMesh, objects, pointSphericalTensorFields, false); PtrList pointSymmTensorFields; - readFields(pMesh, objects, pointSymmTensorFields); + readFields(pMesh, objects, pointSymmTensorFields, false); PtrList pointTensorFields; - readFields(pMesh, objects, pointTensorFields); + readFields(pMesh, objects, pointTensorFields, false); // Construct the Lagrangian fields @@ -820,16 +844,6 @@ int main(int argc, char *argv[]) processorDb.setTime(runTime); - // remove files remnants that can cause horrible problems - // - mut and nut are used to mark the new turbulence models, - // their existence prevents old models from being upgraded - { - fileName timeDir(processorDb.path()/processorDb.timeName()); - - rm(timeDir/"mut"); - rm(timeDir/"nut"); - } - // read the mesh if (!procMeshList.set(procI)) { diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index 39483a01e3..0beef4f762 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -17,11 +17,61 @@ FoamFile numberOfSubdomains 2; + +// Optional decomposition constraints +//constraints +//{ +// preserveBaffles +// { +// //- Keep owner and neighbour of baffles on same processor (i.e. +// // keep it detectable as a baffle). Baffles are two boundary face +// // sharing the same points +// type preserveBaffles; +// } +// preserveFaceZones +// { +// //- Keep owner and neighbour on same processor for faces in zones +// type preserveFaceZones; +// zones (".*"); +// } +// preservePatches +// { +// //- Keep owner and neighbour on same processor for faces in patches +// // (only makes sense for cyclic patches. Not suitable for e.g. +// // cyclicAMI since these are not coupled on the patch level. Use +// // singleProcessorFaceSets for those) +// type preservePatches; +// patches (".*"); +// } +// singleProcessorFaceSets +// { +// //- Keep all of faceSet on a single processor. This puts all cells +// // connected with a point, edge or face on the same processor. +// // (just having face connected cells might not guarantee a balanced +// // decomposition) +// // The processor can be -1 (the decompositionMethod chooses the +// // processor for a good load balance) or explicitly provided (upsets +// // balance) +// type singleProcessorFaceSets; +// singleProcessorFaceSets ((f1 -1)); +// } +// refinementHistory +// { +// //- Decompose cells such that all cell originating from single cell +// // end up on same processor +// type refinementHistory; +// } +//} + + +// Deprecated form of specifying decomposition constraints: //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); //- Keep owner and neighbour on same processor for faces in patches: -// (makes sense only for cyclic patches) +// (makes sense only for cyclic patches. Not suitable for e.g. cyclicAMI +// since these are not coupled on the patch level. Use +// singleProcessorFaceSets for those) //preservePatches (cyclic_half0 cyclic_half1); //- Keep all of faceSet on a single processor. This puts all cells @@ -32,12 +82,13 @@ numberOfSubdomains 2; // for a good load balance) or explicitly provided (upsets balance). //singleProcessorFaceSets ((f0 -1)); - //- Keep owner and neighbour of baffles on same processor (i.e. keep it // detectable as a baffle). Baffles are two boundary face sharing the // same points. //preserveBaffles true; + + //- Use the volScalarField named here as a weight for each cell in the // decomposition. For example, use a particle population field to decompose // for a balanced number of particles in a lagrangian simulation. diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 7d86369398..b27f7628c8 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,14 +31,14 @@ License #include "fvMesh.H" #include "OSspecific.H" #include "Map.H" -#include "globalMeshData.H" #include "DynamicList.H" #include "fvFieldDecomposer.H" #include "IOobjectList.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" -#include "uniformDimensionedFields.H" +#include "decompositionModel.H" +#include "hexRef8Data.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -69,7 +69,12 @@ void Foam::domainDecomposition::mark // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::domainDecomposition::domainDecomposition(const IOobject& io) +// from components +Foam::domainDecomposition::domainDecomposition +( + const IOobject& io, + const fileName& decompDictFile +) : fvMesh(io), facesInstancePointsPtr_ @@ -90,18 +95,18 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) ) : NULL ), - decompositionDict_ + decompDictFile_(decompDictFile), + nProcs_ ( - IOobject + readInt ( - "decomposeParDict", - time().system(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + decompositionModel::New + ( + *this, + decompDictFile + ).lookup("numberOfSubdomains") ) ), - nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), cellToProc_(nCells()), procPointAddressing_(nProcs_), @@ -115,7 +120,11 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procProcessorPatchSubPatchIDs_(nProcs_), procProcessorPatchSubPatchStarts_(nProcs_) { - decompositionDict_.readIfPresent("distributed", distributed_); + decompositionModel::New + ( + *this, + decompDictFile + ).readIfPresent("distributed", distributed_); } @@ -195,57 +204,20 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - autoPtr cellLevelPtr; - { - IOobject io + // Load refinement data (if any) + hexRef8Data baseMeshData + ( + IOobject ( - "cellLevel", + "dummy", facesInstance(), polyMesh::meshSubDir, *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - cellLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr pointLevelPtr; - { - IOobject io - ( - "pointLevel", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - pointLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr level0EdgePtr; - { - IOobject io - ( - "level0Edge", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - level0EdgePtr.reset(new uniformDimensionedScalarField(io)); - } - } + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); @@ -816,8 +788,8 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } } - // Set the precision of the points data to 10 - IOstream::defaultPrecision(10); + // Set the precision of the points data to be min 10 + IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); procMesh.write(); @@ -887,64 +859,23 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - // hexRef8 data - if (cellLevelPtr.valid()) - { - labelIOList + // Optional hexRef8 data + hexRef8Data + ( + IOobject ( - IOobject - ( - cellLevelPtr().name(), - facesInstance(), - polyMesh::meshSubDir, - procMesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - UIndirectList