Commit 003a6ee0 authored by Mark Olesen's avatar Mark Olesen

ENH: added -decomposeParDict support for preparePar (fixes #4)

parent 11f2f77a
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
decompDict="-decomposeParDict system/decomposeParDict.6"
runApplication $decompDict preparePar
# An ugly way to make things available
for dir in processor*
do
(cd $dir 2> /dev/null && ln -sf ../bunnyWrapped.stl .)
done
echo "WARNING WARNING: this seems to have problems in parallel"
runParallel $decompDict pMesh
runParallel $decompDict checkMesh
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: - |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 6;
// ************************************************************************* //
......@@ -34,8 +34,6 @@ Description
#include "OSspecific.H"
#include "demandDrivenData.H"
#include "triSurfaceImportSurfaceAsSubset.H"
#include <cstdlib>
#include <sstream>
using namespace Foam;
using namespace Foam::Module;
......@@ -70,7 +68,7 @@ int main(int argc, char *argv[])
{
fileName newName = inFileName.lessExt();
newName.append(".fms");
Warning << "Writting surface as " << newName
Warning << "Writing surface as " << newName
<< " to preserve the subset!!" << endl;
originalSurface.writeSurface(newName);
......
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I../../meshLibrary/lnInclude
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
-ldecompose
......@@ -30,68 +30,85 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "polyMeshGen.H"
#include <sstream>
#include "Time.H"
#include "decompositionModel.H"
using namespace Foam;
using namespace Foam::Module;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Create processor directories in preparation for a parallel run"
);
argList::noParallel();
argList::addOption
(
"decomposeParDict",
"file",
"read decomposePar dictionary from specified location"
);
#include "setRootCase.H"
#include "createTime.H"
// Allow override of decomposeParDict location
fileName decompDictFile;
args.readIfPresent("decomposeParDict", decompDictFile);
IOdictionary meshDict
(
IOobject
(
"meshDict",
runTime.system(),
runTime.time().system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
IOdictionary decomposeParDict
// Get requested numberOfSubdomains directly from the dictionary.
// Note: have no mesh yet so cannot use decompositionModel::New
const label nDomains = decompositionMethod::nDomains
(
IOobject
IOdictionary
(
"decomposeParDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
decompositionModel::selectIO
(
IOobject
(
"decomposeParDict",
runTime.time().system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
decompDictFile
)
)
);
const label nProcessors
(
readLabel(decomposeParDict.lookup("numberOfSubdomains"))
);
for (label procI = 0; procI < nProcessors; ++procI)
for (label proci = 0; proci < nDomains; ++proci)
{
fileName file("processor");
std::ostringstream ss;
ss << procI;
file += ss.str();
Info<< "Creating " << file << endl;
fileName dir("processor" + Foam::name(proci));
Info<< "Creating " << dir << endl;
// create a directory for processor data
mkDir(runTime.path()/file);
mkDir(runTime.path()/dir);
// copy the contents of the const directory into processor*
cp(runTime.path()/"constant", runTime.path()/file);
cp(runTime.path()/"constant", runTime.path()/dir);
// generate 0 directories for
mkDir(runTime.path()/file/"0");
mkDir(runTime.path()/dir/"0");
}
Info<< "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -31,7 +31,6 @@ Description
#include "fileName.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include <sstream>
using namespace Foam;
using namespace Foam::Module;
......
......@@ -33,9 +33,6 @@ Description
#include "OFstream.H"
#include "OSspecific.H"
#include "demandDrivenData.H"
#include <cstdlib>
#include <sstream>
#include "triSurfaceDetectFeatureEdges.H"
#include "triSurfacePatchManipulator.H"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment