Commit 65db55bc authored by laurence's avatar laurence
Browse files

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

parents cf89f77c 9b30d01b
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object meshQualityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Maximum non-orthogonality allowed. Set to 180 to disable.
maxNonOrtho 65;
//- Max skewness allowed. Set to <0 to disable.
maxBoundarySkewness 50;
//- Max skewness allowed. Set to <0 to disable.
maxInternalSkewness 10;
//- Max concaveness allowed. Is angle (in degrees) below which concavity
// is allowed. 0 is straight face, <0 would be convex face.
// Set to 180 to disable.
maxConcave 80;
//- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minVol 1e-20;
//- Minimum quality of the tet formed by the face-centre
// and variable base point minimum decomposition triangles and
// the cell centre. This has to be a positive number for tracking
// to work. Set to very negative number (e.g. -1E30) to
// disable.
// <0 = inside out tet,
// 0 = flat tet
// 1 = regular tet
minTetQuality 1e-30;
//- Minimum face area. Set to <0 to disable.
minArea -1;
//- Minimum face twist. Set to <-1 to disable. dot product of face normal
//- and face centre triangles normal
minTwist 0.0;
//- minimum normalised cell determinant
//- 1 = hex, <= 0 = folded or flattened illegal cell
minDeterminant 0.001;
//- minFaceWeight (0 -> 0.5)
minFaceWeight 0.02;
//- minVolRatio (0 -> 1)
minVolRatio 0.01;
//must be >0 for Fluent compatibility
minTriangleTwist -1;
// ************************************************************************* //
......@@ -43,7 +43,7 @@ inline bool Foam::pointEdgeCollapse::update
<< "problem." << abort(FatalError);
}
if (w2.collapseIndex_ == -1)
if (w2.collapseIndex_ == -1 || collapseIndex_ == -1)
{
// Not marked for collapse; only happens on edges.
return false;
......@@ -56,11 +56,11 @@ inline bool Foam::pointEdgeCollapse::update
}
else
{
// Same coordinate. Same string?
// Take over w2 if it is 'better'
if (w2.collapseIndex_ < collapseIndex_)
{
// Take over string index from w2 (and also coordinate but this
// was same)
// Take over string index and coordinate from w2
operator=(w2);
return true;
}
......@@ -85,35 +85,6 @@ inline bool Foam::pointEdgeCollapse::update
{
return false;
}
// if (samePoint(w2.collapsePoint_))
// {
// // Same coordinate. Same string?
// if (w2.collapseIndex_ < collapseIndex_)
// {
// // Take over string index from w2 (and also coordinate but
// // this was same)
// operator=(w2);
// return true;
// }
// else
// {
// return false;
// }
// }
// else
// {
// // Find nearest coordinate
// if (magSqr(w2.collapsePoint_) < magSqr(collapsePoint_))
// {
// operator=(w2);
// return true;
// }
// else
// {
// return false;
// }
// }
}
}
......
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-ltriSurface \
-lautoMesh \
-lmeshTools
......@@ -123,14 +123,6 @@ void writeMesh
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
Foam::argList::addBoolOption
(
"checkOnly",
"check existing mesh against snappyHexMeshDict settings"
);
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
......@@ -141,8 +133,6 @@ int main(int argc, char *argv[])
const bool overwrite = args.optionFound("overwrite");
const bool checkOnly = args.optionFound("checkOnly");
// Check patches and faceZones are synchronised
mesh.boundaryMesh().checkParallelSync(true);
meshRefinement::checkCoupledFaceZones(mesh);
......@@ -184,36 +174,6 @@ int main(int argc, char *argv[])
);
if (checkOnly)
{
Info<< "Checking initial mesh ..." << endl;
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
motionSmoother::checkMesh(false, mesh, motionDict, wrongFaces);
const label nInitErrors = returnReduce
(
wrongFaces.size(),
sumOp<label>()
);
Info<< "Detected " << nInitErrors << " illegal faces"
<< " (concave, zero area or negative cell pyramid volume)"
<< endl;
if (nInitErrors > 0)
{
Info<< "Writing " << nInitErrors
<< " faces in error to set "
<< wrongFaces.name() << endl;
wrongFaces.instance() = mesh.pointsInstance();
wrongFaces.write();
}
Info<< "End\n" << endl;
return 0;
}
// Read decomposePar dictionary
IOdictionary decomposeDict
......
printMeshStats.C
checkTopology.C
checkGeometry.C
checkMeshQuality.C
checkMesh.C
EXE = $(FOAM_APPBIN)/checkMesh
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lmeshTools
-lmeshTools \
-ldynamicMesh
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -27,6 +27,21 @@ Application
Description
Checks validity of a mesh
Usage
- checkMesh [OPTION]
\param -allGeometry \n
Checks all (including non finite-volume specific) geometry
\param -allTopology \n
Checks all (including non finite-volume specific) addressing
\param -meshQualityDict \n
Checks against user defined (in \a system/meshQualityDict) quality settings
\param -region \<name\> \n
Specify an alternative mesh region.
\*---------------------------------------------------------------------------*/
#include "argList.H"
......@@ -39,6 +54,7 @@ Description
#include "printMeshStats.H"
#include "checkTopology.H"
#include "checkGeometry.H"
#include "checkMeshQuality.H"
using namespace Foam;
......@@ -63,6 +79,11 @@ int main(int argc, char *argv[])
"allTopology",
"include extra topology checks"
);
argList::addBoolOption
(
"meshQualityDict",
"read user-defined mesh quality criterions from system/meshQualityDict"
);
# include "setRootCase.H"
# include "createTime.H"
......@@ -72,6 +93,46 @@ 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");
if (noTopology)
{
Info<< "Disabling all topology checks." << nl << endl;
}
if (allTopology)
{
Info<< "Enabling all (cell, face, edge, point) topology checks."
<< nl << endl;
}
if (allGeometry)
{
Info<< "Enabling all geometry checks." << nl << endl;
}
if (meshQualityDict)
{
Info<< "Enabling user-defined geometry checks." << nl << endl;
}
autoPtr<IOdictionary> qualDict;
if (meshQualityDict)
{
qualDict.reset
(
new IOdictionary
(
IOobject
(
"meshQualityDict",
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
forAll(timeDirs, timeI)
{
......@@ -96,25 +157,31 @@ int main(int argc, char *argv[])
printMeshStats(mesh, allTopology);
label noFailedChecks = 0;
label nFailedChecks = 0;
if (!noTopology)
{
noFailedChecks += checkTopology(mesh, allTopology, allGeometry);
nFailedChecks += checkTopology(mesh, allTopology, allGeometry);
}
nFailedChecks += checkGeometry(mesh, allGeometry);
if (meshQualityDict)
{
nFailedChecks += checkMeshQuality(mesh, qualDict());
}
noFailedChecks += checkGeometry(mesh, allGeometry);
// Note: no reduction in noFailedChecks necessary since is
// Note: no reduction in nFailedChecks necessary since is
// counter of checks, not counter of failed cells,faces etc.
if (noFailedChecks == 0)
if (nFailedChecks == 0)
{
Info<< "\nMesh OK.\n" << endl;
}
else
{
Info<< "\nFailed " << noFailedChecks << " mesh checks.\n"
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
<< endl;
}
}
......@@ -124,6 +191,12 @@ int main(int argc, char *argv[])
label nFailedChecks = checkGeometry(mesh, allGeometry);
if (meshQualityDict)
{
nFailedChecks += checkMeshQuality(mesh, qualDict());
}
if (nFailedChecks)
{
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
......
#include "checkMeshQuality.H"
#include "polyMesh.H"
#include "cellSet.H"
#include "faceSet.H"
#include "motionSmoother.H"
Foam::label Foam::checkMeshQuality
(
const polyMesh& mesh,
const dictionary& dict
)
{
label noFailedChecks = 0;
{
faceSet faces(mesh, "meshQualityFaces", mesh.nFaces()/100+1);
motionSmoother::checkMesh(false, mesh, dict, faces);
label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{
noFailedChecks++;
Info<< " <<Writing " << nFaces
<< " faces in error to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
return noFailedChecks;
}
#include "polyMesh.H"
namespace Foam
{
label checkMeshQuality(const polyMesh& mesh, const dictionary&);
}
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -52,6 +52,7 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
......@@ -77,7 +78,7 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
if
(
model != hex
// && model != wedge // See above.
&& model != wedge // See above.
&& model != prism
&& model != pyr
&& model != tet
......@@ -164,21 +165,21 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
cellTypes_[cellI] = VTK_WEDGE;
}
// else if (cellModel == wedge)
// {
// // Treat as squeezed hex
// vtkVerts.setSize(8);
// vtkVerts[0] = cellShape[0];
// vtkVerts[1] = cellShape[1];
// vtkVerts[2] = cellShape[2];
// vtkVerts[3] = cellShape[0];
// vtkVerts[4] = cellShape[3];
// vtkVerts[5] = cellShape[4];
// vtkVerts[6] = cellShape[5];
// vtkVerts[7] = cellShape[6];
//
// cellTypes_[cellI] = VTK_HEXAHEDRON;
// }
else if (cellModel == wedge)
{
// Treat as squeezed hex
vtkVerts.setSize(8);
vtkVerts[0] = cellShape[0];
vtkVerts[1] = cellShape[1];
vtkVerts[2] = cellShape[2];
vtkVerts[3] = cellShape[2];
vtkVerts[4] = cellShape[3];
vtkVerts[5] = cellShape[4];
vtkVerts[6] = cellShape[5];
vtkVerts[7] = cellShape[6];
cellTypes_[cellI] = VTK_HEXAHEDRON;
}
else if (cellModel == hex)
{
vtkVerts = cellShape;
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment