reconstructParMesh: Added -allRegions option

This commit is contained in:
Will Bainbridge
2018-06-01 08:49:51 +01:00
parent b0a414b5d6
commit 35326ba39b
5 changed files with 417 additions and 396 deletions

View File

@ -1,8 +1,10 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ldynamicMesh \ -ldynamicMesh \
-lmeshTools -lmeshTools \
-lregionModels

View File

@ -2,7 +2,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-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,6 +50,7 @@ Description
#include "fvMeshAdder.H" #include "fvMeshAdder.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "extrapolatedCalculatedFvPatchFields.H" #include "extrapolatedCalculatedFvPatchFields.H"
#include "regionProperties.H"
using namespace Foam; using namespace Foam;
@ -479,6 +480,7 @@ int main(int argc, char *argv[])
); );
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addAllRegionsOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -498,18 +500,21 @@ int main(int argc, char *argv[])
<< endl; << endl;
word regionName = polyMesh::defaultRegion; const wordList regionNames(selectRegionNames(args, runTime));
word regionDir = word::null; if (regionNames.size() > 1)
if
(
args.optionReadIfPresent("region", regionName)
&& regionName != polyMesh::defaultRegion
)
{ {
regionDir = regionName; Info<< "Operating on regions " << regionNames[0];
Info<< "Operating on region " << regionName << nl << endl; for (label regioni = 1; regioni < regionNames.size() - 1; ++ regioni)
{
Info<< ", " << regionNames[regioni];
} }
Info<< " and " << regionNames.last() << nl << endl;
}
else if (regionNames[0] != polyMesh::defaultRegion)
{
Info<< "Operating on region " << regionNames[0] << nl << endl;
}
scalar mergeTol = defaultMergeTol; scalar mergeTol = defaultMergeTol;
args.optionReadIfPresent("mergeTol", mergeTol); args.optionReadIfPresent("mergeTol", mergeTol);
@ -596,6 +601,14 @@ int main(int argc, char *argv[])
databases[proci].setTime(timeDirs[timeI], timeI); databases[proci].setTime(timeDirs[timeI], timeI);
} }
forAll(regionNames, regioni)
{
const word& regionName = regionNames[regioni];
const word regionDir =
regionName == polyMesh::defaultRegion
? word::null
: regionName;
IOobject facesIO IOobject facesIO
( (
"faces", "faces",
@ -708,7 +721,11 @@ int main(int argc, char *argv[])
renumber(map().addedCellMap(), cellProcAddressing[proci]); renumber(map().addedCellMap(), cellProcAddressing[proci]);
renumber(map().addedFaceMap(), faceProcAddressing[proci]); renumber(map().addedFaceMap(), faceProcAddressing[proci]);
renumber(map().addedPointMap(), pointProcAddressing[proci]); renumber(map().addedPointMap(), pointProcAddressing[proci]);
renumber(map().addedPatchMap(), boundaryProcAddressing[proci]); renumber
(
map().addedPatchMap(),
boundaryProcAddressing[proci]
);
} }
for (label step=2; step<nProcs*2; step*=2) for (label step=2; step<nProcs*2; step*=2)
{ {
@ -720,7 +737,8 @@ int main(int argc, char *argv[])
continue; continue;
} }
Info<< "Merging mesh " << proci << " with " << next << endl; Info<< "Merging mesh " << proci << " with " << next
<< endl;
// Find geometrically shared points/faces. // Find geometrically shared points/faces.
autoPtr<faceCoupleInfo> couples = determineCoupledFaces autoPtr<faceCoupleInfo> couples = determineCoupledFaces
@ -819,7 +837,12 @@ int main(int argc, char *argv[])
// See if any points on the mastermesh have become connected // See if any points on the mastermesh have become connected
// because of connections through processor meshes. // because of connections through processor meshes.
mergeSharedPoints(mergeDist, masterMesh[0], pointProcAddressing); mergeSharedPoints
(
mergeDist,
masterMesh[0],
pointProcAddressing
);
// Save some properties on the reconstructed mesh // Save some properties on the reconstructed mesh
masterInternalFaces = masterMesh[0].nInternalFaces(); masterInternalFaces = masterMesh[0].nInternalFaces();
@ -929,8 +952,8 @@ int main(int argc, char *argv[])
&& masterFacei < masterInternalFaces && masterFacei < masterInternalFaces
) )
{ {
// proc face is now external but used to be internal face. // proc face is now external but used to be internal
// Check if we have owner or neighbour. // face. Check if we have owner or neighbour.
label procOwn = procMesh.faceOwner()[procFacei]; label procOwn = procMesh.faceOwner()[procFacei];
label masterOwn = masterOwner[masterFacei]; label masterOwn = masterOwner[masterFacei];
@ -1008,6 +1031,7 @@ int main(int argc, char *argv[])
Info<< endl; Info<< endl;
} }
} }
}
Info<< "End.\n" << endl; Info<< "End.\n" << endl;

View File

@ -6,6 +6,8 @@ cd ${0%/*} || exit 1 # Run from this directory
cleanCase cleanCase
rm -rf \ rm -rf \
0/cellToRegion \
0/*/cellToRegion \
constant/*/polyMesh \ constant/*/polyMesh \
constant/extendedFeatureEdgeMesh \ constant/extendedFeatureEdgeMesh \
constant/triSurface/*.eMesh constant/triSurface/*.eMesh

View File

@ -7,17 +7,13 @@ cd ${0%/*} || exit 1 # Run from this directory
# Meshing # Meshing
runApplication blockMesh runApplication blockMesh
runApplication topoSet runApplication topoSet
runApplication decomposePar -copyZero runApplication splitMeshRegions -cellZones -overwrite
runParallel splitMeshRegions -cellZones -overwrite runApplication decomposePar -copyZero -allRegions
# Simulation # Simulation
runParallel $(getApplication) runParallel $(getApplication)
# Reconstruct # Reconstruct
for region in bottomWater topAir heater leftSolid rightSolid
do
runApplication -s $region reconstructParMesh -constant -region $region
done
runApplication reconstructPar -allRegions runApplication reconstructPar -allRegions
# Post-process # Post-process

View File

@ -15,10 +15,7 @@ runParallel splitMeshRegions -cellZones -overwrite
runParallel $(getApplication) runParallel $(getApplication)
# Reconstruct # Reconstruct
for region in bottomAir topAir heater leftSolid rightSolid runApplication reconstructParMesh -constant -allRegions
do
runApplication -s $region reconstructParMesh -constant -region $region
done
runApplication reconstructPar -allRegions runApplication reconstructPar -allRegions
# Post-process # Post-process