decomposePar, reconstructPar: Renamed cellDist to cellProc

The cellProc field is the field of cell-processor labels.

The names "distribution" and "dist" have been removed as these are
ambiguous in relation to other forms of distribution and to distance.
This commit is contained in:
Will Bainbridge
2022-07-20 15:36:31 +01:00
parent 52f262859a
commit dafe3fa004
12 changed files with 55 additions and 60 deletions

View File

@ -59,32 +59,29 @@ Description
using namespace Foam; using namespace Foam;
// Create named field from labelList for postprocessing void writeCellLabels
tmp<volScalarField> createScalarField
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& name, const word& name,
const labelList& elems const labelList& elems
) )
{ {
tmp<volScalarField> tfld volScalarField::Internal fld
( (
volScalarField::New IOobject
( (
name, name,
mesh.time().timeName(),
mesh, mesh,
dimensionedScalar(dimless, 0), IOobject::NO_READ,
zeroGradientFvPatchScalarField::typeName IOobject::AUTO_WRITE
) ),
mesh,
dimless,
scalarField(scalarList(elems))
); );
volScalarField& fld = tfld.ref();
forAll(fld, celli) fld.write();
{
fld[celli] = elems[celli];
}
return tfld;
} }
@ -850,18 +847,16 @@ int main(int argc, char *argv[])
UPstream::parRun() = oldParRun; UPstream::parRun() = oldParRun;
// For debugging: write out region // For debugging: write out region
createScalarField writeCellLabels
( (
mesh, mesh,
"cellDist", "cellProc",
cellToRegion cellToRegion
)().write(); );
Info<< nl << "Written decomposition as volScalarField::Internal to "
Info<< nl << "Written decomposition as volScalarField to " << "cellProc for use in postprocessing."
<< "cellDist for use in postprocessing."
<< nl << endl; << nl << endl;
cellOrder = regionRenumber(renumberPtr(), mesh, cellToRegion); cellOrder = regionRenumber(renumberPtr(), mesh, cellToRegion);
// Determine new to old face order with new cell numbering // Determine new to old face order with new cell numbering
@ -1237,19 +1232,19 @@ int main(int argc, char *argv[])
if (writeMaps) if (writeMaps)
{ {
// For debugging: write out region // For debugging: write out region
createScalarField writeCellLabels
( (
mesh, mesh,
"origCellID", "origCellID",
map().cellMap() map().cellMap()
)().write(); );
createScalarField writeCellLabels
( (
mesh, mesh,
"cellID", "cellID",
identity(mesh.nCells()) identity(mesh.nCells())
)().write(); );
Info<< nl << "Written current cellID and origCellID as volScalarField" Info<< nl << "Written current cellID and origCellID as volScalarField"
<< " for use in postprocessing." << " for use in postprocessing."

View File

@ -32,9 +32,9 @@ Usage
\b decomposePar [OPTION] \b decomposePar [OPTION]
Options: Options:
- \par -cellDist - \par -cellProc
Write the cell distribution as a labelList, for use with 'manual' Write cell processor indices as a volScalarField::Internal for
decomposition method or as a volScalarField for post-processing. post-processing.
- \par -region \<regionName\> \n - \par -region \<regionName\> \n
Decompose named region. Does not check for existence of processor*. Decompose named region. Does not check for existence of processor*.
@ -164,7 +164,7 @@ void decomposeUniform
void writeDecomposition(const domainDecomposition& meshes) void writeDecomposition(const domainDecomposition& meshes)
{ {
// Write as volScalarField for postprocessing. // Write as volScalarField::Internal for postprocessing.
volScalarField::Internal cellProc volScalarField::Internal cellProc
( (
IOobject IOobject
@ -182,7 +182,7 @@ void writeDecomposition(const domainDecomposition& meshes)
cellProc.write(); cellProc.write();
Info<< "Wrote decomposition as volScalarField to " Info<< "Wrote decomposition as volScalarField::Internal to "
<< cellProc.name() << " for use in postprocessing." << cellProc.name() << " for use in postprocessing."
<< nl << endl; << nl << endl;
} }
@ -206,9 +206,9 @@ int main(int argc, char *argv[])
#include "addAllRegionsOption.H" #include "addAllRegionsOption.H"
argList::addBoolOption argList::addBoolOption
( (
"cellDist", "cellProc",
"write cell distribution as a labelList - for use with 'manual' " "write cell processor indices as a volScalarField::Internal for "
"decomposition method or as a volScalarField for post-processing." "post-processing."
); );
argList::addBoolOption argList::addBoolOption
( (
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
bool region = args.optionFound("region"); bool region = args.optionFound("region");
bool writeCellDist = args.optionFound("cellDist"); bool writeCellProc = args.optionFound("cellProc");
bool copyZero = args.optionFound("copyZero"); bool copyZero = args.optionFound("copyZero");
bool copyUniform = args.optionFound("copyUniform"); bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly = args.optionFound("fields"); bool decomposeFieldsOnly = args.optionFound("fields");
@ -396,7 +396,7 @@ int main(int argc, char *argv[])
domainDecomposition meshes(runTimes, regionName); domainDecomposition meshes(runTimes, regionName);
if (!decomposeFieldsOnly || !copyZero) if (!decomposeFieldsOnly || !copyZero)
{ {
if (meshes.readDecompose(decomposeSets) && writeCellDist) if (meshes.readDecompose(decomposeSets) && writeCellProc)
{ {
writeDecomposition(meshes); writeDecomposition(meshes);
fileHandler().flush(); fileHandler().flush();
@ -445,7 +445,7 @@ int main(int argc, char *argv[])
// Write the decomposition, if necessary // Write the decomposition, if necessary
if if
( (
writeCellDist writeCellProc
&& meshes.completeMesh().facesInstance() && meshes.completeMesh().facesInstance()
== runTimes.completeTime().timeName() == runTimes.completeTime().timeName()
) )

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,11 +41,11 @@ void Foam::readFields
// Search list of objects for fields of type GeomField // Search list of objects for fields of type GeomField
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Remove the cellDist field // Remove the cellProc field
IOobjectList::iterator celDistIter = fieldObjects.find("cellDist"); IOobjectList::iterator cellProcIter = fieldObjects.find("cellProc");
if (celDistIter != fieldObjects.end()) if (cellProcIter != fieldObjects.end())
{ {
fieldObjects.erase(celDistIter); fieldObjects.erase(cellProcIter);
} }
// Get sorted set of names (different processors might read objects in // Get sorted set of names (different processors might read objects in

View File

@ -66,7 +66,7 @@ bool haveAllTimes
void writeDecomposition(const domainDecomposition& meshes) void writeDecomposition(const domainDecomposition& meshes)
{ {
// Write as volScalarField for postprocessing. // Write as volScalarField::Internal for postprocessing.
volScalarField::Internal cellProc volScalarField::Internal cellProc
( (
IOobject IOobject
@ -84,7 +84,7 @@ void writeDecomposition(const domainDecomposition& meshes)
cellProc.write(); cellProc.write();
Info<< "Wrote decomposition as volScalarField to " Info<< "Wrote decomposition as volScalarField::Internal to "
<< cellProc.name() << " for use in postprocessing." << cellProc.name() << " for use in postprocessing."
<< nl << endl; << nl << endl;
} }
@ -110,9 +110,9 @@ int main(int argc, char *argv[])
#include "addAllRegionsOption.H" #include "addAllRegionsOption.H"
argList::addBoolOption argList::addBoolOption
( (
"cellDist", "cellProc",
"write cell distribution as a labelList - for use with 'manual' " "write cell processor indices as a volScalarField::Internal for "
"decomposition method or as a volScalarField for post-processing." "post-processing."
); );
argList::addOption argList::addOption
( (
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
const bool writeCellDist = args.optionFound("cellDist"); const bool writeCellProc = args.optionFound("cellProc");
HashSet<word> selectedFields; HashSet<word> selectedFields;
if (args.optionFound("fields")) if (args.optionFound("fields"))
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
// Create meshes // Create meshes
Info<< "\n\nReconstructing mesh " << regionName << nl << endl; Info<< "\n\nReconstructing mesh " << regionName << nl << endl;
domainDecomposition meshes(runTimes, regionName); domainDecomposition meshes(runTimes, regionName);
if (meshes.readReconstruct(!noReconstructSets) && writeCellDist) if (meshes.readReconstruct(!noReconstructSets) && writeCellProc)
{ {
writeDecomposition(meshes); writeDecomposition(meshes);
fileHandler().flush(); fileHandler().flush();
@ -301,7 +301,7 @@ int main(int argc, char *argv[])
// Write the decomposition, if necessary // Write the decomposition, if necessary
if if
( (
writeCellDist writeCellProc
&& meshes.completeMesh().facesInstance() && meshes.completeMesh().facesInstance()
== runTimes.completeTime().timeName() == runTimes.completeTime().timeName()
) )

View File

@ -762,7 +762,7 @@ _decomposePar_ ()
local line=${COMP_LINE} local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ") local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="-allRegions -case -cellDist -constant -copyUniform -copyZero -dict -doc -fields -fileHandler -force -help -latestTime -libs -noFields -noFunctionObjects -noSets -noZero -region -srcDoc -time" opts="-allRegions -case -cellProc -constant -copyUniform -copyZero -dict -doc -fields -fileHandler -force -help -latestTime -libs -noFields -noFunctionObjects -noSets -noZero -region -srcDoc -time"
for o in $used ; do opts="${opts/$o/}" ; done for o in $used ; do opts="${opts/$o/}" ; done
extra="" extra=""
@ -2831,7 +2831,7 @@ _reconstructPar_ ()
local line=${COMP_LINE} local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ") local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="- -allRegions -case -constant -doc -fields -fileHandler -help -lagrangianFields -latestTime -libs -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -region -srcDoc -time -withZero" opts="- -allRegions -case -cellProc -constant -doc -fields -fileHandler -help -lagrangianFields -latestTime -libs -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -region -srcDoc -time -withZero"
for o in $used ; do opts="${opts/$o/}" ; done for o in $used ; do opts="${opts/$o/}" ; done
extra="" extra=""

View File

@ -6,8 +6,8 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication blockMesh runApplication blockMesh
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
runParallel $(getApplication) runParallel $(getApplication)
runApplication reconstructPar -cellDist runApplication reconstructPar -cellProc
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -13,7 +13,7 @@ runApplication blockMesh
#runApplication $application #runApplication $application
#- Run parallel #- Run parallel
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
runParallel $application runParallel $application
runApplication reconstructPar runApplication reconstructPar

View File

@ -16,7 +16,7 @@ runApplication transformPoints -pointSet ball "Rz=-45"
runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple
# Decompose # Decompose
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
# Set the value of the scalar transport field # Set the value of the scalar transport field
runParallel setFields runParallel setFields

View File

@ -4,6 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions # Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions . $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase & rm -f 0/cellDist cleanCase & rm -f 0/cellProc
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ runApplication blockMesh
runApplication topoSet runApplication topoSet
runApplication refineHexMesh c0 -noFields -overwrite runApplication refineHexMesh c0 -noFields -overwrite
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
runParallel $application runParallel $application
runApplication reconstructPar runApplication reconstructPar

View File

@ -14,7 +14,7 @@ runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/ballValve
runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple
# Decompose # Decompose
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
# Initialise the velocity field # Initialise the velocity field
runParallel potentialFoam -pName p_rgh runParallel potentialFoam -pName p_rgh

View File

@ -9,8 +9,8 @@ runApplication topoSet
runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields
runApplication setFields runApplication setFields
runApplication decomposePar -cellDist runApplication decomposePar -cellProc
runParallel $(getApplication) runParallel $(getApplication)
runApplication reconstructPar -cellDist runApplication reconstructPar -cellProc
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------