ENH: region-wise decomposition specification for decomposeParDict

Within decomposeParDict, it is now possible to specify a different
  decomposition method, methods coefficients or number of subdomains
  for each region individually.

  The top-level numberOfSubdomains remains mandatory, since this
  specifies the number of domains for the entire simulation.
  The individual regions may use the same number or fewer domains.

  Any optional method coefficients can be specified in a general
  "coeffs" entry or a method-specific one, eg "metisCoeffs".

  For multiLevel, only the method-specific "multiLevelCoeffs" dictionary
  is used, and is also mandatory.

----

ENH: shortcut specification for multiLevel.

  In addition to the longer dictionary form, it is also possible to
  use a shorter notation for multiLevel decomposition when the same
  decomposition method applies to each level.
This commit is contained in:
Mark Olesen
2017-11-09 12:30:24 +01:00
parent 69ea4976ac
commit a9ffcab5af
211 changed files with 2416 additions and 3933 deletions

View File

@ -330,7 +330,6 @@ int main(int argc, char *argv[])
} }
forAll(regionNames, regioni) forAll(regionNames, regioni)
{ {
const word& regionName = regionNames[regioni]; const word& regionName = regionNames[regioni];
@ -338,13 +337,12 @@ int main(int argc, char *argv[])
Info<< "\n\nDecomposing mesh " << regionName << nl << endl; Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
// Determine the existing processor count directly // Determine the existing processor count directly
label nProcs = fileHandler().nProcs(runTime.path(), regionDir); label nProcs = fileHandler().nProcs(runTime.path(), regionDir);
// Get requested numberOfSubdomains. Note: have no mesh yet so // Get requested numberOfSubdomains directly from the dictionary.
// cannot use decompositionModel::New // Note: have no mesh yet so cannot use decompositionModel::New
const label nDomains = readLabel const label nDomains = decompositionMethod::nDomains
( (
IOdictionary IOdictionary
( (
@ -362,7 +360,7 @@ int main(int argc, char *argv[])
), ),
decompDictFile decompDictFile
) )
).lookup("numberOfSubdomains") )
); );
if (decomposeFieldsOnly) if (decomposeFieldsOnly)

View File

@ -15,10 +15,174 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2; //- The total number of domains (mandatory)
numberOfSubdomains 256;
//- The decomposition method (mandatory)
method scotch;
// method hierarchical;
// method simple;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
// Optional decomposition constraints //- Optional region-wise decomposition.
// Can specify a different method.
// The number of subdomains can be less than the top-level numberOfSubdomains.
regions
{
water
{
numberOfSubdomains 128;
method metis;
}
".*solid"
{
numberOfSubdomains 4;
method metis;
}
heater
{
numberOfSubdomains 1;
method none;
}
}
// Coefficients for the decomposition method are either as a
// general "coeffs" dictionary or method-specific "<method>Coeffs".
// For multiLevel, using multiLevelCoeffs only.
multiLevelCoeffs
{
// multiLevel decomposition methods to apply in turn.
// This is like hierarchical but fully general
// - every method can be used at every level.
// Only sub-dictionaries containing the keyword "method" are used.
//
level0
{
numberOfSubdomains 16;
method scotch;
}
level1
{
numberOfSubdomains 2;
method scotch;
coeffs
{
n (2 1 1);
delta 0.001;
}
}
level2
{
numberOfSubdomains 8;
// method simple;
method scotch;
}
}
multiLevelCoeffs
{
// Compact multiLevel specification, activated by the presence of the
// keywords "method" and "domains"
method scotch;
domains (16 2 8);
//// Or with implicit '16' for the first level with numberOfSubdomains=256
//domains (2 8);
}
// Other example coefficents
simpleCoeffs
{
n (2 1 1);
// delta 0.001; //< default value = 0.001
}
hierarchicalCoeffs
{
n (1 2 1);
// delta 0.001; //< default value = 0.001
// order xyz; //< default order = xyz
}
metisCoeffs
{
/*
processorWeights
(
1
1
1
1
);
*/
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (movingWall);
// Method to use on the 2D subset
method scotch;
}
//- 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.
// weightField dsmcRhoNMean;
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
//
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Decomposition constraints
//constraints //constraints
//{ //{
// preserveBaffles // preserveBaffles
@ -88,107 +252,4 @@ numberOfSubdomains 2;
//preserveBaffles true; //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.
// weightField dsmcRhoNMean;
method scotch;
//method hierarchical;
// method simple;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
multiLevelCoeffs
{
// Decomposition methods to apply in turn. This is like hierarchical but
// fully general - every method can be used at every level.
level0
{
numberOfSubdomains 64;
//method simple;
//simpleCoeffs
//{
// n (2 1 1);
// delta 0.001;
//}
method scotch;
}
level1
{
numberOfSubdomains 4;
method scotch;
}
}
// Desired output
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
/*
processorWeights
(
1
1
1
1
);
*/
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (movingWall);
// Method to use on the 2D subset
method scotch;
}
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* // // ************************************************************************* //

View File

@ -49,10 +49,8 @@ void Foam::domainDecomposition::mark
labelList& elementToZone labelList& elementToZone
) )
{ {
forAll(zoneElems, i) for (const label pointi : zoneElems)
{ {
label pointi = zoneElems[i];
if (elementToZone[pointi] == -1) if (elementToZone[pointi] == -1)
{ {
// First occurrence // First occurrence
@ -69,7 +67,6 @@ void Foam::domainDecomposition::mark
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
Foam::domainDecomposition::domainDecomposition Foam::domainDecomposition::domainDecomposition
( (
const IOobject& io, const IOobject& io,
@ -98,13 +95,13 @@ Foam::domainDecomposition::domainDecomposition
decompDictFile_(decompDictFile), decompDictFile_(decompDictFile),
nProcs_ nProcs_
( (
readInt decompositionMethod::nDomains
( (
decompositionModel::New decompositionModel::New
( (
*this, *this,
decompDictFile decompDictFile
).lookup("numberOfSubdomains") )
) )
), ),
distributed_(false), distributed_(false),

View File

@ -46,11 +46,11 @@ void Foam::domainDecomposition::distributeCells()
decompDictFile_ decompDictFile_
); );
word weightName;
scalarField cellWeights; scalarField cellWeights;
if (method.found("weightField"))
{
word weightName = method.lookup("weightField");
if (method.readIfPresent("weightField", weightName))
{
volScalarField weights volScalarField weights
( (
IOobject IOobject

View File

@ -58,7 +58,7 @@ int readNumProcs
dictFile = dictFile / dictName; dictFile = dictFile / dictName;
} }
return readInt return decompositionMethod::nDomains
( (
IOdictionary IOdictionary
( (
@ -75,7 +75,7 @@ int readNumProcs
), ),
dictFile dictFile
) )
).lookup("numberOfSubdomains") )
); );
} }

View File

@ -73,10 +73,20 @@ Foam::label Foam::kahipDecomp::decomposeSerial
Foam::kahipDecomp::kahipDecomp Foam::kahipDecomp::kahipDecomp
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp("kahip", decompDict)
{}
Foam::kahipDecomp::kahipDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp("kahip", decompDict, regionName)
{} {}

View File

@ -73,10 +73,20 @@ Foam::label Foam::metisDecomp::decomposeSerial
Foam::metisDecomp::metisDecomp Foam::metisDecomp::metisDecomp
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp("metis", decompDict)
{}
Foam::metisDecomp::metisDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp("metis", decompDict, regionName)
{} {}

View File

@ -98,10 +98,22 @@ Foam::label Foam::ptscotchDecomp::decompose
Foam::ptscotchDecomp::ptscotchDecomp Foam::ptscotchDecomp::ptscotchDecomp
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
: :
decompositionMethod(decompositionDict) decompositionMethod(decompDict),
coeffsDict_(dictionary::null)
{}
Foam::ptscotchDecomp::ptscotchDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
decompositionMethod(decompDict, regionName),
coeffsDict_(dictionary::null)
{} {}

View File

@ -80,10 +80,20 @@ Foam::label Foam::scotchDecomp::decomposeSerial
Foam::scotchDecomp::scotchDecomp Foam::scotchDecomp::scotchDecomp
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp("scotch", decompDict)
{}
Foam::scotchDecomp::scotchDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp("scotch", decompDict, regionName)
{} {}

View File

@ -34,6 +34,7 @@ namespace Foam
defineTypeNameAndDebug(decompositionModel, 0); defineTypeNameAndDebug(decompositionModel, 0);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::decompositionModel::decompositionModel Foam::decompositionModel::decompositionModel

View File

@ -75,14 +75,14 @@ public:
// Selectors // Selectors
//- Read (optionallly from absolute path) & register on mesh //- Read (optionally from absolute path) & register on mesh
static const decompositionModel& New static const decompositionModel& New
( (
const polyMesh& mesh, const polyMesh& mesh,
const fileName& decompDictFile = "" const fileName& decompDictFile = ""
); );
//- Read (optionallly from supplied dictionary) & register on mesh //- Read (optionally from supplied dictionary) & register on mesh
static const decompositionModel& New static const decompositionModel& New
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -94,42 +94,51 @@ public:
// Constructors // Constructors
//- Construct from typeName or optional path to controlDictionary //- Construct from typeName or optional path to controlDictionary
decompositionModel(const polyMesh&, const fileName& = ""); decompositionModel
(
const polyMesh& mesh,
const fileName& decompDictFile = ""
);
//- Construct from typeName or optional path to controlDictionary //- Construct from typeName or optional path to controlDictionary
decompositionModel decompositionModel
( (
const polyMesh&, const polyMesh& mesh,
const dictionary& dict, const dictionary& dict,
const fileName& = "" const fileName& decompDictFile = ""
); );
// Member functions // Member Functions
decompositionMethod& decomposer() const decompositionMethod& decomposer() const
{ {
if (!decomposerPtr_.valid()) if (!decomposerPtr_.valid())
{ {
decomposerPtr_ = decompositionMethod::New(*this); decomposerPtr_ =
decompositionMethod::New
(
*this,
this->mesh().name() // Name of mesh region
);
} }
return decomposerPtr_(); return decomposerPtr_();
} }
//- Helper: return IOobject with optionally absolute path provided //- Helper: return IOobject with optionally absolute path provided
static IOobject selectIO(const IOobject&, const fileName&); static IOobject selectIO(const IOobject& io, const fileName& f);
// UpdateableMeshObject // UpdateableMeshObject
virtual bool movePoints() virtual bool movePoints()
{ {
return false; return false;
} }
virtual void updateMesh(const mapPolyMesh&) virtual void updateMesh(const mapPolyMesh&)
{} {}
}; };

View File

