mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge commit 'origin/master' into splitCyclic
Conflicts: applications/utilities/parallelProcessing/decomposePar/decomposePar.C applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
This commit is contained in:
@ -34,8 +34,8 @@ Usage
|
||||
- decomposePar [OPTION]
|
||||
|
||||
@param -cellDist \n
|
||||
Write the cell distribution as a labelList for use with 'manual'
|
||||
decomposition method and as a volScalarField for post-processing.
|
||||
Write the cell distribution as a labelList, for use with 'manual'
|
||||
decomposition method or as a volScalarField for post-processing.
|
||||
|
||||
@param -region regionName \n
|
||||
Decompose named region. Does not check for existence of processor*.
|
||||
@ -46,9 +46,6 @@ Usage
|
||||
@param -fields \n
|
||||
Use existing geometry decomposition and convert fields only.
|
||||
|
||||
@param -filterPatches \n
|
||||
Remove empty patches when decomposing the geometry.
|
||||
|
||||
@param -force \n
|
||||
Remove any existing @a processor subdirectories before decomposing the
|
||||
geometry.
|
||||
@ -66,7 +63,6 @@ Usage
|
||||
#include "OSspecific.H"
|
||||
#include "fvCFD.H"
|
||||
#include "IOobjectList.H"
|
||||
//#include "processorFvPatchFields.H"
|
||||
#include "domainDecomposition.H"
|
||||
#include "labelIOField.H"
|
||||
#include "scalarIOField.H"
|
||||
@ -87,7 +83,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
# include "addRegionOption.H"
|
||||
argList::addBoolOption("cellDist");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"cellDist",
|
||||
"write cell distribution as a labelList - for use with 'manual' "
|
||||
"decomposition method or as a volScalarField for post-processing."
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"copyUniform",
|
||||
@ -99,11 +100,6 @@ int main(int argc, char *argv[])
|
||||
"use existing geometry decomposition and convert fields only"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"filterPatches",
|
||||
"remove empty patches when decomposing the geometry"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"force",
|
||||
"remove existing processor*/ subdirs before decomposing the geometry"
|
||||
@ -114,6 +110,11 @@ int main(int argc, char *argv[])
|
||||
"only decompose geometry if the number of domains has changed"
|
||||
);
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"decompose a mesh and fields of a case for parallel execution"
|
||||
);
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
word regionName = fvMesh::defaultRegion;
|
||||
@ -128,7 +129,6 @@ int main(int argc, char *argv[])
|
||||
bool writeCellDist = args.optionFound("cellDist");
|
||||
bool copyUniform = args.optionFound("copyUniform");
|
||||
bool decomposeFieldsOnly = args.optionFound("fields");
|
||||
bool filterPatches = args.optionFound("filterPatches");
|
||||
bool forceOverwrite = args.optionFound("force");
|
||||
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
||||
|
||||
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
|
||||
// Decompose the mesh
|
||||
if (!decomposeFieldsOnly)
|
||||
{
|
||||
mesh.decomposeMesh(filterPatches);
|
||||
mesh.decomposeMesh();
|
||||
|
||||
mesh.writeDecomposition();
|
||||
|
||||
@ -337,22 +337,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Construct the point fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// pointMesh pMesh(mesh);
|
||||
pointMesh pMesh(mesh);
|
||||
|
||||
PtrList<pointScalarField> pointScalarFields;
|
||||
// readFields(pMesh, objects, pointScalarFields);
|
||||
readFields(pMesh, objects, pointScalarFields);
|
||||
|
||||
PtrList<pointVectorField> pointVectorFields;
|
||||
// readFields(pMesh, objects, pointVectorFields);
|
||||
readFields(pMesh, objects, pointVectorFields);
|
||||
|
||||
PtrList<pointSphericalTensorField> pointSphericalTensorFields;
|
||||
// readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
|
||||
PtrList<pointSymmTensorField> pointSymmTensorFields;
|
||||
// readFields(pMesh, objects, pointSymmTensorFields);
|
||||
readFields(pMesh, objects, pointSymmTensorFields);
|
||||
|
||||
PtrList<pointTensorField> pointTensorFields;
|
||||
// readFields(pMesh, objects, pointTensorFields);
|
||||
readFields(pMesh, objects, pointTensorFields);
|
||||
|
||||
|
||||
// Construct the Lagrangian fields
|
||||
@ -652,45 +652,45 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// // Point fields
|
||||
// if
|
||||
// (
|
||||
// pointScalarFields.size()
|
||||
// || pointVectorFields.size()
|
||||
// || pointSphericalTensorFields.size()
|
||||
// || pointSymmTensorFields.size()
|
||||
// || pointTensorFields.size()
|
||||
// )
|
||||
// {
|
||||
// labelIOList pointProcAddressing
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "pointProcAddressing",
|
||||
// procMesh.facesInstance(),
|
||||
// procMesh.meshSubDir,
|
||||
// procMesh,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// pointMesh procPMesh(procMesh, true);
|
||||
//
|
||||
// pointFieldDecomposer fieldDecomposer
|
||||
// (
|
||||
// pMesh,
|
||||
// procPMesh,
|
||||
// pointProcAddressing,
|
||||
// boundaryProcAddressing
|
||||
// );
|
||||
//
|
||||
// fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
// fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
// }
|
||||
// Point fields
|
||||
if
|
||||
(
|
||||
pointScalarFields.size()
|
||||
|| pointVectorFields.size()
|
||||
|| pointSphericalTensorFields.size()
|
||||
|| pointSymmTensorFields.size()
|
||||
|| pointTensorFields.size()
|
||||
)
|
||||
{
|
||||
labelIOList pointProcAddressing
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
pointMesh procPMesh(procMesh);
|
||||
|
||||
pointFieldDecomposer fieldDecomposer
|
||||
(
|
||||
pMesh,
|
||||
procPMesh,
|
||||
pointProcAddressing,
|
||||
boundaryProcAddressing
|
||||
);
|
||||
|
||||
fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
}
|
||||
|
||||
|
||||
// If there is lagrangian data write it out
|
||||
|
||||
@ -70,6 +70,24 @@ void Foam::domainDecomposition::mark
|
||||
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
facesInstancePointsPtr_
|
||||
(
|
||||
pointsInstance() != facesInstance()
|
||||
? new pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
facesInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
*this,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
: NULL
|
||||
),
|
||||
decompositionDict_
|
||||
(
|
||||
IOobject
|
||||
@ -87,7 +105,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
procPointAddressing_(nProcs_),
|
||||
procFaceAddressing_(nProcs_),
|
||||
procCellAddressing_(nProcs_),
|
||||
procBoundaryAddressing_(nProcs_),
|
||||
procPatchSize_(nProcs_),
|
||||
procPatchStartIndex_(nProcs_),
|
||||
procNeighbourProcessors_(nProcs_),
|
||||
@ -255,24 +272,67 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
"system",
|
||||
"constant"
|
||||
);
|
||||
processorDb.setTime(time());
|
||||
|
||||
// create the mesh
|
||||
polyMesh procMesh
|
||||
(
|
||||
IOobject
|
||||
// create the mesh. Two situations:
|
||||
// - points and faces come from the same time ('instance'). The mesh
|
||||
// will get constructed in the same instance.
|
||||
// - points come from a different time (moving mesh cases).
|
||||
// It will read the points belonging to the faces instance and
|
||||
// construct the procMesh with it which then gets handled as above.
|
||||
// (so with 'old' geometry).
|
||||
// Only at writing time will it additionally write the current
|
||||
// points.
|
||||
|
||||
autoPtr<polyMesh> procMeshPtr;
|
||||
|
||||
if (facesInstancePointsPtr_.valid())
|
||||
{
|
||||
// Construct mesh from facesInstance.
|
||||
pointField facesInstancePoints
|
||||
(
|
||||
this->polyMesh::name(), // region name of undecomposed mesh
|
||||
pointsInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
);
|
||||
facesInstancePointsPtr_(),
|
||||
curPointLabels
|
||||
);
|
||||
|
||||
procMeshPtr.reset
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(facesInstancePoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procMeshPtr.reset
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
polyMesh& procMesh = procMeshPtr();
|
||||
|
||||
|
||||
// Create processor boundary patches
|
||||
const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
|
||||
|
||||
const labelList& curPatchSizes = procPatchSize_[procI];
|
||||
|
||||
const labelList& curPatchStarts = procPatchStartIndex_[procI];
|
||||
@ -331,8 +391,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
{
|
||||
// Get the face labels consistent with the field mapping
|
||||
// (reuse the patch field mappers)
|
||||
const polyPatch& meshPatch =
|
||||
meshPatches[curBoundaryAddressing[patchi]];
|
||||
const polyPatch& meshPatch = meshPatches[patchi];
|
||||
|
||||
fvFieldDecomposer::patchFieldDecomposer patchMapper
|
||||
(
|
||||
@ -346,14 +405,13 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
);
|
||||
|
||||
// Map existing patches
|
||||
procPatches[nPatches] =
|
||||
meshPatches[curBoundaryAddressing[patchi]].clone
|
||||
(
|
||||
procMesh.boundaryMesh(),
|
||||
nPatches,
|
||||
patchMapper.directAddressing(),
|
||||
curPatchStarts[patchi]
|
||||
).ptr();
|
||||
procPatches[nPatches] = meshPatch.clone
|
||||
(
|
||||
procMesh.boundaryMesh(),
|
||||
nPatches,
|
||||
patchMapper.directAddressing(),
|
||||
curPatchStarts[patchi]
|
||||
).ptr();
|
||||
|
||||
nPatches++;
|
||||
}
|
||||
@ -672,6 +730,26 @@ forAll(procPatches, patchI)
|
||||
|
||||
procMesh.write();
|
||||
|
||||
// Write points if pointsInstance differing from facesInstance
|
||||
if (facesInstancePointsPtr_.valid())
|
||||
{
|
||||
pointIOField pointsInstancePoints
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
pointsInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
procMesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(procPoints)
|
||||
);
|
||||
pointsInstancePoints.write();
|
||||
}
|
||||
|
||||
Info<< endl
|
||||
<< "Processor " << procI << nl
|
||||
<< " Number of cells = " << procMesh.nCells()
|
||||
@ -761,6 +839,16 @@ forAll(procPatches, patchI)
|
||||
);
|
||||
cellProcAddressing.write();
|
||||
|
||||
// Write patch map for backwards compatibility.
|
||||
// (= identity map for original patches, -1 for processor patches)
|
||||
label nMeshPatches = curPatchSizes.size();
|
||||
labelList procBoundaryAddressing(identity(nMeshPatches));
|
||||
procBoundaryAddressing.setSize
|
||||
(
|
||||
nMeshPatches+curProcessorPatchSizes.size(),
|
||||
-1
|
||||
);
|
||||
|
||||
labelIOList boundaryProcAddressing
|
||||
(
|
||||
IOobject
|
||||
@ -772,7 +860,7 @@ forAll(procPatches, patchI)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procBoundaryAddressing_[procI]
|
||||
procBoundaryAddressing
|
||||
);
|
||||
boundaryProcAddressing.write();
|
||||
}
|
||||
|
||||
@ -56,6 +56,9 @@ class domainDecomposition
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Optional: points at the facesInstance
|
||||
autoPtr<pointIOField> facesInstancePointsPtr_;
|
||||
|
||||
//- Mesh decomposition control dictionary
|
||||
IOdictionary decompositionDict_;
|
||||
|
||||
@ -84,9 +87,6 @@ class domainDecomposition
|
||||
//- Labels of cells for each processor
|
||||
labelListList procCellAddressing_;
|
||||
|
||||
//- Original patch index for every processor patch
|
||||
labelListList procBoundaryAddressing_;
|
||||
|
||||
//- Sizes for processor mesh patches
|
||||
// Excludes inter-processor boundaries
|
||||
labelListList procPatchSize_;
|
||||
@ -167,8 +167,8 @@ public:
|
||||
return distributed_;
|
||||
}
|
||||
|
||||
//- Decompose mesh. Optionally remove zero-sized patches.
|
||||
void decomposeMesh(const bool filterEmptyPatches);
|
||||
//- Decompose mesh.
|
||||
void decomposeMesh();
|
||||
|
||||
//- Write decomposition
|
||||
bool writeDecomposition();
|
||||
|
||||
@ -40,6 +40,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
<<<<<<< HEAD
|
||||
void Foam::domainDecomposition::append(labelList& lst, const label elem)
|
||||
{
|
||||
label sz = lst.size();
|
||||
@ -97,7 +98,7 @@ void Foam::domainDecomposition::addInterProcFace
|
||||
}
|
||||
|
||||
|
||||
void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
void Foam::domainDecomposition::decomposeMesh()
|
||||
{
|
||||
// Decide which cell goes to which processor
|
||||
distributeCells();
|
||||
|
||||
@ -80,6 +80,4 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
|
||||
#include "pointFieldDecomposer.H"
|
||||
#include "processorPointPatchFields.H"
|
||||
#include "globalPointPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,12 +39,8 @@ Foam::pointFieldDecomposer::decomposeField
|
||||
// Create and map the internal field values
|
||||
Field<Type> internalField(field.internalField(), pointAddressing_);
|
||||
|
||||
// Create a list of pointers for the patchFields including one extra
|
||||
// for the global patch
|
||||
PtrList<pointPatchField<Type> > patchFields
|
||||
(
|
||||
boundaryAddressing_.size() + 1
|
||||
);
|
||||
// Create a list of pointers for the patchFields
|
||||
PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size());
|
||||
|
||||
// Create and map the patch field values
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
@ -78,17 +73,6 @@ Foam::pointFieldDecomposer::decomposeField
|
||||
}
|
||||
}
|
||||
|
||||
// Add the global patch
|
||||
patchFields.set
|
||||
(
|
||||
boundaryAddressing_.size(),
|
||||
new globalPointPatchField<Type>
|
||||
(
|
||||
procMesh_.boundary().globalPatch(),
|
||||
DimensionedField<Type, pointMesh>::null()
|
||||
)
|
||||
);
|
||||
|
||||
// Create the field for the processor
|
||||
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user