diff --git a/applications/utilities/mesh/generation/cvMesh/cvMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMesh.C index 351e52c7ac..484110fd76 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,18 +56,18 @@ int main(int argc, char *argv[]) conformalVoronoiMesh mesh(runTime, cvMeshDict); - while (runTime.loop()) - { - Info<< nl << "Time = " << runTime.timeName() << endl; + // while (runTime.loop()) + // { + // Info<< nl << "Time = " << runTime.timeName() << endl; - mesh.move(); + // mesh.move(); - Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } + // Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + // << " ClockTime = " << runTime.elapsedClockTime() << " s" + // << nl << endl; + // } - mesh.writeMesh(runTime.constant()); + // mesh.writeMesh(runTime.constant()); Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 2829cf62f6..fbb106efef 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -1193,6 +1193,21 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh ) ) { + fvMesh mesh + ( + IOobject + ( + fvMesh::defaultRegion, + runTime_.constant(), + runTime_, + IOobject::MUST_READ + ) + ); + + findRemainingProtrusionSet(mesh); + + return; + createFeaturePoints(); if (cvMeshControls().objOutput()) diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index fefc5546d6..bf91b5bf6f 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -399,76 +399,76 @@ void Foam::conformalVoronoiMesh::writeCellSizes cellSize[i] = cellSizeControl().cellSize(C[i]); } - Info<< nl << "Create targetCellVolume volScalarField" << endl; + // Info<< nl << "Create targetCellVolume volScalarField" << endl; - volScalarField targetCellVolume - ( - IOobject - ( - "targetCellVolume", - mesh.polyMesh::instance(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("cellVolume", dimLength, 0), - zeroGradientPointPatchField::typeName - ); + // volScalarField targetCellVolume + // ( + // IOobject + // ( + // "targetCellVolume", + // mesh.polyMesh::instance(), + // mesh, + // IOobject::NO_READ, + // IOobject::AUTO_WRITE + // ), + // mesh, + // dimensionedScalar("cellVolume", dimLength, 0), + // zeroGradientPointPatchField::typeName + // ); - targetCellVolume.internalField() = pow3(cellSize); + // targetCellVolume.internalField() = pow3(cellSize); - Info<< nl << "Create actualCellVolume volScalarField" << endl; + // Info<< nl << "Create actualCellVolume volScalarField" << endl; - volScalarField actualCellVolume - ( - IOobject - ( - "actualCellVolume", - mesh.polyMesh::instance(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("cellVolume", dimVolume, 0), - zeroGradientPointPatchField::typeName - ); + // volScalarField actualCellVolume + // ( + // IOobject + // ( + // "actualCellVolume", + // mesh.polyMesh::instance(), + // mesh, + // IOobject::NO_READ, + // IOobject::AUTO_WRITE + // ), + // mesh, + // dimensionedScalar("cellVolume", dimVolume, 0), + // zeroGradientPointPatchField::typeName + // ); - actualCellVolume.internalField() = mesh.cellVolumes(); + // actualCellVolume.internalField() = mesh.cellVolumes(); - Info<< nl << "Create equivalentCellSize volScalarField" << endl; + // Info<< nl << "Create equivalentCellSize volScalarField" << endl; - volScalarField equivalentCellSize - ( - IOobject - ( - "equivalentCellSize", - mesh.polyMesh::instance(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("cellSize", dimLength, 0), - zeroGradientPointPatchField::typeName - ); + // volScalarField equivalentCellSize + // ( + // IOobject + // ( + // "equivalentCellSize", + // mesh.polyMesh::instance(), + // mesh, + // IOobject::NO_READ, + // IOobject::AUTO_WRITE + // ), + // mesh, + // dimensionedScalar("cellSize", dimLength, 0), + // zeroGradientPointPatchField::typeName + // ); - equivalentCellSize.internalField() = pow - ( - actualCellVolume.internalField(), - 1.0/3.0 - ); + // equivalentCellSize.internalField() = pow + // ( + // actualCellVolume.internalField(), + // 1.0/3.0 + // ); targetCellSize.correctBoundaryConditions(); - targetCellVolume.correctBoundaryConditions(); - actualCellVolume.correctBoundaryConditions(); - equivalentCellSize.correctBoundaryConditions(); + // targetCellVolume.correctBoundaryConditions(); + // actualCellVolume.correctBoundaryConditions(); + // equivalentCellSize.correctBoundaryConditions(); targetCellSize.write(); - targetCellVolume.write(); - actualCellVolume.write(); - equivalentCellSize.write(); + // targetCellVolume.write(); + // actualCellVolume.write(); + // equivalentCellSize.write(); } // { @@ -525,30 +525,97 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet labelHashSet protrudingBoundaryPoints; - forAll(patches, patchI) + label objPtI = 2; + + meshTools::writeOBJ(Info, vector::zero); + + // forAll(patches, patchI) + // { + // Info<< "# " << patches[patchI].name() << endl; + + // const labelList& patchLocalPtIs = patches[patchI].boundaryPoints(); + + // forAll(patchLocalPtIs, ppI) + // { + // label meshPtI = + // patches[patchI].meshPoints()[patchLocalPtIs[ppI]]; + + // const Foam::point& pt = mesh.points()[meshPtI]; + + // if + // ( + // geometryToConformTo_.wellOutside + // ( + // pt, + // sqr(1.2*targetCellSize(pt)) + // ) + // ) + // { + // Info<< "# maxSurfaceProtrusion " << maxSurfaceProtrusion(pt) + // << endl; + + // meshTools::writeOBJ(Info, pt); + // Info<< "l 1 " << objPtI++ << endl; + + // protrudingBoundaryPoints.insert(meshPtI); + // } + // } + // } + + label patchI = patches.size() - 1; + + Info<< "# " << patches[patchI].name() << endl; + + const labelList& patchLocalPtIs = patches[patchI].boundaryPoints(); + + forAll(patchLocalPtIs, ppI) { - const labelList& patchLocalPtIs = patches[patchI].boundaryPoints(); + label meshPtI = patches[patchI].meshPoints()[patchLocalPtIs[ppI]]; - forAll(patchLocalPtIs, ppI) + const Foam::point& pt = mesh.points()[meshPtI]; + + Info<< nl << "# ppI " << ppI << " " << pt << endl; + + bool wO = geometryToConformTo_.wellOutside + ( + pt, + sqr(1.2*targetCellSize(pt)) + ); + + Info<< "# wO " << wO << endl; + + if (wO) { - label meshPtI = patches[patchI].meshPoints()[patchLocalPtIs[ppI]]; + meshTools::writeOBJ(Info, pt); + Info<< "l 1 " << objPtI++ << endl; - const Foam::point& pt = mesh.points()[meshPtI]; - - if - ( - geometryToConformTo_.wellOutside - ( - pt, - sqr(2.0*maxSurfaceProtrusion(pt)) - ) - ) - { - protrudingBoundaryPoints.insert(meshPtI); - } + protrudingBoundaryPoints.insert(meshPtI); } } + // forAll(mesh.points(), pI) + // { + // const Foam::point& pt = mesh.points()[pI]; + + // if + // ( + // geometryToConformTo_.wellOutside + // ( + // pt, + // sqr(1.2*targetCellSize(pt)) + // ) + // ) + // { + // Info<< "# maxSurfaceProtrusion " << maxSurfaceProtrusion(pt) + // << endl; + + // meshTools::writeOBJ(Info, pt); + // Info<< "l 1 " << objPtI++ << endl; + + // protrudingBoundaryPoints.insert(pI); + // } + // } + cellSet protrudingCells ( mesh, @@ -561,9 +628,9 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet const label pointI = iter.key(); const labelList& pCells = mesh.pointCells()[pointI]; - forAll(pCells, pCellI) + forAll(pCells, pCI) { - protrudingCells.insert(pCells[pCellI]); + protrudingCells.insert(pCells[pCI]); } } diff --git a/src/mesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C b/src/mesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C index 527a15023c..a1bb274c9e 100644 --- a/src/mesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C +++ b/src/mesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C @@ -336,6 +336,7 @@ Foam::Field Foam::conformationSurfaces::wellInOutSide bool testForInside ) const { + Info<< "Enter wellInOutSide " << endl; List > surfaceVolumeTests ( surfaces_.size(), @@ -402,11 +403,20 @@ Foam::Field Foam::conformationSurfaces::wellInOutSide { inOutSidePoint[i] = !testForInside; + Info<< " break " << endl; + break; } } } + Info<< "# " << referenceVolumeTypes_[0] << " " + << surfaceVolumeTests[0][0] << " " + << hitInfo[0].hit() << " " + << inOutSidePoint[0] << endl; + + Info<< "Return wellInOutSide " << inOutSidePoint << endl; + return inOutSidePoint; } @@ -437,7 +447,15 @@ Foam::Field Foam::conformationSurfaces::wellOutside const scalarField& testDistSqr ) const { - return wellInOutSide(samplePts, testDistSqr, false); + Info<< "field pt wellOutside" << endl; + + Field wO = wellInOutSide(samplePts, testDistSqr, false); + + Info<< "field pt wellOutside field " << wO << endl; + + return wO; + + // return wellInOutSide(samplePts, testDistSqr, false); } @@ -447,7 +465,19 @@ bool Foam::conformationSurfaces::wellOutside scalar testDistSqr ) const { - return wellOutside(pointField(1, samplePt), scalarField(1, testDistSqr))[0]; + Info<< "single pt wellOutside" << endl; + + Field wO = wellOutside + ( + pointField(1, samplePt), + scalarField(1, testDistSqr) + ); + + Info<< "single pt wellOutside field " << wO << endl; + + return wO[0]; + + // return wellOutside(pointField(1, samplePt), scalarField(1, testDistSqr))[0]; }