From 15709858b3af3c6c78fc88d30761cc3668fa722a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 2 Jul 2008 10:11:48 +0200 Subject: [PATCH 1/4] decomposePar gets -lazy option --- .../decomposePar/decomposePar.C | 56 +++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 0c820006c7..e9fe85e3da 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -48,7 +48,15 @@ Usage @param -force \n Remove any existing @a processor subdirectories before decomposing the - geometry. + geometry. Has precedence over the @a -lazy option. + + @param -lazy \n + Only decompose the geometry if the number of domains has changed + from a previous decomposition. Any existing @a processor subdirectories + are removed as necessary. This option can be used to avoid redundant + geometry decomposition (eg, in scripts), but should be used with caution + when the underlying (serial) geometry or the decomposition method etc + have been changed between decompositions. \*---------------------------------------------------------------------------*/ @@ -80,6 +88,7 @@ int main(int argc, char *argv[]) argList::validOptions.insert("fields", ""); argList::validOptions.insert("filterPatches", ""); argList::validOptions.insert("force", ""); + argList::validOptions.insert("lazy", ""); # include "setRootCase.H" @@ -88,6 +97,7 @@ int main(int argc, char *argv[]) bool decomposeFieldsOnly(args.options().found("fields")); bool filterPatches(args.options().found("filterPatches")); bool forceOverwrite(args.options().found("force")); + bool lazyDecomposition(args.options().found("lazy")); # include "createTime.H" @@ -115,6 +125,8 @@ int main(int argc, char *argv[]) { if (nProcs) { + bool hasProcDirs = true; + if (forceOverwrite) { Info<< "Removing " << nProcs @@ -130,13 +142,47 @@ int main(int argc, char *argv[]) rmDir(procDir); } + + hasProcDirs = false; } - else + else if (lazyDecomposition) + { + // lazy decomposition + IOdictionary decompDict + ( + IOobject + ( + "decomposeParDict", + runTime.time().system(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + label nDomains + ( + readInt(decompDict.lookup("numberOfSubdomains")) + ); + + // avoid repeated decomposition + if (nDomains == nProcs) + { + decomposeFieldsOnly = true; + hasProcDirs = false; + + Info<< "Using existing processor directories" << nl; + } + } + + if (hasProcDirs) { FatalErrorIn(args.executable()) - << "Case is already decomposed, " - "use the -force option or manually remove" << nl - << "processor directories before decomposing. e.g.," << nl + << "Case is already decomposed with " << nProcs + << " domains, use the -force option or manually" << nl + << "remove processor directories before decomposing. e.g.," + << nl << " rm -rf " << runTime.path().c_str() << "/processor*" << nl << exit(FatalError); From 7d9f709ecc97304363d063b00a76a76c3d4ffde3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 2 Jul 2008 11:25:28 +0200 Subject: [PATCH 2/4] restrict MAX_DOT_GRAPH_DEPTH = 3 for smaller (more readable) collaboration diagrams --- doc/Doxygen/Doxyfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Doxygen/Doxyfile b/doc/Doxygen/Doxyfile index 13c36d9d30..f5ab120424 100644 --- a/doc/Doxygen/Doxyfile +++ b/doc/Doxygen/Doxyfile @@ -1244,7 +1244,7 @@ DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the number +# visualized by representing a node as a red box. Note that if the number # of direct children of the root node in a graph is already larger than # MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. @@ -1259,7 +1259,7 @@ DOT_GRAPH_MAX_NODES = 50 # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. -MAX_DOT_GRAPH_DEPTH = 0 +MAX_DOT_GRAPH_DEPTH = 3 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. From e9a0d8147d4d9b98a5c72716dad36706a50134ee Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 3 Jul 2008 09:46:44 +0200 Subject: [PATCH 3/4] decomposePar changes * improved error checking for the -fields option * allow -lazy and -force combination --- .../decomposePar/decomposePar.C | 135 +++++++++--------- .../decomposePar/decomposeParDict | 70 ++++----- 2 files changed, 103 insertions(+), 102 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index e9fe85e3da..3685be43c4 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -48,15 +48,15 @@ Usage @param -force \n Remove any existing @a processor subdirectories before decomposing the - geometry. Has precedence over the @a -lazy option. + geometry. @param -lazy \n - Only decompose the geometry if the number of domains has changed - from a previous decomposition. Any existing @a processor subdirectories - are removed as necessary. This option can be used to avoid redundant - geometry decomposition (eg, in scripts), but should be used with caution - when the underlying (serial) geometry or the decomposition method etc - have been changed between decompositions. + Only decompose the geometry if the number of domains has changed from a + previous decomposition. No @a processor subdirectories will be removed + unless the @a -force option is also specified. This option can be used + to avoid redundant geometry decomposition (eg, in scripts), but should + be used with caution when the underlying (serial) geometry or the + decomposition method etc. have been changed between decompositions. \*---------------------------------------------------------------------------*/ @@ -110,83 +110,84 @@ int main(int argc, char *argv[]) ++nProcs; } - // Check for previously decomposed case first + // get requested numberOfSubdomains + label nDomains = 0; + { + IOdictionary decompDict + ( + IOobject + ( + "decomposeParDict", + runTime.time().system(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + decompDict.lookup("numberOfSubdomains") >> nDomains; + } + if (decomposeFieldsOnly) { - if (!nProcs) + // Sanity check on previously decomposed case + if (nProcs != nDomains) { FatalErrorIn(args.executable()) - << "Specifying -fields requires a decomposed geometry!" + << "Specified -fields, but the case was decomposed with " + << nProcs << " domains" + << nl + << "instead of " << nDomains + << " domains as specified in decomposeParDict" << nl << exit(FatalError); } } - else + else if (nProcs) { - if (nProcs) + bool procDirsProblem = true; + + if (lazyDecomposition && nProcs == nDomains) { - bool hasProcDirs = true; + // we can reuse the decomposition + decomposeFieldsOnly = true; + procDirsProblem = false; + forceOverwrite = false; - if (forceOverwrite) + Info<< "Using existing processor directories" << nl; + } + + if (forceOverwrite) + { + Info<< "Removing " << nProcs + << " existing processor directories" << endl; + + // remove existing processor dirs + // reverse order to avoid gaps if someone interrupts the process + for (label procI = nProcs-1; procI >= 0; --procI) { - Info<< "Removing " << nProcs - << " existing processor directories" << endl; - - // remove existing processor dirs - for (label procI = nProcs-1; procI >= 0; --procI) - { - fileName procDir - ( - runTime.path()/(word("processor") + name(procI)) - ); - - rmDir(procDir); - } - - hasProcDirs = false; - } - else if (lazyDecomposition) - { - // lazy decomposition - IOdictionary decompDict + fileName procDir ( - IOobject - ( - "decomposeParDict", - runTime.time().system(), - runTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) + runTime.path()/(word("processor") + name(procI)) ); - label nDomains - ( - readInt(decompDict.lookup("numberOfSubdomains")) - ); - - // avoid repeated decomposition - if (nDomains == nProcs) - { - decomposeFieldsOnly = true; - hasProcDirs = false; - - Info<< "Using existing processor directories" << nl; - } + rmDir(procDir); } - if (hasProcDirs) - { - FatalErrorIn(args.executable()) - << "Case is already decomposed with " << nProcs - << " domains, use the -force option or manually" << nl - << "remove processor directories before decomposing. e.g.," - << nl - << " rm -rf " << runTime.path().c_str() << "/processor*" - << nl - << exit(FatalError); - } + procDirsProblem = false; + } + + if (procDirsProblem) + { + FatalErrorIn(args.executable()) + << "Case is already decomposed with " << nProcs + << " domains, use the -force option or manually" << nl + << "remove processor directories before decomposing. e.g.," + << nl + << " rm -rf " << runTime.path().c_str() << "/processor*" + << nl + << exit(FatalError); } } diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index b9ee4eaeb1..c7317b464f 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -1,61 +1,61 @@ -// Mesh decomposition control dictionary - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - +/*-------------------------------*- C++ -*---------------------------------*\ +| ========= | +| \\ / OpenFOAM | +| \\ / | +| \\ / The Open Source CFD Toolbox | +| \\/ http://www.OpenFOAM.org | +\*-------------------------------------------------------------------------*/ FoamFile { - version 0.5; - format ascii; - - root "ROOT"; - case "CASE"; - instance "system"; - local ""; - - class dictionary; - - object decompositionDict; + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + location "system"; + object decomposeParDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 4; -//preservePatches (inlet); -//preserveFaceZones (heater solid1 solid3); +// preservePatches (inlet); +// preserveFaceZones (heater solid1 solid3); -method simple; -//method hierarchical; -//method metis; -//method manual; +method simple; +// method hierarchical; +// method metis; +// method manual; simpleCoeffs { - n (2 2 1); - delta 0.001; + n (2 2 1); + delta 0.001; } hierarchicalCoeffs { - n (2 2 1); - delta 0.001; - order xyz; + n (2 2 1); + delta 0.001; + order xyz; } metisCoeffs { - //processorWeights - //( - // 1 - // 1 - // 1 - // 1 - //); + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ } manualCoeffs { - dataFile "decompositionData"; + dataFile "decompositionData"; } // ************************************************************************* // From d8b29eb7ef33477b603e020ed00c99f961509550 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 4 Jul 2008 09:57:43 +0200 Subject: [PATCH 4/4] added 'conversion' library * started with polyDualMesh, but add mesh reader/writers in the future --- .../utilities/mesh/conversion/polyDualMesh/Make/files | 1 - .../utilities/mesh/conversion/polyDualMesh/Make/options | 5 +++-- src/Allwmake | 1 + src/conversion/Allwmake | 4 ++++ src/conversion/Make/files | 3 +++ src/conversion/Make/options | 5 +++++ .../mesh => src}/conversion/polyDualMesh/polyDualMesh.C | 0 .../mesh => src}/conversion/polyDualMesh/polyDualMesh.H | 0 8 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 src/conversion/Allwmake create mode 100644 src/conversion/Make/files create mode 100644 src/conversion/Make/options rename {applications/utilities/mesh => src}/conversion/polyDualMesh/polyDualMesh.C (100%) rename {applications/utilities/mesh => src}/conversion/polyDualMesh/polyDualMesh.H (100%) diff --git a/applications/utilities/mesh/conversion/polyDualMesh/Make/files b/applications/utilities/mesh/conversion/polyDualMesh/Make/files index de69b15edf..c43f79e8e1 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/Make/files +++ b/applications/utilities/mesh/conversion/polyDualMesh/Make/files @@ -1,4 +1,3 @@ -polyDualMesh.C polyDualMeshApp.C EXE = $(FOAM_APPBIN)/polyDualMesh diff --git a/applications/utilities/mesh/conversion/polyDualMesh/Make/options b/applications/utilities/mesh/conversion/polyDualMesh/Make/options index 54c035b8f5..6dc63a7a98 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/Make/options +++ b/applications/utilities/mesh/conversion/polyDualMesh/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/conversion/lnInclude EXE_LIBS = \ - -lmeshTools + -lmeshTools -lconversion diff --git a/src/Allwmake b/src/Allwmake index f7b68983c6..08bb914b74 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -31,6 +31,7 @@ wmake libso randomProcesses ( cd turbulenceModels && ./Allwmake ) ( cd lagrangian && ./Allwmake ) ( cd postProcessing && ./Allwmake ) +( cd conversion && ./Allwmake ) wmake libso autoMesh wmake libso errorEstimation diff --git a/src/conversion/Allwmake b/src/conversion/Allwmake new file mode 100755 index 0000000000..72e9c2b141 --- /dev/null +++ b/src/conversion/Allwmake @@ -0,0 +1,4 @@ +#!/bin/sh +set -x + +wmake libso diff --git a/src/conversion/Make/files b/src/conversion/Make/files new file mode 100644 index 0000000000..435c341cd3 --- /dev/null +++ b/src/conversion/Make/files @@ -0,0 +1,3 @@ +polyDualMesh/polyDualMesh.C + +LIB = $(FOAM_LIBBIN)/libconversion diff --git a/src/conversion/Make/options b/src/conversion/Make/options new file mode 100644 index 0000000000..4b2f0a059f --- /dev/null +++ b/src/conversion/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lmeshTools diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMesh.C b/src/conversion/polyDualMesh/polyDualMesh.C similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/polyDualMesh.C rename to src/conversion/polyDualMesh/polyDualMesh.C diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMesh.H b/src/conversion/polyDualMesh/polyDualMesh.H similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/polyDualMesh.H rename to src/conversion/polyDualMesh/polyDualMesh.H