mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: remove old proc-addressing when redistributing (issue #656)
- after redistribution, the old cellProcAddressing etc files are incorrect and potentially troublesome.
This commit is contained in:
@ -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 | 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.
|
||||||
@ -275,15 +275,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
bool region = args.optionFound("region");
|
const bool optRegion = args.optionFound("region");
|
||||||
bool allRegions = args.optionFound("allRegions");
|
const bool allRegions = args.optionFound("allRegions");
|
||||||
bool writeCellDist = args.optionFound("cellDist");
|
const bool writeCellDist = args.optionFound("cellDist");
|
||||||
bool copyZero = args.optionFound("copyZero");
|
const bool copyZero = args.optionFound("copyZero");
|
||||||
bool copyUniform = args.optionFound("copyUniform");
|
const bool copyUniform = args.optionFound("copyUniform");
|
||||||
bool decomposeFieldsOnly = args.optionFound("fields");
|
const bool decomposeSets = !args.optionFound("noSets");
|
||||||
bool decomposeSets = !args.optionFound("noSets");
|
bool decomposeFieldsOnly = args.optionFound("fields");
|
||||||
bool forceOverwrite = args.optionFound("force");
|
bool forceOverwrite = args.optionFound("force");
|
||||||
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
const bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
||||||
|
|
||||||
// Set time from database
|
// Set time from database
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
@ -296,44 +296,30 @@ int main(int argc, char *argv[])
|
|||||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||||
|
|
||||||
wordList regionNames;
|
wordList regionNames;
|
||||||
wordList regionDirs;
|
|
||||||
if (allRegions)
|
if (allRegions)
|
||||||
{
|
{
|
||||||
Info<< "Decomposing all regions in regionProperties" << nl << endl;
|
Info<< "Decomposing all regions in regionProperties" << nl << endl;
|
||||||
regionProperties rp(runTime);
|
regionProperties rp(runTime);
|
||||||
forAllConstIter(HashTable<wordList>, rp, iter)
|
|
||||||
|
wordHashSet names;
|
||||||
|
forAllConstIters(rp, iter)
|
||||||
{
|
{
|
||||||
const wordList& regions = iter();
|
names.insert(iter.object());
|
||||||
forAll(regions, i)
|
|
||||||
{
|
|
||||||
if (!regionNames.found(regions[i]))
|
|
||||||
{
|
|
||||||
regionNames.append(regions[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
regionDirs = regionNames;
|
|
||||||
|
regionNames = names.sortedToc();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
word regionName;
|
regionNames = {fvMesh::defaultRegion};
|
||||||
if (args.optionReadIfPresent("region", regionName))
|
args.optionReadIfPresent("region", regionNames[0]);
|
||||||
{
|
|
||||||
regionNames = wordList(1, regionName);
|
|
||||||
regionDirs = regionNames;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
regionNames = wordList(1, fvMesh::defaultRegion);
|
|
||||||
regionDirs = wordList(1, word::null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
forAll(regionNames, regioni)
|
forAll(regionNames, regioni)
|
||||||
{
|
{
|
||||||
const word& regionName = regionNames[regioni];
|
const word& regionName = regionNames[regioni];
|
||||||
const word& regionDir = regionDirs[regioni];
|
const word& regionDir =
|
||||||
|
regionName == fvMesh::defaultRegion ? word::null : regionName;
|
||||||
|
|
||||||
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
|
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
|
||||||
|
|
||||||
@ -391,7 +377,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Using existing processor directories" << nl;
|
Info<< "Using existing processor directories" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (region || allRegions)
|
if (allRegions || optRegion)
|
||||||
{
|
{
|
||||||
procDirsProblem = false;
|
procDirsProblem = false;
|
||||||
forceOverwrite = false;
|
forceOverwrite = false;
|
||||||
@ -527,7 +513,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// Copy the 0 directory into each of the processor directories
|
// Copy the 0 directory into each of the processor directories
|
||||||
fileName prevTimePath;
|
fileName prevTimePath;
|
||||||
for (label proci = 0; proci < mesh.nProcs(); proci++)
|
for (label proci = 0; proci < mesh.nProcs(); ++proci)
|
||||||
{
|
{
|
||||||
Time processorDb
|
Time processorDb
|
||||||
(
|
(
|
||||||
@ -736,13 +722,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
label cloudI = 0;
|
label cloudI = 0;
|
||||||
|
|
||||||
forAll(cloudDirs, i)
|
for (const fileName& cloudDir : cloudDirs)
|
||||||
{
|
{
|
||||||
IOobjectList sprayObjs
|
IOobjectList sprayObjs
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
cloud::prefix/cloudDirs[i],
|
cloud::prefix/cloudDir,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
@ -759,7 +745,7 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Info<< "Identified lagrangian data set: "
|
Info<< "Identified lagrangian data set: "
|
||||||
<< cloudDirs[i] << endl;
|
<< cloudDir << endl;
|
||||||
|
|
||||||
lagrangianPositions.set
|
lagrangianPositions.set
|
||||||
(
|
(
|
||||||
@ -767,7 +753,7 @@ int main(int argc, char *argv[])
|
|||||||
new Cloud<indexedParticle>
|
new Cloud<indexedParticle>
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
cloudDirs[i],
|
cloudDir,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -944,7 +930,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
// split the fields over processors
|
// split the fields over processors
|
||||||
for (label proci = 0; proci < mesh.nProcs(); proci++)
|
for (label proci = 0; proci < mesh.nProcs(); ++proci)
|
||||||
{
|
{
|
||||||
Info<< "Processor " << proci << ": field transfer" << endl;
|
Info<< "Processor " << proci << ": field transfer" << endl;
|
||||||
|
|
||||||
@ -1234,8 +1220,8 @@ int main(int argc, char *argv[])
|
|||||||
// directory
|
// directory
|
||||||
decomposeUniform(copyUniform, mesh, processorDb, regionDir);
|
decomposeUniform(copyUniform, mesh, processorDb, regionDir);
|
||||||
|
|
||||||
// For the first region of a multi-region case additionally
|
// For a multi-region case, also decompose the "uniform"
|
||||||
// decompose the "uniform" directory in the time directory
|
// directory in the time directory
|
||||||
if (regionNames.size() > 1 && regioni == 0)
|
if (regionNames.size() > 1 && regioni == 0)
|
||||||
{
|
{
|
||||||
decomposeUniform(copyUniform, mesh, processorDb);
|
decomposeUniform(copyUniform, mesh, processorDb);
|
||||||
|
|||||||
@ -54,14 +54,14 @@ Description
|
|||||||
|
|
||||||
bool haveAllTimes
|
bool haveAllTimes
|
||||||
(
|
(
|
||||||
const HashSet<word>& masterTimeDirSet,
|
const wordHashSet& masterTimeDirSet,
|
||||||
const instantList& timeDirs
|
const instantList& timeDirs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Loop over all times
|
// Loop over all times
|
||||||
forAll(timeDirs, timei)
|
for (const instant& t : timeDirs)
|
||||||
{
|
{
|
||||||
if (!masterTimeDirSet.found(timeDirs[timei].name()))
|
if (!masterTimeDirSet.found(t.name()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -126,11 +126,8 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
HashSet<word> selectedFields;
|
wordHashSet selectedFields;
|
||||||
if (args.optionFound("fields"))
|
args.optionReadIfPresent("fields", selectedFields);
|
||||||
{
|
|
||||||
args.optionLookup("fields")() >> selectedFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool noFields = args.optionFound("noFields");
|
const bool noFields = args.optionFound("noFields");
|
||||||
|
|
||||||
@ -158,8 +155,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HashSet<word> selectedLagrangianFields;
|
wordHashSet selectedLagrangianFields;
|
||||||
if (args.optionFound("lagrangianFields"))
|
if (args.optionReadIfPresent("lagrangianFields", selectedLagrangianFields))
|
||||||
{
|
{
|
||||||
if (noLagrangian)
|
if (noLagrangian)
|
||||||
{
|
{
|
||||||
@ -168,50 +165,42 @@ int main(int argc, char *argv[])
|
|||||||
<< "options together."
|
<< "options together."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.optionLookup("lagrangianFields")() >> selectedLagrangianFields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const bool newTimes = args.optionFound("newTimes");
|
const bool newTimes = args.optionFound("newTimes");
|
||||||
const bool allRegions = args.optionFound("allRegions");
|
const bool allRegions = args.optionFound("allRegions");
|
||||||
|
|
||||||
|
|
||||||
wordList regionNames;
|
wordList regionNames;
|
||||||
wordList regionDirs;
|
wordList regionDirs;
|
||||||
if (allRegions)
|
if (allRegions)
|
||||||
{
|
{
|
||||||
Info<< "Reconstructing for all regions in regionProperties" << nl
|
Info<< "Reconstructing all regions in regionProperties" << nl << endl;
|
||||||
<< endl;
|
|
||||||
regionProperties rp(runTime);
|
regionProperties rp(runTime);
|
||||||
forAllConstIter(HashTable<wordList>, rp, iter)
|
|
||||||
|
wordHashSet names;
|
||||||
|
forAllConstIters(rp, iter)
|
||||||
{
|
{
|
||||||
const wordList& regions = iter();
|
names.insert(iter.object());
|
||||||
forAll(regions, i)
|
|
||||||
{
|
|
||||||
if (!regionNames.found(regions[i]))
|
|
||||||
{
|
|
||||||
regionNames.append(regions[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regionNames = names.sortedToc();
|
||||||
regionDirs = regionNames;
|
regionDirs = regionNames;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
word regionName;
|
regionNames = {fvMesh::defaultRegion};
|
||||||
if (args.optionReadIfPresent("region", regionName))
|
if (args.optionReadIfPresent("region", regionNames[0]))
|
||||||
{
|
{
|
||||||
regionNames = wordList(1, regionName);
|
|
||||||
regionDirs = regionNames;
|
regionDirs = regionNames;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionNames = wordList(1, fvMesh::defaultRegion);
|
regionDirs = {word::null};
|
||||||
regionDirs = wordList(1, word::null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Determine the processor count
|
// Determine the processor count
|
||||||
label nProcs = fileHandler().nProcs(args.path(), regionDirs[0]);
|
label nProcs = fileHandler().nProcs(args.path(), regionDirs[0]);
|
||||||
|
|
||||||
@ -267,10 +256,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
masterTimeDirs = runTime.times();
|
masterTimeDirs = runTime.times();
|
||||||
}
|
}
|
||||||
HashSet<word> masterTimeDirSet(2*masterTimeDirs.size());
|
wordHashSet masterTimeDirSet(2*masterTimeDirs.size());
|
||||||
forAll(masterTimeDirs, i)
|
for (const instant& t : masterTimeDirs)
|
||||||
{
|
{
|
||||||
masterTimeDirSet.insert(masterTimeDirs[i].name());
|
masterTimeDirSet.insert(t.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -567,21 +556,18 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(cloudDirs, i)
|
for (const fileName& cloudDir : cloudDirs)
|
||||||
{
|
{
|
||||||
// Check if we already have cloud objects for this
|
// Check if we already have cloud objects for this
|
||||||
// cloudname
|
// cloudname
|
||||||
HashTable<IOobjectList>::const_iterator iter =
|
if (!cloudObjects.found(cloudDir))
|
||||||
cloudObjects.find(cloudDirs[i]);
|
|
||||||
|
|
||||||
if (iter == cloudObjects.end())
|
|
||||||
{
|
{
|
||||||
// Do local scan for valid cloud objects
|
// Do local scan for valid cloud objects
|
||||||
IOobjectList sprayObjs
|
IOobjectList sprayObjs
|
||||||
(
|
(
|
||||||
procMeshes.meshes()[proci],
|
procMeshes.meshes()[proci],
|
||||||
databases[proci].timeName(),
|
databases[proci].timeName(),
|
||||||
cloud::prefix/cloudDirs[i]
|
cloud::prefix/cloudDir
|
||||||
);
|
);
|
||||||
|
|
||||||
IOobject* positionsPtr =
|
IOobject* positionsPtr =
|
||||||
@ -591,7 +577,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (coordsPtr || positionsPtr)
|
if (coordsPtr || positionsPtr)
|
||||||
{
|
{
|
||||||
cloudObjects.insert(cloudDirs[i], sprayObjs);
|
cloudObjects.insert(cloudDir, sprayObjs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,7 +592,7 @@ int main(int argc, char *argv[])
|
|||||||
const word cloudName = word::validate(iter.key());
|
const word cloudName = word::validate(iter.key());
|
||||||
|
|
||||||
// Objects (on arbitrary processor)
|
// Objects (on arbitrary processor)
|
||||||
const IOobjectList& sprayObjs = iter();
|
const IOobjectList& sprayObjs = iter.object();
|
||||||
|
|
||||||
Info<< "Reconstructing lagrangian fields for cloud "
|
Info<< "Reconstructing lagrangian fields for cloud "
|
||||||
<< cloudName << nl << endl;
|
<< cloudName << nl << endl;
|
||||||
|
|||||||
@ -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 | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -105,7 +105,7 @@ scalar getMergeDistance
|
|||||||
scalar mergeTol = defaultMergeTol;
|
scalar mergeTol = defaultMergeTol;
|
||||||
args.optionReadIfPresent("mergeTol", mergeTol);
|
args.optionReadIfPresent("mergeTol", mergeTol);
|
||||||
|
|
||||||
scalar writeTol =
|
const scalar writeTol =
|
||||||
Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision()));
|
Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision()));
|
||||||
|
|
||||||
Info<< "Merge tolerance : " << mergeTol << nl
|
Info<< "Merge tolerance : " << mergeTol << nl
|
||||||
@ -236,7 +236,7 @@ void writeDecomposition
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const labelList& decomp
|
const labelUList& decomp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write the decomposition as labelList for use with 'manual'
|
// Write the decomposition as labelList for use with 'manual'
|
||||||
@ -388,10 +388,9 @@ void determineDecomposition
|
|||||||
// Write addressing if decomposing (1 to many) or reconstructing (many to 1)
|
// Write addressing if decomposing (1 to many) or reconstructing (many to 1)
|
||||||
void writeProcAddressing
|
void writeProcAddressing
|
||||||
(
|
(
|
||||||
const bool decompose,
|
|
||||||
const fileName& meshSubDir,
|
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const mapDistributePolyMesh& map
|
const mapDistributePolyMesh& map,
|
||||||
|
const bool decompose
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Writing procAddressing files to " << mesh.facesInstance()
|
Info<< "Writing procAddressing files to " << mesh.facesInstance()
|
||||||
@ -403,7 +402,7 @@ void writeProcAddressing
|
|||||||
(
|
(
|
||||||
"cellProcAddressing",
|
"cellProcAddressing",
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
@ -416,7 +415,7 @@ void writeProcAddressing
|
|||||||
(
|
(
|
||||||
"faceProcAddressing",
|
"faceProcAddressing",
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
@ -429,7 +428,7 @@ void writeProcAddressing
|
|||||||
(
|
(
|
||||||
"pointProcAddressing",
|
"pointProcAddressing",
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
@ -442,7 +441,7 @@ void writeProcAddressing
|
|||||||
(
|
(
|
||||||
"boundaryProcAddressing",
|
"boundaryProcAddressing",
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
@ -545,10 +544,10 @@ void writeProcAddressing
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cellOk = cellMap.write();
|
const bool cellOk = cellMap.write();
|
||||||
bool faceOk = faceMap.write();
|
const bool faceOk = faceMap.write();
|
||||||
bool pointOk = pointMap.write();
|
const bool pointOk = pointMap.write();
|
||||||
bool patchOk = patchMap.write();
|
const bool patchOk = patchMap.write();
|
||||||
|
|
||||||
if (!cellOk || !faceOk || !pointOk || !patchOk)
|
if (!cellOk || !faceOk || !pointOk || !patchOk)
|
||||||
{
|
{
|
||||||
@ -562,6 +561,24 @@ void writeProcAddressing
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Remove addressing
|
||||||
|
void removeProcAddressing(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
for (const auto prefix : {"boundary", "cell", "face", "point"})
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
prefix + word("ProcAddressing"),
|
||||||
|
mesh.facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
const fileName procFile(io.objectPath());
|
||||||
|
rm(procFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generic mesh-based field reading
|
// Generic mesh-based field reading
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
@ -906,8 +923,8 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
// We don't want to map the decomposition (mapping already tested when
|
// We don't want to map the decomposition (mapping already tested when
|
||||||
// mapping the cell centre field)
|
// mapping the cell centre field)
|
||||||
IOobjectList::iterator iter = objects.find("cellDist");
|
auto iter = objects.find("cellDist");
|
||||||
if (iter != objects.end())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
objects.erase(iter);
|
objects.erase(iter);
|
||||||
}
|
}
|
||||||
@ -1162,7 +1179,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
(
|
(
|
||||||
"procAddressing",
|
"procAddressing",
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
@ -1181,16 +1198,16 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
mesh.write();
|
mesh.write();
|
||||||
topoSet::removeFiles(mesh);
|
topoSet::removeFiles(mesh);
|
||||||
forAll(pointFieldNames, i)
|
for (const word& fieldName : pointFieldNames)
|
||||||
{
|
{
|
||||||
IOobject io
|
IOobject io
|
||||||
(
|
(
|
||||||
pointFieldNames[i],
|
fieldName,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
fileName fieldFile(io.objectPath());
|
const fileName fieldFile(io.objectPath());
|
||||||
if (topoSet::debug) DebugVar(fieldFile);
|
if (topoSet::debug) DebugVar(fieldFile);
|
||||||
rm(fieldFile);
|
rm(fieldFile);
|
||||||
}
|
}
|
||||||
@ -1204,16 +1221,16 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
{
|
{
|
||||||
mesh.write();
|
mesh.write();
|
||||||
topoSet::removeFiles(mesh);
|
topoSet::removeFiles(mesh);
|
||||||
forAll(pointFieldNames, i)
|
for (const word& fieldName : pointFieldNames)
|
||||||
{
|
{
|
||||||
IOobject io
|
IOobject io
|
||||||
(
|
(
|
||||||
pointFieldNames[i],
|
fieldName,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
fileName fieldFile(io.objectPath());
|
const fileName fieldFile(io.objectPath());
|
||||||
if (topoSet::debug) DebugVar(fieldFile);
|
if (topoSet::debug) DebugVar(fieldFile);
|
||||||
rm(fieldFile);
|
rm(fieldFile);
|
||||||
}
|
}
|
||||||
@ -1224,7 +1241,16 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
if (decompose || nDestProcs == 1)
|
if (decompose || nDestProcs == 1)
|
||||||
{
|
{
|
||||||
writeProcAddressing(decompose, meshSubDir, mesh, map);
|
// Decompose (1 -> N) or reconstruct (N -> 1)
|
||||||
|
// so {boundary,cell,face,point}ProcAddressing have meaning
|
||||||
|
writeProcAddressing(mesh, map, decompose);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redistribute (N -> M)
|
||||||
|
// {boundary,cell,face,point}ProcAddressing would be incorrect
|
||||||
|
// - can either remove or redistribute previous
|
||||||
|
removeProcAddressing(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2272,9 +2298,9 @@ int main(int argc, char *argv[])
|
|||||||
Foam::argList args(argc, argv);
|
Foam::argList args(argc, argv);
|
||||||
bool decompose = args.optionFound("decompose");
|
bool decompose = args.optionFound("decompose");
|
||||||
const bool reconstruct = args.optionFound("reconstruct");
|
const bool reconstruct = args.optionFound("reconstruct");
|
||||||
|
const bool writeCellDist = args.optionFound("cellDist");
|
||||||
|
const bool newTimes = args.optionFound("newTimes");
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
bool writeCellDist = args.optionFound("cellDist");
|
|
||||||
bool newTimes = args.optionFound("newTimes");
|
|
||||||
|
|
||||||
|
|
||||||
if (Foam::sigFpe::requested())
|
if (Foam::sigFpe::requested())
|
||||||
@ -2363,8 +2389,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "No processor directories; switching on decompose mode"
|
Info<< "No processor directories; switching on decompose mode"
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
// If master changed to decompose mode make sure all nodes know about
|
// If master changed to decompose mode make sure all nodes know about it
|
||||||
// it
|
|
||||||
Pstream::scatter(decompose);
|
Pstream::scatter(decompose);
|
||||||
|
|
||||||
|
|
||||||
@ -2382,9 +2407,9 @@ int main(int argc, char *argv[])
|
|||||||
timeDirs = Time::findTimes(args.path(), "constant");
|
timeDirs = Time::findTimes(args.path(), "constant");
|
||||||
}
|
}
|
||||||
Pstream::scatter(timeDirs);
|
Pstream::scatter(timeDirs);
|
||||||
forAll(timeDirs, i)
|
for (const instant& t : timeDirs)
|
||||||
{
|
{
|
||||||
mkDir(args.path()/timeDirs[i].name());
|
mkDir(args.path()/t.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2418,9 +2443,9 @@ int main(int argc, char *argv[])
|
|||||||
timeDirs = Time::findTimes(basePath, "constant");
|
timeDirs = Time::findTimes(basePath, "constant");
|
||||||
}
|
}
|
||||||
Pstream::scatter(timeDirs);
|
Pstream::scatter(timeDirs);
|
||||||
forAll(timeDirs, i)
|
for (const instant& t : timeDirs)
|
||||||
{
|
{
|
||||||
mkDir(basePath/timeDirs[i].name());
|
mkDir(basePath/t.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,33 +2466,32 @@ int main(int argc, char *argv[])
|
|||||||
if (newTimes)
|
if (newTimes)
|
||||||
{
|
{
|
||||||
instantList baseTimeDirs(baseRunTime.times());
|
instantList baseTimeDirs(baseRunTime.times());
|
||||||
forAll(baseTimeDirs, i)
|
for (const instant& t : baseTimeDirs)
|
||||||
{
|
{
|
||||||
masterTimeDirSet.insert(baseTimeDirs[i].name());
|
masterTimeDirSet.insert(t.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Determine any region
|
// Determine any region
|
||||||
word regionName = polyMesh::defaultRegion;
|
word regionName = polyMesh::defaultRegion;
|
||||||
fileName meshSubDir;
|
fileName meshSubDir = polyMesh::meshSubDir;
|
||||||
if (args.optionReadIfPresent("region", regionName))
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
meshSubDir = regionName/polyMesh::meshSubDir;
|
meshSubDir = regionName/polyMesh::meshSubDir;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
meshSubDir = polyMesh::meshSubDir;
|
|
||||||
}
|
|
||||||
Info<< "Using mesh subdirectory " << meshSubDir << nl << endl;
|
Info<< "Using mesh subdirectory " << meshSubDir << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Allow override of decomposeParDict location
|
||||||
|
fileName decompDictFile;
|
||||||
|
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||||
|
|
||||||
|
|
||||||
// Demand driven lagrangian mapper
|
// Demand driven lagrangian mapper
|
||||||
autoPtr<parLagrangianRedistributor> lagrangianReconstructorPtr;
|
autoPtr<parLagrangianRedistributor> lagrangianReconstructorPtr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (reconstruct)
|
if (reconstruct)
|
||||||
{
|
{
|
||||||
// use the times list from the master processor
|
// use the times list from the master processor
|
||||||
@ -2689,7 +2713,8 @@ int main(int argc, char *argv[])
|
|||||||
// detect points by hand
|
// detect points by hand
|
||||||
if (mesh.pointsInstance() != mesh.facesInstance())
|
if (mesh.pointsInstance() != mesh.facesInstance())
|
||||||
{
|
{
|
||||||
Info<< " Dected initial mesh motion; reconstructing points" << nl
|
Info<< " Detected initial mesh motion;"
|
||||||
|
<< " reconstructing points" << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
fvReconstructorPtr().reconstructPoints();
|
fvReconstructorPtr().reconstructPoints();
|
||||||
}
|
}
|
||||||
@ -2918,11 +2943,6 @@ int main(int argc, char *argv[])
|
|||||||
mesh.bounds()
|
mesh.bounds()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Allow override of decomposeParDict location
|
|
||||||
fileName decompDictFile;
|
|
||||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
|
||||||
|
|
||||||
|
|
||||||
// Determine decomposition
|
// Determine decomposition
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user