mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TEMP: WIP commit to move code.
This commit is contained in:
@ -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"
|
||||||
|
|||||||
@ -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())
|
||||||
|
|||||||
@ -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,30 +525,97 @@ 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();
|
||||||
|
|
||||||
|
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];
|
protrudingBoundaryPoints.insert(meshPtI);
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
geometryToConformTo_.wellOutside
|
|
||||||
(
|
|
||||||
pt,
|
|
||||||
sqr(2.0*maxSurfaceProtrusion(pt))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
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
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user