Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C
This commit is contained in:
mattijs
2011-09-13 10:14:15 +01:00
747 changed files with 32829 additions and 98339 deletions

View File

@ -136,7 +136,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
// Surface protrusion conformation is done in two steps.
// 1. the dual edges (of all internal vertices) can stretch to
// 1. the dual edges (of all internal vertices) can stretch to
// 'infinity' so any intersection would be badly behaved. So
// just find the nearest point on the geometry and insert point
// pairs.

View File

@ -310,15 +310,15 @@ void Foam::conformalVoronoiMesh::writeMesh
{
// Determine map from Delaunay vertex to Dual mesh
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// From all Delaunay vertices to cell (positive index)
// or patch face (negative index)
labelList vertexToDualAddressing(number_of_vertices(), 0);
forAll(cellToDelaunayVertex, cellI)
{
label vertI = cellToDelaunayVertex[cellI];
if (vertexToDualAddressing[vertI] != 0)
{
FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
@ -330,14 +330,14 @@ void Foam::conformalVoronoiMesh::writeMesh
}
vertexToDualAddressing[vertI] = cellI+1;
}
forAll(patchToDelaunayVertex, patchI)
{
const labelList& patchVertices = patchToDelaunayVertex[patchI];
forAll(patchVertices, i)
{
label vertI = patchVertices[i];
if (vertexToDualAddressing[vertI] > 0)
{
FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
@ -348,7 +348,7 @@ void Foam::conformalVoronoiMesh::writeMesh
<< vertexToDualAddressing[vertI]-1
<< exit(FatalError);
}
// Vertex might be used by multiple faces. Which one to
// use? For now last one wins.
label dualFaceI = dualPatchStarts[patchI]+i;
@ -389,7 +389,7 @@ void Foam::conformalVoronoiMesh::writeMesh
// Calculate map from tet points to dual mesh cells/patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelIOList pointDualAddressing
(
IOobject
@ -408,7 +408,7 @@ void Foam::conformalVoronoiMesh::writeMesh
pointToDelaunayVertex
)()
);
label pointI = findIndex(pointDualAddressing, -1);
if (pointI != -1)
{
@ -422,13 +422,13 @@ void Foam::conformalVoronoiMesh::writeMesh
) << "Delaunay vertex " << pointI
<< " does not have a corresponding dual cell." << endl;
}
Info<< "Writing map from tetDualMesh points to Voronoi mesh to "
<< pointDualAddressing.objectPath() << endl;
pointDualAddressing.write();
// Write tet points corresponding to the Voronoi cell/face centre
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
@ -457,11 +457,11 @@ void Foam::conformalVoronoiMesh::writeMesh
),
points
);
forAll(pointDualAddressing, pointI)
{
label index = pointDualAddressing[pointI];
if (index > 0)
{
label cellI = index-1;
@ -476,7 +476,7 @@ void Foam::conformalVoronoiMesh::writeMesh
}
}
}
Info<< "Writing new tetDualMesh points mapped onto Voronoi mesh to "
<< dualPoints.objectPath() << endl
<< "Replace the polyMesh/points with these." << endl;

View File