@ -0,0 +1,282 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
\page domainDecomposition Domain decomposition
\section secIntroduction Introduction
When running a simulation in parallel, the geometry must first be decomposed
(segmented) into individual geometries for each MPI process. These separate
geometries are \a connected together with special processor boundary patches.
The processor-specific \c constant/polyMesh/boundary files will contain this
type of entry:
\verbatim
procBoundary0to14
{
type processor;
inGroups 1(processor);
nFaces 131;
startFace 34983;
matchTolerance 0.0001;
transform unknown;
myProcNo 0;
neighbProcNo 14;
}
\endverbatim
The decomposePar utility is a commonly used method to decompose domains
and subsequently distribute the fields.
The reconstructPar and reconstructParMesh utilities
can be used to reconstruct a single domain from the processor sub-domains.
\section secDecomposeParDict The decomposeParDict
The \c decomposeParDict is required by decompose utilities and for any solvers
or utilities running in parallel. It is normally located in the simulation
\c system directory. The <tt>-decomposeParDict name</tt> command-line option
can be used to specify an alternate file.
The \a numberOfSubdomains entry is mandatory:
\verbatim
numberOfSubdomains <int>;
\endverbatim
The \a method entry is required for the decomposePar utility and specifies
the decomposition method type:
\verbatim
method <word>;
\endverbatim
The \a method entry is generally not required when running a simulation.
OpenFOAM offers a variety of decomposition methods and interfaces to external,
third-party decomposition routines. The types of decomposition methods
available will thus depend on your particular installation.
\table
Name | Class
none | #Foam::noDecomp
manual | #Foam::manualDecomp
simple | #Foam::simpleGeomDecomp
hierarchical | #Foam::hierarchGeomDecomp
kahip | #Foam::kahipDecomp
metis | #Foam::metisDecomp
scotch | #Foam::scotchDecomp
structured | #Foam::structuredDecomp
multiLevel | #Foam::multiLevelDecomp
\endtable
If a decomposition method requires any additional configuration controls,
these are specified either within in a generic \c coeffs dictionary that
or a method-specific version. For example,
\verbatim
method hierarchical;
coeffs
{
n (4 2 3);
}
// -----
method metis;
metisCoeffs
{
method k-way;
}
\endverbatim
For simplicity, the generic \c coeffs dictionary is generally preferrable.
However, for some specific decomposition methods
(eg, \ref subsecMultiLevel "multiLevel") only the
method-specific coefficients dictionary is permitted.
\subsection subsecRegions Multi-region
When running multi-region simulations, it may be desirable to use different
decomposition methods for one or more regions, or even to have fewer
processors allocated to a particular region.
If, for example, the multi-region simulation contains a large fluid region
and a very small solid region, it can be advantageous to decompose the solid
onto fewer processors.
The region-wise specification is contained in a \a regions subdictionary with
decomposeParDict. For example,
\verbatim
numberOfSubdomains 2048;
method metis;
regions
{
heater
{
numberOfSubdomains 2;
method hierarchical;
coeffs
{
n (2 1 1);
}
}
"*.solid"
{
numberOfSubdomains 16;
method scotch;
}
}
\endverbatim
\note
The top-level numberOfSubdomains remains mandatory, since this specifies the
number of domains for the entire simulation. The individual regions may use
the same number or fewer domains. The \a numberOfSubdomains entry within
a region specification is only needed if the value differs.
\subsection subsecMultiLevel Multi-level decomposition
The #Foam::multiLevelDecomp decomposition provides a general means of
successively decomposing with different methods. Each appplication of the
decomposition is termed a level. For example,
\verbatim
numberOfSubdomains 2048;
method multiLevel;
multiLevelCoeffs
{
nodes
{
numberOfSubdomains 128;
method hierarchical;
coeffs
{
n (16 4 2);
}
}
cpus
{
numberOfSubdomains 2;
method scotch;
}
cores
{
numberOfSubdomains 8;
method metis;
}
}
\endverbatim
For cases where the same method is applied at each level, this can also be
conveniently written in a much shorter form:
\verbatim
numberOfSubdomains 2048;
method multiLevel;
multiLevelCoeffs
{
method scotch
domains (128 2 8);
}
\endverbatim
When the specified \a domains is smaller than \a numberOfSubdomains
but can be resolved as an integral multiple, this integral multiple
is used as the first level. This can make it easier to manage when
changing the number of domains for the simulation.
For example,
\verbatim
numberOfSubdomains 1024;
method multiLevel;
multiLevelCoeffs
{
method scotch
domains (2 8); //< inferred as domains (64 2 8);
}
\endverbatim
\subsection subsecConstraints Constraints
\verbatim
constraints
{
preserveBaffles
{
// Keep owner and neighbour of baffles on same processor
// (ie, 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;
}
}
\endverbatim
\*---------------------------------------------------------------------------*/

View File

