From 1c64911367aea41033b98bcc99b22d1cf6013885 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Wed, 20 Jun 2018 07:57:25 +0100 Subject: [PATCH] ENH: Updated meshToMesh to be able to use the new processorLOD --- .../preProcessing/mapFieldsPar/mapFieldsPar.C | 48 ++- .../interRegionOption/interRegionOption.C | 13 +- .../cellVolumeWeightCellCellStencil.C | 3 +- .../meshToMeshMethod/meshToMeshMethod.C | 37 ++- src/sampling/meshToMesh/meshToMesh.C | 29 +- src/sampling/meshToMesh/meshToMesh.H | 20 +- .../meshToMesh/meshToMeshParallelOps.C | 277 ++++++++++-------- 7 files changed, 281 insertions(+), 146 deletions(-) diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 1d021b5280..a44bcb651c 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,6 +46,7 @@ void mapConsistentMesh const fvMesh& meshTarget, const word& mapMethod, const word& AMIMapMethod, + const word& procMapMethod, const bool subtract, const wordHashSet& selectedFields, const bool noLagrangian @@ -54,7 +55,14 @@ void mapConsistentMesh Info<< nl << "Consistently creating and mapping fields for time " << meshSource.time().timeName() << nl << endl; - meshToMesh interp(meshSource, meshTarget, mapMethod, AMIMapMethod); + meshToMesh interp + ( + meshSource, + meshTarget, + mapMethod, + AMIMapMethod, + meshToMesh::procMapMethodNames_[procMapMethod] + ); if (subtract) { @@ -85,6 +93,7 @@ void mapSubMesh const wordList& cuttingPatches, const word& mapMethod, const word& AMIMapMethod, + const word& procMapMethod, const bool subtract, const wordHashSet& selectedFields, const bool noLagrangian @@ -100,7 +109,8 @@ void mapSubMesh mapMethod, AMIMapMethod, patchMap, - cuttingPatches + cuttingPatches, + meshToMesh::procMapMethodNames_[procMapMethod] ); if (subtract) @@ -171,6 +181,12 @@ int main(int argc, char *argv[]) "word", "specify the patch mapping method (direct|mapNearest|faceAreaWeight)" ); + argList::addOption + ( + "procMapMethod", + "word", + "specify the processor distribution map method (AABB|LOD)" + ); argList::addBoolOption ( "subtract", @@ -217,7 +233,7 @@ int main(int argc, char *argv[]) word mapMethod = meshToMesh::interpolationMethodNames_ [ - meshToMesh::imCellVolumeWeight + meshToMesh::interpolationMethod::imCellVolumeWeight ]; if (args.readIfPresent("mapMethod", mapMethod)) @@ -225,7 +241,6 @@ int main(int argc, char *argv[]) Info<< "Mapping method: " << mapMethod << endl; } - word patchMapMethod; if (meshToMesh::interpolationMethodNames_.found(mapMethod)) { @@ -233,12 +248,25 @@ int main(int argc, char *argv[]) meshToMesh::interpolationMethod method = meshToMesh::interpolationMethodNames_[mapMethod]; - patchMapMethod = AMIPatchToPatchInterpolation::interpolationMethodNames_ - [ - meshToMesh::interpolationMethodAMI(method) - ]; + patchMapMethod = + AMIPatchToPatchInterpolation::interpolationMethodNames_ + [ + meshToMesh::interpolationMethodAMI(method) + ]; } + word procMapMethod = + meshToMesh::procMapMethodNames_ + [ + meshToMesh::procMapMethod::pmAABB + ]; + + if (args.readIfPresent("prcoMapMethod", procMapMethod)) + { + Info<< "Processor map method: " << procMapMethod << endl; + } + + // Optionally override if (args.readIfPresent("patchMapMethod", patchMapMethod)) { @@ -325,6 +353,7 @@ int main(int argc, char *argv[]) meshTarget, mapMethod, patchMapMethod, + procMapMethod, subtract, selectedFields, noLagrangian @@ -340,6 +369,7 @@ int main(int argc, char *argv[]) cuttingPatches, mapMethod, patchMapMethod, + procMapMethod, subtract, selectedFields, noLagrangian diff --git a/src/fvOptions/interRegionOption/interRegionOption.C b/src/fvOptions/interRegionOption/interRegionOption.C index 32a3f88564..bf81ccf383 100644 --- a/src/fvOptions/interRegionOption/interRegionOption.C +++ b/src/fvOptions/interRegionOption/interRegionOption.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) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,10 +65,17 @@ void Foam::fv::interRegionOption::setMapper() ( mesh_, nbrMesh, - meshToMesh::interpolationMethodNames_.lookup + meshToMesh::interpolationMethodNames_.lookupOrDefault ( "interpolationMethod", - coeffs_ + coeffs_, + meshToMesh::interpolationMethod::imCellVolumeWeight + ), + meshToMesh::procMapMethodNames_.lookupOrDefault + ( + "procMapMethod", + coeffs_, + meshToMesh::procMapMethod::pmAABB ), false // not interpolating patches ) diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 8ffc7f6c6e..1c9a5e72c4 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -784,9 +784,10 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() ( srcMesh, tgtMesh, - meshToMesh::imCellVolumeWeight, + meshToMesh::interpolationMethod::imCellVolumeWeight, HashTable(0), // patchMap, wordList(0), // cuttingPatches + meshToMesh::procMapMethod::pmAABB, false // do not normalise ); diff --git a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C index afb6b727dc..ef21a395f1 100644 --- a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C +++ b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -84,7 +84,14 @@ bool Foam::meshToMeshMethod::intersect tetOverlapVolume overlapEngine; - treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]); + // Note: avoid demand-driven construction of cellPoints + // treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]); + const UList