@ -27,9 +27,9 @@ Description
- used to e.g. extrude baffles (extrude internal faces) or create
liquid film regions.
- if extruding internal faces:
- create baffles in original mesh with directMappedWall patches
- create baffles in original mesh with mappedWall patches
- if extruding boundary faces:
- convert boundary faces to directMappedWall patches
- convert boundary faces to mappedWall patches
- extrude edges of faceZone as a \<zone\>_sidePatch
- extrude edges inbetween different faceZones as a
(nonuniformTransform)cyclic \<zoneA\>_\<zoneB\>
@ -68,9 +68,9 @@ into the space of the neighbour:
| |
+-------------+
BBB=directMapped between owner on original mesh and new extrusion.
BBB=mapped between owner on original mesh and new extrusion.
(zero offset)
CCC=directMapped between neighbour on original mesh and new extrusion
CCC=mapped between neighbour on original mesh and new extrusion
(offset due to the thickness of the extruded mesh)
For the case of flipMap the extrusion is the other way around: from the
@ -98,7 +98,7 @@ becomes
| |
+-----------+
BBB=directMapped between original mesh and new extrusion
BBB=mapped between original mesh and new extrusion
CCC=polypatch
@ -126,7 +126,7 @@ Usage
#include "patchPointEdgeCirculator.H"
#include "OFstream.H"
#include "meshTools.H"
#include "directMappedWallPolyPatch.H"
#include "mappedWallPolyPatch.H"
#include "createShellMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -920,13 +920,12 @@ tmp<pointField> calcOffset
int main(int argc, char *argv[])
{
argList::noParallel();
argList::addNote
(
"Create region mesh by extruding a faceZone"
);
argList::addNote("Create region mesh by extruding a faceZone");
#include "addRegionOption.H"
#include "addOverwriteOption.H"
argList::addBoolOption("AMI", "apply mapped AMI boundary type");
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
@ -934,6 +933,12 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE;
if (args.optionFound("AMI"))
{
sampleMode = mappedPatchBase::NEARESTPATCHFACEAMI;
}
IOdictionary dict
(
IOobject
@ -1122,7 +1127,7 @@ int main(int argc, char *argv[])
// Check whether the zone is internal or external faces to determine
// what patch type to insert. Cannot be mixed
// since then how to couple? - directMapped only valid for a whole patch.
// since then how to couple? - mapped only valid for a whole patch.
boolList isInternal(zoneIDs.size(), false);
forAll(zoneIDs, i)
{
@ -1174,7 +1179,7 @@ int main(int argc, char *argv[])
if (isInternal[i])
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName + "_top"
@ -1185,7 +1190,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName + "_bottom"
@ -1209,7 +1214,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName
@ -1222,7 +1227,7 @@ int main(int argc, char *argv[])
}
else if (zoneShadowNames.size() > 0) //patch using shadow face zones.
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
zoneShadowNames[i] + "_top"
@ -1233,7 +1238,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName
@ -1661,7 +1666,7 @@ int main(int argc, char *argv[])
if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{
@ -1669,14 +1674,14 @@ int main(int argc, char *argv[])
topOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
sampleMode, // sampleMode
pp.name(), // samplePatch
topOffsets[index], // offset
patches
@ -1684,7 +1689,7 @@ int main(int argc, char *argv[])
}
else if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{
@ -1692,14 +1697,14 @@ int main(int argc, char *argv[])
bottomOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
sampleMode, // sampleMode
pp.name(), // samplePatch
bottomOffsets[index], // offset
patches
@ -1985,19 +1990,19 @@ int main(int argc, char *argv[])
if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{
label index = findIndex(interRegionTopPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
sampleMode, // sampleMode
pp.name(), // samplePatch
-topOffsets[index], // offset
patches
@ -2005,20 +2010,20 @@ int main(int argc, char *argv[])
}
else if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{
label index = findIndex(interRegionBottomPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
sampleMode, // sampleMode
pp.name(), // samplePatch
-bottomOffsets[index], // offset
patches

View File

@ -23,13 +23,13 @@ faceZones (f0);
// FaceZone shadow
//faceZonesShadow (fBaffleShadow);
// Adapt the original mesh to have directMapped patches at where the
// Adapt the original mesh to have mapped patches at where the
// faceZones are?
// If true:
// - extruding internal faces: become baffles on directMapped patches
// - extruding boundary faces: repatched to be on directMapped patches
// - extruding internal faces: become baffles on mapped patches
// - extruding boundary faces: repatched to be on mapped patches
// If false: leave original mesh intact. Extruded mesh will still have
// directMapped patch which might need to be adapted.
// mapped patch which might need to be adapted.
adaptMesh true;
// Extrude 1D-columns of cells?

View File

@ -36,7 +36,7 @@ Description
Output is:
- volScalarField with regions as different scalars (-detectOnly)
or
- mesh with multiple regions and directMapped patches. These patches
- mesh with multiple regions and mapped patches. These patches
either cover the whole interface between two region (default) or
only part according to faceZones (-useFaceZones)
or
@ -57,7 +57,7 @@ Description
- Should work in parallel.
cellZones can differ on either side of processor boundaries in which case
the faces get moved from processor patch to directMapped patch. Not
the faces get moved from processor patch to mapped patch. Not
very well tested.
- If a cell zone gets split into more than one region it can detect
@ -94,7 +94,7 @@ Description
#include "EdgeMap.H"
#include "syncTools.H"
#include "ReadFields.H"
#include "directMappedWallPolyPatch.H"
#include "mappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam;
@ -687,7 +687,7 @@ void getInterfaceSizes
}
}
// Rework
// Rework
Pstream::scatter(regionsToSize);
@ -1260,14 +1260,14 @@ labelList addRegionPatches
// << " trying to add patches " << names << endl;
directMappedWallPolyPatch patch1
mappedWallPolyPatch patch1
(
names[0],
0, // overridden
0, // overridden
0, // overridden
regionNames[e[1]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
mappedPatchBase::NEARESTPATCHFACE,
names[1], // samplePatch
point::zero, // offset
mesh.boundaryMesh()
@ -1275,14 +1275,14 @@ labelList addRegionPatches
interfacePatches[interI] = addPatch(mesh, patch1);
directMappedWallPolyPatch patch2
mappedWallPolyPatch patch2
(
names[1],
0,
0,
0,
regionNames[e[0]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
mappedPatchBase::NEARESTPATCHFACE,
names[0],
point::zero, // offset
mesh.boundaryMesh()

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
numberOfSubdomains 2;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
@ -24,13 +24,22 @@ numberOfSubdomains 8;
// (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1);
//- Keep all of faceZone on a single processor. This puts all cells
// connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced
// decomposition)
// The processor can be -1 (the decompositionMethod chooses the processor
// for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceZones ((f0 -1));
//- Use the volScalarField named here as a weight for each cell in the
// decomposition. For example, use a particle population field to decompose
// for a balanced number of particles in a lagrangian simulation.
// weightField dsmcRhoNMean;
method scotch;
// method hierarchical;
//method hierarchical;
// method simple;
// method metis;
// method manual;
@ -70,7 +79,7 @@ simpleCoeffs
hierarchicalCoeffs
{
n (2 2 1);
n (1 2 1);
delta 0.001;
order xyz;
}

View File

@ -28,6 +28,7 @@ License
#include "cpuTime.H"
#include "cellSet.H"
#include "regionSplit.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,7 +48,8 @@ void Foam::domainDecomposition::distributeCells()
{
wordList pNames(decompositionDict_.lookup("preservePatches"));
Info<< "Keeping owner of faces in patches " << pNames
Info<< nl
<< "Keeping owner of faces in patches " << pNames
<< " on same processor. This only makes sense for cyclics." << endl;
const polyBoundaryMesh& patches = boundaryMesh();
@ -76,7 +78,8 @@ void Foam::domainDecomposition::distributeCells()
{
wordList zNames(decompositionDict_.lookup("preserveFaceZones"));
Info<< "Keeping owner and neighbour of faces in zones " << zNames
Info<< nl
<< "Keeping owner and neighbour of faces in zones " << zNames
<< " on same processor" << endl;
const faceZoneMesh& fZones = faceZones();
@ -103,6 +106,65 @@ void Foam::domainDecomposition::distributeCells()
}
// Specified processor for owner and neighbour of faces
Map<label> specifiedProcessorFaces;
List<Tuple2<word, label> > zNameAndProcs;
if (decompositionDict_.found("singleProcessorFaceZones"))
{
decompositionDict_.lookup("singleProcessorFaceZones") >> zNameAndProcs;
const faceZoneMesh& fZones = faceZones();
label nCells = 0;
Info<< endl;
forAll(zNameAndProcs, i)
{
Info<< "Keeping all cells connected to faceZone "
<< zNameAndProcs[i].first()
<< " on processor " << zNameAndProcs[i].second() << endl;
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
if (zoneI == -1)
{
FatalErrorIn("domainDecomposition::distributeCells()")
<< "Unknown singleProcessorFaceZone "
<< zNameAndProcs[i].first()
<< endl << "Valid faceZones are " << fZones.names()
<< exit(FatalError);
}
const faceZone& fz = fZones[zoneI];
nCells += fz.size();
}
// Size
specifiedProcessorFaces.resize(2*nCells);
// Fill
forAll(zNameAndProcs, i)
{
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
const faceZone& fz = fZones[zoneI];
label procI = zNameAndProcs[i].second();
forAll(fz, fzI)
{
label faceI = fz[fzI];
specifiedProcessorFaces.insert(faceI, procI);
}
}
}
// Construct decomposition method and either do decomposition on
// cell centres or on agglomeration
@ -112,7 +174,8 @@ void Foam::domainDecomposition::distributeCells()
decompositionDict_
);
if (sameProcFaces.empty())
if (sameProcFaces.empty() && specifiedProcessorFaces.empty())
{
if (decompositionDict_.found("weightField"))
{
@ -146,9 +209,11 @@ void Foam::domainDecomposition::distributeCells()
}
else
{
Info<< "Selected " << sameProcFaces.size()
<< " faces whose owner and neighbour cell should be kept on the"
<< " same processor" << endl;
Info<< "Constrained decomposition:" << endl
<< " faces with same processor owner and neighbour : "
<< sameProcFaces.size() << endl
<< " faces all on same processor : "
<< specifiedProcessorFaces.size() << endl << endl;
// Faces where owner and neighbour are not 'connected' (= all except
// sameProcFaces)
@ -159,6 +224,24 @@ void Foam::domainDecomposition::distributeCells()
blockedFace[iter.key()] = false;
}
// For specifiedProcessorFaces add all point connected faces
{
forAllConstIter(Map<label>, specifiedProcessorFaces, iter)
{
const face& f = faces()[iter.key()];
forAll(f, fp)
{
const labelList& pFaces = pointFaces()[f[fp]];
forAll(pFaces, i)
{
blockedFace[pFaces[i]] = false;
}
}
}
}
// Connect coupled boundary faces
const polyBoundaryMesh& patches = boundaryMesh();
@ -201,10 +284,11 @@ void Foam::domainDecomposition::distributeCells()
// Do decomposition on agglomeration
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scalarField regionWeights(globalRegion.nRegions(), 0);
if (decompositionDict_.found("weightField"))
{
scalarField regionWeights(globalRegion.nRegions(), 0);
word weightName = decompositionDict_.lookup("weightField");
volScalarField weights
@ -226,23 +310,70 @@ void Foam::domainDecomposition::distributeCells()
regionWeights[regionI] += weights.internalField()[cellI];
}
cellToProc_ = decomposePtr().decompose
(
*this,
globalRegion,
regionCentres,
regionWeights
);
}
else
{
cellToProc_ = decomposePtr().decompose
(
*this,
globalRegion,
regionCentres
);
forAll(globalRegion, cellI)
{
label regionI = globalRegion[cellI];
regionWeights[regionI] += 1.0;
}
}
cellToProc_ = decomposePtr().decompose
(
*this,
globalRegion,
regionCentres,
regionWeights
);
// For specifiedProcessorFaces rework the cellToProc to enforce
// all on one processor since we can't guarantee that the input
// to regionSplit was a single region.
// E.g. faceZone 'a' with the cells split into two regions
// by a notch formed by two walls
//
// \ /
// \ /
// ---a----+-----a-----
//
//
// Note that reworking the cellToProc might make the decomposition
// unbalanced.
if (specifiedProcessorFaces.size())
{
const faceZoneMesh& fZones = faceZones();
forAll(zNameAndProcs, i)
{
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
const faceZone& fz = fZones[zoneI];
if (fz.size())
{
label procI = zNameAndProcs[i].second();
if (procI == -1)
{
// If no processor specified use the one from the
// 0th element
procI = cellToProc_[faceOwner()[fz[0]]];
}
forAll(fz, fzI)
{
label faceI = fz[fzI];
cellToProc_[faceOwner()[faceI]] = procI;
if (isInternalFace(faceI))
{
cellToProc_[faceNeighbour()[faceI]] = procI;
}
}
}
}
}
}

View File

@ -576,13 +576,13 @@ void ensightPointField
label ensightPatchI = eMesh.patchPartOffset();
forAll(allPatchNames, patchi)
{
const word& patchName = allPatchNames[patchi];
eMesh.barrier();
if (patchNames.empty() || patchNames.found(patchName))
{
const fvPatch& p = mesh.boundary()[patchi];
@ -603,24 +603,24 @@ void ensightPointField
pointToGlobal,
uniqueMeshPointLabels
);
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
}
writeField
(
"coordinates",
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
ensightFile
);
ensightPatchI++;
}
}
}
// write faceZones, if requested
if (faceZoneNames.size())
{

View File

@ -20,7 +20,7 @@ dictionaryReplacement
{
".*"
{
type directMappedPatch;
type mappedPatch;
}
}