Commit 8407dd24 authored by mattijs's avatar mattijs
Browse files

ENH: autoLayerDriver: use weighted smoothing

parent 633d9447
......@@ -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
......
......@@ -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
)
......
......@@ -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];
......
Markdown is supported
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