diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index a4148b950b5494eb6fa6e48bb12dd12d92d9fc50..b4117c424a6c1adf80dc3960d3570b6cc55bcd0c 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -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, @@ -417,9 +406,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; @@ -433,9 +422,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; @@ -484,7 +473,7 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio { return 1.0 - / layerExpansionRatio + /layerExpansionRatio ( nLayers, totalThickness/finalLayerThickess @@ -577,8 +566,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 diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H index 505fb8b07bd1cd7a0f29e186fb6557ec4546b182..f617916f4739c86bf9969044b581230342486aff 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -333,7 +333,6 @@ public: const label nLayers, const scalar expansionRatio ) const; - };