diff --git a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C index 4186013211..b0595ae934 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C +++ b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C @@ -98,6 +98,10 @@ void Foam::CV3D::setVertexAlignmentDirections() vector d = pHit.hitPoint() - vert; + vit->distanceToClosestSurface() = mag(d); + + vit->indexOfClosestPatch() = qSurf_[pHit.index()].region(); + tensor R = rotationTensor(vector(0,0,1), np); label s = 36; @@ -1019,6 +1023,9 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) // Use the least similar of globalAlignmentDirs as the // 2nd alignment and then generate the third. + Warning<< "Using supplementary globalAlignmentDirs." + << endl; + scalar minDotProduct = 1+SMALL; alignmentDirs.setSize(3); @@ -1048,6 +1055,8 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) } else { + Warning<< "Using all globalAlignmentDirs." << endl; + alignmentDirs = globalAlignmentDirs; } @@ -1084,6 +1093,38 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) // targetCellSize *= 0.56222 - 0.413*midEdgeY; + scalar targetCellSizeA = targetCellSize; + + scalar targetCellSizeB = targetCellSize; + + if + ( + vA->indexOfClosestPatch() == 1 + && vA->distanceToClosestSurface() < 0.03 + ) + { + targetCellSizeA *= 0.5; + } + else if (vA->indexOfClosestPatch() == 0) + { + targetCellSizeA *= 2; + } + + if + ( + vB->indexOfClosestPatch() == 1 + && vB->distanceToClosestSurface() < 0.03 + ) + { + targetCellSizeB *= 0.5; + } + else if (vB->indexOfClosestPatch() == 0) + { + targetCellSizeB *= 2; + } + + targetCellSize = sqrt(targetCellSizeA * targetCellSizeB); + scalar targetFaceArea = targetCellSize*targetCellSize; if (alignmentDotProd > cosAcceptanceAngle) diff --git a/applications/utilities/mesh/generation/CV3DMesher/indexedVertex.H b/applications/utilities/mesh/generation/CV3DMesher/indexedVertex.H index 35b6600571..310a3044f7 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/indexedVertex.H +++ b/applications/utilities/mesh/generation/CV3DMesher/indexedVertex.H @@ -67,6 +67,10 @@ class indexedVertex Foam::List alignmentDirections_; + Foam::scalar distanceToClosestSurface_; + + Foam::label indexOfClosestPatch_; + public: @@ -94,7 +98,9 @@ public: Vb(), index_(INTERNAL_POINT), type_(INTERNAL_POINT), - alignmentDirections_(0) + alignmentDirections_(0), + distanceToClosestSurface_(-1), + indexOfClosestPatch_(-1) {} indexedVertex(const Point& p) @@ -102,7 +108,9 @@ public: Vb(p), index_(INTERNAL_POINT), type_(INTERNAL_POINT), - alignmentDirections_(0) + alignmentDirections_(0), + distanceToClosestSurface_(-1), + indexOfClosestPatch_(-1) {} indexedVertex(const Point& p, Cell_handle f) @@ -110,7 +118,9 @@ public: Vb(f, p), index_(INTERNAL_POINT), type_(INTERNAL_POINT), - alignmentDirections_(0) + alignmentDirections_(0), + distanceToClosestSurface_(-1), + indexOfClosestPatch_(-1) {} indexedVertex(Cell_handle f) @@ -118,7 +128,9 @@ public: Vb(f), index_(INTERNAL_POINT), type_(INTERNAL_POINT), - alignmentDirections_(0) + alignmentDirections_(0), + distanceToClosestSurface_(-1), + indexOfClosestPatch_(-1) {} @@ -142,16 +154,26 @@ public: return type_; } - Foam::List& alignmentDirections() + inline Foam::List& alignmentDirections() { return alignmentDirections_; } - const Foam::List& alignmentDirections() const + inline const Foam::List& alignmentDirections() const { return alignmentDirections_; } + inline Foam::scalar& distanceToClosestSurface() + { + return distanceToClosestSurface_; + } + + inline Foam::label& indexOfClosestPatch() + { + return indexOfClosestPatch_; + } + inline bool uninitialised() const { return type_ == INTERNAL_POINT && index_ == INTERNAL_POINT; diff --git a/applications/utilities/mesh/generation/CV3DMesher/insertSurfaceNearestPointPairs.C b/applications/utilities/mesh/generation/CV3DMesher/insertSurfaceNearestPointPairs.C index 060a67453f..4f2f48a0a2 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/insertSurfaceNearestPointPairs.C +++ b/applications/utilities/mesh/generation/CV3DMesher/insertSurfaceNearestPointPairs.C @@ -888,14 +888,16 @@ void Foam::CV3D::insertSurfaceNearestPointPairs() if (edgePoints.size()) { - smoothEdgePositions(edgePoints, edgeLabels); + Warning<< "Edge point insertion disabled." << endl; - insertEdgePointGroups - ( - edgePoints, - edgeLabels, - "surfaceNearestEdgePoints.obj" - ); + // smoothEdgePositions(edgePoints, edgeLabels); + + // insertEdgePointGroups + // ( + // edgePoints, + // edgeLabels, + // "surfaceNearestEdgePoints.obj" + // ); } }