Commit 346b31d9 authored by Henry Weller's avatar Henry Weller
Browse files

snappyHexMesh layerParameters: Increased maxIters to 20

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1918
Patch provided by Richard Jones

maxIters could be made an option input if 20 is not sufficient for
difficult cases.
parent cb048746
......@@ -48,12 +48,9 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
return 1.0;
}
//scalar totalOverFirst = totalThickness/firstLayerThickess;
const label maxIters = 10;
const label maxIters = 20;
const scalar tol = 1e-8;
if (mag(n-totalOverFirst) < tol)
{
return 1.0;
......@@ -74,8 +71,6 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
maxR = totalOverFirst/(n - 1);
}
//Info<< "Solution bounds = (" << minR << ", " << maxR << ")" << nl << endl;
// Starting guess
scalar r = 0.5*(minR + maxR);
......@@ -85,14 +80,9 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
const scalar fx = pow(r, n) - totalOverFirst*r - (1 - totalOverFirst);
const scalar dfx = n*pow(r, n - 1) - totalOverFirst;
r -= fx/dfx;
const scalar error = mag(r - prevr);
//Info<< i << " " << r << " Error = " << error << endl;
if (error < tol)
if (mag(r - prevr) < tol)
{
break;
}
......@@ -103,7 +93,6 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::layerParameters::layerParameters
(
const dictionary& dict,
......@@ -406,9 +395,9 @@ Foam::scalar Foam::layerParameters::layerThickness
}
else
{
return firstLayerThickess *
(1.0 - pow(expansionRatio, nLayers))
/ (1.0 - expansionRatio);
return firstLayerThickess
*(1.0 - pow(expansionRatio, nLayers))
/(1.0 - expansionRatio);
}
}
break;
......@@ -422,9 +411,9 @@ Foam::scalar Foam::layerParameters::layerThickness
else
{
scalar invExpansion = 1.0 / expansionRatio;
return finalLayerThickess *
(1.0 - pow(invExpansion, nLayers))
/ (1.0 - invExpansion);
return finalLayerThickess
*(1.0 - pow(invExpansion, nLayers))
/(1.0 - invExpansion);
}
}
break;
......@@ -472,7 +461,7 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
{
return
1.0
/ layerExpansionRatio
/layerExpansionRatio
(
nLayers,
totalThickness/finalLayerThickess
......@@ -565,8 +554,8 @@ Foam::scalar Foam::layerParameters::finalLayerThicknessRatio
{
return
pow(expansionRatio, nLayers - 1)
* (1.0 - expansionRatio)
/ (1.0 - pow(expansionRatio, nLayers));
*(1.0 - expansionRatio)
/(1.0 - pow(expansionRatio, nLayers));
}
}
else
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -326,7 +326,6 @@ public:
const label nLayers,
const scalar expansionRatio
) const;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment