diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H index db7e226505..effb7ee448 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H @@ -109,6 +109,11 @@ public: // Query + const Time& time() const + { + return runTime_; + } + //- Calculate and return the barycentric coordinates for // interpolating quantities on the background mesh void barycentricCoords diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C index 294512e60b..4d8c11b87c 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C @@ -51,18 +51,18 @@ Foam::scalar Foam::controlMeshRefinement::calcFirstDerivative } -Foam::scalar Foam::controlMeshRefinement::calcSecondDerivative -( - const Foam::point& a, - const scalar& cellSizeA, - const Foam::point& midPoint, - const scalar& cellSizeMid, - const Foam::point& b, - const scalar& cellSizeB -) const -{ - return (cellSizeA - 2*cellSizeMid + cellSizeB)/magSqr((a - b)/2); -} +//Foam::scalar Foam::controlMeshRefinement::calcSecondDerivative +//( +// const Foam::point& a, +// const scalar& cellSizeA, +// const Foam::point& midPoint, +// const scalar& cellSizeMid, +// const Foam::point& b, +// const scalar& cellSizeB +//) const +//{ +// return (cellSizeA - 2*cellSizeMid + cellSizeB)/magSqr((a - b)/2); +//} bool Foam::controlMeshRefinement::detectEdge @@ -77,15 +77,23 @@ bool Foam::controlMeshRefinement::detectEdge Foam::point a(startPt); Foam::point b(endPt); +// scalar cellSizeA = sizeControls_.cellSize(a); +// scalar cellSizeB = sizeControls_.cellSize(b); + Foam::point midPoint = (a + b)/2.0; +// scalar cellSizeMid = sizeControls_.cellSize(midPoint); + label nIterations = 0; while (true) { nIterations++; - if (magSqr(a - b) < tolSqr) + if + ( + magSqr(a - b) < tolSqr + ) { pointFound.setPoint(midPoint); pointFound.setHit(); @@ -95,9 +103,15 @@ bool Foam::controlMeshRefinement::detectEdge // Split into two regions - const scalar cellSizeA = sizeControls_.cellSize(a); - const scalar cellSizeB = sizeControls_.cellSize(b); - const scalar cellSizeMid = sizeControls_.cellSize(midPoint); + scalar cellSizeA = sizeControls_.cellSize(a); + scalar cellSizeB = sizeControls_.cellSize(b); + + if (magSqr(cellSizeA - cellSizeB) < 1e-6) + { + return false; + } + + scalar cellSizeMid = sizeControls_.cellSize(midPoint); // Region 1 Foam::point midPoint1 = (a + midPoint)/2.0; @@ -150,12 +164,16 @@ bool Foam::controlMeshRefinement::detectEdge if (magSqr(secondDerivative1) > magSqr(secondDerivative2)) { b = midPoint; +// cellSizeB = cellSizeMid; midPoint = midPoint1; +// cellSizeMid = cellSizeMid1; } else { a = midPoint; +// cellSizeA = cellSizeMid; midPoint = midPoint2; +// cellSizeMid = cellSizeMid2; } } } @@ -435,6 +453,8 @@ Foam::label Foam::controlMeshRefinement::refineMesh DynamicList verts(mesh_.number_of_vertices()); + label count = 0; + for ( CellSizeDelaunay::Finite_edges_iterator eit = @@ -443,6 +463,14 @@ Foam::label Foam::controlMeshRefinement::refineMesh ++eit ) { + if (count % 10000 == 0) + { + Info<< count << " edges, inserted " << verts.size() + << " Time = " << mesh_.time().elapsedCpuTime() + << endl; + } + count++; + CellSizeDelaunay::Cell_handle c = eit->first; CellSizeDelaunay::Vertex_handle vA = c->vertex(eit->second); CellSizeDelaunay::Vertex_handle vB = c->vertex(eit->third); @@ -452,8 +480,8 @@ Foam::label Foam::controlMeshRefinement::refineMesh mesh_.is_infinite(vA) || mesh_.is_infinite(vB) || (vA->referred() && vB->referred()) - || (vA->referred() && vA->procIndex() > vB->procIndex()) - || (vB->referred() && vB->procIndex() > vA->procIndex()) + || (vA->referred() && (vA->procIndex() > vB->procIndex())) + || (vB->referred() && (vB->procIndex() > vA->procIndex())) ) { continue; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.H index ea5b94f889..622a228aa4 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.H @@ -82,7 +82,10 @@ class controlMeshRefinement const scalar& cellSizeMid, const Foam::point& b, const scalar& cellSizeB - ) const; + ) const + { + return (cellSizeA - 2*cellSizeMid + cellSizeB)/magSqr((a - b)/2); + } bool detectEdge diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C index bd5edbe80b..eb028f386b 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C @@ -86,6 +86,7 @@ void Foam::conformationSurfaces::hasBoundedVolume Info<< " Sum of all the surface normals (if near zero, surface is" << " probably closed):" << nl + << " Note: Does not include baffle surfaces in calculation" << nl << " Sum = " << sum/totalTriangles << nl << " mag(Sum) = " << mag(sum)/totalTriangles << endl;