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

This commit is contained in:
laurence
2012-05-31 17:22:34 +01:00
502 changed files with 6050 additions and 24228 deletions

View File

@ -35,6 +35,16 @@ Description
the boundary point intact. When both points inside it chooses random. When
both points on boundary random again.
Usage
- collapseEdges <edge length> <merge angle> [OPTION]
\param -allowCellCollapse \n
Allow collapsing of cells to a single point
\param -meshQuality \n
Only collapse if not exceeding user defined (in \a system/meshQualityDict)
quality settings
\*---------------------------------------------------------------------------*/
#include "argList.H"
@ -1178,7 +1188,7 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"checkMeshQuality",
"meshQuality",
"Only collapse if not exceeding given meshQualityDict limits"
);
@ -1195,7 +1205,7 @@ int main(int argc, char *argv[])
const bool allowCellCollapse = args.optionFound("allowCellCollapse");
const bool overwrite = args.optionFound("overwrite");
const bool checkQuality = args.optionFound("checkMeshQuality");
const bool checkQuality = args.optionFound("meshQuality");
scalar maxCos = Foam::cos(degToRad(angle));

View File

@ -96,8 +96,9 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
if (cellSizeFunctions_.size())
{
// Initialise to the last (lowest) priority
label previousPriority = cellSizeFunctions_.last().priority();
// Maintain priority of current hit. Initialise so it always goes
// through at least once.
label previousPriority = -1;
forAll(cellSizeFunctions_, i)
{

View File

@ -196,7 +196,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
{
if (vit->internalPoint() && !vit->nearBoundary())
{
const Foam::point& pt = topoint(vit->point());
pointFromPoint pt = topoint(vit->point());
const scalar range = sqr(2.0*targetCellSize(pt));
pointIndexHit pHit;

View File

@ -238,6 +238,25 @@ int main(int argc, char *argv[])
dict.lookup("constructFrom")
);
// Any merging of small edges
const scalar mergeTol(dict.lookupOrDefault<scalar>("mergeTol", 1e-4));
Info<< "Extruding from " << ExtrudeModeNames[mode]
<< " using model " << model().type() << endl;
if (flipNormals)
{
Info<< "Flipping normals before extruding" << endl;
}
if (mergeTol > 0)
{
Info<< "Collapsing edges < " << mergeTol << " of bounding box" << endl;
}
else
{
Info<< "Not collapsing any edges after extrusion" << endl;
}
Info<< endl;
// Generated mesh (one of either)
autoPtr<fvMesh> meshFromMesh;
@ -251,10 +270,10 @@ int main(int argc, char *argv[])
if (mode == PATCH || mode == MESH)
{
if (flipNormals)
if (flipNormals && mode == MESH)
{
FatalErrorIn(args.executable())
<< "Flipping normals not supported for extrusions from patch."
<< "Flipping normals not supported for extrusions from mesh."
<< exit(FatalError);
}
@ -297,6 +316,60 @@ int main(int argc, char *argv[])
addPatchCellLayer layerExtrude(mesh, (mode == MESH));
const labelList meshFaces(patchFaces(patches, sourcePatches));
if (mode == PATCH && flipNormals)
{
// Cheat. Flip patch faces in mesh. This invalidates the
// mesh (open cells) but does produce the correct extrusion.
polyTopoChange meshMod(mesh);
forAll(meshFaces, i)
{
label meshFaceI = meshFaces[i];
label patchI = patches.whichPatch(meshFaceI);
label own = mesh.faceOwner()[meshFaceI];
label nei = -1;
if (patchI == -1)
{
nei = mesh.faceNeighbour()[meshFaceI];
}
label zoneI = mesh.faceZones().whichZone(meshFaceI);
bool zoneFlip = false;
if (zoneI != -1)
{
label index = mesh.faceZones()[zoneI].whichFace(meshFaceI);
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
}
meshMod.modifyFace
(
mesh.faces()[meshFaceI].reverseFace(), // modified face
meshFaceI, // label of face
own, // owner
nei, // neighbour
true, // face flip
patchI, // patch for face
zoneI, // zone for face
zoneFlip // face flip in zone
);
}
// Change the mesh. No inflation.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
// Update fields
mesh.updateMesh(map);
// Move mesh (since morphing does not do this)
if (map().hasMotionPoints())
{
mesh.movePoints(map().preMotionPoints());
}
}
indirectPrimitivePatch extrudePatch
(
IndirectList<face>
@ -471,11 +544,6 @@ int main(int argc, char *argv[])
displacement[pointI] = extrudePt - layer0Points[pointI];
}
if (flipNormals)
{
Info<< "Flipping faces." << nl << endl;
displacement = -displacement;
}
// Check if wedge (has layer0 different from original patch points)
// If so move the mesh to starting position.
@ -666,7 +734,7 @@ int main(int argc, char *argv[])
const boundBox& bb = mesh.bounds();
const vector span = bb.span();
const scalar mergeDim = 1e-4 * bb.minDim();
const scalar mergeDim = mergeTol * bb.minDim();
Info<< "Mesh bounding box : " << bb << nl
<< " with span : " << span << nl
@ -677,6 +745,7 @@ int main(int argc, char *argv[])
// Collapse edges
// ~~~~~~~~~~~~~~
if (mergeDim > 0)
{
Info<< "Collapsing edges < " << mergeDim << " ..." << nl << endl;

View File

@ -31,7 +31,8 @@ exposedPatchName movingWall;
// If construct from surface:
surface "movingWall.stl";
// Flip surface normals before usage.
// Flip surface normals before usage. Valid only for extrude from surface or
// patch.
flipNormals false;
//- Linear extrusion in point-normal direction
@ -87,4 +88,8 @@ sigmaRadialCoeffs
// degree wedges.
mergeFaces false; //true;
// Merge small edges. Fraction of bounding box.
mergeTol 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,7 +36,7 @@ Usage
\param -allTopology \n
Checks all (including non finite-volume specific) addressing
\param -meshQualityDict \n
\param -meshQuality \n
Checks against user defined (in \a system/meshQualityDict) quality settings
\param -region \<name\> \n
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"meshQualityDict",
"meshQuality",
"read user-defined mesh quality criterions from system/meshQualityDict"
);
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.optionFound("allGeometry");
const bool allTopology = args.optionFound("allTopology");
const bool meshQualityDict = args.optionFound("meshQualityDict");
const bool meshQuality = args.optionFound("meshQuality");
if (noTopology)
{
@ -108,14 +108,14 @@ int main(int argc, char *argv[])
{
Info<< "Enabling all geometry checks." << nl << endl;
}
if (meshQualityDict)
if (meshQuality)
{
Info<< "Enabling user-defined geometry checks." << nl << endl;
}
autoPtr<IOdictionary> qualDict;
if (meshQualityDict)
if (meshQuality)
{
qualDict.reset
(
@ -166,7 +166,7 @@ int main(int argc, char *argv[])
nFailedChecks += checkGeometry(mesh, allGeometry);
if (meshQualityDict)
if (meshQuality)
{
nFailedChecks += checkMeshQuality(mesh, qualDict());
}
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
label nFailedChecks = checkGeometry(mesh, allGeometry);
if (meshQualityDict)
if (meshQuality)
{
nFailedChecks += checkMeshQuality(mesh, qualDict());
}