Commit 73dac8c7 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updating utilities based on internal development line

parent eaf50306
......@@ -34,7 +34,8 @@ Description
NOTE: To avoid exposing wrong fields values faceSets should include
faces contained in the blockedCells cellset.
- coupledFaces reads coupledFacesSet to introduces mixe-coupled baffles
- coupledFaces reads coupledFacesSet to introduces mixed-coupled
duplicate baffles
Subsets out the blocked cells and splits the blockedFaces and updates
fields.
......
......@@ -17,7 +17,8 @@ FoamFile
//- Per faceSet the patch the faces should go into blocked baffles
blockedFaces ((blockedFacesSet blockedFaces));
//- Per faceSet the patch the faces should go into coupled baffles
//- Per faceSet the duplicate baffles to generate (one 'normal', wall baffle,
// one cyclic baffle). For use with active baffle boundary conditions.
coupledFaces
{
coupledFacesSet
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
Info<< "Created zone " << name
<< " at index " << zoneID
<< " with " << n << " faces" << endl;
<< " with " << returnReduce(n, sumOp<label>()) << " faces" << endl;
mesh.faceZones().set
(
......
......@@ -512,6 +512,11 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
#include "addRegionOption.H"
#include "addDictOption.H"
Foam::argList::addBoolOption
(
"writeObj",
"write obj files showing the cyclic matching process"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
......@@ -523,12 +528,13 @@ int main(int argc, char *argv[])
#include "createNamedPolyMesh.H"
const bool writeObj = args.optionFound("writeObj");
const word oldInstance = mesh.pointsInstance();
const word dictName("createPatchDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
Info<< "Reading " << dictIO.instance()/dictIO.name() << nl << endl;
IOdictionary dict(dictIO);
......@@ -542,7 +548,10 @@ int main(int argc, char *argv[])
patches.checkParallelSync(true);
dumpCyclicMatch("initial_", mesh);
if (writeObj)
{
dumpCyclicMatch("initial_", mesh);
}
// Read patch construct info from dictionary
PtrList<dictionary> patchSources(dict.lookup("patches"));
......@@ -761,7 +770,10 @@ int main(int argc, char *argv[])
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, true);
mesh.movePoints(map().preMotionPoints());
dumpCyclicMatch("coupled_", mesh);
if (writeObj)
{
dumpCyclicMatch("coupled_", mesh);
}
// Synchronise points.
if (!pointSync)
......@@ -872,7 +884,10 @@ int main(int argc, char *argv[])
filterPatches(mesh, addedPatchNames);
dumpCyclicMatch("final_", mesh);
if (writeObj)
{
dumpCyclicMatch("final_", mesh);
}
// Set the precision of the points data to 10
......
......@@ -96,6 +96,8 @@ int main(int argc, char *argv[])
Info<< "Writing points into directory " << points.path() << nl << endl;
points.write();
Info<< nl << "End" << nl << endl;
return 0;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -62,7 +62,6 @@ int main(int argc, char *argv[])
"merge two meshes"
);
argList::noParallel();
#include "addOverwriteOption.H"
argList::validArgs.append("masterCase");
......@@ -97,6 +96,18 @@ int main(int argc, char *argv[])
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
// Since we don't use argList processor directory detection, add it to
// the casename ourselves so it triggers the logic inside TimePath.
const fileName& cName = args.caseName();
std::string::size_type pos = cName.find("processor");
if (pos != string::npos && pos != 0)
{
fileName processorName = cName.substr(pos, cName.size()-pos);
masterCase += '/' + processorName;
addCase += '/' + processorName;
}
getRootCase(masterCase);
getRootCase(addCase);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -243,8 +243,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
// Mirror boundary faces patch by patch
wordList newPatchTypes(boundary().size());
wordList newPatchNames(boundary().size());
labelList newToOldPatch(boundary().size(), -1);
labelList newPatchSizes(boundary().size(), -1);
labelList newPatchStarts(boundary().size(), -1);
label nNewPatches = 0;
......@@ -303,8 +304,8 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
// If patch exists, grab the name and type of the original patch
if (nNewFaces > newPatchStarts[nNewPatches])
{
newPatchTypes[nNewPatches] = boundaryMesh()[patchI].type();
newPatchNames[nNewPatches] = boundaryMesh()[patchI].name();
newToOldPatch[nNewPatches] = patchI;
newPatchSizes[nNewPatches] =
nNewFaces - newPatchStarts[nNewPatches];
......@@ -316,8 +317,7 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
newFaces.setSize(nNewFaces);
Info<< " New faces: " << nNewFaces << endl;
newPatchTypes.setSize(nNewPatches);
newPatchNames.setSize(nNewPatches);
newToOldPatch.setSize(nNewPatches);
newPatchSizes.setSize(nNewPatches);
newPatchStarts.setSize(nNewPatches);
......@@ -377,18 +377,16 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
fvMesh& pMesh = *mirrorMeshPtr_;
// Add the boundary patches
List<polyPatch*> p(newPatchTypes.size());
List<polyPatch*> p(newPatchSizes.size());
forAll(p, patchI)
{
p[patchI] = polyPatch::New
p[patchI] = boundaryMesh()[newToOldPatch[patchI]].clone
(
newPatchTypes[patchI],
newPatchNames[patchI],
newPatchSizes[patchI],
newPatchStarts[patchI],
pMesh.boundaryMesh(),
patchI,
pMesh.boundaryMesh()
newPatchSizes[patchI],
newPatchStarts[patchI]
).ptr();
}
......
......@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
Info<< "Writing mirrored mesh" << endl;
mesh.mirrorMesh().write();
Info<< "End" << endl;
Info<< "End" << nl << endl;
return 0;
}
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anispulation |
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -46,6 +46,9 @@ Description
#include "zeroGradientFvPatchFields.H"
#include "CuthillMcKeeRenumber.H"
#include "fvMeshSubset.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#ifdef FOAM_USE_ZOLTAN
#include "zoltanRenumber.H"
......@@ -634,6 +637,12 @@ int main(int argc, char *argv[])
"calculate the rms of the frontwidth"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
// Force linker to include zoltan symbols. This section is only needed since
// Zoltan is a static library
#ifdef FOAM_USE_ZOLTAN
......@@ -641,9 +650,6 @@ int main(int argc, char *argv[])
(void)zoltanRenumber::typeName;
#endif
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
// Get times list
instantList Times = runTime.times();
......@@ -700,6 +706,7 @@ int main(int argc, char *argv[])
bool writeMaps = false;
bool orderPoints = false;
label blockSize = 0;
bool renumberSets = true;
// Construct renumberMethod
autoPtr<IOdictionary> renumberDictPtr;
......@@ -760,6 +767,8 @@ int main(int argc, char *argv[])
Info<< "Writing renumber maps (new to old) to polyMesh." << nl
<< endl;
}
renumberSets = renumberDict.lookupOrDefault("renumberSets", true);
}
else
{
......@@ -861,6 +870,71 @@ int main(int argc, char *argv[])
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
// Read point fields.
PtrList<pointScalarField> psFlds;
ReadFields(pointMesh::New(mesh), objects, psFlds);
PtrList<pointVectorField> pvFlds;
ReadFields(pointMesh::New(mesh), objects, pvFlds);
PtrList<pointSphericalTensorField> pstFlds;
ReadFields(pointMesh::New(mesh), objects, pstFlds);
PtrList<pointSymmTensorField> psymtFlds;
ReadFields(pointMesh::New(mesh), objects, psymtFlds);
PtrList<pointTensorField> ptFlds;
ReadFields(pointMesh::New(mesh), objects, ptFlds);
// Read sets
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
if (renumberSets)
{
// Read sets
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
{
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
if (cSets.size())
{
Info<< "Reading cellSets:" << endl;
forAllConstIter(IOobjectList, cSets, iter)
{
cellSets.append(new cellSet(*iter()));
Info<< " " << cellSets.last().name() << endl;
}
}
}
{
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
if (fSets.size())
{
Info<< "Reading faceSets:" << endl;
forAllConstIter(IOobjectList, fSets, iter)
{
faceSets.append(new faceSet(*iter()));
Info<< " " << faceSets.last().name() << endl;
}
}
}
{
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
if (pSets.size())
{
Info<< "Reading pointSets:" << endl;
forAllConstIter(IOobjectList, pSets, iter)
{
pointSets.append(new pointSet(*iter()));
Info<< " " << pointSets.last().name() << endl;
}
}
}
}
Info<< endl;
// From renumbering:
......@@ -1055,7 +1129,6 @@ int main(int argc, char *argv[])
mesh.updateMesh(map);
// Update proc maps
if (cellProcAddressing.headerOk())
if
(
cellProcAddressing.headerOk()
......@@ -1070,7 +1143,6 @@ int main(int argc, char *argv[])
UIndirectList<label>(cellProcAddressing, map().cellMap())
);
}
if (faceProcAddressing.headerOk())
if
(
faceProcAddressing.headerOk()
......@@ -1101,7 +1173,6 @@ int main(int argc, char *argv[])
}
}
}
if (pointProcAddressing.headerOk())
if
(
pointProcAddressing.headerOk()
......@@ -1226,47 +1297,80 @@ int main(int argc, char *argv[])
mesh.write();
if (cellProcAddressing.headerOk())
if
(
cellProcAddressing.headerOk()
&& cellProcAddressing.size() == mesh.nCells()
)
{
cellProcAddressing.instance() = mesh.facesInstance();
cellProcAddressing.write();
if (cellProcAddressing.size() == mesh.nCells())
{
cellProcAddressing.write();
}
else
{
// procAddressing no longer valid. Delete it.
const fileName fName(cellProcAddressing.filePath());
if (fName.size())
{
Info<< "Deleting inconsistent processor cell decomposition"
<< " map " << fName << endl;
rm(fName);
}
}
}
if (faceProcAddressing.headerOk())
if
(
faceProcAddressing.headerOk()
&& faceProcAddressing.size() == mesh.nFaces()
)
{
faceProcAddressing.instance() = mesh.facesInstance();
faceProcAddressing.write();
if (faceProcAddressing.size() == mesh.nFaces())
{
faceProcAddressing.write();
}
else
{
const fileName fName(faceProcAddressing.filePath());
if (fName.size())
{
Info<< "Deleting inconsistent processor face decomposition"
<< " map " << fName << endl;
rm(fName);
}
}
}
if (pointProcAddressing.headerOk())
if
(
pointProcAddressing.headerOk()
&& pointProcAddressing.size() == mesh.nPoints()
)
{
pointProcAddressing.instance() = mesh.facesInstance();
pointProcAddressing.write();
if (pointProcAddressing.size() == mesh.nPoints())
{
pointProcAddressing.write();
}
else
{
const fileName fName(pointProcAddressing.filePath());
if (fName.size())
{
Info<< "Deleting inconsistent processor point decomposition"
<< " map " << fName << endl;
rm(fName);
}
}
}
if (boundaryProcAddressing.headerOk())
if
(
boundaryProcAddressing.headerOk()
&& boundaryProcAddressing.size() == mesh.boundaryMesh().size()
)
{
boundaryProcAddressing.instance() = mesh.facesInstance();
boundaryProcAddressing.write();
if (boundaryProcAddressing.size() == mesh.boundaryMesh().size())
{
boundaryProcAddressing.write();
}
else
{
const fileName fName(boundaryProcAddressing.filePath());
if (fName.size())
{
Info<< "Deleting inconsistent processor patch decomposition"
<< " map " << fName << endl;
rm(fName);
}
}
}
if (writeMaps)
{
// For debugging: write out region
......@@ -1331,6 +1435,28 @@ int main(int argc, char *argv[])
).write();
}
if (renumberSets)
{
forAll(cellSets, i)
{
cellSets[i].updateMesh(map());
cellSets[i].instance() = mesh.facesInstance();
cellSets[i].write();
}
forAll(faceSets, i)
{
faceSets[i].updateMesh(map());
faceSets[i].instance() = mesh.facesInstance();
faceSets[i].write();
}
forAll(pointSets, i)
{
pointSets[i].updateMesh(map());
pointSets[i].instance() = mesh.facesInstance();
pointSets[i].write();
}
}
Info<< "\nEnd\n" << endl;
return 0;
......
......@@ -34,6 +34,8 @@ sortCoupledFaceCells false;
// Optional entry: sort points into internal and boundary points
//orderPoints false;
// Optional: suppress renumbering cellSets,faceSets,pointSets
//renumberSets false;
method CuthillMcKee;
......
......@@ -287,7 +287,8 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< nl << "end" << endl;
Info<< nl << "End" << nl << endl;
return 0;
}
......
......@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
// Write fields
runTime.write();
Info<< nl << "end" << endl;
Info<< nl << "End" << nl << endl;
return 0;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -41,11 +41,86 @@ Description
#include "cellSet.H"
#include "IOobjectList.H"
#include "volFields.H"
#include "topoDistanceData.H"
#include "FaceCellWave.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
// Count number of faces in exposedPatchIDs
label nFaces = 0;
forAll(patchIDs, i)
{
const polyPatch& pp = pbm[patchIDs[i]];
nFaces += pp.size();
}
// Field on cells and faces.
List<topoDistanceData> cellData(mesh.nCells());
List<topoDistanceData> faceData(mesh.nFaces());
// Start of changes
labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces);
nFaces = 0;
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& pp = pbm[patchI];
forAll(pp, i)
{
patchFaces[nFaces] = pp.start()+i;
patchData[nFaces] = topoDistanceData(patchI, 0);
nFaces++;
}
}
// Propagate information inwards
FaceCellWave<topoDistanceData> deltaCalc
(
mesh,
patchFaces,
patchData,