@ -44,49 +44,97 @@ namespace Foam
{ {
defineTypeNameAndDebug(decompositionMethod, 0); defineTypeNameAndDebug(decompositionMethod, 0);
defineRunTimeSelectionTable(decompositionMethod, dictionary); defineRunTimeSelectionTable(decompositionMethod, dictionary);
defineRunTimeSelectionTable(decompositionMethod, dictionaryRegion);
// Fallback name when searching for optional coefficients directories
static const word defaultName("coeffs");
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::decompositionMethod::decompositionMethod Foam::label Foam::decompositionMethod::nDomains(const dictionary& decompDict)
(
const dictionary& decompositionDict
)
:
decompositionDict_(decompositionDict),
nProcessors_
(
readLabel(decompositionDict.lookup("numberOfSubdomains"))
)
{ {
// Read any constraints return readLabel(decompDict.lookup("numberOfSubdomains"));
wordList constraintTypes_; }
if (decompositionDict_.found("constraints"))
Foam::label Foam::decompositionMethod::nDomains
(
const dictionary& decompDict,
const word& regionName
)
{
const label nDomainsGlobal = nDomains(decompDict);
const dictionary& regionDict(optionalRegionDict(decompDict, regionName));
label nDomainsRegion;
if (regionDict.readIfPresent("numberOfSubdomains", nDomainsRegion))
{ {
//PtrList<dictionary> constraintsList if (nDomainsRegion >= 1 && nDomainsRegion <= nDomainsGlobal)
//( {
// decompositionDict_.lookup("constraints") return nDomainsRegion;
//); }
//forAll(constraintsList, i)
//{ WarningInFunction
// const dictionary& dict = constraintsList[i]; << "ignoring out of range numberOfSubdomains "
const dictionary& constraintsList = decompositionDict_.subDict << nDomainsRegion << " for region " << regionName
( << nl << nl
"constraints" << endl;
); }
forAllConstIter(dictionary, constraintsList, iter)
return nDomainsGlobal;
}
const Foam::dictionary& Foam::decompositionMethod::optionalRegionDict
(
const dictionary& decompDict,
const word& regionName
)
{
auto finder = decompDict.csearch("regions");
if (!regionName.empty() && finder.isDict())
{
finder = finder.dict().csearch(regionName);
if (finder.isDict())
{
return finder.dict();
}
}
return dictionary::null;
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::decompositionMethod::readConstraints()
{
constraints_.clear();
// Read any constraints
wordList constraintTypes;
const dictionary* dictptr = decompositionDict_.subDictPtr("constraints");
if (dictptr)
{
forAllConstIters(*dictptr, iter)
{ {
const dictionary& dict = iter().dict(); const dictionary& dict = iter().dict();
constraintTypes_.append(dict.lookup("type")); constraintTypes.append(dict.lookup("type"));
constraints_.append constraints_.append
( (
decompositionConstraint::New decompositionConstraint::New
( (
dict, dict,
constraintTypes_.last() constraintTypes.last()
) )
); );
} }
@ -96,7 +144,7 @@ Foam::decompositionMethod::decompositionMethod
if if
( (
decompositionDict_.found("preserveBaffles") decompositionDict_.found("preserveBaffles")
&& !constraintTypes_.found && !constraintTypes.found
( (
decompositionConstraints::preserveBafflesConstraint::typeName decompositionConstraints::preserveBafflesConstraint::typeName
) )
@ -111,7 +159,7 @@ Foam::decompositionMethod::decompositionMethod
if if
( (
decompositionDict_.found("preservePatches") decompositionDict_.found("preservePatches")
&& !constraintTypes_.found && !constraintTypes.found
( (
decompositionConstraints::preservePatchesConstraint::typeName decompositionConstraints::preservePatchesConstraint::typeName
) )
@ -128,7 +176,7 @@ Foam::decompositionMethod::decompositionMethod
if if
( (
decompositionDict_.found("preserveFaceZones") decompositionDict_.found("preserveFaceZones")
&& !constraintTypes_.found && !constraintTypes.found
( (
decompositionConstraints::preserveFaceZonesConstraint::typeName decompositionConstraints::preserveFaceZonesConstraint::typeName
) )
@ -145,7 +193,7 @@ Foam::decompositionMethod::decompositionMethod
if if
( (
decompositionDict_.found("singleProcessorFaceSets") decompositionDict_.found("singleProcessorFaceSets")
&& !constraintTypes_.found && !constraintTypes.found
( (
decompositionConstraints::preserveFaceZonesConstraint::typeName decompositionConstraints::preserveFaceZonesConstraint::typeName
) )
@ -166,17 +214,144 @@ Foam::decompositionMethod::decompositionMethod
} }
} }
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
(
const dictionary& dict,
const word& coeffsName,
int select
)
{
dictionary::const_searcher fnd;
if
(
(fnd = dict.csearch(coeffsName)).isDict()
||
(
!(select & selectionType::EXACT)
&& (fnd = dict.csearch(defaultName)).isDict()
)
)
{
return fnd.dict();
}
// Not found
if (select & selectionType::MANDATORY)
{
FatalIOError
<< "'" << coeffsName << "' dictionary not found in dictionary "
<< dict.name() << endl
<< abort(FatalIOError);
}
if (select & selectionType::NULL_DICT)
{
return dictionary::null;
}
return dict;
}
const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
(
const word& coeffsName,
int select
) const
{
dictionary::const_searcher fnd;
if
(
!decompositionRegionDict_.empty()
&&
(
(fnd = decompositionRegionDict_.csearch(coeffsName)).isDict()
||
(
!(select & selectionType::EXACT)
&& (fnd = decompositionRegionDict_.csearch(defaultName)).isDict()
)
)
)
{
return fnd.dict();
}
if
(
(fnd = decompositionDict_.csearch(coeffsName)).isDict()
||
(
!(select & selectionType::EXACT)
&& (fnd = decompositionDict_.csearch(defaultName)).isDict()
)
)
{
return fnd.dict();
}
// Not found
if (select & selectionType::MANDATORY)
{
FatalIOError
<< "'" << coeffsName << "' dictionary not found in dictionary "
<< decompositionDict_.name() << endl
<< abort(FatalIOError);
}
if (select & selectionType::NULL_DICT)
{
return dictionary::null;
}
return decompositionDict_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::decompositionMethod::decompositionMethod
(
const dictionary& decompDict
)
:
decompositionDict_(decompDict),
decompositionRegionDict_(dictionary::null),
nDomains_(nDomains(decompDict))
{
readConstraints();
}
Foam::decompositionMethod::decompositionMethod
(
const dictionary& decompDict,
const word& regionName
)
:
decompositionDict_(decompDict),
decompositionRegionDict_
(
optionalRegionDict(decompositionDict_, regionName)
),
nDomains_(nDomains(decompDict, regionName))
{
readConstraints();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
{ {
const word methodType(decompositionDict.lookup("method")); const word methodType(decompDict.lookup("method"));
Info<< "Selecting decompositionMethod " << methodType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodType); auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodType);
@ -190,7 +365,58 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<decompositionMethod>(cstrIter()(decompositionDict)); // verbose
{
Info<< "Selecting decompositionMethod " << methodType
<< " [" << (nDomains(decompDict)) << "]" << endl;
}
return autoPtr<decompositionMethod>(cstrIter()(decompDict));
}
Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
(
const dictionary& decompDict,
const word& regionName
)
{
const dictionary& regionDict(optionalRegionDict(decompDict, regionName));
if (regionDict.empty())
{
// No region-specific information - just forward to normal routine
return decompositionMethod::New(decompDict);
}
word methodType(decompDict.lookup("method"));
regionDict.readIfPresent("method", methodType);
auto cstrIter = dictionaryRegionConstructorTablePtr_->cfind(methodType);
if (!cstrIter.found())
{
WarningInFunction
<< nl
<< "Unknown region decompositionMethod "
<< methodType << nl << nl
<< "Valid decompositionMethods : " << endl
<< dictionaryRegionConstructorTablePtr_->sortedToc() << nl
<< "Reverting to non-region version" << nl
<< endl;
return decompositionMethod::New(decompDict);
}
// verbose
{
Info<< "Selecting decompositionMethod " << methodType
<< " [" << (nDomains(decompDict, regionName)) << "] (region "
<< regionName << ")" << endl;
}
return autoPtr<decompositionMethod>(cstrIter()(decompDict, regionName));
} }
@ -341,7 +567,7 @@ void Foam::decompositionMethod::calcCellCells
// Number of faces per coarse cell // Number of faces per coarse cell
labelList nFacesPerCell(nLocalCoarse, 0); labelList nFacesPerCell(nLocalCoarse, 0);
for (label facei = 0; facei < mesh.nInternalFaces(); facei++) for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
{ {
const label own = agglom[faceOwner[facei]]; const label own = agglom[faceOwner[facei]];
const label nei = agglom[faceNeighbour[facei]]; const label nei = agglom[faceNeighbour[facei]];
@ -391,7 +617,7 @@ void Foam::decompositionMethod::calcCellCells
const labelList& offsets = cellCells.offsets(); const labelList& offsets = cellCells.offsets();
// For internal faces is just offsetted owner and neighbour // For internal faces is just offsetted owner and neighbour
for (label facei = 0; facei < mesh.nInternalFaces(); facei++) for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
{ {
const label own = agglom[faceOwner[facei]]; const label own = agglom[faceOwner[facei]];
const label nei = agglom[faceNeighbour[facei]]; const label nei = agglom[faceNeighbour[facei]];
@ -453,7 +679,7 @@ void Foam::decompositionMethod::calcCellCells
const label endIndex = cellCells.offsets()[celli+1]; const label endIndex = cellCells.offsets()[celli+1];
for (label i = startIndex; i < endIndex; i++) for (label i = startIndex; i < endIndex; ++i)
{ {
if (nbrCells.insert(cellCells.m()[i])) if (nbrCells.insert(cellCells.m()[i]))
{ {
@ -547,10 +773,10 @@ void Foam::decompositionMethod::calcCellCells
// Number of faces per coarse cell // Number of faces per coarse cell
labelList nFacesPerCell(nLocalCoarse, 0); labelList nFacesPerCell(nLocalCoarse, 0);
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
{ {
const label own = agglom[faceOwner[faceI]]; const label own = agglom[faceOwner[facei]];
const label nei = agglom[faceNeighbour[faceI]]; const label nei = agglom[faceNeighbour[facei]];
nFacesPerCell[own]++; nFacesPerCell[own]++;
nFacesPerCell[nei]++; nFacesPerCell[nei]++;
@ -599,18 +825,18 @@ void Foam::decompositionMethod::calcCellCells
const labelList& offsets = cellCells.offsets(); const labelList& offsets = cellCells.offsets();
// For internal faces is just offsetted owner and neighbour // For internal faces is just offsetted owner and neighbour
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
{ {
const label own = agglom[faceOwner[faceI]]; const label own = agglom[faceOwner[facei]];
const label nei = agglom[faceNeighbour[faceI]]; const label nei = agglom[faceNeighbour[facei]];
const label ownIndex = offsets[own] + nFacesPerCell[own]++; const label ownIndex = offsets[own] + nFacesPerCell[own]++;
const label neiIndex = offsets[nei] + nFacesPerCell[nei]++; const label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
m[ownIndex] = globalAgglom.toGlobal(nei); m[ownIndex] = globalAgglom.toGlobal(nei);
w[ownIndex] = mag(mesh.faceAreas()[faceI]); w[ownIndex] = mag(mesh.faceAreas()[facei]);
m[neiIndex] = globalAgglom.toGlobal(own); m[neiIndex] = globalAgglom.toGlobal(own);
w[ownIndex] = mag(mesh.faceAreas()[faceI]); w[ownIndex] = mag(mesh.faceAreas()[facei]);
} }
// For boundary faces is offsetted coupled neighbour // For boundary faces is offsetted coupled neighbour
@ -661,14 +887,14 @@ void Foam::decompositionMethod::calcCellCells
label startIndex = cellCells.offsets()[0]; label startIndex = cellCells.offsets()[0];
forAll(cellCells, cellI) forAll(cellCells, celli)
{ {
nbrCells.clear(); nbrCells.clear();
nbrCells.insert(globalAgglom.toGlobal(cellI)); nbrCells.insert(globalAgglom.toGlobal(celli));
const label endIndex = cellCells.offsets()[cellI+1]; const label endIndex = cellCells.offsets()[celli+1];
for (label i = startIndex; i < endIndex; i++) for (label i = startIndex; i < endIndex; ++i)
{ {
if (nbrCells.insert(cellCells.m()[i])) if (nbrCells.insert(cellCells.m()[i]))
{ {
@ -678,8 +904,8 @@ void Foam::decompositionMethod::calcCellCells
} }
} }
startIndex = endIndex; startIndex = endIndex;
cellCells.offsets()[cellI+1] = newIndex; cellCells.offsets()[celli+1] = newIndex;
cellCellWeights.offsets()[cellI+1] = newIndex; cellCellWeights.offsets()[celli+1] = newIndex;
} }
cellCells.m().setSize(newIndex); cellCells.m().setSize(newIndex);
@ -753,7 +979,7 @@ void Foam::decompositionMethod::calcCellCells
// labelList nFacesPerCell(nLocalCoarse, 0); // labelList nFacesPerCell(nLocalCoarse, 0);
// //
// // 1. Internal faces // // 1. Internal faces
// for (label facei = 0; facei < mesh.nInternalFaces(); facei++) // for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
// { // {
// if (!blockedFace[facei]) // if (!blockedFace[facei])
// { // {
@ -880,7 +1106,7 @@ void Foam::decompositionMethod::calcCellCells
// const labelList& offsets = cellCells.offsets(); // const labelList& offsets = cellCells.offsets();
// //
// // 1. For internal faces is just offsetted owner and neighbour // // 1. For internal faces is just offsetted owner and neighbour
// for (label facei = 0; facei < mesh.nInternalFaces(); facei++) // for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
// { // {
// if (!blockedFace[facei]) // if (!blockedFace[facei])
// { // {
@ -1032,7 +1258,7 @@ void Foam::decompositionMethod::calcCellCells
// //
// label endIndex = cellCells.offsets()[celli+1]; // label endIndex = cellCells.offsets()[celli+1];
// //
// for (label i = startIndex; i < endIndex; i++) // for (label i = startIndex; i < endIndex; ++i)
// { // {
// if (nbrCells.insert(cellCells.m()[i])) // if (nbrCells.insert(cellCells.m()[i]))
// { // {
@ -1180,11 +1406,11 @@ Foam::labelList Foam::decompositionMethod::decompose
forAll(localRegion, celli) forAll(localRegion, celli)
{ {
label regionI = localRegion[celli]; const label regioni = localRegion[celli];
if (regionCentres[regionI] == point::max) if (regionCentres[regioni] == point::max)
{ {
regionCentres[regionI] = mesh.cellCentres()[celli]; regionCentres[regioni] = mesh.cellCentres()[celli];
} }
} }
@ -1197,18 +1423,18 @@ Foam::labelList Foam::decompositionMethod::decompose
{ {
forAll(localRegion, celli) forAll(localRegion, celli)
{ {
label regionI = localRegion[celli]; const label regioni = localRegion[celli];
regionWeights[regionI] += cellWeights[celli]; regionWeights[regioni] += cellWeights[celli];
} }
} }
else else
{ {
forAll(localRegion, celli) forAll(localRegion, celli)
{ {
label regionI = localRegion[celli]; const label regioni = localRegion[celli];
regionWeights[regionI] += 1.0; regionWeights[regioni] += 1.0;
} }
} }
@ -1224,11 +1450,11 @@ Foam::labelList Foam::decompositionMethod::decompose
// Implement the explicitConnections since above decompose // Implement the explicitConnections since above decompose
// does not know about them // does not know about them
forAll(explicitConnections, i) forAll(explicitConnections, connectioni)
{ {
const labelPair& baffle = explicitConnections[i]; const labelPair& baffle = explicitConnections[connectioni];
label f0 = baffle.first(); const label f0 = baffle.first();
label f1 = baffle.second(); const label f1 = baffle.second();
if (!blockedFace[f0] && !blockedFace[f1]) if (!blockedFace[f0] && !blockedFace[f1])
{ {
@ -1292,7 +1518,7 @@ Foam::labelList Foam::decompositionMethod::decompose
{ {
if (!blockedFace[facei]) if (!blockedFace[facei])
{ {
label own = mesh.faceOwner()[facei]; const label own = mesh.faceOwner()[facei];
seedFaces[nUnblocked] = facei; seedFaces[nUnblocked] = facei;
seedData[nUnblocked] = minData(finalDecomp[own]); seedData[nUnblocked] = minData(finalDecomp[own]);
nUnblocked++; nUnblocked++;
@ -1361,10 +1587,8 @@ Foam::labelList Foam::decompositionMethod::decompose
forAll(f, fp) forAll(f, fp)
{ {
const labelList& pFaces = mesh.pointFaces()[f[fp]]; const labelList& pFaces = mesh.pointFaces()[f[fp]];
forAll(pFaces, i) for (const label facei : pFaces)
{ {
label facei = pFaces[i];
finalDecomp[mesh.faceOwner()[facei]] = proci; finalDecomp[mesh.faceOwner()[facei]] = proci;
if (mesh.isInternalFace(facei)) if (mesh.isInternalFace(facei))
{ {
@ -1433,9 +1657,9 @@ void Foam::decompositionMethod::setConstraints
specifiedProcessorFaces.clear(); specifiedProcessorFaces.clear();
explicitConnections.clear(); explicitConnections.clear();
forAll(constraints_, constraintI) forAll(constraints_, constrainti)
{ {
constraints_[constraintI].add constraints_[constrainti].add
( (
mesh, mesh,
blockedFace, blockedFace,
@ -1457,9 +1681,9 @@ void Foam::decompositionMethod::applyConstraints
labelList& decomposition labelList& decomposition
) )
{ {
forAll(constraints_, constraintI) forAll(constraints_, constrainti)
{ {
constraints_[constraintI].apply constraints_[constrainti].apply
( (
mesh, mesh,
blockedFace, blockedFace,

View File

@ -25,7 +25,7 @@ Class
Foam::decompositionMethod Foam::decompositionMethod
Description Description
Abstract base class for decomposition Abstract base class for domain decomposition
SourceFiles SourceFiles
decompositionMethod.C decompositionMethod.C
@ -43,29 +43,86 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class decompositionMethod Declaration Class decompositionMethod Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class decompositionMethod class decompositionMethod
{ {
// Private Member Functions
//- Set PtrList of constraints by reading decompositionDict_.
void readConstraints();
//- Disallow default bitwise copy construct and assignment
decompositionMethod(const decompositionMethod&) = delete;
void operator=(const decompositionMethod&) = delete;
protected: protected:
//- Selection type when handling the coefficients dictionary.
// To be used as a bit-mask for findCoeffsDict
enum selectionType
{
DEFAULT = 0, //!< Default request
EXACT = 1, //!< No fallback to "coeffs" if main name not found
MANDATORY = 2, //!< Fatal if dictionary could not be found
NULL_DICT = 4, //!< On failure, return dictionary::null instead
//!< of the top-level enclosing dictionary.
};
// Protected data // Protected data
//- Top-level decomposition dictionary (eg, decomposeParDict)
const dictionary& decompositionDict_; const dictionary& decompositionDict_;
label nProcessors_;
//- Region-specific decomposition dictionary information
const dictionary& decompositionRegionDict_;
//- Number of domains for the decomposition
label nDomains_;
//- Optional constraints //- Optional constraints
PtrList<decompositionConstraint> constraints_; PtrList<decompositionConstraint> constraints_;
private:
// Private Member Functions // Protected Member Functions
//- Disallow default bitwise copy construct and assignment //- Locate coeffsName dictionary or the fallback "coeffs" dictionary
decompositionMethod(const decompositionMethod&); //- within an enclosing dictionary.
void operator=(const decompositionMethod&); //
// \param select choose to include "coeffs" in the search, make
// failure a FatalError, return dictionary::null instead on
// failure.
//
// \return the coefficients dictionary found. If nothing was found,
// return the enclosing dictionary or
// dictionary::null (depending on the select parameter).
static const dictionary& findCoeffsDict
(
const dictionary& dict,
const word& coeffsName,
int select = selectionType::DEFAULT
);
//- Locate coeffsName dictionary or the fallback "coeffs" dictionary.
// Searches both the region-specific decomposition dictionary
// and the top-level decomposition dictionary.
//
// \param select choose to include "coeffs" in the search, make
// failure a FatalError, return dictionary::null instead on
// failure.
//
// \return the coefficients dictionary found. If nothing was found,
// return the top-level (non-region) dictionary or
// dictionary::null (depending on the select parameter).
const dictionary& findCoeffsDict
(
const word& coeffsName,
int select = selectionType::DEFAULT
) const;
public: public:
@ -82,9 +139,43 @@ public:
decompositionMethod, decompositionMethod,
dictionary, dictionary,
( (
const dictionary& decompositionDict const dictionary& decompDict
), ),
(decompositionDict) (decompDict)
);
declareRunTimeSelectionTable
(
autoPtr,
decompositionMethod,
dictionaryRegion,
(
const dictionary& decompDict,
const word& regionName
),
(decompDict, regionName)
);
// Static Methods
//- Return the \c numberOfSubdomains entry from the dictionary
static label nDomains(const dictionary& decompDict);
//- Return the \c numberOfSubdomains from a region within the
// "regions" sub-dictionary
static label nDomains
(
const dictionary& decompDict,
const word& regionName
);
//- Return an optional region dictionary from "regions" sub-dictionary
// or dictionary::null on failure.
static const dictionary& optionalRegionDict
(
const dictionary& decompDict,
const word& regionName
); );
@ -93,14 +184,29 @@ public:
//- Return a reference to the selected decomposition method //- Return a reference to the selected decomposition method
static autoPtr<decompositionMethod> New static autoPtr<decompositionMethod> New
( (
const dictionary& decompositionDict const dictionary& decompDict
);
//- Return a reference to the selected decomposition method,
//- with region specification
static autoPtr<decompositionMethod> New
(
const dictionary& decompDict,
const word& regionName
); );
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
decompositionMethod(const dictionary& decompositionDict); decompositionMethod(const dictionary& decompDict);
//- Construct given the decomposition dictionary for specific region
decompositionMethod
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor
@ -110,9 +216,10 @@ public:
// Member Functions // Member Functions
label nDomains() const //- Number of domains
inline label nDomains() const
{ {
return nProcessors_; return nDomains_;
} }
//- Is method parallel aware (i.e. does it synchronize domains across //- Is method parallel aware (i.e. does it synchronize domains across

View File

@ -25,36 +25,29 @@ License
#include "geomDecomp.H" #include "geomDecomp.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::geomDecomp::geomDecomp void Foam::geomDecomp::readCoeffs()
(
const dictionary& decompositionDict,
const word& derivedType
)
:
decompositionMethod(decompositionDict),
geomDecomDict_(decompositionDict.optionalSubDict(derivedType + "Coeffs")),
n_(geomDecomDict_.lookup("n")),
delta_(readScalar(geomDecomDict_.lookup("delta"))),
rotDelta_(I)
{ {
// check that the case makes sense : coeffsDict_.readIfPresent("delta", delta_);
if (nProcessors_ != n_.x()*n_.y()*n_.z()) coeffsDict_.lookup("n") >> n_;
// Verify that the input makes sense
if (nDomains_ != n_.x()*n_.y()*n_.z())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Wrong number of processor divisions in geomDecomp:" << nl << "Wrong number of domain divisions in geomDecomp:" << nl
<< "Number of domains : " << nProcessors_ << nl << "Number of domains : " << nDomains_ << nl
<< "Wanted decomposition : " << n_ << "Wanted decomposition : " << n_
<< exit(FatalError); << exit(FatalError);
} }
scalar d = 1 - 0.5*delta_*delta_; const scalar d = 1 - 0.5*delta_*delta_;
scalar d2 = sqr(d); const scalar d2 = sqr(d);
scalar a = delta_; const scalar a = delta_;
scalar a2 = sqr(a); const scalar a2 = sqr(a);
rotDelta_ = tensor rotDelta_ = tensor
( (
@ -65,4 +58,41 @@ Foam::geomDecomp::geomDecomp
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::geomDecomp::geomDecomp
(
const word& derivedType,
const dictionary& decompDict,
int select
)
:
decompositionMethod(decompDict),
coeffsDict_(findCoeffsDict(derivedType + "Coeffs", select)),
n_(1,1,1),
delta_(0.001),
rotDelta_(I)
{
readCoeffs();
}
Foam::geomDecomp::geomDecomp
(
const word& derivedType,
const dictionary& decompDict,
const word& regionName,
int select
)
:
decompositionMethod(decompDict, regionName),
coeffsDict_(findCoeffsDict(derivedType + "Coeffs", select)),
n_(1,1,1),
delta_(0.001),
rotDelta_(I)
{
readCoeffs();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,7 +25,14 @@ Class
Foam::geomDecomp Foam::geomDecomp
Description Description
Geometrical domain decomposition Base for geometrical domain decomposition methods
Base coefficients:
\table
Property | Description | Required | Default
n | (nx ny nz) | yes
delta | delta for rotation matrix | no | 0.001
\endtable
SourceFiles SourceFiles
geomDecomp.C geomDecomp.C
@ -42,36 +49,56 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class geomDecomp Declaration Class geomDecomp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class geomDecomp class geomDecomp
: :
public decompositionMethod public decompositionMethod
{ {
// Private Member Functions
//- Read input values and initialize the rotDelta_
void readCoeffs();
protected: protected:
// Protected data // Protected data
const dictionary& geomDecomDict_; //- Coefficients for all derived methods
const dictionary& coeffsDict_;
Vector<label> n_; Vector<label> n_;
//- Default = 0.001
scalar delta_; scalar delta_;
tensor rotDelta_; tensor rotDelta_;
public: public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct for derived type name and decomposition dictionary
// and the derived type name
geomDecomp geomDecomp
( (
const dictionary& decompositionDict, const word& derivedType,
const word& derivedType const dictionary& decompDict,
int select = selectionType::DEFAULT
); );
//- Construct for derived type name, decomposition dictionary
//- and region name
geomDecomp
(
const word& derivedType,
const dictionary& decompDict,
const word& regionName,
int select = selectionType::DEFAULT
);
//- Return for every coordinate the wanted processor number. //- Return for every coordinate the wanted processor number.
virtual labelList decompose virtual labelList decompose
( (

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,44 +40,51 @@ namespace Foam
hierarchGeomDecomp, hierarchGeomDecomp,
dictionary dictionary
); );
addToRunTimeSelectionTable
(
decompositionMethod,
hierarchGeomDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::hierarchGeomDecomp::setDecompOrder() void Foam::hierarchGeomDecomp::setDecompOrder()
{ {
const word order(geomDecomDict_.lookup("order")); word order;
if (order.size() != 3) if (coeffsDict_.readIfPresent("order", order))
{ {
FatalIOErrorInFunction if (order.size() != 3)
(
decompositionDict_
) << "number of characters in order (" << order << ") != 3"
<< exit(FatalIOError);
}
for (label i = 0; i < 3; ++i)
{
if (order[i] == 'x')
{
decompOrder_[i] = 0;
}
else if (order[i] == 'y')
{
decompOrder_[i] = 1;
}
else if (order[i] == 'z')
{
decompOrder_[i] = 2;
}
else
{ {
FatalIOErrorInFunction FatalIOErrorInFunction
( (
decompositionDict_ decompositionDict_
) << "Illegal decomposition order " << order << endl ) << "number of characters in order (" << order << ") != 3"
<< "It should only contain x, y or z" << exit(FatalError); << exit(FatalIOError);
}
for (int i = 0; i < 3; ++i)
{
// Change [x-z] -> [0-2]
switch (order[i])
{
case 'x': decompOrder_[i] = 0; break;
case 'y': decompOrder_[i] = 1; break;
case 'z': decompOrder_[i] = 2; break;
default:
FatalIOErrorInFunction
(
decompositionDict_
) << "Illegal decomposition order " << order << nl
<< "It should only contain x, y or z"
<< exit(FatalError);
break;
}
} }
} }
} }
@ -704,7 +711,7 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
label allSize = points.size(); label allSize = points.size();
reduce(allSize, sumOp<label>()); reduce(allSize, sumOp<label>());
const label sizeTol = max(1, label(1e-3*allSize/nProcessors_)); const label sizeTol = max(1, label(1e-3*allSize/nDomains_));
// Sort recursive // Sort recursive
sortComponent sortComponent
@ -745,7 +752,7 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
label allSize = points.size(); label allSize = points.size();
reduce(allSize, sumOp<label>()); reduce(allSize, sumOp<label>());
const label sizeTol = max(1, label(1e-3*allSize/nProcessors_)); const label sizeTol = max(1, label(1e-3*allSize/nDomains_));
// Sort recursive // Sort recursive
sortComponent sortComponent
@ -767,11 +774,24 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
Foam::hierarchGeomDecomp::hierarchGeomDecomp Foam::hierarchGeomDecomp::hierarchGeomDecomp
( (
const dictionary& decompositionDict const dictionary& decompDict
) )
: :
geomDecomp(decompositionDict, typeName), geomDecomp(typeName, decompDict),
decompOrder_() decompOrder_({0,1,2})
{
setDecompOrder();
}
Foam::hierarchGeomDecomp::hierarchGeomDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
geomDecomp(typeName, decompDict, regionName),
decompOrder_({0,1,2})
{ {
setDecompOrder(); setDecompOrder();
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,9 +25,10 @@ Class
Foam::hierarchGeomDecomp Foam::hierarchGeomDecomp
Description Description
Does hierarchical decomposition of points. Works by first sorting the Does hierarchical decomposition of points, selectable as \c hierarchical.
points in x direction into equal sized bins, then in y direction and
finally in z direction. Works by first sorting the points in x direction into equal sized bins,
then in y direction and finally in z direction.
Uses single array to hold decomposition which is indexed as if it is a Uses single array to hold decomposition which is indexed as if it is a
3 dimensional array: 3 dimensional array:
@ -44,6 +45,13 @@ Description
Since the domains are of equal size the maximum difference in size is Since the domains are of equal size the maximum difference in size is
n[0]*n[1] (or n[1]*n[2]?) (small anyway) n[0]*n[1] (or n[1]*n[2]?) (small anyway)
Method coefficients:
\table
Property | Description | Required | Default
n | (nx ny nz) | yes
delta | delta for rotation matrix | no | 0.001
order | order of operation | no | xyz
\endtable
SourceFiles SourceFiles
hierarchGeomDecomp.C hierarchGeomDecomp.C
@ -61,7 +69,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class hierarchGeomDecomp Declaration Class hierarchGeomDecomp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class hierarchGeomDecomp class hierarchGeomDecomp
@ -77,6 +85,7 @@ class hierarchGeomDecomp
// Private Member Functions // Private Member Functions
//- Convert ordering string ("xyz") into list of components. //- Convert ordering string ("xyz") into list of components.
// Checks for bad entries, but no check for duplicate entries.
void setDecompOrder(); void setDecompOrder();
//- Evaluates the weighted sizes for each sorted point. //- Evaluates the weighted sizes for each sorted point.
@ -155,8 +164,8 @@ class hierarchGeomDecomp
); );
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const hierarchGeomDecomp&); void operator=(const hierarchGeomDecomp&) = delete;
hierarchGeomDecomp(const hierarchGeomDecomp&); hierarchGeomDecomp(const hierarchGeomDecomp&) = delete;
public: public:
@ -168,7 +177,14 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
hierarchGeomDecomp(const dictionary& decompositionDict); hierarchGeomDecomp(const dictionary& decompDict);
//- Construct for decomposition dictionary and region name
hierarchGeomDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -21,9 +21,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Decomposition given a cell-to-processor association in a file
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "manualDecomp.H" #include "manualDecomp.H"
@ -43,21 +40,33 @@ namespace Foam
manualDecomp, manualDecomp,
dictionary dictionary
); );
addToRunTimeSelectionTable
(
decompositionMethod,
manualDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::manualDecomp::manualDecomp(const dictionary& decompositionDict) Foam::manualDecomp::manualDecomp(const dictionary& decompDict)
: :
decompositionMethod(decompositionDict), decompositionMethod(decompDict),
decompDataFile_ dataFile_(findCoeffsDict(typeName + "Coeffs").lookup("dataFile"))
( {}
decompositionDict.optionalSubDict
(
word(decompositionDict.lookup("method")) + "Coeffs" Foam::manualDecomp::manualDecomp
).lookup("dataFile") (
) const dictionary& decompDict,
const word& regionName
)
:
decompositionMethod(decompDict, regionName),
dataFile_(findCoeffsDict(typeName + "Coeffs").lookup("dataFile"))
{} {}
@ -74,7 +83,7 @@ Foam::labelList Foam::manualDecomp::decompose
( (
IOobject IOobject
( (
decompDataFile_, dataFile_,
mesh.facesInstance(), mesh.facesInstance(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -93,18 +102,18 @@ Foam::labelList Foam::manualDecomp::decompose
<< finalDecomp.size() << " Number of points: " << finalDecomp.size() << " Number of points: "
<< points.size() << points.size()
<< ".\n" << "Manual decomposition data read from file " << ".\n" << "Manual decomposition data read from file "
<< decompDataFile_ << "." << endl << dataFile_ << "." << endl
<< exit(FatalError); << exit(FatalError);
} }
if (min(finalDecomp) < 0 || max(finalDecomp) > nProcessors_ - 1) if (min(finalDecomp) < 0 || max(finalDecomp) > nDomains_ - 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "According to the decomposition, cells assigned to " << "According to the decomposition, cells assigned to "
<< "impossible processor numbers. Min processor = " << "impossible processor numbers. Min processor = "
<< min(finalDecomp) << " Max processor = " << max(finalDecomp) << min(finalDecomp) << " Max processor = " << max(finalDecomp)
<< ".\n" << "Manual decomposition data read from file " << ".\n" << "Manual decomposition data read from file "
<< decompDataFile_ << "." << endl << dataFile_ << "." << endl
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,13 @@ Class
Foam::manualDecomp Foam::manualDecomp
Description Description
Decomposition given a cell-to-processor association in a file Decompose based on cell-to-processor association in a file
Method coefficients:
\table
Property | Description | Required | Default
dataFile | filename of cell decomposition data | yes |
\endtable
SourceFiles SourceFiles
manualDecomp.C manualDecomp.C
@ -50,14 +56,14 @@ class manualDecomp
{ {
// Private data // Private data
fileName decompDataFile_; fileName dataFile_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const manualDecomp&); void operator=(const manualDecomp&) = delete;
manualDecomp(const manualDecomp&); manualDecomp(const manualDecomp&) = delete;
public: public:
@ -69,7 +75,15 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
manualDecomp(const dictionary& decompositionDict); manualDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
manualDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor
virtual ~manualDecomp() virtual ~manualDecomp()

View File

@ -150,9 +150,28 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::metisLikeDecomp::metisLikeDecomp(const dictionary& decompositionDict) Foam::metisLikeDecomp::metisLikeDecomp
(
const word& derivedType,
const dictionary& decompDict,
int select
)
: :
decompositionMethod(decompositionDict) decompositionMethod(decompDict),
coeffsDict_(findCoeffsDict(derivedType + "Coeffs", select))
{}
Foam::metisLikeDecomp::metisLikeDecomp
(
const word& derivedType,
const dictionary& decompDict,
const word& regionName,
int select
)
:
decompositionMethod(decompDict, regionName),
coeffsDict_(findCoeffsDict(derivedType + "Coeffs", select))
{} {}

View File

@ -60,6 +60,12 @@ class metisLikeDecomp
protected: protected:
// Protected data
//- Coefficients for all derived methods
const dictionary& coeffsDict_;
// Protected Member Functions // Protected Member Functions
//- Serial and/or collect/distribute for parallel operation //- Serial and/or collect/distribute for parallel operation
@ -84,8 +90,29 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct for derived type name and decomposition dictionary.
metisLikeDecomp(const dictionary& decompositionDict); // The default search for the coefficients will return dictionary::null
// on failure. This avoids a name clash of a metis "method" with the
// top level.
metisLikeDecomp
(
const word& derivedType,
const dictionary& decompDict,
int select = selectionType::NULL_DICT
);
//- Construct for derived type name, decomposition dictionary
//- and region name
// The default search for the coefficients will return dictionary::null
// on failure. This avoids a name clash of a metis "method" with the
// top level.
metisLikeDecomp
(
const word& derivedType,
const dictionary& decompDict,
const word& regionName,
int select = selectionType::NULL_DICT
);
//- Destructor //- Destructor

View File

@ -41,11 +41,209 @@ namespace Foam
multiLevelDecomp, multiLevelDecomp,
dictionary dictionary
); );
addToRunTimeSelectionTable
(
decompositionMethod,
multiLevelDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::multiLevelDecomp::createMethodsDict()
{
methodsDict_.clear();
word defaultMethod;
labelList domains;
label nTotal = 0;
label nLevels = 0;
// Found (non-recursive, no patterns) "method" and "domains" ?
// Allow as quick short-cut entry
if
(
// non-recursive, no patterns
coeffsDict_.readIfPresent("method", defaultMethod, false, false)
// non-recursive, no patterns
&& coeffsDict_.readIfPresent("domains", domains, false, false)
)
{
// Short-cut version specified by method, domains only
nTotal = (domains.empty() ? 0 : 1);
for (const label n : domains)
{
nTotal *= n;
++nLevels;
}
if (nTotal == 1)
{
// Emit Warning
nTotal = nDomains();
nLevels = 1;
domains.setSize(1);
domains[0] = nTotal;
}
else if (nTotal > 0 && nTotal < nDomains() && !(nDomains() % nTotal))
{
// nTotal < nDomains, but with an integral factor,
// which we insert as level 0
++nLevels;
labelList old(std::move(domains));
domains.setSize(old.size()+1);
domains[0] = nDomains() / nTotal;
forAll(old, i)
{
domains[i+1] = old[i];
}
nTotal *= domains[0];
Info<<" inferred level0 with " << domains[0]
<< " domains" << nl << nl;
}
if (!nLevels || nTotal != nDomains())
{
FatalErrorInFunction
<< "Top level decomposition specifies " << nDomains()
<< " domains which is not equal to the product of"
<< " all sub domains " << nTotal
<< exit(FatalError);
}
// Create editable methods dictionaries
nLevels = 0;
// Common coeffs dictionary
const dictionary& subMethodCoeffsDict
(
findCoeffsDict
(
coeffsDict_,
defaultMethod + "Coeffs",
selectionType::NULL_DICT
)
);
for (const label n : domains)
{
const word levelName("level" + Foam::name(nLevels++));
entry* dictptr = methodsDict_.set(levelName, dictionary());
dictionary& dict = dictptr->dict();
dict.add("method", defaultMethod);
dict.add("numberOfSubdomains", n);
// Inject coeffs dictionary too
if (subMethodCoeffsDict.size())
{
dict.add(subMethodCoeffsDict.dictName(), subMethodCoeffsDict);
}
}
}
else
{
// Specified by full dictionaries
// Create editable methods dictionaries
// - Only consider sub-dictionaries with a "numberOfSubdomains" entry
// This automatically filters out any coeffs dictionaries
forAllConstIters(coeffsDict_, iter)
{
word methodName;
if
(
iter().isDict()
// non-recursive, no patterns
&& iter().dict().found("numberOfSubdomains", false, false)
)
{
// No method specified? can use a default method?
const bool addDefaultMethod
(
!(iter().dict().found("method", false, false))
&& !defaultMethod.empty()
);
entry* e = methodsDict_.add(iter());
if (addDefaultMethod && e && e->isDict())
{
e->dict().add("method", defaultMethod);
}
}
}
}
}
void Foam::multiLevelDecomp::setMethods()
{
// Assuming methodsDict_ has be properly created, convert the method
// dictionaries to actual methods
label nLevels = 0;
methods_.clear();
methods_.setSize(methodsDict_.size());
forAllConstIters(methodsDict_, iter)
{
// Dictionary entries only
// - these method dictioaries are non-regional
if (iter().isDict())
{
methods_.set
(
nLevels++,
// non-verbose would be nicer
decompositionMethod::New(iter().dict())
);
}
}
methods_.setSize(nLevels);
// Verify that nTotal is correct based on what each method delivers
Info<< nl
<< "Decompose " << type() << " [" << nDomains() << "] in "
<< nLevels << " levels:" << endl;
label nTotal = 1;
forAll(methods_, i)
{
Info<< " level " << i << " : " << methods_[i].type()
<< " [" << methods_[i].nDomains() << "]" << endl;
nTotal *= methods_[i].nDomains();
}
if (nTotal != nDomains())
{
FatalErrorInFunction
<< "Top level decomposition specifies " << nDomains()
<< " domains which is not equal to the product of"
<< " all sub domains " << nTotal
<< exit(FatalError);
}
}
// Given a subset of cells determine the new global indices. The problem // Given a subset of cells determine the new global indices. The problem
// is in the cells from neighbouring processors which need to be renumbered. // is in the cells from neighbouring processors which need to be renumbered.
void Foam::multiLevelDecomp::subsetGlobalCellCells void Foam::multiLevelDecomp::subsetGlobalCellCells
@ -277,7 +475,7 @@ void Foam::multiLevelDecomp::decompose
// Get original level0 dictionary and modify numberOfSubdomains // Get original level0 dictionary and modify numberOfSubdomains
dictionary level0Dict; dictionary level0Dict;
forAllConstIter(dictionary, methodsDict_, iter) forAllConstIters(methodsDict_, iter)
{ {
if (iter().isDict()) if (iter().isDict())
{ {
@ -367,42 +565,45 @@ void Foam::multiLevelDecomp::decompose
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiLevelDecomp::multiLevelDecomp(const dictionary& decompositionDict) Foam::multiLevelDecomp::multiLevelDecomp(const dictionary& decompDict)
: :
decompositionMethod(decompositionDict), decompositionMethod(decompDict),
methodsDict_(decompositionDict_.subDict(typeName + "Coeffs")) coeffsDict_
(
findCoeffsDict
(
typeName + "Coeffs",
(selectionType::EXACT | selectionType::MANDATORY)
)
),
methodsDict_(),
methods_()
{ {
methods_.setSize(methodsDict_.size()); createMethodsDict();
label nLevels = 0; setMethods();
forAllConstIter(dictionary, methodsDict_, iter) }
{
// Ignore primitive entries which may be there for additional control
if (iter().isDict())
{
methods_.set(nLevels++, decompositionMethod::New(iter().dict()));
}
}
methods_.setSize(nLevels);
label nTot = 1; Foam::multiLevelDecomp::multiLevelDecomp
Info<< "decompositionMethod " << type() << " :" << endl; (
forAll(methods_, i) const dictionary& decompDict,
{ const word& regionName
Info<< " level " << i << " decomposing with " << methods_[i].type() )
<< " into " << methods_[i].nDomains() << " subdomains." << endl; :
decompositionMethod(decompDict, regionName),
nTot *= methods_[i].nDomains(); coeffsDict_
} (
findCoeffsDict
if (nTot != nDomains()) (
{ typeName + "Coeffs",
FatalErrorInFunction (selectionType::EXACT | selectionType::MANDATORY)
<< "Top level decomposition specifies " << nDomains() )
<< " domains which is not equal to the product of" ),
<< " all sub domains " << nTot methodsDict_(),
<< exit(FatalError); methods_()
} {
createMethodsDict();
setMethods();
} }
@ -417,6 +618,7 @@ bool Foam::multiLevelDecomp::parallelAware() const
return false; return false;
} }
} }
return true; return true;
} }

View File

@ -25,7 +25,7 @@ Class
Foam::multiLevelDecomp Foam::multiLevelDecomp
Description Description
Decomposition given using consecutive application of decomposers. Decompose given using consecutive application of decomposers.
SourceFiles SourceFiles
multiLevelDecomp.C multiLevelDecomp.C
@ -50,6 +50,10 @@ class multiLevelDecomp
{ {
// Private data // Private data
//- Original coefficients for this method
const dictionary& coeffsDict_;
//- Rewritten dictionary of individual methods
dictionary methodsDict_; dictionary methodsDict_;
PtrList<decompositionMethod> methods_; PtrList<decompositionMethod> methods_;
@ -57,6 +61,13 @@ class multiLevelDecomp
// Private Member Functions // Private Member Functions
//- Fill the methodsDict_
void createMethodsDict();
//- Set methods based on the contents of the methodsDict_
void setMethods();
//- Given connectivity across processors work out connectivity //- Given connectivity across processors work out connectivity
// for a (consistent) subset // for a (consistent) subset
void subsetGlobalCellCells void subsetGlobalCellCells
@ -98,7 +109,14 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
multiLevelDecomp(const dictionary& decompositionDict); multiLevelDecomp(const dictionary& decompDict);
//- Construct given decomposition dictionary and region name
multiLevelDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,14 +39,32 @@ namespace Foam
dictionary, dictionary,
none none
); );
addNamedToRunTimeSelectionTable
(
decompositionMethod,
noDecomp,
dictionaryRegion,
none
);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::noDecomp::noDecomp(const dictionary& decompositionDict) Foam::noDecomp::noDecomp(const dictionary& decompDict)
: :
decompositionMethod(decompositionDict) decompositionMethod(decompDict)
{}
Foam::noDecomp::noDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
decompositionMethod(decompDict, regionName)
{} {}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,9 @@ Class
Foam::noDecomp Foam::noDecomp
Description Description
Dummy decomposition method A dummy decomposition method, selected as \c none.
Method coefficients: \a none
SourceFiles SourceFiles
noDecomp.C noDecomp.C
@ -52,8 +54,8 @@ class noDecomp
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const noDecomp&); void operator=(const noDecomp&) = delete;
noDecomp(const noDecomp&); noDecomp(const noDecomp&) = delete;
public: public:
@ -65,7 +67,15 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
noDecomp(const dictionary& decompositionDict); noDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
noDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor
virtual ~noDecomp() virtual ~noDecomp()
@ -74,15 +84,15 @@ public:
// Member Functions // Member Functions
//- Manual decompose does not care about proc boundaries - is all //- Manual decompose does not care about proc boundaries - it is all
// up to the user. //- up to the user.
virtual bool parallelAware() const virtual bool parallelAware() const
{ {
return true; return true;
} }
//- Return for every coordinate the wanted processor number. Use the //- Return for every coordinate the wanted processor number.
// mesh connectivity (if needed) // Use the mesh connectivity (if needed)
virtual labelList decompose virtual labelList decompose
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -93,8 +103,8 @@ public:
return labelList(cc.size(), Pstream::myProcNo()); return labelList(cc.size(), Pstream::myProcNo());
} }
//- Return for every coordinate the wanted processor number. Explicitly //- Return for every coordinate the wanted processor number.
// provided connectivity - does not use mesh_. // Explicitly provided connectivity - does not use mesh_.
// The connectivity is equal to mesh.cellCells() except for // The connectivity is equal to mesh.cellCells() except for
// - in parallel the cell numbers are global cell numbers (starting // - in parallel the cell numbers are global cell numbers (starting
// from 0 at processor0 and then incrementing all through the // from 0 at processor0 and then incrementing all through the

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,8 +41,16 @@ namespace Foam
simpleGeomDecomp, simpleGeomDecomp,
dictionary dictionary
); );
addToRunTimeSelectionTable
(
decompositionMethod,
simpleGeomDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// assignToProcessorGroup : given nCells cells and nProcGroup processor // assignToProcessorGroup : given nCells cells and nProcGroup processor
@ -297,9 +305,19 @@ Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::simpleGeomDecomp::simpleGeomDecomp(const dictionary& decompositionDict) Foam::simpleGeomDecomp::simpleGeomDecomp(const dictionary& decompDict)
: :
geomDecomp(decompositionDict, typeName) geomDecomp(typeName, decompDict)
{}
Foam::simpleGeomDecomp::simpleGeomDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
geomDecomp(typeName, decompDict, regionName)
{} {}

View File

@ -25,6 +25,14 @@ Class
Foam::simpleGeomDecomp Foam::simpleGeomDecomp
Description Description
Simple geometric decomposition, selectable as \c simple
Method coefficients:
\table
Property | Description | Required | Default
n | (nx ny nz) | yes
delta | delta for rotation matrix | no | 0.001
\endtable
SourceFiles SourceFiles
simpleGeomDecomp.C simpleGeomDecomp.C
@ -40,7 +48,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class simpleGeomDecomp Declaration Class simpleGeomDecomp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class simpleGeomDecomp class simpleGeomDecomp
@ -69,8 +77,8 @@ class simpleGeomDecomp
) const; ) const;
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const simpleGeomDecomp&); void operator=(const simpleGeomDecomp&) = delete;
simpleGeomDecomp(const simpleGeomDecomp&); simpleGeomDecomp(const simpleGeomDecomp&) = delete;
public: public:
@ -81,8 +89,15 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given decomposition dictionary
simpleGeomDecomp(const dictionary& decompositionDict); simpleGeomDecomp(const dictionary& decompDict);
//- Construct given decomposition dictionary and region name
simpleGeomDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -46,10 +46,10 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict) Foam::structuredDecomp::structuredDecomp(const dictionary& decompDict)
: :
decompositionMethod(decompositionDict), decompositionMethod(decompDict),
methodDict_(decompositionDict_.optionalSubDict(typeName + "Coeffs")), methodDict_(findCoeffsDict(typeName + "Coeffs", selectionType::MANDATORY)),
patches_(methodDict_.lookup("patches")) patches_(methodDict_.lookup("patches"))
{ {
methodDict_.set("numberOfSubdomains", nDomains()); methodDict_.set("numberOfSubdomains", nDomains());
@ -76,20 +76,16 @@ Foam::labelList Foam::structuredDecomp::decompose
const labelHashSet patchIDs(pbm.patchSet(patches_)); const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0; label nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
nFaces += pbm[iter.key()].size(); nFaces += pbm[patchi].size();
} }
// Extract a submesh. // Extract a submesh.
labelHashSet patchCells(2*nFaces); labelHashSet patchCells(2*nFaces);
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
const labelUList& fc = pbm[iter.key()].faceCells(); patchCells.insert(pbm[patchi].faceCells());
forAll(fc, i)
{
patchCells.insert(fc[i]);
}
} }
// Subset the layer of cells next to the patch // Subset the layer of cells next to the patch
@ -118,9 +114,9 @@ Foam::labelList Foam::structuredDecomp::decompose
labelList patchFaces(nFaces); labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces); List<topoDistanceData> patchData(nFaces);
nFaces = 0; nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
const polyPatch& pp = pbm[iter.key()]; const polyPatch& pp = pbm[patchi];
const labelUList& fc = pp.faceCells(); const labelUList& fc = pp.faceCells();
forAll(fc, i) forAll(fc, i)
{ {

View File

@ -25,7 +25,7 @@ Class
Foam::structuredDecomp Foam::structuredDecomp
Description Description
Decomposition by walking out decomposition of patch cells mesh. Walk out decomposition of patch cells mesh - selectable as \c structured.
SourceFiles SourceFiles
structuredDecomp.C structuredDecomp.C
@ -41,7 +41,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class structuredDecomp Declaration Class structuredDecomp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class structuredDecomp class structuredDecomp
@ -60,8 +60,8 @@ class structuredDecomp
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const structuredDecomp&); void operator=(const structuredDecomp&) = delete;
structuredDecomp(const structuredDecomp&); structuredDecomp(const structuredDecomp&) = delete;
public: public:
@ -73,7 +73,7 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
structuredDecomp(const dictionary& decompositionDict); structuredDecomp(const dictionary& decompDict);
//- Destructor //- Destructor

View File

@ -38,7 +38,20 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(kahipDecomp, 0); defineTypeNameAndDebug(kahipDecomp, 0);
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary);
addToRunTimeSelectionTable
(
decompositionMethod,
kahipDecomp,
dictionary
);
addToRunTimeSelectionTable
(
decompositionMethod,
kahipDecomp,
dictionaryRegion
);
} }
@ -73,9 +86,6 @@ Foam::label Foam::kahipDecomp::decomposeSerial
int seed = 0; int seed = 0;
bool verbose = false; bool verbose = false;
const dictionary* coeffsDictPtr =
decompositionDict_.subDictPtr("kahipCoeffs");
#if WM_LABEL_SIZE == 64 #if WM_LABEL_SIZE == 64
if (xadj.size()-1 > INT_MAX) if (xadj.size()-1 > INT_MAX)
{ {
@ -120,109 +130,91 @@ Foam::label Foam::kahipDecomp::decomposeSerial
} }
} }
kahipConfig =
configNames.lookupOrDefault("config", coeffsDict_, kahipConfig);
coeffsDict_.readIfPresent("imbalance", imbalance);
coeffsDict_.readIfPresent("verbose", verbose);
Info<< "kahipDecomp :"
<< " config=" << configNames[kahipConfig]
<< " imbalance=" << imbalance;
if (coeffsDict_.readIfPresent("seed", seed))
{
Info<< " seed=" << seed;
}
// Additional sizing parameters (testing only) // Additional sizing parameters (testing only)
std::map<std::string, std::vector<int>> sizingParams; std::map<std::string, std::vector<int>> sizingParams;
// Check for user supplied weights and decomp options List<int> labels;
if (coeffsDictPtr) if
(
coeffsDict_.readIfPresent("hierarchy", labels)
&& !labels.empty()
)
{ {
const dictionary& coeffDict = *coeffsDictPtr; std::vector<int> vec;
vec.reserve(labels.size()+1);
//- Find the key in the dictionary and return the corresponding // Verify sizing
// enumeration element based on its name.
// Return the default value if the key was not found in the dictionary.
// Fatal if the enumerated name was incorrect.
kahipConfig = int n = 1;
configNames.lookupOrDefault("config", coeffDict, kahipConfig); for (auto val : labels)
coeffDict.readIfPresent("imbalance", imbalance);
coeffDict.readIfPresent("verbose", verbose);
Info<< "kahipDecomp :"
<< " config=" << configNames[kahipConfig]
<< " imbalance=" << imbalance;
List<int> labels;
if
(
coeffDict.readIfPresent("hierarchy", labels)
&& !labels.empty()
)
{ {
std::vector<int> vec; n *= val;
vec.reserve(labels.size()+1); vec.push_back(val);
}
// Verify sizing if (n != nDomains_)
{
// Size mismatch. Try to correct.
int n = 1; if (nDomains_ % n)
for (auto val : labels)
{ {
n *= val; WarningInFunction
vec.push_back(val); << "Mismatch in number of processors and "
<< "hierarchy specified" << flatOutput(labels) << endl;
vec.clear();
} }
else
if (n != nProcessors_)
{ {
// Size mismatch. Try to correct. // Evenly divisible, add extra hierarchy level
vec.push_back(nDomains_ / n);
if (nProcessors_ % n)
{
WarningInFunction
<< "Mismatch in number of processors and "
<< "hierarchy specified" << flatOutput(labels) << endl;
vec.clear();
}
else
{
// Evenly divisible, add extra hierarchy level
vec.push_back(nProcessors_ / n);
}
}
if (!vec.empty())
{
sizingParams["hierarchy"] = std::move(vec);
Info<< " hierarchy=" << flatOutput(labels);
} }
} }
if if (!vec.empty())
(
coeffDict.readIfPresent("distance", labels)
&& !labels.empty()
)
{ {
std::vector<int> vec(labels.size()); sizingParams["hierarchy"] = std::move(vec);
Info<< " hierarchy=" << flatOutput(labels);
forAll(labels, i)
{
vec[i] = labels[i];
}
sizingParams["distance"] = std::move(vec);
Info<< " distance=" << flatOutput(labels);
} }
if (coeffDict.readIfPresent("seed", seed))
{
Info<< " seed=" << seed;
}
Info<< endl;
} }
else
if
(
coeffsDict_.readIfPresent("distance", labels)
&& !labels.empty()
)
{ {
Info<< "kahipDecomp :" std::vector<int> vec(labels.size());
<< " config=" << configNames[kahipConfig]
<< " imbalance=" << imbalance << endl; forAll(labels, i)
{
vec[i] = labels[i];
}
sizingParams["distance"] = std::move(vec);
Info<< " distance=" << flatOutput(labels);
} }
Info<< endl;
// Number of partitions // Number of partitions
int nParts = nProcessors_; int nParts = nDomains_;
// Output: number of cut edges // Output: number of cut edges
int edgeCut = 0; int edgeCut = 0;
@ -322,9 +314,19 @@ Foam::label Foam::kahipDecomp::decomposeSerial
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kahipDecomp::kahipDecomp(const dictionary& decompositionDict) Foam::kahipDecomp::kahipDecomp(const dictionary& decompDict)
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp(typeName, decompDict, selectionType::NULL_DICT)
{}
Foam::kahipDecomp::kahipDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp(typeName, decompDict, regionName, selectionType::NULL_DICT)
{} {}

View File

@ -31,6 +31,8 @@ Description
When run in parallel will collect the entire graph on to the master, When run in parallel will collect the entire graph on to the master,
decompose and send back. decompose and send back.
Coefficients dictionary: \a kahipCoeffs, \a coeffs.
\verbatim \verbatim
numberOfSubdomains N; numberOfSubdomains N;
method kahip; method kahip;
@ -42,12 +44,12 @@ Description
} }
\endverbatim \endverbatim
Where the coefficients dictionary is optional, as are all its entries: Method coefficients:
\table \table
Property | Description | Default value Property | Description | Required | Default
config | fast / eco / strong | fast config | fast / eco / strong | no | fast
imbalance | imbalance on cells between domains | 0.01 imbalance | imbalance on cells between domains | no | 0.01
seed | initial value for random number generator | 0 seed | initial value for random number generator | no | 0
\endtable \endtable
SourceFiles SourceFiles
@ -114,7 +116,14 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
kahipDecomp(const dictionary& decompositionDict); kahipDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
kahipDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,7 +39,20 @@ extern "C"
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(metisDecomp, 0); defineTypeNameAndDebug(metisDecomp, 0);
addToRunTimeSelectionTable(decompositionMethod, metisDecomp, dictionary);
addToRunTimeSelectionTable
(
decompositionMethod,
metisDecomp,
dictionary
);
addToRunTimeSelectionTable
(
decompositionMethod,
metisDecomp,
dictionaryRegion
);
} }
@ -148,19 +161,19 @@ Foam::label Foam::metisDecomp::decomposeSerial
{ {
processorWeights /= sum(processorWeights); processorWeights /= sum(processorWeights);
if (processorWeights.size() != nProcessors_) if (processorWeights.size() != nDomains_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Number of processor weights " << "Number of processor weights "
<< processorWeights.size() << processorWeights.size()
<< " does not equal number of domains " << nProcessors_ << " does not equal number of domains " << nDomains_
<< exit(FatalError); << exit(FatalError);
} }
} }
} }
label ncon = 1; label ncon = 1;
label nProcs = nProcessors_; label nProcs = nDomains_;
// Output: cell -> processor addressing // Output: cell -> processor addressing
decomp.setSize(numCells); decomp.setSize(numCells);
@ -213,9 +226,19 @@ Foam::label Foam::metisDecomp::decomposeSerial
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::metisDecomp::metisDecomp(const dictionary& decompositionDict) Foam::metisDecomp::metisDecomp(const dictionary& decompDict)
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp(typeName, decompDict, selectionType::NULL_DICT)
{}
Foam::metisDecomp::metisDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp(typeName, decompDict, regionName, selectionType::NULL_DICT)
{} {}

View File

@ -30,24 +30,26 @@ Description
When run in parallel will collect the entire graph on to the master, When run in parallel will collect the entire graph on to the master,
decompose and send back. decompose and send back.
Coefficients dictionary: \a metisCoeffs, \a coeffs.
\verbatim \verbatim
numberOfSubdomains N; numberOfSubdomains N;
method metis; method metis;
metisCoeffs metisCoeffs
{ {
method recursive; // k-way method recursive; // k-way
options ( ...); options ( ...);
processorWeights ( ... ); processorWeights ( ... );
} }
\endverbatim \endverbatim
Where the coefficients dictionary is optional, as are all its entries: Method coefficients:
\table \table
Property | Description | Default value Property | Description | Required | Default
method | recursive / k-way | recursive method | recursive / k-way | no | recursive
options | metis options | options | metis options | no
processorWeights | list of weighting per partition | processorWeights | list of weighting per partition | no
\endtable \endtable
SourceFiles SourceFiles
@ -97,7 +99,14 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary //- Construct given the decomposition dictionary
metisDecomp(const dictionary& decompositionDict); metisDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
metisDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -228,7 +228,20 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(ptscotchDecomp, 0); defineTypeNameAndDebug(ptscotchDecomp, 0);
addToRunTimeSelectionTable(decompositionMethod, ptscotchDecomp, dictionary);
addToRunTimeSelectionTable
(
decompositionMethod,
ptscotchDecomp,
dictionary
);
addToRunTimeSelectionTable
(
decompositionMethod,
ptscotchDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -478,56 +491,50 @@ Foam::label Foam::ptscotchDecomp::decompose
} }
// Dump graph // Dump graph
if (decompositionDict_.found("scotchCoeffs")) if (coeffsDict_.lookupOrDefault("writeGraph", false))
{ {
const dictionary& scotchCoeffs = OFstream str
decompositionDict_.subDict("scotchCoeffs"); (
graphPath_ + "_" + Foam::name(Pstream::myProcNo()) + ".dgr"
);
if (scotchCoeffs.lookupOrDefault("writeGraph", false)) Pout<< "Dumping Scotch graph file to " << str.name() << endl
<< "Use this in combination with dgpart." << endl;
globalIndex globalCells(xadjSize-1);
// Distributed graph file (.grf)
const label version = 2;
str << version << nl;
// Number of files (procglbnbr)
str << Pstream::nProcs();
// My file number (procloc)
str << ' ' << Pstream::myProcNo() << nl;
// Total number of vertices (vertglbnbr)
str << globalCells.size();
// Total number of connections (edgeglbnbr)
str << ' ' << returnReduce(xadj[xadjSize-1], sumOp<label>()) << nl;
// Local number of vertices (vertlocnbr)
str << xadjSize-1;
// Local number of connections (edgelocnbr)
str << ' ' << xadj[xadjSize-1] << nl;
// Numbering starts from 0
label baseval = 0;
// 100*hasVertlabels+10*hasEdgeWeights+1*hasVertWeighs
str << baseval << ' ' << "000" << nl;
for (label celli = 0; celli < xadjSize-1; celli++)
{ {
OFstream str const label start = xadj[celli];
( const label end = xadj[celli+1];
graphPath_ + "_" + Foam::name(Pstream::myProcNo()) + ".dgr"
);
Pout<< "Dumping Scotch graph file to " << str.name() << endl str << end-start; // size
<< "Use this in combination with dgpart." << endl;
globalIndex globalCells(xadjSize-1); for (label i = start; i < end; i++)
// Distributed graph file (.grf)
label version = 2;
str << version << nl;
// Number of files (procglbnbr)
str << Pstream::nProcs();
// My file number (procloc)
str << ' ' << Pstream::myProcNo() << nl;
// Total number of vertices (vertglbnbr)
str << globalCells.size();
// Total number of connections (edgeglbnbr)
str << ' ' << returnReduce(xadj[xadjSize-1], sumOp<label>())
<< nl;
// Local number of vertices (vertlocnbr)
str << xadjSize-1;
// Local number of connections (edgelocnbr)
str << ' ' << xadj[xadjSize-1] << nl;
// Numbering starts from 0
label baseval = 0;
// 100*hasVertlabels+10*hasEdgeWeights+1*hasVertWeighs
str << baseval << ' ' << "000" << nl;
for (label celli = 0; celli < xadjSize-1; celli++)
{ {
label start = xadj[celli]; str << ' ' << adjncy[i];
label end = xadj[celli+1];
str << end-start;
for (label i = start; i < end; i++)
{
str << ' ' << adjncy[i];
}
str << nl;
} }
str << nl;
} }
} }
@ -538,27 +545,19 @@ Foam::label Foam::ptscotchDecomp::decompose
SCOTCH_Strat stradat; SCOTCH_Strat stradat;
check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit"); check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit");
if (decompositionDict_.found("scotchCoeffs")) string strategy;
if (coeffsDict_.readIfPresent("strategy", strategy))
{ {
const dictionary& scotchCoeffs = if (debug)
decompositionDict_.subDict("scotchCoeffs");
string strategy;
if (scotchCoeffs.readIfPresent("strategy", strategy))
{ {
if (debug) Info<< "ptscotchDecomp : Using strategy " << strategy << endl;
{
Info<< "ptscotchDecomp : Using strategy " << strategy << endl;
}
SCOTCH_stratDgraphMap(&stradat, strategy.c_str());
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
} }
SCOTCH_stratDgraphMap(&stradat, strategy.c_str());
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
} }
// Graph // Graph
// ~~~~~ // ~~~~~
@ -632,7 +631,6 @@ Foam::label Foam::ptscotchDecomp::decompose
} }
if (debug) if (debug)
{ {
Pout<< "SCOTCH_dgraphInit" << endl; Pout<< "SCOTCH_dgraphInit" << endl;
@ -697,14 +695,11 @@ Foam::label Foam::ptscotchDecomp::decompose
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit"); check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
List<label> processorWeights; List<label> processorWeights;
if (decompositionDict_.found("scotchCoeffs")) if
{ (
const dictionary& scotchCoeffs = coeffsDict_.readIfPresent("processorWeights", processorWeights)
decompositionDict_.subDict("scotchCoeffs"); && processorWeights.size()
)
scotchCoeffs.readIfPresent("processorWeights", processorWeights);
}
if (processorWeights.size())
{ {
if (debug) if (debug)
{ {
@ -716,7 +711,7 @@ Foam::label Foam::ptscotchDecomp::decompose
( (
SCOTCH_archCmpltw SCOTCH_archCmpltw
( (
&archdat, nProcessors_, processorWeights.begin() &archdat, nDomains_, processorWeights.begin()
), ),
"SCOTCH_archCmpltw" "SCOTCH_archCmpltw"
); );
@ -729,7 +724,7 @@ Foam::label Foam::ptscotchDecomp::decompose
} }
check check
( (
SCOTCH_archCmplt(&archdat, nProcessors_), SCOTCH_archCmplt(&archdat, nDomains_),
"SCOTCH_archCmplt" "SCOTCH_archCmplt"
); );
} }
@ -778,7 +773,7 @@ Foam::label Foam::ptscotchDecomp::decompose
// SCOTCH_dgraphPart // SCOTCH_dgraphPart
// ( // (
// &grafdat, // &grafdat,
// nProcessors_, // partnbr // nDomains_, // partnbr
// &stradat, // const SCOTCH_Strat * // &stradat, // const SCOTCH_Strat *
// finalDecomp.begin() // parttab // finalDecomp.begin() // parttab
// ), // ),
@ -802,9 +797,21 @@ Foam::label Foam::ptscotchDecomp::decompose
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ptscotchDecomp::ptscotchDecomp(const dictionary& decompositionDict) Foam::ptscotchDecomp::ptscotchDecomp(const dictionary& decompDict)
: :
decompositionMethod(decompositionDict) decompositionMethod(decompDict),
coeffsDict_(findCoeffsDict("scotchCoeffs", selectionType::NULL_DICT))
{}
Foam::ptscotchDecomp::ptscotchDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
decompositionMethod(decompDict, regionName),
coeffsDict_(findCoeffsDict("scotchCoeffs", selectionType::NULL_DICT))
{} {}

View File

@ -26,8 +26,11 @@ Class
Description Description
PTScotch domain decomposition. PTScotch domain decomposition.
For the main details about how to define the strategies, see scotchDecomp. For the main details about how to define the strategies, see scotchDecomp.
Coefficients dictionary: \a scotchCoeffs, \a coeffs.
Nonetheless, when decomposing in parallel, using <tt>writeGraph=true</tt> Nonetheless, when decomposing in parallel, using <tt>writeGraph=true</tt>
will write out \c .dgr files for debugging. For example, use these files will write out \c .dgr files for debugging. For example, use these files
with \c dgpart as follows: with \c dgpart as follows:
@ -57,7 +60,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class ptscotchDecomp Declaration Class ptscotchDecomp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class ptscotchDecomp class ptscotchDecomp
@ -66,6 +69,9 @@ class ptscotchDecomp
{ {
// Private data // Private data
//- Original coefficients for this method
dictionary coeffsDict_;
//- Output path and name for optional grf file. //- Output path and name for optional grf file.
fileName graphPath_; fileName graphPath_;
@ -111,8 +117,12 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary and mesh //- Construct given the decomposition dictionary
ptscotchDecomp(const dictionary& decompositionDict); ptscotchDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
ptscotchDecomp(const dictionary& decompDict, const word& regionName);
//- Destructor //- Destructor

View File

@ -155,6 +155,13 @@ namespace Foam
scotchDecomp, scotchDecomp,
dictionary dictionary
); );
addToRunTimeSelectionTable
(
decompositionMethod,
scotchDecomp,
dictionaryRegion
);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -184,11 +191,8 @@ Foam::label Foam::scotchDecomp::decomposeSerial
List<label>& decomp List<label>& decomp
) )
{ {
const dictionary* coeffsDictPtr =
decompositionDict_.subDictPtr("scotchCoeffs");
// Dump graph // Dump graph
if (coeffsDictPtr && coeffsDictPtr->lookupOrDefault("writeGraph", false)) if (coeffsDict_.lookupOrDefault("writeGraph", false))
{ {
OFstream str(graphPath_); OFstream str(graphPath_);
@ -230,20 +234,17 @@ Foam::label Foam::scotchDecomp::decomposeSerial
SCOTCH_Strat stradat; SCOTCH_Strat stradat;
check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit"); check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit");
if (coeffsDictPtr) string strategy;
if (coeffsDict_.readIfPresent("strategy", strategy))
{ {
string strategy; if (debug)
if (coeffsDictPtr->readIfPresent("strategy", strategy))
{ {
if (debug) Info<< "scotchDecomp : Using strategy " << strategy << endl;
{
Info<< "scotchDecomp : Using strategy " << strategy << endl;
}
SCOTCH_stratGraphMap(&stradat, strategy.c_str());
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
} }
SCOTCH_stratGraphMap(&stradat, strategy.c_str());
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
} }
@ -330,8 +331,7 @@ Foam::label Foam::scotchDecomp::decomposeSerial
List<label> processorWeights; List<label> processorWeights;
if if
( (
coeffsDictPtr coeffsDict_.readIfPresent("processorWeights", processorWeights)
&& coeffsDictPtr->readIfPresent("processorWeights", processorWeights)
&& processorWeights.size() && processorWeights.size()
) )
{ {
@ -344,7 +344,7 @@ Foam::label Foam::scotchDecomp::decomposeSerial
( (
SCOTCH_archCmpltw SCOTCH_archCmpltw
( (
&archdat, nProcessors_, processorWeights.begin() &archdat, nDomains_, processorWeights.begin()
), ),
"SCOTCH_archCmpltw" "SCOTCH_archCmpltw"
); );
@ -353,7 +353,7 @@ Foam::label Foam::scotchDecomp::decomposeSerial
{ {
check check
( (
SCOTCH_archCmplt(&archdat, nProcessors_), SCOTCH_archCmplt(&archdat, nDomains_),
"SCOTCH_archCmplt" "SCOTCH_archCmplt"
); );
@ -433,7 +433,7 @@ Foam::label Foam::scotchDecomp::decomposeSerial
// SCOTCH_graphPart // SCOTCH_graphPart
// ( // (
// &grafdat, // &grafdat,
// nProcessors_, // partnbr // nDomains_, // partnbr
// &stradat, // const SCOTCH_Strat * // &stradat, // const SCOTCH_Strat *
// decomp.begin() // parttab // decomp.begin() // parttab
// ), // ),
@ -453,9 +453,19 @@ Foam::label Foam::scotchDecomp::decomposeSerial
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::scotchDecomp::scotchDecomp(const dictionary& decompositionDict) Foam::scotchDecomp::scotchDecomp(const dictionary& decompDict)
: :
metisLikeDecomp(decompositionDict) metisLikeDecomp(typeName, decompDict, selectionType::NULL_DICT)
{}
Foam::scotchDecomp::scotchDecomp
(
const dictionary& decompDict,
const word& regionName
)
:
metisLikeDecomp(typeName, decompDict, regionName, selectionType::NULL_DICT)
{} {}

View File

@ -26,10 +26,13 @@ Class
Description Description
Scotch domain decomposition. Scotch domain decomposition.
When run in parallel will collect the whole graph on to the master, When run in parallel will collect the whole graph on to the master,
decompose and send back. Use ptscotchDecomp for proper distributed decompose and send back. Use ptscotchDecomp for proper distributed
decomposition. decomposition.
Coefficients dictionary: \a scotchCoeffs, \a coeffs.
Quoting from the Scotch forum, on the 2008-08-22 10:09, Francois Quoting from the Scotch forum, on the 2008-08-22 10:09, Francois
PELLEGRINI posted the following details: PELLEGRINI posted the following details:
\verbatim \verbatim
@ -262,8 +265,15 @@ public:
// Constructors // Constructors
//- Construct given the decomposition dictionary and mesh //- Construct given the decomposition dictionary
scotchDecomp(const dictionary& decompositionDict); scotchDecomp(const dictionary& decompDict);
//- Construct given the decomposition dictionary and region name
scotchDecomp
(
const dictionary& decompDict,
const word& regionName
);
//- Destructor //- Destructor

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,22 +18,12 @@ numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (4 1 1); n (4 1 1);
delta 0.001; //delta 0.001; // default=0.001
} //order xyz; // default=xzy
dataFile "";
hierarchicalCoeffs
{
n (4 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
} }
distributed no; distributed no;

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 2;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n (2 1 1); n (2 1 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,31 +10,20 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
} //order xyz; // default=xzy
dataFile "decompositionData";
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData";
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 6;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n ( 6 1 1 ); n (6 1 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
preservePatches (cyclic0 cyclic1 ami0 ami1); preservePatches (cyclic0 cyclic1 ami0 ami1);

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,4 @@ numberOfSubdomains 8;
method scotch; method scotch;
simpleCoeffs
{
n ( 4 1 4 );
delta 0.001;
}
hierarchicalCoeffs
{
n ( 1 2 2 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
}
metisCoeffs
{
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -26,27 +25,9 @@ structuredCoeffs
simpleCoeffs simpleCoeffs
{ {
n ( 5 1 4 ); n (5 1 4);
delta 0.001; delta 0.001;
} }
} }
hierarchicalCoeffs
{
n ( 1 2 2 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
}
metisCoeffs
{
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,26 +18,12 @@ numberOfSubdomains 6;
method simple; method simple;
simpleCoeffs coeffs
{
n (1 3 2);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 2 2);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
}
scotchCoeffs
{ {
n (1 3 2);
//delta 0.001; // default=0.001
//order xyz; // default=xzy
dataFile "cellDecomposition";
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,14 +10,12 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 6; numberOfSubdomains 6;
method structured; method structured;
structuredCoeffs structuredCoeffs
@ -33,21 +31,12 @@ structuredCoeffs
} }
} }
coeffs
hierarchicalCoeffs
{
n (1 2 2);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
}
metisCoeffs
{ {
n (1 2 3);
//delta 0.001; // default=0.001
//order xyz; // default=xzy
dataFile "cellDecomposition";
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,22 +18,11 @@ numberOfSubdomains 4;
method hierarchical; method hierarchical;
simpleCoeffs coeffs
{ n (1 2 2);
n (1 2 2); //delta 0.001; // default=0.001
delta 0.001; //order xyz; // default=xzy
} dataFile "cellDecomposition";
hierarchicalCoeffs
{
n (1 2 2);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
} }

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,12 @@ numberOfSubdomains 6;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (1 1 6); n (1 1 6);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
dataFile "";
} }
hierarchicalCoeffs
{
n ( 1 1 1 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 4;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus | | \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 4;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 4;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,13 @@ numberOfSubdomains 8;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (8 1 1); n (8 1 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
dataFile "";
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 3;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n (3 1 1); n (3 1 1);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,13 +31,4 @@ hierarchicalCoeffs
order xyz; order xyz;
} }
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,11 +18,11 @@ numberOfSubdomains 8;
method hierarchical; method hierarchical;
hierarchicalCoeffs coeffs
{ {
n ( 2 2 2 ); n (2 2 2);
delta 0.001; //delta 0.001; // default=0.001
order xyz; //order xyz; // default=xzy
} }
preservePatches (); preservePatches ();

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -32,14 +31,4 @@ hierarchicalCoeffs
order xyz; order xyz;
} }
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -32,14 +31,4 @@ hierarchicalCoeffs
order xyz; order xyz;
} }
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,18 +18,11 @@ numberOfSubdomains 6;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (3 2 1); n (3 2 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (3 2 1);
delta 0.001;
order xyz;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,12 @@ numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (1 2 2); n (1 2 2);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,12 @@ numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (1 2 2); n (1 2 2);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,11 @@ numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,27 +18,11 @@ numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* // // ************************************************************************* //

View File

@ -15,34 +15,15 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2; numberOfSubdomains 2;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (2 1 1); n (2 1 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* // // ************************************************************************* //

View File

@ -15,34 +15,16 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
method simple; method simple;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* // // ************************************************************************* //

View File

@ -15,34 +15,15 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
method scotch; method scotch;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
//order xyz; // default=xzy
} }
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,23 +18,13 @@ numberOfSubdomains 2;
method scotch; method scotch;
simpleCoeffs //coeffs
{ //{
n (4 1 1); // n (3 2 1);
delta 0.001; // delta 0.001;
} // order xyz;
// dataFile "cellDecomposition";
hierarchicalCoeffs //}
{
n (3 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "cellDecomposition";
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,72 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -10,11 +10,8 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
@ -27,34 +24,12 @@ method scotch;
// method simple; // method simple;
// method manual; // method manual;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
} //order xyz; // default=xzy
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData"; dataFile "decompositionData";
} }
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -1,72 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -10,38 +10,24 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
method scotch; method scotch;
coeffs
simpleCoeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
} //order xyz; // default=xzy
dataFile "decompositionData";
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
} }
scotchCoeffs scotchCoeffs
{ {
} }
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -0,0 +1,26 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
runApplication blockMesh
runApplication topoSet
runApplication splitMeshRegions -cellZones -overwrite
# Remove fluid fields from solid regions (important for post-processing)
for i in heater leftSolid rightSolid
do
rm -f 0*/$i/{nut,alphat,epsilon,k,U,p_rgh}
done
for i in bottomWater topAir heater leftSolid rightSolid
do
runApplication -s $i changeDictionary -region $i
done
echo
echo "Creating files for paraview post-processing"
echo
paraFoam -touchAll
#------------------------------------------------------------------------------

View File

@ -2,22 +2,7 @@
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
runApplication blockMesh runApplication ./Allmesh
runApplication topoSet
runApplication splitMeshRegions -cellZones -overwrite
# remove fluid fields from solid regions (important for post-processing)
for i in heater leftSolid rightSolid
do
rm -f 0*/$i/{nut,alphat,epsilon,k,U,p_rgh}
done
for i in bottomWater topAir heater leftSolid rightSolid
do
runApplication -s $i changeDictionary -region $i
done
#-- Run on single processor #-- Run on single processor
#runApplication $(getApplication) #runApplication $(getApplication)
@ -31,10 +16,4 @@ runParallel $(getApplication)
# Reconstruct # Reconstruct
runApplication reconstructPar -allRegions runApplication reconstructPar -allRegions
echo
echo "creating files for paraview post-processing"
echo
paraFoam -touchAll
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,2 +1,6 @@
The 0/ field files contain nonsense patchFields. All interesting - The 0/ field files contain nonsense patchFields.
work is done using the changeDictionaryDicts. All interesting work is done using the changeDictionaryDicts.
- The uses region-specific decomposition for the heater.
This can be useful when the solid region is relatively small and a
normal decomposition would result in very few cells per process.

View File

@ -1,72 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -10,11 +10,8 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
@ -23,38 +20,29 @@ numberOfSubdomains 4;
// preserveFaceZones (heater solid1 solid3); // preserveFaceZones (heater solid1 solid3);
method scotch; method scotch;
// method hierarchical; // method hierarchical;
// method simple; // method simple;
// method manual; // method manual;
simpleCoeffs regions
{ {
n (2 2 1); heater
delta 0.001; {
numberOfSubdomains 1;
method none;
coeffs
{
n (1 1 1);
delta 0.001;
}
}
} }
hierarchicalCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001;
order xyz;
} }
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -1,72 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../decomposeParDict

View File

@ -10,11 +10,8 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict; object decomposeParDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4; numberOfSubdomains 4;
@ -27,17 +24,12 @@ method scotch;
// method simple; // method simple;
// method manual; // method manual;
simpleCoeffs coeffs
{ {
n (2 2 1); n (2 2 1);
delta 0.001; //delta 0.001; // default=0.001
} //order xyz; // default=xzy
dataFile "decompositionData";
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
} }
scotchCoeffs scotchCoeffs
@ -53,20 +45,4 @@ scotchCoeffs
//strategy "b"; //strategy "b";
} }
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* // // ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More