mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / 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-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,12 +48,9 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
|
|||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//scalar totalOverFirst = totalThickness/firstLayerThickess;
|
const label maxIters = 20;
|
||||||
|
|
||||||
const label maxIters = 10;
|
|
||||||
const scalar tol = 1e-8;
|
const scalar tol = 1e-8;
|
||||||
|
|
||||||
|
|
||||||
if (mag(n-totalOverFirst) < tol)
|
if (mag(n-totalOverFirst) < tol)
|
||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
@ -74,8 +71,6 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
|
|||||||
maxR = totalOverFirst/(n - 1);
|
maxR = totalOverFirst/(n - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Info<< "Solution bounds = (" << minR << ", " << maxR << ")" << nl << endl;
|
|
||||||
|
|
||||||
// Starting guess
|
// Starting guess
|
||||||
scalar r = 0.5*(minR + maxR);
|
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 fx = pow(r, n) - totalOverFirst*r - (1 - totalOverFirst);
|
||||||
const scalar dfx = n*pow(r, n - 1) - totalOverFirst;
|
const scalar dfx = n*pow(r, n - 1) - totalOverFirst;
|
||||||
|
|
||||||
r -= fx/dfx;
|
r -= fx/dfx;
|
||||||
|
|
||||||
const scalar error = mag(r - prevr);
|
if (mag(r - prevr) < tol)
|
||||||
|
|
||||||
//Info<< i << " " << r << " Error = " << error << endl;
|
|
||||||
|
|
||||||
if (error < tol)
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -103,7 +93,6 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from dictionary
|
|
||||||
Foam::layerParameters::layerParameters
|
Foam::layerParameters::layerParameters
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -417,9 +406,9 @@ Foam::scalar Foam::layerParameters::layerThickness
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return firstLayerThickess *
|
return firstLayerThickess
|
||||||
(1.0 - pow(expansionRatio, nLayers))
|
*(1.0 - pow(expansionRatio, nLayers))
|
||||||
/ (1.0 - expansionRatio);
|
/(1.0 - expansionRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -433,9 +422,9 @@ Foam::scalar Foam::layerParameters::layerThickness
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
scalar invExpansion = 1.0 / expansionRatio;
|
scalar invExpansion = 1.0 / expansionRatio;
|
||||||
return finalLayerThickess *
|
return finalLayerThickess
|
||||||
(1.0 - pow(invExpansion, nLayers))
|
*(1.0 - pow(invExpansion, nLayers))
|
||||||
/ (1.0 - invExpansion);
|
/(1.0 - invExpansion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -484,7 +473,7 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
1.0
|
1.0
|
||||||
/ layerExpansionRatio
|
/layerExpansionRatio
|
||||||
(
|
(
|
||||||
nLayers,
|
nLayers,
|
||||||
totalThickness/finalLayerThickess
|
totalThickness/finalLayerThickess
|
||||||
@ -577,8 +566,8 @@ Foam::scalar Foam::layerParameters::finalLayerThicknessRatio
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
pow(expansionRatio, nLayers - 1)
|
pow(expansionRatio, nLayers - 1)
|
||||||
* (1.0 - expansionRatio)
|
*(1.0 - expansionRatio)
|
||||||
/ (1.0 - pow(expansionRatio, nLayers));
|
/(1.0 - pow(expansionRatio, nLayers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / 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-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -333,7 +333,6 @@ public:
|
|||||||
const label nLayers,
|
const label nLayers,
|
||||||
const scalar expansionRatio
|
const scalar expansionRatio
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user