TEMP: WIP commit to move code.

This commit is contained in:
graham
2011-01-25 14:39:52 +00:00
parent 3171dd78a8
commit c57986326a
4 changed files with 201 additions and 89 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,18 +56,18 @@ int main(int argc, char *argv[])
conformalVoronoiMesh mesh(runTime, cvMeshDict); conformalVoronoiMesh mesh(runTime, cvMeshDict);
while (runTime.loop()) // while (runTime.loop())
{ // {
Info<< nl << "Time = " << runTime.timeName() << endl; // Info<< nl << "Time = " << runTime.timeName() << endl;
mesh.move(); // mesh.move();
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" // Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" // << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; // << nl << endl;
} // }
mesh.writeMesh(runTime.constant()); // mesh.writeMesh(runTime.constant());
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"

View File

@ -1193,6 +1193,21 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
) )
) )
{ {
fvMesh mesh
(
IOobject
(
fvMesh::defaultRegion,
runTime_.constant(),
runTime_,
IOobject::MUST_READ
)
);
findRemainingProtrusionSet(mesh);
return;
createFeaturePoints(); createFeaturePoints();
if (cvMeshControls().objOutput()) if (cvMeshControls().objOutput())

View File

@ -399,76 +399,76 @@ void Foam::conformalVoronoiMesh::writeCellSizes
cellSize[i] = cellSizeControl().cellSize(C[i]); cellSize[i] = cellSizeControl().cellSize(C[i]);
} }
Info<< nl << "Create targetCellVolume volScalarField" << endl; // Info<< nl << "Create targetCellVolume volScalarField" << endl;
volScalarField targetCellVolume // volScalarField targetCellVolume
( // (
IOobject // IOobject
( // (
"targetCellVolume", // "targetCellVolume",
mesh.polyMesh::instance(), // mesh.polyMesh::instance(),
mesh, // mesh,
IOobject::NO_READ, // IOobject::NO_READ,
IOobject::AUTO_WRITE // IOobject::AUTO_WRITE
), // ),
mesh, // mesh,
dimensionedScalar("cellVolume", dimLength, 0), // dimensionedScalar("cellVolume", dimLength, 0),
zeroGradientPointPatchField<scalar>::typeName // zeroGradientPointPatchField<scalar>::typeName
); // );
targetCellVolume.internalField() = pow3(cellSize); // targetCellVolume.internalField() = pow3(cellSize);
Info<< nl << "Create actualCellVolume volScalarField" << endl; // Info<< nl << "Create actualCellVolume volScalarField" << endl;
volScalarField actualCellVolume // volScalarField actualCellVolume
( // (
IOobject // IOobject
( // (
"actualCellVolume", // "actualCellVolume",
mesh.polyMesh::instance(), // mesh.polyMesh::instance(),
mesh, // mesh,
IOobject::NO_READ, // IOobject::NO_READ,
IOobject::AUTO_WRITE // IOobject::AUTO_WRITE
), // ),
mesh, // mesh,
dimensionedScalar("cellVolume", dimVolume, 0), // dimensionedScalar("cellVolume", dimVolume, 0),
zeroGradientPointPatchField<scalar>::typeName // zeroGradientPointPatchField<scalar>::typeName
); // );
actualCellVolume.internalField() = mesh.cellVolumes(); // actualCellVolume.internalField() = mesh.cellVolumes();
Info<< nl << "Create equivalentCellSize volScalarField" << endl; // Info<< nl << "Create equivalentCellSize volScalarField" << endl;
volScalarField equivalentCellSize // volScalarField equivalentCellSize
( // (
IOobject // IOobject
( // (
"equivalentCellSize", // "equivalentCellSize",
mesh.polyMesh::instance(), // mesh.polyMesh::instance(),
mesh, // mesh,
IOobject::NO_READ, // IOobject::NO_READ,
IOobject::AUTO_WRITE // IOobject::AUTO_WRITE
), // ),
mesh, // mesh,
dimensionedScalar("cellSize", dimLength, 0), // dimensionedScalar("cellSize", dimLength, 0),
zeroGradientPointPatchField<scalar>::typeName // zeroGradientPointPatchField<scalar>::typeName
); // );
equivalentCellSize.internalField() = pow // equivalentCellSize.internalField() = pow
( // (
actualCellVolume.internalField(), // actualCellVolume.internalField(),
1.0/3.0 // 1.0/3.0
); // );
targetCellSize.correctBoundaryConditions(); targetCellSize.correctBoundaryConditions();
targetCellVolume.correctBoundaryConditions(); // targetCellVolume.correctBoundaryConditions();
actualCellVolume.correctBoundaryConditions(); // actualCellVolume.correctBoundaryConditions();
equivalentCellSize.correctBoundaryConditions(); // equivalentCellSize.correctBoundaryConditions();
targetCellSize.write(); targetCellSize.write();
targetCellVolume.write(); // targetCellVolume.write();
actualCellVolume.write(); // actualCellVolume.write();
equivalentCellSize.write(); // equivalentCellSize.write();
} }
// { // {
@ -525,8 +525,47 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
labelHashSet protrudingBoundaryPoints; 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(); const labelList& patchLocalPtIs = patches[patchI].boundaryPoints();
forAll(patchLocalPtIs, ppI) forAll(patchLocalPtIs, ppI)
@ -535,19 +574,47 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
const Foam::point& pt = mesh.points()[meshPtI]; const Foam::point& pt = mesh.points()[meshPtI];
if Info<< nl << "# ppI " << ppI << " " << pt << endl;
(
geometryToConformTo_.wellOutside bool wO = geometryToConformTo_.wellOutside
( (
pt, pt,
sqr(2.0*maxSurfaceProtrusion(pt)) sqr(1.2*targetCellSize(pt))
) );
)
Info<< "# wO " << wO << endl;
if (wO)
{ {
meshTools::writeOBJ(Info, pt);
Info<< "l 1 " << objPtI++ << endl;
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 cellSet protrudingCells
( (
@ -561,9 +628,9 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
const label pointI = iter.key(); const label pointI = iter.key();
const labelList& pCells = mesh.pointCells()[pointI]; const labelList& pCells = mesh.pointCells()[pointI];
forAll(pCells, pCellI) forAll(pCells, pCI)
{ {
protrudingCells.insert(pCells[pCellI]); protrudingCells.insert(pCells[pCI]);
} }
} }

View File

@ -336,6 +336,7 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
bool testForInside bool testForInside
) const ) const
{ {
Info<< "Enter wellInOutSide " << endl;
List<List<searchableSurface::volumeType> > surfaceVolumeTests List<List<searchableSurface::volumeType> > surfaceVolumeTests
( (
surfaces_.size(), surfaces_.size(),
@ -402,11 +403,20 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
{ {
inOutSidePoint[i] = !testForInside; inOutSidePoint[i] = !testForInside;
Info<< " break " << endl;
break; break;
} }
} }
} }
Info<< "# " << referenceVolumeTypes_[0] << " "
<< surfaceVolumeTests[0][0] << " "
<< hitInfo[0].hit() << " "
<< inOutSidePoint[0] << endl;
Info<< "Return wellInOutSide " << inOutSidePoint << endl;
return inOutSidePoint; return inOutSidePoint;
} }
@ -437,7 +447,15 @@ Foam::Field<bool> Foam::conformationSurfaces::wellOutside
const scalarField& testDistSqr const scalarField& testDistSqr
) const ) const
{ {
return wellInOutSide(samplePts, testDistSqr, false); Info<< "field pt wellOutside" << endl;
Field<bool> 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 scalar testDistSqr
) const ) const
{ {
return wellOutside(pointField(1, samplePt), scalarField(1, testDistSqr))[0]; Info<< "single pt wellOutside" << endl;
Field<bool> 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];
} }