From dafe3fa00455d615661de9f39455836de6242ef1 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 20 Jul 2022 15:36:31 +0100 Subject: [PATCH] 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. --- .../manipulation/renumberMesh/renumberMesh.C | 45 +++++++++---------- .../decomposePar/decomposePar.C | 22 ++++----- .../decomposePar/readFields.C | 10 ++--- .../reconstructPar/reconstructPar.C | 16 +++---- etc/config.sh/bash_completion | 4 +- .../counterFlowFlame2D_GRI/Allrun-parallel | 4 +- .../pimpleFoam/LES/channel395/Allrun | 2 +- .../pimpleFoam/RAS/ballValve/Allrun | 2 +- .../simpleFoam/pipeCyclic/Allclean | 2 +- .../simpleFoam/pipeCyclic/Allrun | 2 +- .../RAS/ballValve/Allrun | 2 +- .../RAS/floatingObject/Allrun-parallel | 4 +- 12 files changed, 55 insertions(+), 60 deletions(-) diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index ab05fc11f7..eaee1cecd0 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -59,32 +59,29 @@ Description using namespace Foam; -// Create named field from labelList for postprocessing -tmp createScalarField +void writeCellLabels ( const fvMesh& mesh, const word& name, const labelList& elems ) { - tmp tfld + volScalarField::Internal fld ( - volScalarField::New + IOobject ( name, + mesh.time().timeName(), mesh, - dimensionedScalar(dimless, 0), - zeroGradientFvPatchScalarField::typeName - ) + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimless, + scalarField(scalarList(elems)) ); - volScalarField& fld = tfld.ref(); - forAll(fld, celli) - { - fld[celli] = elems[celli]; - } - - return tfld; + fld.write(); } @@ -850,18 +847,16 @@ int main(int argc, char *argv[]) UPstream::parRun() = oldParRun; // For debugging: write out region - createScalarField + writeCellLabels ( mesh, - "cellDist", + "cellProc", cellToRegion - )().write(); - - Info<< nl << "Written decomposition as volScalarField to " - << "cellDist for use in postprocessing." + ); + Info<< nl << "Written decomposition as volScalarField::Internal to " + << "cellProc for use in postprocessing." << nl << endl; - cellOrder = regionRenumber(renumberPtr(), mesh, cellToRegion); // Determine new to old face order with new cell numbering @@ -1237,19 +1232,19 @@ int main(int argc, char *argv[]) if (writeMaps) { // For debugging: write out region - createScalarField + writeCellLabels ( mesh, "origCellID", map().cellMap() - )().write(); + ); - createScalarField + writeCellLabels ( mesh, "cellID", identity(mesh.nCells()) - )().write(); + ); Info<< nl << "Written current cellID and origCellID as volScalarField" << " for use in postprocessing." diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 058d00eee9..92e947d0e4 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -32,9 +32,9 @@ Usage \b decomposePar [OPTION] Options: - - \par -cellDist - Write the cell distribution as a labelList, for use with 'manual' - decomposition method or as a volScalarField for post-processing. + - \par -cellProc + Write cell processor indices as a volScalarField::Internal for + post-processing. - \par -region \ \n Decompose named region. Does not check for existence of processor*. @@ -164,7 +164,7 @@ void decomposeUniform void writeDecomposition(const domainDecomposition& meshes) { - // Write as volScalarField for postprocessing. + // Write as volScalarField::Internal for postprocessing. volScalarField::Internal cellProc ( IOobject @@ -182,7 +182,7 @@ void writeDecomposition(const domainDecomposition& meshes) cellProc.write(); - Info<< "Wrote decomposition as volScalarField to " + Info<< "Wrote decomposition as volScalarField::Internal to " << cellProc.name() << " for use in postprocessing." << nl << endl; } @@ -206,9 +206,9 @@ int main(int argc, char *argv[]) #include "addAllRegionsOption.H" argList::addBoolOption ( - "cellDist", - "write cell distribution as a labelList - for use with 'manual' " - "decomposition method or as a volScalarField for post-processing." + "cellProc", + "write cell processor indices as a volScalarField::Internal for " + "post-processing." ); argList::addBoolOption ( @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" bool region = args.optionFound("region"); - bool writeCellDist = args.optionFound("cellDist"); + bool writeCellProc = args.optionFound("cellProc"); bool copyZero = args.optionFound("copyZero"); bool copyUniform = args.optionFound("copyUniform"); bool decomposeFieldsOnly = args.optionFound("fields"); @@ -396,7 +396,7 @@ int main(int argc, char *argv[]) domainDecomposition meshes(runTimes, regionName); if (!decomposeFieldsOnly || !copyZero) { - if (meshes.readDecompose(decomposeSets) && writeCellDist) + if (meshes.readDecompose(decomposeSets) && writeCellProc) { writeDecomposition(meshes); fileHandler().flush(); @@ -445,7 +445,7 @@ int main(int argc, char *argv[]) // Write the decomposition, if necessary if ( - writeCellDist + writeCellProc && meshes.completeMesh().facesInstance() == runTimes.completeTime().timeName() ) diff --git a/applications/utilities/parallelProcessing/decomposePar/readFields.C b/applications/utilities/parallelProcessing/decomposePar/readFields.C index 9cea51d749..75c0d6c539 100644 --- a/applications/utilities/parallelProcessing/decomposePar/readFields.C +++ b/applications/utilities/parallelProcessing/decomposePar/readFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,11 +41,11 @@ void Foam::readFields // Search list of objects for fields of type GeomField IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - // Remove the cellDist field - IOobjectList::iterator celDistIter = fieldObjects.find("cellDist"); - if (celDistIter != fieldObjects.end()) + // Remove the cellProc field + IOobjectList::iterator cellProcIter = fieldObjects.find("cellProc"); + if (cellProcIter != fieldObjects.end()) { - fieldObjects.erase(celDistIter); + fieldObjects.erase(cellProcIter); } // Get sorted set of names (different processors might read objects in diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index ac5fa7720b..f4c7fbcb1d 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -66,7 +66,7 @@ bool haveAllTimes void writeDecomposition(const domainDecomposition& meshes) { - // Write as volScalarField for postprocessing. + // Write as volScalarField::Internal for postprocessing. volScalarField::Internal cellProc ( IOobject @@ -84,7 +84,7 @@ void writeDecomposition(const domainDecomposition& meshes) cellProc.write(); - Info<< "Wrote decomposition as volScalarField to " + Info<< "Wrote decomposition as volScalarField::Internal to " << cellProc.name() << " for use in postprocessing." << nl << endl; } @@ -110,9 +110,9 @@ int main(int argc, char *argv[]) #include "addAllRegionsOption.H" argList::addBoolOption ( - "cellDist", - "write cell distribution as a labelList - for use with 'manual' " - "decomposition method or as a volScalarField for post-processing." + "cellProc", + "write cell processor indices as a volScalarField::Internal for " + "post-processing." ); argList::addOption ( @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" - const bool writeCellDist = args.optionFound("cellDist"); + const bool writeCellProc = args.optionFound("cellProc"); HashSet selectedFields; if (args.optionFound("fields")) @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) // Create meshes Info<< "\n\nReconstructing mesh " << regionName << nl << endl; domainDecomposition meshes(runTimes, regionName); - if (meshes.readReconstruct(!noReconstructSets) && writeCellDist) + if (meshes.readReconstruct(!noReconstructSets) && writeCellProc) { writeDecomposition(meshes); fileHandler().flush(); @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) // Write the decomposition, if necessary if ( - writeCellDist + writeCellProc && meshes.completeMesh().facesInstance() == runTimes.completeTime().timeName() ) diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion index 649047a5cb..c9e5d0a2ce 100644 --- a/etc/config.sh/bash_completion +++ b/etc/config.sh/bash_completion @@ -762,7 +762,7 @@ _decomposePar_ () local line=${COMP_LINE} 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 extra="" @@ -2831,7 +2831,7 @@ _reconstructPar_ () local line=${COMP_LINE} 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 extra="" diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel index 7fd9858515..7af05e71fb 100755 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel @@ -6,8 +6,8 @@ cd ${0%/*} || exit 1 # Run from this directory runApplication blockMesh -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc runParallel $(getApplication) -runApplication reconstructPar -cellDist +runApplication reconstructPar -cellProc #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/LES/channel395/Allrun b/tutorials/incompressible/pimpleFoam/LES/channel395/Allrun index 0ae462d1ad..97f5364963 100755 --- a/tutorials/incompressible/pimpleFoam/LES/channel395/Allrun +++ b/tutorials/incompressible/pimpleFoam/LES/channel395/Allrun @@ -13,7 +13,7 @@ runApplication blockMesh #runApplication $application #- Run parallel -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc runParallel $application runApplication reconstructPar diff --git a/tutorials/incompressible/pimpleFoam/RAS/ballValve/Allrun b/tutorials/incompressible/pimpleFoam/RAS/ballValve/Allrun index 5f7adb4126..c04fd3bb55 100755 --- a/tutorials/incompressible/pimpleFoam/RAS/ballValve/Allrun +++ b/tutorials/incompressible/pimpleFoam/RAS/ballValve/Allrun @@ -16,7 +16,7 @@ runApplication transformPoints -pointSet ball "Rz=-45" runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple # Decompose -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc # Set the value of the scalar transport field runParallel setFields diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean b/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean index 27276efe95..f04a965158 100755 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean @@ -4,6 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions -cleanCase & rm -f 0/cellDist +cleanCase & rm -f 0/cellProc #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun index 2ba339d534..e1607160c1 100755 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun @@ -11,7 +11,7 @@ runApplication blockMesh runApplication topoSet runApplication refineHexMesh c0 -noFields -overwrite -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc runParallel $application runApplication reconstructPar diff --git a/tutorials/multiphase/compressibleInterFoam/RAS/ballValve/Allrun b/tutorials/multiphase/compressibleInterFoam/RAS/ballValve/Allrun index 1032b53408..72d853b574 100755 --- a/tutorials/multiphase/compressibleInterFoam/RAS/ballValve/Allrun +++ b/tutorials/multiphase/compressibleInterFoam/RAS/ballValve/Allrun @@ -14,7 +14,7 @@ runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/ballValve runApplication createNonConformalCouples -overwrite pipeNonCouple ballNonCouple # Decompose -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc # Initialise the velocity field runParallel potentialFoam -pName p_rgh diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel index 3b498baaad..c4e4387075 100755 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel @@ -9,8 +9,8 @@ runApplication topoSet runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields runApplication setFields -runApplication decomposePar -cellDist +runApplication decomposePar -cellProc runParallel $(getApplication) -runApplication reconstructPar -cellDist +runApplication reconstructPar -cellProc #------------------------------------------------------------------------------