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