mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -15,6 +15,9 @@
|
||||
const volScalarField& kappa = tkappa();
|
||||
//const volSymmTensorField& K = tK();
|
||||
|
||||
tmp<volScalarField> trhoCp = cp*rho;
|
||||
const volScalarField& rhoCp = trhoCp();
|
||||
|
||||
volScalarField& T = thermo.T();
|
||||
|
||||
IObasicSourceList& sources = solidHeatSources[i];
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
tmp<fvScalarMatrix> TEqn
|
||||
(
|
||||
- fvm::laplacian(betav*kappa, T, "laplacian(K,T)")
|
||||
+ sources(rho, T)
|
||||
+ sources(rhoCp, T)
|
||||
);
|
||||
|
||||
TEqn().relax();
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
const volScalarField& kappa = tkappa();
|
||||
//const volSymmTensorField& K = tK();
|
||||
|
||||
tmp<volScalarField> trhoCp = cp*rho;
|
||||
const volScalarField& rhoCp = trhoCp();
|
||||
|
||||
volScalarField& T = thermo.T();
|
||||
|
||||
IObasicSourceList& sources = solidHeatSources[i];
|
||||
|
||||
@ -10,7 +10,7 @@ if (finalIter)
|
||||
(
|
||||
fvm::ddt(betav*rho*cp, T)
|
||||
- fvm::laplacian(betav*kappa, T, "laplacian(K,T)")
|
||||
+ sources(rho, T)
|
||||
+ sources(rhoCp, T)
|
||||
);
|
||||
|
||||
TEqn().relax();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
/*--------------------------------*- 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;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Move points:
|
||||
// Move boundary points:
|
||||
// Every entry is two coordinates. First one is location of the point to move,
|
||||
// the second is the position to move to.
|
||||
pointsToMove
|
||||
@ -22,15 +22,15 @@ pointsToMove
|
||||
(( -0.17861 -0.45073 0.75276)( -0.18 -0.45073 0.75276))
|
||||
);
|
||||
|
||||
// Split edge in two:
|
||||
// First coord is a point on the edge to cut, second is the position of the
|
||||
// newly introduced point
|
||||
// Split boundary edge in two:
|
||||
// First coord is a point on the (boundary) edge to cut, second is the
|
||||
// position of the newly introduced point
|
||||
edgesToSplit
|
||||
(
|
||||
(( -0.17692 -0.45312 0.74516)( -0.18 -0.45 0.742))
|
||||
);
|
||||
|
||||
// Triangulate a face:
|
||||
// Triangulate a boundary face:
|
||||
// First coord is a point on the face to triangulate. It will introduce a
|
||||
// point on the face, triangulate and move the point to the second coordinate.
|
||||
facesToTriangulate
|
||||
@ -38,8 +38,8 @@ facesToTriangulate
|
||||
(( -0.039123 -0.45045 0.74083) (-0.03844 -0.45049 0.73572))
|
||||
);
|
||||
|
||||
// Edges to collapse. First coord is point on the edge, second is coordinate
|
||||
// to collapse to.
|
||||
// Boundary edges to collapse. First coord is point on the edge, second
|
||||
// is coordinate to collapse to.
|
||||
edgesToCollapse
|
||||
(
|
||||
((0.054975 0.099987 0.0044074)(0.054975 0.099987 0.0044074))
|
||||
@ -55,7 +55,8 @@ cellsToSplit
|
||||
);
|
||||
|
||||
// Change patch:
|
||||
// Changes patchID of faces. Coord selects the face, label is the patch index.
|
||||
// Changes patchID of boundary faces. Coord selects the face, label is the
|
||||
// patch index.
|
||||
facesToRepatch
|
||||
(
|
||||
(( -0.039123 -0.45045 0.74083) 1)
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
checkCvMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/checkCvMesh
|
||||
@ -1,14 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
checkCvMesh
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "autoSnapDriver.H"
|
||||
#include "faceSet.H"
|
||||
#include "motionSmoother.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "addOverwriteOption.H"
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createNamedPolyMesh.H"
|
||||
|
||||
runTime.functionObjects().off();
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName()
|
||||
<< nl << endl;
|
||||
|
||||
mesh.readUpdate();
|
||||
|
||||
// Check patches and faceZones are synchronised
|
||||
mesh.boundaryMesh().checkParallelSync(true);
|
||||
meshRefinement::checkCoupledFaceZones(mesh);
|
||||
|
||||
// Read meshing dictionary
|
||||
IOdictionary cvMeshDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cvMeshDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// mesh motion and mesh quality parameters
|
||||
const dictionary& meshQualityDict
|
||||
= cvMeshDict.subDict("meshQualityControls");
|
||||
|
||||
|
||||
Info<< "Checking mesh ..." << endl;
|
||||
|
||||
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
||||
|
||||
motionSmoother::checkMesh(false, mesh, meshQualityDict, 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<< nl << "End of time " << runTime.timeName() << nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -251,10 +251,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 +297,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 +525,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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
printMeshStats.C
|
||||
checkTopology.C
|
||||
checkGeometry.C
|
||||
checkMeshQuality.C
|
||||
checkMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/checkMesh
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
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);
|
||||
}
|
||||
|
||||
noFailedChecks += checkGeometry(mesh, allGeometry);
|
||||
nFailedChecks += checkGeometry(mesh, allGeometry);
|
||||
|
||||
// Note: no reduction in noFailedChecks necessary since is
|
||||
if (meshQualityDict)
|
||||
{
|
||||
nFailedChecks += checkMeshQuality(mesh, qualDict());
|
||||
}
|
||||
|
||||
|
||||
// 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"
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
#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;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
#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) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -554,6 +554,15 @@ public:
|
||||
const int tag = UPstream::msgType()
|
||||
);
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void distribute
|
||||
(
|
||||
DynamicList<T>& fld,
|
||||
const bool dummyTransform = true,
|
||||
const int tag = UPstream::msgType()
|
||||
) const;
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void distribute
|
||||
|
||||
@ -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
|
||||
@ -887,6 +887,25 @@ void Foam::mapDistribute::applyInverseTransforms
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
(
|
||||
DynamicList<T>& fld,
|
||||
const bool dummyTransform,
|
||||
const int tag
|
||||
) const
|
||||
{
|
||||
fld.shrink();
|
||||
|
||||
List<T>& fldList = static_cast<List<T>& >(fld);
|
||||
|
||||
distribute(fldList, dummyTransform, tag);
|
||||
|
||||
fld.setCapacity(fldList.size());
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
|
||||
@ -634,7 +634,7 @@ bool Foam::processorPolyPatch::order
|
||||
fileName str
|
||||
(
|
||||
boundaryMesh().mesh().time().path()
|
||||
/name()/name()+"_faces.obj"
|
||||
/name() + "_faces.obj"
|
||||
);
|
||||
Pout<< "processorPolyPatch::order :"
|
||||
<< " Writing faces to OBJ file " << str.name() << endl;
|
||||
|
||||
@ -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
|
||||
@ -127,9 +127,7 @@ public:
|
||||
// A point can be deleted if
|
||||
// - it is not used by any edge.
|
||||
// or
|
||||
// - is not used by an internal edge
|
||||
// - is used by only two boundary edges. (note that these two
|
||||
// edges will always be boundary ones!)
|
||||
// - is used by only two edges
|
||||
// - these two edges are sufficiently in line (cos > minCos)
|
||||
// - all processors agree that point can be deleted.
|
||||
label countPointUsage
|
||||
|
||||
@ -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
|
||||
@ -132,7 +132,7 @@ void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
vector hatAxis = axis_/mag(axis_);
|
||||
|
||||
const vectorField r(patch().Cf() - centre_);
|
||||
tmp<vectorField> d = r - (hatAxis & r)*hatAxis;
|
||||
const vectorField d = r - (hatAxis & r)*hatAxis;
|
||||
|
||||
tmp<vectorField> tangVel
|
||||
(
|
||||
|
||||
@ -6,7 +6,8 @@ cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication cvMesh
|
||||
runApplication snappyHexMesh
|
||||
#runApplication collapseEdges 1e-10 180 -overwrite
|
||||
runApplication snappyHexMesh -overwrite
|
||||
runApplication checkMesh -constant -allGeometry -allTopology
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -92,6 +92,8 @@ surfaceConformation
|
||||
|
||||
surfaceConformationRebuildFrequency 10;
|
||||
|
||||
specialiseFeaturePoints off;
|
||||
|
||||
conformationControls
|
||||
{
|
||||
initial
|
||||
@ -230,18 +232,8 @@ polyMeshFiltering
|
||||
|
||||
meshQualityControls
|
||||
{
|
||||
maxNonOrtho 65;
|
||||
maxBoundarySkewness 50;
|
||||
maxInternalSkewness 10;
|
||||
maxConcave 80;
|
||||
minVol 1e-20;
|
||||
minTetQuality 1e-30;
|
||||
minArea -1;
|
||||
minTwist 0.0;
|
||||
minDeterminant 0.001;
|
||||
minFaceWeight 0.02;
|
||||
minVolRatio 0.01;
|
||||
minTriangleTwist -1;
|
||||
#include "meshQualityDict"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
73
tutorials/mesh/cvMesh/blob/system/meshQualityDict
Normal file
73
tutorials/mesh/cvMesh/blob/system/meshQualityDict
Normal file
@ -0,0 +1,73 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: 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;
|
||||
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 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 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 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.001;
|
||||
|
||||
//- 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;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -282,53 +282,7 @@ addLayersControls
|
||||
// where to undo.
|
||||
meshQualityControls
|
||||
{
|
||||
//- Maximum non-orthogonality allowed. Set to 180 to disable.
|
||||
maxNonOrtho 65;
|
||||
|
||||
//- Max skewness allowed. Set to <0 to disable.
|
||||
maxBoundarySkewness 20;
|
||||
maxInternalSkewness 4;
|
||||
|
||||
//- 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-13;
|
||||
|
||||
//- 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 -1; //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.02;
|
||||
|
||||
//- 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;
|
||||
|
||||
#include "meshQualityDict"
|
||||
|
||||
// Advanced
|
||||
|
||||
|
||||
Reference in New Issue
Block a user