mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: added option to check mesh
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,6 +46,8 @@ Description
|
|||||||
#include "snapParameters.H"
|
#include "snapParameters.H"
|
||||||
#include "layerParameters.H"
|
#include "layerParameters.H"
|
||||||
|
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "motionSmoother.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -122,6 +124,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
# include "addOverwriteOption.H"
|
# include "addOverwriteOption.H"
|
||||||
|
|
||||||
|
Foam::argList::addBoolOption
|
||||||
|
(
|
||||||
|
"checkOnly",
|
||||||
|
"check existing mesh against snappyHexMeshDict settings"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
runTime.functionObjects().off();
|
runTime.functionObjects().off();
|
||||||
@ -132,24 +141,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const bool overwrite = args.optionFound("overwrite");
|
const bool overwrite = args.optionFound("overwrite");
|
||||||
|
|
||||||
|
const bool checkOnly = args.optionFound("checkOnly");
|
||||||
|
|
||||||
// Check patches and faceZones are synchronised
|
// Check patches and faceZones are synchronised
|
||||||
mesh.boundaryMesh().checkParallelSync(true);
|
mesh.boundaryMesh().checkParallelSync(true);
|
||||||
meshRefinement::checkCoupledFaceZones(mesh);
|
meshRefinement::checkCoupledFaceZones(mesh);
|
||||||
|
|
||||||
|
|
||||||
// Read decomposePar dictionary
|
|
||||||
IOdictionary decomposeDict
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"decomposeParDict",
|
|
||||||
runTime.system(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Read meshing dictionary
|
// Read meshing dictionary
|
||||||
IOdictionary meshDict
|
IOdictionary meshDict
|
||||||
(
|
(
|
||||||
@ -186,6 +184,51 @@ 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
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"decomposeParDict",
|
||||||
|
runTime.system(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
// ~~~~~
|
// ~~~~~
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user