Commit 0238fa97 authored by andy's avatar andy
Browse files

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

parents 5a80198b f669dfe8
......@@ -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();
......
/*--------------------------------*- 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)
......
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
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
......
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");