Decomposition/redistribution: Separated choice of mesh decomposition and redistribution methods

When snappyHexMesh is run in parallel it re-balances the mesh during refinement
and layer addition by redistribution which requires a decomposition method
that operates in parallel, e.g. hierachical or ptscotch.  decomposePar uses a
decomposition method which operates in serial e.g. hierachical but NOT
ptscotch.  In order to run decomposePar followed by snappyHexMesh in parallel it
has been necessary to change the method specified in decomposeParDict but now
this is avoided by separately specifying the decomposition and distribution
methods, e.g. in the incompressible/simpleFoam/motorBike case:

numberOfSubdomains  6;

decomposer      hierarchical;
distributor     ptscotch;

hierarchicalCoeffs
{
    n               (3 2 1);
    order           xyz;
}

The distributor entry is also used for run-time mesh redistribution, e.g. in the
multiphase/interFoam/RAS/floatingObject case re-distribution for load-balancing
is enabled in constant/dynamicMeshDict:

distributor
{
    type            distributor;

    libs            ("libfvMeshDistributors.so");

    redistributionInterval  10;
}

which uses the distributor specified in system/decomposeParDict:

distributor     hierarchical;

This rationalisation provides the structure for development of mesh
redistribution and load-balancing.
This commit is contained in:
Henry Weller
2021-12-15 22:12:00 +00:00
parent 349addce38
commit f97f6326f0
86 changed files with 358 additions and 1391 deletions

View File

@ -1,10 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-ldecompositionMethods \
-lsampling \
-lmeshTools \
-llagrangian \

View File

@ -32,11 +32,16 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "argList.H"
#include "fvMesh.H"
#include "surfaceMesh.H"
#include "decompositionMethod.H"
#include "meshToMesh0.H"
#include "processorFvPatch.H"
#include "MapMeshes.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void mapConsistentMesh
@ -320,20 +325,14 @@ int main(int argc, char *argv[])
if (parallelSource && !parallelTarget)
{
IOdictionary decompositionDict
const int nProcs
(
IOobject
decompositionMethod::decomposeParDict(runTimeSource).lookup<int>
(
"decomposeParDict",
runTimeSource.system(),
runTimeSource,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
"numberOfSubdomains"
)
);
const int nProcs(decompositionDict.lookup<int>("numberOfSubdomains"));
Info<< "Create target mesh\n" << endl;
fvMesh meshTarget
@ -401,20 +400,14 @@ int main(int argc, char *argv[])
}
else if (!parallelSource && parallelTarget)
{
IOdictionary decompositionDict
const int nProcs
(
IOobject
decompositionMethod::decomposeParDict(runTimeSource).lookup<int>
(
"decomposeParDict",
runTimeTarget.system(),
runTimeTarget,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
"numberOfSubdomains"
)
);
const int nProcs(decompositionDict.lookup<int>("numberOfSubdomains"));
Info<< "Create source mesh\n" << endl;
#include "setTimeIndex.H"
@ -482,39 +475,20 @@ int main(int argc, char *argv[])
}
else if (parallelSource && parallelTarget)
{
IOdictionary decompositionDictSource
(
IOobject
(
"decomposeParDict",
runTimeSource.system(),
runTimeSource,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
const int nProcsSource
(
decompositionDictSource.lookup<int>("numberOfSubdomains")
);
IOdictionary decompositionDictTarget
(
IOobject
decompositionMethod::decomposeParDict(runTimeSource).lookup<int>
(
"decomposeParDict",
runTimeTarget.system(),
runTimeTarget,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
"numberOfSubdomains"
)
);
const int nProcsTarget
(
decompositionDictTarget.lookup<int>("numberOfSubdomains")
decompositionMethod::decomposeParDict(runTimeTarget).lookup<int>
(
"numberOfSubdomains"
)
);
List<boundBox> bbsTarget(nProcsTarget);