diff --git a/applications/test/fvMeshStitcher/Make/files b/applications/test/fvMeshStitcher/Make/files
new file mode 100644
index 0000000000..013d3aa8e8
--- /dev/null
+++ b/applications/test/fvMeshStitcher/Make/files
@@ -0,0 +1,3 @@
+Test-fvMeshStitcher.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-fvMeshStitcher
diff --git a/applications/test/fvMeshStitcher/Make/options b/applications/test/fvMeshStitcher/Make/options
new file mode 100644
index 0000000000..fbb5bf176c
--- /dev/null
+++ b/applications/test/fvMeshStitcher/Make/options
@@ -0,0 +1,9 @@
+EXE_INC = \
+ -I$(LIB_SRC)/fileFormats/lnInclude \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+ -lfileFormats \
+ -lfiniteVolume \
+ -lmeshTools
diff --git a/applications/test/fvMeshStitcher/Test-fvMeshStitcher.C b/applications/test/fvMeshStitcher/Test-fvMeshStitcher.C
new file mode 100644
index 0000000000..2518c4e7f7
--- /dev/null
+++ b/applications/test/fvMeshStitcher/Test-fvMeshStitcher.C
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "fvMesh.H"
+#include "Time.H"
+#include "timeSelector.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+using namespace Foam;
+
+int main(int argc, char *argv[])
+{
+ Foam::argList::addBoolOption("write", "write mesh/results files");
+ #include "addOverwriteOption.H"
+ #include "addRegionOption.H"
+
+ #include "setRootCase.H"
+ #include "createTime.H"
+ runTime.functionObjects().off();
+ #include "createNamedMesh.H"
+
+ const bool write = args.optionFound("write");
+ const bool overwrite = args.optionFound("overwrite");
+
+ if (write || overwrite)
+ {
+ const word oldInstance = mesh.pointsInstance();
+
+ mesh.setInstance(runTime.timeName());
+
+ // Set the precision of the points data to 10
+ IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
+
+ if (!overwrite)
+ {
+ runTime++;
+ }
+ else
+ {
+ mesh.setInstance(oldInstance);
+ }
+
+ // Write resulting mesh
+ Info<< "Writing mesh to " << runTime.timeName() << nl << endl;
+ mesh.write();
+ }
+
+ Info<< "End" << nl << endl;
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/patchToPatch/Make/files b/applications/test/patchToPatch/Make/files
new file mode 100644
index 0000000000..af75781c67
--- /dev/null
+++ b/applications/test/patchToPatch/Make/files
@@ -0,0 +1,3 @@
+Test-patchToPatch.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-patchToPatch
diff --git a/applications/test/patchToPatch/Make/options b/applications/test/patchToPatch/Make/options
new file mode 100644
index 0000000000..d820876f44
--- /dev/null
+++ b/applications/test/patchToPatch/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+ -I$(LIB_SRC)/fileFormats/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+ -lfileFormats \
+ -lmeshTools
diff --git a/applications/test/patchToPatch/Test-patchToPatch.C b/applications/test/patchToPatch/Test-patchToPatch.C
new file mode 100644
index 0000000000..a25f9930fb
--- /dev/null
+++ b/applications/test/patchToPatch/Test-patchToPatch.C
@@ -0,0 +1,77 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "AMIInterpolation.H"
+#include "cpuTime.H"
+#include "patchToPatch.H"
+#include "polyMesh.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+using namespace Foam;
+
+
+int main(int argc, char *argv[])
+{
+ argList::validArgs.append("source");
+ argList::validArgs.append("target");
+ argList::validArgs.append("method");
+
+ #include "setRootCase.H"
+ #include "createTime.H"
+ #include "createPolyMesh.H"
+
+ const polyPatch& srcPatch = mesh.boundaryMesh()[args[1]];
+ const polyPatch& tgtPatch = mesh.boundaryMesh()[args[2]];
+ const word& method = args[3];
+
+ cpuTime time;
+
+ /*
+ AMIInterpolation(srcPatch, tgtPatch, faceAreaIntersect::tmMesh);
+
+ Info<< nl << "AMI" << ": Completed in "
+ << time.cpuTimeIncrement() << " s" << nl << endl;
+ */
+
+ patchToPatch::New(method, false)->update
+ (
+ srcPatch,
+ srcPatch.pointNormals(),
+ tgtPatch
+ );
+
+ Info<< nl << patchToPatch::typeName << ": Completed in "
+ << time.cpuTimeIncrement() << " s" << nl << endl;
+
+ Info<< "End" << nl << endl;
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/volPointInterpolation/Test-volPointInterpolation.C b/applications/test/volPointInterpolation/Test-volPointInterpolation.C
index 3d06e2f764..799c39ec2e 100644
--- a/applications/test/volPointInterpolation/Test-volPointInterpolation.C
+++ b/applications/test/volPointInterpolation/Test-volPointInterpolation.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -27,45 +27,45 @@ Application
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
+#include "timeSelector.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+template
+bool interpolate(const fvMesh& mesh, const word& name)
+{
+ typeIOobject> io
+ (
+ name,
+ mesh.time().timeName(),
+ mesh,
+ IOobject::MUST_READ
+ );
+
+ if (!io.headerOk()) return false;
+
+ Info<< "Reading field " << name << nl << endl;
+
+ const VolField vf(io, mesh);
+ const PointField pf(volPointInterpolation::New(mesh).interpolate(vf));
+
+ Info<< "Writing field " << pf.name() << nl << endl;
+
+ return pf.write();
+}
+
+
int main(int argc, char *argv[])
{
+ argList::validArgs.append("field");
+
+ Foam::timeSelector::addOptions();
#include "setRootCase.H"
-
#include "createTime.H"
+ Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
#include "createMesh.H"
- Info<< "Reading field p\n" << endl;
- volScalarField p
- (
- IOobject
- (
- "p",
- runTime.timeName(),
- mesh,
- IOobject::MUST_READ,
- IOobject::AUTO_WRITE
- ),
- mesh
- );
-
- Info<< "Reading field U\n" << endl;
- volVectorField U
- (
- IOobject
- (
- "U",
- runTime.timeName(),
- mesh,
- IOobject::MUST_READ,
- IOobject::AUTO_WRITE
- ),
- mesh
- );
-
const pointMesh& pMesh = pointMesh::New(mesh);
const pointBoundaryMesh& pbm = pMesh.boundary();
@@ -78,21 +78,31 @@ int main(int argc, char *argv[])
<< endl;
}
- const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);
+ const word name = args.argRead(1);
-
- pointScalarField pp(pInterp.interpolate(p));
- Info<< pp.name() << " boundary" << endl;
- forAll(pp.boundaryField(), patchi)
+ forAll(timeDirs, timei)
{
- Info<< pbm[patchi].name() << " coupled="
- << pp.boundaryField()[patchi].coupled()<< endl;
+ runTime.setTime(timeDirs[timei], timei);
+
+ Info<< "Time = " << runTime.userTimeName() << endl;
+
+ mesh.readUpdate();
+
+ if
+ (
+ !interpolate(mesh, name)
+ && !interpolate(mesh, name)
+ && !interpolate(mesh, name)
+ && !interpolate(mesh, name)
+ && !interpolate(mesh, name)
+ )
+ {
+ WarningInFunction
+ << "Could not find field " << name << nl << endl;
+ }
}
- pp.write();
-
- pointVectorField pU(pInterp.interpolate(U));
- pU.write();
+ Info<< "End\n" << endl;
return 0;
}
diff --git a/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/files b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/files
new file mode 100644
index 0000000000..e35a967698
--- /dev/null
+++ b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/files
@@ -0,0 +1,3 @@
+createNonConformalCouples.C
+
+EXE = $(FOAM_APPBIN)/createNonConformalCouples
diff --git a/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options
new file mode 100644
index 0000000000..9b8c3dea8c
--- /dev/null
+++ b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options
@@ -0,0 +1,9 @@
+EXE_INC = \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/dynamicMesh/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+ -lfiniteVolume \
+ -ldynamicMesh \
+ -lmeshTools
diff --git a/applications/utilities/mesh/manipulation/createNonConformalCouples/createNonConformalCouples.C b/applications/utilities/mesh/manipulation/createNonConformalCouples/createNonConformalCouples.C
new file mode 100644
index 0000000000..c92776a9d9
--- /dev/null
+++ b/applications/utilities/mesh/manipulation/createNonConformalCouples/createNonConformalCouples.C
@@ -0,0 +1,377 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Application
+ createNonConformalCouples
+
+Description
+ Utility to create non-conformal couples between non-coupled patches.
+
+Usage
+ \b createNonConformalCouples
+
+Note
+ If run with two arguments, these arguments specify the patches between
+ which a single couple is to be created. The resulting couple will not have
+ a transformation.
+
+Usage
+ \b createNonConformalCouples
+
+Note
+ If run without arguments then settings are read from a \b
+ system/createNonConformalCouplesDict dictionary (or from a different
+ dictionary specified by the \b -dict option). This dictionary can specify
+ the creation of multiple couples and/or couples with transformations.
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "fvMeshStitchersStationary.H"
+#include "nonConformalCyclicPolyPatch.H"
+#include "nonConformalErrorPolyPatch.H"
+#include "nonConformalProcessorCyclicPolyPatch.H"
+#include "polyMesh.H"
+#include "processorPolyPatch.H"
+#include "systemDict.H"
+#include "Time.H"
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+void createNonConformalCouples
+(
+ fvMesh& mesh,
+ const List>& patchNames,
+ const wordList& cyclicNames,
+ const List& transforms
+)
+{
+ const polyBoundaryMesh& patches = mesh.boundaryMesh();
+
+ List newPatches;
+
+ // Find the first processor patch and face
+ label firstProcPatchi = patches.size(), firstProcFacei = mesh.nFaces();
+ forAll(patches, patchi)
+ {
+ const polyPatch& pp = patches[patchi];
+
+ if (isA(pp) && firstProcPatchi == patches.size())
+ {
+ firstProcPatchi = patchi;
+ firstProcFacei = pp.start();
+ }
+
+ if (!isA(pp) && firstProcPatchi != patches.size())
+ {
+ FatalErrorInFunction
+ << "Processor patches do not follow boundary patches"
+ << exit(FatalError);
+ }
+ }
+
+ // Clone the non-processor patches
+ for (label patchi = 0; patchi < firstProcPatchi; ++ patchi)
+ {
+ const polyPatch& pp = patches[patchi];
+
+ newPatches.append
+ (
+ pp.clone(patches, patchi, pp.size(), pp.start()).ptr()
+ );
+ }
+
+ // Convenience function to generate patch names for the owner or neighbour
+ auto nccPatchNames = [&](const label i)
+ {
+ return
+ Pair
+ (
+ cyclicNames[i] + "_on_" + patchNames[i][0],
+ cyclicNames[i] + "_on_" + patchNames[i][1]
+ );
+ };
+
+ // Add the cyclic patches
+ forAll(patchNames, i)
+ {
+ Info<< indent << "Adding "
+ << nonConformalCyclicPolyPatch::typeName
+ << " interfaces between patches: " << incrIndent << nl
+ << indent << patchNames[i] << decrIndent << nl
+ << indent << "Named:" << incrIndent << nl
+ << indent << Pair(nccPatchNames(i)) << decrIndent << nl
+ << indent << "With transform: " << incrIndent << nl;
+ transforms[i].write(Info);
+ Info<< decrIndent << nl;
+
+ newPatches.append
+ (
+ new nonConformalCyclicPolyPatch
+ (
+ nccPatchNames(i)[0],
+ 0,
+ firstProcFacei,
+ newPatches.size(),
+ patches,
+ nonConformalCyclicPolyPatch::typeName,
+ nccPatchNames(i)[1],
+ patchNames[i][0],
+ transforms[i]
+ )
+ );
+ newPatches.append
+ (
+ new nonConformalCyclicPolyPatch
+ (
+ nccPatchNames(i)[1],
+ 0,
+ firstProcFacei,
+ newPatches.size(),
+ patches,
+ nonConformalCyclicPolyPatch::typeName,
+ nccPatchNames(i)[0],
+ patchNames[i][1],
+ inv(transforms[i])
+ )
+ );
+ }
+
+ // Add the error patches. Note there is only one for each source patch,
+ // regardless of how many interfaces are attached to that patch.
+ auto appendErrorPatches = [&](const bool owner)
+ {
+ wordHashSet patchANames;
+ forAll(patchNames, i)
+ {
+ patchANames.insert(patchNames[i][!owner]);
+ }
+ forAllConstIter(wordHashSet, patchANames, iter)
+ {
+ newPatches.append
+ (
+ new nonConformalErrorPolyPatch
+ (
+ nonConformalErrorPolyPatch::typeName + "_on_" + iter.key(),
+ 0,
+ firstProcFacei,
+ newPatches.size(),
+ patches,
+ nonConformalErrorPolyPatch::typeName,
+ iter.key()
+ )
+ );
+ }
+ };
+ appendErrorPatches(true);
+ appendErrorPatches(false);
+
+ // Clone the processor patches
+ for (label patchi = firstProcPatchi; patchi < patches.size(); ++ patchi)
+ {
+ const polyPatch& pp = patches[patchi];
+
+ newPatches.append
+ (
+ pp.clone(patches, newPatches.size(), pp.size(), pp.start()).ptr()
+ );
+ }
+
+ // Add the processor cyclic patches
+ if (Pstream::parRun())
+ {
+ forAll(patchNames, i)
+ {
+ const polyPatch& patch1 = patches[patchNames[i][0]];
+ const polyPatch& patch2 = patches[patchNames[i][1]];
+
+ boolList procHasPatch1(Pstream::nProcs(), false);
+ procHasPatch1[Pstream::myProcNo()] = !patch1.empty();
+ Pstream::gatherList(procHasPatch1);
+ Pstream::scatterList(procHasPatch1);
+
+ boolList procHasPatch2(Pstream::nProcs(), false);
+ procHasPatch2[Pstream::myProcNo()] = !patch2.empty();
+ Pstream::gatherList(procHasPatch2);
+ Pstream::scatterList(procHasPatch2);
+
+ // Multiple cyclic interfaces must be ordered in a specific way for
+ // processor communication to function correctly.
+ //
+ // A communication that is sent from the cyclic owner is received
+ // on the cyclic neighbour and vice versa. Therefore, in a coupled
+ // pair of processors if one sends the owner first the other must
+ // receive the neighbour first.
+ //
+ // We ensure the above by ordering the patches so that for the
+ // lower indexed processor the owner interface comes first, and for
+ // the higher indexed processor the neighbour comes first.
+
+ auto appendProcPatches = [&](const bool owner, const bool first)
+ {
+ const boolList& procHasPatchA =
+ owner ? procHasPatch1 : procHasPatch2;
+ const boolList& procHasPatchB =
+ owner ? procHasPatch2 : procHasPatch1;
+
+ if (procHasPatchA[Pstream::myProcNo()])
+ {
+ forAll(procHasPatchB, proci)
+ {
+ if
+ (
+ (
+ (first && proci < Pstream::myProcNo())
+ || (!first && proci > Pstream::myProcNo())
+ )
+ && procHasPatchB[proci]
+ )
+ {
+ newPatches.append
+ (
+ new nonConformalProcessorCyclicPolyPatch
+ (
+ 0,
+ mesh.nFaces(),
+ newPatches.size(),
+ patches,
+ Pstream::myProcNo(),
+ proci,
+ nccPatchNames(i)[!owner],
+ patchNames[i][!owner]
+ )
+ );
+ }
+ }
+ }
+ };
+
+ appendProcPatches(true, true);
+ appendProcPatches(false, true);
+ appendProcPatches(false, false);
+ appendProcPatches(true, false);
+ }
+ }
+
+ // Re-patch the mesh
+ mesh.removeFvBoundary();
+ mesh.addFvPatches(newPatches);
+}
+
+
+int main(int argc, char *argv[])
+{
+ #include "addOverwriteOption.H"
+ #include "addRegionOption.H"
+ #include "addDictOption.H"
+
+ const bool haveArgs = argList::hasArgs(argc, argv);
+ if (haveArgs)
+ {
+ argList::validArgs.append("patch1");
+ argList::validArgs.append("patch2");
+ }
+
+ #include "setRootCase.H"
+ #include "createTime.H"
+ runTime.functionObjects().off();
+
+ // Get the patches between which to create interfaces and the associated
+ // transformations. If there are arguments then read the patch names from
+ // the arguments and assume an identity transformation. If not, then load
+ // the system dictionary and read potentially multiple pairs of patches and
+ // associated transformations.
+ List> patchNames;
+ wordList cyclicNames;
+ List transforms;
+ if (haveArgs)
+ {
+ patchNames.append(Pair(args[1], args[2]));
+ cyclicNames.append(nonConformalCyclicPolyPatch::typeName);
+ transforms.append(cyclicTransform(true));
+ }
+ else
+ {
+ static const word dictName("createNonConformalCouplesDict");
+
+ IOdictionary dict(systemDict(dictName, args, runTime));
+
+ forAllConstIter(dictionary, dict, iter)
+ {
+ patchNames.append(iter().dict().lookup>("patches"));
+ cyclicNames.append(iter().dict().dictName());
+ transforms.append(cyclicTransform(iter().dict(), true));
+ }
+ }
+
+ Foam::word meshRegionName = polyMesh::defaultRegion;
+ args.optionReadIfPresent("region", meshRegionName);
+
+ const bool overwrite = args.optionFound("overwrite");
+
+ #include "createNamedMesh.H"
+
+ const word oldInstance = mesh.pointsInstance();
+
+ // Make sure the mesh is not connected before couples are added
+ fvMeshStitchers::stationary stitcher(mesh);
+ stitcher.disconnect(false, false);
+
+ createNonConformalCouples
+ (
+ mesh,
+ patchNames,
+ cyclicNames,
+ transforms
+ );
+
+ // Connect the mesh so that the new stitching topology gets written out
+ stitcher.connect(false, false);
+
+ mesh.setInstance(runTime.timeName());
+
+ // Set the precision of the points data to 10
+ IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
+
+ if (!overwrite)
+ {
+ runTime++;
+ }
+ else
+ {
+ mesh.setInstance(oldInstance);
+ }
+
+ // Write resulting mesh
+ Info<< "Writing mesh to " << runTime.timeName() << nl << endl;
+ mesh.write();
+
+ Info<< "End\n" << endl;
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/files b/applications/utilities/parallelProcessing/decomposePar/Make/files
index 077cbe902a..e5f8107a96 100644
--- a/applications/utilities/parallelProcessing/decomposePar/Make/files
+++ b/applications/utilities/parallelProcessing/decomposePar/Make/files
@@ -1,5 +1,4 @@
decomposePar.C
-domainDecomposition.C
dimFieldDecomposer.C
fvFieldDecomposer.C
pointFieldDecomposer.C
diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options
index ca546847e5..75d78ebfd1 100644
--- a/applications/utilities/parallelProcessing/decomposePar/Make/options
+++ b/applications/utilities/parallelProcessing/decomposePar/Make/options
@@ -1,14 +1,16 @@
EXE_INC = \
- -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
- -I$(LIB_SRC)/dynamicMesh/lnInclude \
- -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
+ -I$(LIB_SRC)/parallel/parallel/lnInclude \
+ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
+ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
- -ldynamicMesh \
- -lgenericPatchFields \
- -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
+ -lfiniteVolume \
+ -lmeshTools\
+ -lparallel \
+ -ldecompositionMethods \
-llagrangian \
- -lregionModels
+ -lregionModels \
+ -lgenericPatchFields
diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
index 5f6bae24c7..c30621ee51 100644
--- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
+++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
@@ -79,6 +79,7 @@ Usage
\*---------------------------------------------------------------------------*/
+#include "processorRunTimes.H"
#include "domainDecomposition.H"
#include "decompositionMethod.H"
#include "argList.H"
@@ -114,14 +115,12 @@ namespace Foam
void decomposeUniform
(
const bool copyUniform,
- const domainDecomposition& decomposition,
- const Time& processorDb,
+ const bool distributeUniform,
+ const Time& runTime,
+ const Time& procRunTime,
const word& regionDir = word::null
)
{
- const Time& runTime = decomposition.mesh().time();
-
- // Any uniform data to copy/link?
const fileName uniformDir(regionDir/"uniform");
if (fileHandler().isDir(runTime.timePath()/uniformDir))
@@ -131,9 +130,9 @@ void decomposeUniform
<< endl;
const fileName timePath =
- fileHandler().filePath(processorDb.timePath());
+ fileHandler().filePath(procRunTime.timePath());
- if (copyUniform || decomposition.distributed())
+ if (copyUniform || distributeUniform)
{
if (!fileHandler().exists(timePath/uniformDir))
{
@@ -171,9 +170,9 @@ void decomposeUniform
}
-void writeDecomposition(const domainDecomposition& decomposition)
+void writeDecomposition(const domainDecomposition& meshes)
{
- const labelList& procIds = decomposition.cellToProc();
+ const labelList& procIds = meshes.cellToProc();
// Write the decomposition as labelList for use with 'manual'
// decomposition method.
@@ -182,8 +181,8 @@ void writeDecomposition(const domainDecomposition& decomposition)
IOobject
(
"cellDecomposition",
- decomposition.mesh().facesInstance(),
- decomposition.mesh(),
+ meshes.completeMesh().facesInstance(),
+ meshes.completeMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
@@ -203,12 +202,12 @@ void writeDecomposition(const domainDecomposition& decomposition)
IOobject
(
"cellDist",
- decomposition.mesh().time().timeName(),
- decomposition.mesh(),
+ meshes.completeMesh().time().timeName(),
+ meshes.completeMesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
- decomposition.mesh(),
+ meshes.completeMesh(),
dimless,
scalarField(scalarList(procIds))
);
@@ -309,18 +308,20 @@ int main(int argc, char *argv[])
}
// Set time from database
- #include "createTime.H"
+ Info<< "Create time\n" << endl;
+ processorRunTimes runTimes(Foam::Time::controlDictName, args);
// Allow override of time
- instantList times = timeSelector::selectIfPresent(runTime, args);
+ const instantList times = runTimes.selectComplete(args);
// Get region names
- const wordList regionNames(selectRegionNames(args, runTime));
+ const wordList regionNames =
+ selectRegionNames(args, runTimes.completeTime());
// Handle existing decomposition directories
{
// Determine the processor count from the directories
- label nProcs = fileHandler().nProcs(runTime.path());
+ label nProcs = fileHandler().nProcs(runTimes.completeTime().path());
if (forceOverwrite)
{
@@ -339,7 +340,7 @@ int main(int argc, char *argv[])
(
fileHandler().readDir
(
- runTime.path(),
+ runTimes.completeTime().path(),
fileType::directory
)
);
@@ -379,12 +380,17 @@ int main(int argc, char *argv[])
<< " domains, use the -force option or manually" << nl
<< "remove processor directories before decomposing. e.g.,"
<< nl
- << " rm -rf " << runTime.path().c_str() << "/processor*"
+ << " rm -rf " << runTimes.completeTime().path().c_str()
+ << "/processor*"
<< nl
<< exit(FatalError);
}
}
+ // Get the decomposition dictionary
+ const dictionary decomposeParDict =
+ decompositionMethod::decomposeParDict(runTimes.completeTime());
+
// Decompose all regions
forAll(regionNames, regioni)
{
@@ -394,12 +400,12 @@ int main(int argc, char *argv[])
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
// Determine the existing processor count directly
- label nProcs = fileHandler().nProcs(runTime.path(), regionDir);
+ const label nProcs =
+ fileHandler().nProcs(runTimes.completeTime().path(), regionDir);
// Get requested numberOfSubdomains
const label nDomains =
- decompositionMethod::decomposeParDict(runTime)
- .lookup