Commit b0a68b77 authored by Henry's avatar Henry
Browse files
parents 2bacd813 14240e93
......@@ -5,7 +5,7 @@ tmp<fvVectorMatrix> UEqn
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
==
fvOptions(U)
);
......@@ -17,7 +17,7 @@ rAU = 1.0/UEqn().A();
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p) + fvOptions(U));
solve(UEqn() == -fvc::grad(p));
fvOptions.correct(U);
}
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -47,6 +47,8 @@ Description
#include "snapParameters.H"
#include "layerParameters.H"
#include "vtkSetWriter.H"
#include "faceSet.H"
#include "motionSmoother.H"
using namespace Foam;
......@@ -675,6 +677,31 @@ int main(int argc, char *argv[])
}
{
// Check final mesh
Info<< "Checking final mesh ..." << endl;
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
motionSmoother::checkMesh(false, mesh, motionDict, wrongFaces);
const label nErrors = returnReduce
(
wrongFaces.size(),
sumOp<label>()
);
if (nErrors > 0)
{
Info<< "Finished meshing with " << nErrors << " illegal faces"
<< " (concave, zero area or negative cell pyramid volume)"
<< endl;
wrongFaces.write();
}
else
{
Info<< "Finished meshing without any errors" << endl;
}
}
Info<< "Finished meshing in = "
<< runTime.elapsedCpuTime() << " s." << endl;
......
......@@ -832,5 +832,39 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
}
}
if (allGeometry)
{
faceSet faces(mesh, "lowWeightFaces", mesh.nFaces()/100);
if (mesh.checkFaceWeight(true, 0.05, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with low interpolation weights to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
if (allGeometry)
{
faceSet faces(mesh, "lowVolRatioFaces", mesh.nFaces()/100);
if (mesh.checkVolRatio(true, 0.05, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with low volume ratio cells to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
return noFailedChecks;
}
......@@ -138,6 +138,8 @@ baffles
//- Select faces and orientation through a searchableSurface
type searchableSurface;
surface searchablePlate;
//name sphere.stl; // name if surface=triSurfaceMesh
origin (0.099 -0.006 0.004);
span (0 0.012 0.012);
......
......@@ -28,6 +28,7 @@ License
#include "syncTools.H"
#include "searchableSurface.H"
#include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -61,7 +62,15 @@ Foam::faceSelections::searchableSurfaceSelection::searchableSurfaceSelection
searchableSurface::New
(
word(dict.lookup("surface")),
mesh.objectRegistry::db(),
IOobject
(
dict.lookupOrDefault("name", mesh.objectRegistry::db().name()),
mesh.time().constant(),
"triSurface",
mesh.objectRegistry::db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
dict
)
)
......
......@@ -378,6 +378,7 @@ FoamFile
// surface searchableSphere;
// centre (0.05 0.05 0.005);
// radius 0.025;
// //name sphere.stl; // Optional name if surface triSurfaceMesh
// }
// }
//
......
......@@ -2,21 +2,26 @@
cd ${0%/*} || exit 1 # run from this directory
#set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
[ -n "$PV_PLUGIN_PATH" ] || {
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
exit 1
}
if [ "$ParaView_VERSION" == "3.98.1" ]
then
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
[ -n "$PV_PLUGIN_PATH" ] || {
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
exit 1
}
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
wmake libso vtkPV398Readers
PV398blockMeshReader/Allwmake
PV398FoamReader/Allwmake
wmake libso vtkPV398Readers
PV398blockMeshReader/Allwmake
PV398FoamReader/Allwmake
else
echo "ERROR: ParaView not found in $ParaView_DIR"
fi
else
echo "ERROR: ParaView not found in $ParaView_DIR"
echo "WARN: PV398 readers not building: ParaView_VERSION=$ParaView_VERSION"
fi
# ----------------------------------------------------------------- end-of-file
......@@ -2,21 +2,26 @@
cd ${0%/*} || exit 1 # run from this directory
#set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
[ -n "$PV_PLUGIN_PATH" ] || {
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
exit 1
}
if [ "$ParaView_VERSION" != "3.98.1" ]
then
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
[ -n "$PV_PLUGIN_PATH" ] || {
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
exit 1
}
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
wmake libso vtkPV3Readers
PV3blockMeshReader/Allwmake
PV3FoamReader/Allwmake
wmake libso vtkPV3Readers
PV3blockMeshReader/Allwmake
PV3FoamReader/Allwmake
else
echo "ERROR: ParaView not found in $ParaView_DIR"
fi
else
echo "ERROR: ParaView not found in $ParaView_DIR"
echo "WARN: PV3 readers not building: ParaView_VERSION=$ParaView_VERSION"
fi
# ----------------------------------------------------------------- end-of-file
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -179,7 +179,10 @@ void Foam::vtkPV3Foam::convertMeshPatches
const word patchName = getPartName(partId);
labelHashSet patchIds(patches.patchSet(List<wordRe>(1, patchName)));
labelHashSet patchIds
(
patches.patchSet(List<wordRe>(1, wordRe(patchName)))
);
if (debug)
{
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -182,8 +182,17 @@ void Foam::csvTableReader<Type>::write(Ostream& os) const
<< headerLine_ << token::END_STATEMENT << nl;
os.writeKeyword("timeColumn")
<< timeColumn_ << token::END_STATEMENT << nl;
os.writeKeyword("valueColumns")
<< componentColumns_ << token::END_STATEMENT << nl;
// Force writing labelList in ascii
os.writeKeyword("valueColumns");
if (os.format() == IOstream::BINARY)
{
os.format(IOstream::ASCII);
os << componentColumns_;
os.format(IOstream::BINARY);
}
os << token::END_STATEMENT << nl;
os.writeKeyword("separator")
<< string(separator_) << token::END_STATEMENT << nl;
}
......
......@@ -265,6 +265,24 @@ private:
const Vector<label>& meshD
) const;
bool checkFaceWeight
(
const vectorField& fCtrs,
const vectorField& fAreas,
const vectorField& cellCtrs,
const bool report,
const scalar minWeight,
labelHashSet* setPtr
) const;
bool checkVolRatio
(
const scalarField& cellVols,
const bool report,
const scalar minRatio,
labelHashSet* setPtr
) const;
public:
// Public typedefs
......@@ -612,6 +630,22 @@ public:
const bool detailedReport = false
) const;
//- Check for face weights
virtual bool checkFaceWeight
(
const bool report,
const scalar minWeight = 0.05,
labelHashSet* setPtr = NULL
) const;
//- Check for neighbouring cell volumes
virtual bool checkVolRatio
(
const bool report,
const scalar minRatio = 0.01,
labelHashSet* setPtr = NULL
) const;
// Helper functions
......
......@@ -142,7 +142,8 @@ bool Foam::polyMesh::checkFaceOrthogonality
if (severeNonOrth > 0)
{
Info<< " *Number of severely non-orthogonal faces: "
Info<< " *Number of severely non-orthogonal (> "
<< primitiveMesh::nonOrthThreshold_ << " degrees) faces: "
<< severeNonOrth << "." << endl;
}
}
......@@ -427,6 +428,8 @@ bool Foam::polyMesh::checkCellDeterminant
const Vector<label>& meshD
) const
{
const scalar warnDet = 1e-3;
if (debug)
{
Info<< "bool polyMesh::checkCellDeterminant(const bool"
......@@ -450,7 +453,7 @@ bool Foam::polyMesh::checkCellDeterminant
forAll (cellDeterminant, cellI)
{
if (cellDeterminant[cellI] < 1e-3)
if (cellDeterminant[cellI] < warnDet)
{
if (setPtr)
{
......@@ -480,7 +483,8 @@ bool Foam::polyMesh::checkCellDeterminant
{
if (debug || report)
{
Info<< " ***Cells with small determinant found, number of cells: "
Info<< " ***Cells with small determinant (< "
<< warnDet << ") found, number of cells: "
<< nErrorCells << endl;
}
......@@ -500,6 +504,192 @@ bool Foam::polyMesh::checkCellDeterminant
}
bool Foam::polyMesh::checkFaceWeight
(
const vectorField& fCtrs,
const vectorField& fAreas,
const vectorField& cellCtrs,
const bool report,
const scalar minWeight,
labelHashSet* setPtr
) const
{
if (debug)
{
Info<< "bool polyMesh::checkFaceWeight(const bool"
<< ", labelHashSet*) const: "
<< "checking for low face interpolation weights" << endl;
}
tmp<scalarField> tfaceWght = polyMeshTools::faceWeights
(
*this,
fCtrs,
fAreas,
cellCtrs
);
scalarField& faceWght = tfaceWght();
label nErrorFaces = 0;
scalar minDet = GREAT;
scalar sumDet = 0.0;
label nSummed = 0;
// Statistics only for internal and masters of coupled faces
PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*this));
forAll (faceWght, faceI)
{
if (faceWght[faceI] < minWeight)
{
// Note: insert both sides of coupled faces
if (setPtr)
{
setPtr->insert(faceI);
}
nErrorFaces++;
}
// Note: statistics only on master of coupled faces
if (isMasterFace[faceI])
{
minDet = min(minDet, faceWght[faceI]);
sumDet += faceWght[faceI];
nSummed++;
}
}
reduce(nErrorFaces, sumOp<label>());
reduce(minDet, minOp<scalar>());
reduce(sumDet, sumOp<scalar>());
reduce(nSummed, sumOp<label>());
if (debug || report)
{
if (nSummed > 0)
{
Info<< " Face interpolation weight : minimum: " << minDet
<< " average: " << sumDet/nSummed
<< endl;
}
}
if (nErrorFaces > 0)
{
if (debug || report)
{
Info<< " ***Faces with small interpolation weight (< " << minWeight
<< ") found, number of faces: "
<< nErrorFaces << endl;
}
return true;
}
else
{
if (debug || report)
{
Info<< " Face interpolation weight check OK." << endl;
}
return false;
}
return false;
}
bool Foam::polyMesh::checkVolRatio
(
const scalarField& cellVols,
const bool report,
const scalar minRatio,
labelHashSet* setPtr
) const
{
if (debug)
{
Info<< "bool polyMesh::checkVolRatio(const bool"
<< ", labelHashSet*) const: "
<< "checking for volume ratio < " << minRatio << endl;
}
tmp<scalarField> tvolRatio = polyMeshTools::volRatio(*this, cellVols);
scalarField& volRatio = tvolRatio();
label nErrorFaces = 0;
scalar minDet = GREAT;
scalar sumDet = 0.0;
label nSummed = 0;
// Statistics only for internal and masters of coupled faces
PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*this));
forAll (volRatio, faceI)
{
if (volRatio[faceI] < minRatio)
{
// Note: insert both sides of coupled faces
if (setPtr)
{
setPtr->insert(faceI);
}
nErrorFaces++;
}
// Note: statistics only on master of coupled faces
if (isMasterFace[faceI])
{
minDet = min(minDet, volRatio[faceI]);
sumDet += volRatio[faceI];
nSummed++;
}
}
reduce(nErrorFaces, sumOp<label>());
reduce(minDet, minOp<scalar>());
reduce(sumDet, sumOp<scalar>());
reduce(nSummed, sumOp<label>());
if (debug || report)
{
if (nSummed > 0)
{
Info<< " Face volume ratio : minimum: " << minDet
<< " average: " << sumDet/nSummed
<< endl;
}
}
if (nErrorFaces > 0)
{
if (debug || report)
{
Info<< " ***Faces with small volume ratio (< " << minRatio
<< ") found, number of faces: "
<< nErrorFaces << endl;
}
return true;
}
else
{
if (debug || report)
{
Info<< " Face volume ratio check OK." << endl;
}
return false;
}
return false;
}
//- Could override checkClosedBoundary to not look at (collocated!) coupled
// faces
//bool Foam::polyMesh::checkClosedBoundary(const bool report) const
......@@ -582,6 +772,36 @@ bool Foam::polyMesh::checkCellDeterminant
}
bool Foam::polyMesh::checkFaceWeight
(
const bool report,
const scalar minWeight,
labelHashSet* setPtr
) const
{
return checkFaceWeight
(
faceCentres(),
faceAreas(),
cellCentres(),
report,
minWeight,
setPtr
);
}
bool Foam::polyMesh::checkVolRatio
(
const bool report,
const scalar minRatio,
labelHashSet* setPtr
) const
{
return checkVolRatio(cellVolumes(), report, minRatio, setPtr);
}
bool Foam::polyMesh::checkMeshMotion
(
const pointField& newPoints,
......
......@@ -187,4 +187,112 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceSkewness
}