- simplify procAddressing read/write - avoid accessing points in faMeshReconstructor. Can rely on the patch meshPoints (labelList), which does not need access to a pointField - report number of points on decomposed mesh. Can be useful additional information. Additional statistics for finite area decomposition - provide bundled reconstructAllFields for various reconstructors - remove reconstructPar checks for very old face addressing (from foam2.0 - ie, older than OpenFOAM itself) - bundle all reading into fieldsDistributor tools, where it can be reused by various utilities as required. - combine decomposition fields as respective fieldsCache which eliminates most of the clutter from decomposePar and similfies reuse in the future. STYLE: remove old wordHashSet selection (deprecated in 2018) BUG: incorrect face flip handling for faMeshReconstructor - a latent bug which is not yet triggered since the faMesh faces are currently only definable on boundary faces (which never flip)
84 lines
2.5 KiB
C++
84 lines
2.5 KiB
C++
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | www.openfoam.com
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
Copyright (C) 2021 OpenCFD Ltd.
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
|
|
Description
|
|
Write proc addressing and decompose area fields (parallel only).
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
if (doDecompose && Pstream::parRun())
|
|
{
|
|
faMeshReconstructor reconstructor(aMesh);
|
|
reconstructor.writeAddressing();
|
|
|
|
Info<< "Wrote proc-addressing" << nl << endl;
|
|
|
|
// Handle area fields
|
|
// ------------------
|
|
|
|
faFieldDecomposer::fieldsCache areaFieldsCache;
|
|
|
|
const faMesh& fullMesh = reconstructor.mesh();
|
|
|
|
{
|
|
// Use uncollated (or master uncollated) file handler here.
|
|
// - each processor is reading in the identical serial fields.
|
|
// - nothing should be parallel-coordinated.
|
|
|
|
// Similarly, if we write the serial finite-area mesh, this is only
|
|
// done from one processor!
|
|
|
|
reconstructor.writeMesh();
|
|
|
|
if (doDecompFields)
|
|
{
|
|
const bool oldDistributed = fileHandler().distributed();
|
|
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
|
fileHandler().distributed(true);
|
|
|
|
IOobjectList objects(fullMesh.time(), runTime.timeName());
|
|
|
|
areaFieldsCache.readAllFields(fullMesh, objects);
|
|
|
|
// Restore old settings
|
|
if (oldHandler)
|
|
{
|
|
fileHandler(std::move(oldHandler));
|
|
}
|
|
fileHandler().distributed(oldDistributed);
|
|
}
|
|
}
|
|
|
|
const label nAreaFields = areaFieldsCache.size();
|
|
|
|
if (nAreaFields)
|
|
{
|
|
Info<< "Decomposing " << nAreaFields << " area fields" << nl;
|
|
|
|
faFieldDecomposer fieldDecomposer
|
|
(
|
|
fullMesh,
|
|
aMesh,
|
|
reconstructor.edgeProcAddressing(),
|
|
reconstructor.faceProcAddressing(),
|
|
reconstructor.boundaryProcAddressing()
|
|
);
|
|
|
|
// Report
|
|
areaFieldsCache.decomposeAllFields(fieldDecomposer, true);
|
|
Info<< endl;
|
|
}
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|