diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index f70381471bda91d4c1a73244c5a1b2b68f2f2c64..c300cc53a71f8c4ecbc68b1da380e6e878154ecb 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -2067,8 +2067,10 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark // The important thing, however, is that when only a few faces // are disabled, their coordinates are printed, and this should be // the case - label nReportLocal = - min + label nReportLocal = nChanged; + if (nChangedTotal > nReportMax) + { + nReportLocal = min ( max(nChangedTotal / Pstream::nProcs(), 1), min @@ -2077,11 +2079,15 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark max(nReportMax / Pstream::nProcs(), 1) ) ); + } - Pout<< "Checked mesh with layers. Disabled extrusion at " << endl; - for (label i=0; i < nReportLocal; i++) + if (nReportLocal) { - Pout<< " " << disabledFaceCentres[i] << endl; + Pout<< "Checked mesh with layers. Disabled extrusion at " << endl; + for (label i=0; i < nReportLocal; i++) + { + Pout<< " " << disabledFaceCentres[i] << endl; + } } label nReportTotal = returnReduce(nReportLocal, sumOp<label>()); @@ -2546,7 +2552,7 @@ void Foam::autoLayerDriver::addLayers false ), meshMover().pMesh(), - dimensionedScalar("pointMedialDist", dimless, 0.0) + dimensionedScalar("pointMedialDist", dimLength, 0.0) ); pointVectorField dispVec @@ -2561,7 +2567,7 @@ void Foam::autoLayerDriver::addLayers false ), meshMover().pMesh(), - dimensionedVector("dispVec", dimless, vector::zero) + dimensionedVector("dispVec", dimLength, vector::zero) ); pointScalarField medialRatio diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C index 5731562575b50d515d75b641459f4f1ddf200cab..a35e2f2171bb4343801ab23dfc4bd5bdcfe7eb28 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,8 @@ void Foam::autoLayerDriver::sumWeights scalarField& invSumWeight ) const { + const pointField& pts = meshRefiner_.mesh().points(); + invSumWeight = 0; forAll(edges, edgeI) @@ -57,7 +59,18 @@ void Foam::autoLayerDriver::sumWeights { const edge& e = edges[edgeI]; //scalar eWeight = edgeWeights[edgeI]; - scalar eWeight = 1.0; + //scalar eWeight = 1.0; + + scalar eMag = max + ( + VSMALL, + mag + ( + pts[meshPoints[e[1]]] + - pts[meshPoints[e[0]]] + ) + ); + scalar eWeight = 1.0/eMag; invSumWeight[e[0]] += eWeight; invSumWeight[e[1]] += eWeight; @@ -799,6 +812,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo // Both end points of edge have very different nearest wall // point. Mark both points as medial axis points. const edge& e = edges[edgeI]; + const point eMid = e.centre(points); forAll(e, ep) { @@ -811,8 +825,8 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo ( pointData ( - points[pointI], - 0.0, + eMid, //points[pointI], + magSqr(points[pointI]-eMid), //0.0, pointI, // passive data vector::zero // passive data ) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C index ddfe4ed4affeea39996ae282674fd037b4edddf0..afb66396c88747a2baac3b68632d19d90c1f9d53 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,8 @@ void Foam::autoLayerDriver::averageNeighbours Field<Type>& average ) { + const pointField& pts = mesh.points(); + average = pTraits<Type>::zero; forAll(edges, edgeI) @@ -49,7 +51,18 @@ void Foam::autoLayerDriver::averageNeighbours { const edge& e = edges[edgeI]; //scalar eWeight = edgeWeights[edgeI]; - scalar eWeight = 1.0; + //scalar eWeight = 1.0; + scalar eMag = max + ( + VSMALL, + mag + ( + pts[meshPoints[e[1]]] + - pts[meshPoints[e[0]]] + ) + ); + scalar eWeight = 1.0/eMag; + label v0 = e[0]; label v1 = e[1];