From 920ff7bcc466a5c15357098b5a7f437864463d6c Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Wed, 23 Jan 2019 13:03:44 +0100 Subject: [PATCH] Manually merged Henrik's DLB and some other stuff --- ...htRcThermalDiffusivityFvPatchScalarField.C | 2 +- .../finiteVolume/domainDecomposition.C | 20 ++ .../finiteVolume/domainDecomposition.H | 7 + .../fvFieldReconstructorReconstructFields.C | 8 +- .../finiteVolume/processorMeshesRebuild.C | 28 +- .../processorMeshesReconstructor.C | 2 + .../processorMeshesReconstructor.H | 9 + .../finiteVolume/sharedPoints.C | 171 +++++++++- .../finiteVolume/sharedPoints.H | 15 +- .../dynamicPolyRefinementFvMesh.C | 14 +- .../topoChangerFvMeshLoadBalance.C | 58 +++- .../topoChangerFvMeshLoadBalanceTemplates.C | 24 +- .../compressible/compressibleCourantNo.H | 21 +- .../cfdTools/incompressible/CourantNo.H | 2 +- .../fixedGradient/fixedGradientFvPatchField.C | 8 +- .../basic/mixed/mixedFvPatchField.C | 8 +- .../inletOutlet/inletOutletFvPatchField.C | 2 +- .../finiteVolume/fvSchemes/fvSchemes.C | 29 +- src/finiteVolume/fvMesh/fvMesh.C | 3 + .../fvMesh/wallDist/nearWallDist.C | 2 +- src/foam/Make/files | 1 + .../GeometricField/GeometricField.C | 10 + .../GeometricField/GeometricField.H | 4 + src/foam/fields/cloud/cloud.C | 7 + src/foam/fields/cloud/cloud.H | 4 +- .../pointBoundaryMesh/pointBoundaryMesh.C | 32 +- .../pointBoundaryMesh/pointBoundaryMesh.H | 6 +- src/foam/meshes/pointMesh/pointMesh.C | 5 +- .../globalMeshData/globalProcFaceIndex.C | 6 +- .../globalMeshData/globalProcFaceIndex.H | 2 +- .../globalMeshData/globalProcPointIndex.C | 319 ++++++++++++++++++ .../globalMeshData/globalProcPointIndex.H | 135 ++++++++ ...undaryDynamicRefineSolidBodyMotionFvMesh.C | 2 +- ...aryEpsilonWallFunctionFvPatchScalarField.C | 2 +- ...ersedBoundaryKqRWallFunctionFvPatchField.C | 2 +- ...ndaryOmegaWallFunctionFvPatchScalarField.C | 2 +- .../CloudDistributeTemplate.H | 2 +- .../basic/CloudTemplate/CloudTemplate.C | 34 ++ .../basic/CloudTemplate/CloudTemplate.H | 3 + .../InjectionModel/InjectionModel.C | 2 +- .../oversetMesh/donorAcceptor/donorAcceptor.H | 3 +- .../adaptiveOverlapFringe.C | 125 ++++--- .../adaptiveOverlapFringe.H | 10 +- .../donorSuitability/donorSuitability.H | 15 + .../overlapFringe/overlapFringe.C | 63 ++-- .../overlapFringe/overlapFringe.H | 2 +- .../oversetMesh/oversetMeshAddressing.C | 21 +- .../oversetMesh/oversetRegion/oversetRegion.C | 92 ++--- src/sampling/sampledSet/curve/curveSet.C | 4 +- src/sampling/sampledSet/face/faceOnlySet.C | 16 +- src/sampling/sampledSet/face/faceOnlySet.H | 7 + .../sampledSet/sampledSet/sampledSet.C | 24 +- .../sampledSet/sampledSet/sampledSet.H | 8 +- src/sampling/sampledSet/uniform/uniformSet.C | 4 +- .../basicChemistryModel/basicChemistryModel.C | 17 +- .../basicChemistryModel/basicChemistryModel.H | 6 +- .../incompressible/RAS/RASModel/RASModel.H | 2 +- .../turbulenceModel/turbulenceModel.H | 2 +- 58 files changed, 1225 insertions(+), 209 deletions(-) create mode 100644 src/foam/meshes/polyMesh/globalMeshData/globalProcPointIndex.C create mode 100644 src/foam/meshes/polyMesh/globalMeshData/globalProcPointIndex.H diff --git a/src/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C b/src/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C index 54497a652..9f15e1af4 100644 --- a/src/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C +++ b/src/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C @@ -261,7 +261,7 @@ Foam::chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); - + tmp kTmp(new scalarField(p.size())); scalarField& k = kTmp(); diff --git a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.C b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.C index 3d9069908..372ec808d 100644 --- a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.C +++ b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.C @@ -34,6 +34,7 @@ License #include "OSspecific.H" #include "Map.H" #include "DynamicList.H" +#include "globalMeshData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -53,6 +54,7 @@ Foam::domainDecomposition::domainDecomposition nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), gfIndex_(mesh_), + gpIndex_(mesh_), cellToProc_(mesh_.nCells()), patchNbrCellToProc_(mesh_.boundaryMesh().size()), procPointAddressing_(nProcs_), @@ -503,6 +505,24 @@ Foam::autoPtr Foam::domainDecomposition::processorMesh } +Foam::labelList Foam::domainDecomposition::globalPointIndex +( + const label procI +) const +{ + const labelList& gppi = gpIndex_.globalLabel(); + const labelList& ppAddr = procPointAddressing_[procI]; + labelList globalPointIndex(ppAddr.size()); + + forAll (globalPointIndex, gpI) + { + globalPointIndex[gpI] = gppi[ppAddr[gpI]]; + } + + return globalPointIndex; +} + + bool Foam::domainDecomposition::writeDecomposition() { Info<< "\nConstructing processor meshes" << endl; diff --git a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.H b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.H index b4f02aa41..fc32d24e4 100644 --- a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.H +++ b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/domainDecomposition.H @@ -43,6 +43,7 @@ SourceFiles #include "PtrList.H" #include "point.H" #include "globalProcFaceIndex.H" +#include "globalProcPointIndex.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,6 +73,9 @@ class domainDecomposition //- Global face index globalProcFaceIndex gfIndex_; + //- Global face index + globalProcPointIndex gpIndex_; + //- Processor label for each cell labelList cellToProc_; @@ -205,6 +209,9 @@ public: const bool createPassiveProcPatches = false ) const; + //- Create and return global point index + labelList globalPointIndex(const label procI) const; + //- Return processor point addressing const labelListList& procPointAddressing() const { diff --git a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/fvFieldReconstructorReconstructFields.C b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/fvFieldReconstructorReconstructFields.C index 47567fa5a..dcf8dc227 100644 --- a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/fvFieldReconstructorReconstructFields.C +++ b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/fvFieldReconstructorReconstructFields.C @@ -44,10 +44,10 @@ void Foam::fvFieldReconstructor::reconstructField ) const { // Get references to internal and boundary field - Field& iField = reconField.internalField(); + Field& iField = reconField; typename GeometricField:: - GeometricBoundaryField& bouField = reconField.boundaryField(); + GeometricBoundaryField& bouField = reconField.boundaryFieldNoStoreOldTimes(); forAll (procFields, procI) { @@ -143,10 +143,10 @@ void Foam::fvFieldReconstructor::reconstructField ) const { // Create the internalField - Field& iField = reconField.internalField(); + Field& iField = reconField; typename GeometricField:: - GeometricBoundaryField& bouField = reconField.boundaryField(); + GeometricBoundaryField& bouField = reconField.boundaryFieldNoStoreOldTimes(); forAll (procFields, procI) { diff --git a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesRebuild.C b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesRebuild.C index fbe520e7b..9d9655059 100644 --- a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesRebuild.C +++ b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesRebuild.C @@ -652,10 +652,30 @@ Foam::processorMeshesReconstructor::reconstructMesh(const Time& db) reconPatchSizes = 0; - // Prepare handling for globally shared points. This is equivalent - // to parallel processor points, but working on a PtrList of meshes - // on the same processor - sharedPoints sharedData(meshes_); + // HR 21.12.18 : A bit of a hack for the moment in order to support the new + // method (using global point addressing) and old method (syncing across + // processor BCs) of constructing the shared points. The old method is still + // needed since global point addressing does not exist when the sharedPoint + // object is constructed from reconstructParMesh. + // + // TODO: Unify the methods by constructing global point addressing from the + // mesh pieces when. Or even better, calculate procPointAddressing directly + // which will simplify the mesh merging immensely. + autoPtr sharedDataPtr; + if(globalPointIndex_.size()) + { + // Determine globally shared points using global point + // adressing + sharedDataPtr.set(new sharedPoints(meshes_, globalPointIndex_)); + } + else + { + // Prepare handling for globally shared points. This is equivalent + // to parallel processor points, but working on a PtrList of meshes + // on the same processor + sharedDataPtr.set(new sharedPoints(meshes_)); + } + sharedPoints& sharedData = sharedDataPtr(); // Record global point index for shared points labelList globalPointMapping(sharedData.nGlobalPoints(), -1); diff --git a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.C b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.C index 18ace98bb..55a754bca 100644 --- a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.C +++ b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.C @@ -71,6 +71,7 @@ Foam::processorMeshesReconstructor::processorMeshesReconstructor : meshName_(meshName), meshes_(), + globalPointIndex_(), pointProcAddressing_(), faceProcAddressing_(), cellProcAddressing_(), @@ -86,6 +87,7 @@ Foam::processorMeshesReconstructor::processorMeshesReconstructor : meshName_(meshName), meshes_(databases.size()), + globalPointIndex_(), pointProcAddressing_(), faceProcAddressing_(), cellProcAddressing_(), diff --git a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.H b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.H index 17e39cacf..a8e4af0c0 100644 --- a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.H +++ b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/processorMeshesReconstructor.H @@ -72,6 +72,9 @@ class processorMeshesReconstructor //- List of processor meshes PtrList meshes_; + //- global point index per sub-mesh + labelListList globalPointIndex_; + //- List of processor point addressing lists PtrList pointProcAddressing_; @@ -161,6 +164,12 @@ public: return meshes_; } + //- Return access to meshes + labelListList& globalPointIndex() + { + return globalPointIndex_; + } + //- Return point-processor addressing arrays const PtrList& pointProcAddressing() const; diff --git a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/sharedPoints.C b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/sharedPoints.C index bc8a97d40..dc8b1d220 100644 --- a/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/sharedPoints.C +++ b/src/decompositionMethods/decomposeReconstruct/reconstructTools/finiteVolume/sharedPoints.C @@ -451,9 +451,160 @@ void Foam::sharedPoints::calcSharedPoints() } +void Foam::sharedPoints::calcSharedPoints +( + const labelListList& globalPointIndex +) +{ + typedef HashTable, label, Hash