ENH: snappyHexMesh: user size limit. See #972.

This commit is contained in:
mattijs 2019-01-23 12:25:54 +00:00
parent 10da897275
commit 47d29b1cdd
2 changed files with 23 additions and 16 deletions

View File

@ -858,6 +858,11 @@ int main(int argc, char *argv[])
writer<scalar>::New(setFormat)
);
const scalar maxSizeRatio
(
meshDict.lookupOrDefault<scalar>("maxSizeRatio", 100.0)
);
// Read decomposePar dictionary
dictionary decomposeDict;
@ -1121,10 +1126,10 @@ int main(int argc, char *argv[])
// Check geometry
allGeometry.checkGeometry
(
100.0, // max size ratio
1e-9, // intersection tolerance
maxSizeRatio, // max size ratio
1e-9, // intersection tolerance
setFormatter,
0.01, // min triangle quality
0.01, // min triangle quality
true
);
@ -1146,12 +1151,12 @@ int main(int argc, char *argv[])
const boundBox& bb = s.bounds();
scalar ratio = bb.mag() / meshBb.mag();
if (ratio > 100.0 || ratio < 1.0/100.0)
if (ratio > maxSizeRatio || ratio < 1.0/maxSizeRatio)
{
Warning
<< " " << allGeometry.names()[geomi]
<< " bounds differ from mesh"
<< " by more than a factor 100:" << nl
<< " by more than a factor " << maxSizeRatio << ":" << nl
<< " bounding box : " << bb << nl
<< " mesh bounding box : " << meshBb
<< endl;
@ -1259,10 +1264,10 @@ int main(int argc, char *argv[])
OStringStream os;
bool hasErrors = features.checkSizes
(
100.0, //const scalar maxRatio,
maxSizeRatio, //const scalar maxRatio,
mesh.bounds(),
true, //const bool report,
os //FatalIOError
true, //const bool report,
os //FatalIOError
);
if (hasErrors)
{

View File

@ -143,8 +143,9 @@ bool Foam::motionSmootherAlgo::checkMesh
<< "Missing/incorrect required dictionary entries:" << nl
<< nl
<< IOerrorMsg.c_str() << nl
<< errorMsg.c_str() << nl << nl
<< "Exiting dry-run" << nl << endl;
<< errorMsg.c_str() << nl
//<< nl << "Exiting dry-run" << nl
<< endl;
FatalError.clear();
FatalIOError.clear();
@ -576,17 +577,18 @@ bool Foam::motionSmootherAlgo::checkMesh
if (errorMsg.size() || IOerrorMsg.size())
{
errorMsg = "[dryRun] " + errorMsg;
errorMsg.replaceAll("\n", "\n[dryRun] ");
IOerrorMsg = "[dryRun] " + IOerrorMsg;
IOerrorMsg.replaceAll("\n", "\n[dryRun] ");
//errorMsg = "[dryRun] " + errorMsg;
//errorMsg.replaceAll("\n", "\n[dryRun] ");
//IOerrorMsg = "[dryRun] " + IOerrorMsg;
//IOerrorMsg.replaceAll("\n", "\n[dryRun] ");
Perr<< nl
<< "Missing/incorrect required dictionary entries:" << nl
<< nl
<< IOerrorMsg.c_str() << nl
<< errorMsg.c_str() << nl << nl
<< "Exiting dry-run" << nl << endl;
<< errorMsg.c_str() << nl
//<< nl << "Exiting dry-run" << nl
<< endl;
FatalError.clear();
FatalIOError.clear();