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
|
||||
\\ / 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"
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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<scalar>::typeName
|
||||
);
|
||||
// volScalarField targetCellVolume
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "targetCellVolume",
|
||||
// mesh.polyMesh::instance(),
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// dimensionedScalar("cellVolume", dimLength, 0),
|
||||
// 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
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"actualCellVolume",
|
||||
mesh.polyMesh::instance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("cellVolume", dimVolume, 0),
|
||||
zeroGradientPointPatchField<scalar>::typeName
|
||||
);
|
||||
// volScalarField actualCellVolume
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "actualCellVolume",
|
||||
// mesh.polyMesh::instance(),
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// dimensionedScalar("cellVolume", dimVolume, 0),
|
||||
// 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
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"equivalentCellSize",
|
||||
mesh.polyMesh::instance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("cellSize", dimLength, 0),
|
||||
zeroGradientPointPatchField<scalar>::typeName
|
||||
);
|
||||
// volScalarField equivalentCellSize
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "equivalentCellSize",
|
||||
// mesh.polyMesh::instance(),
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// dimensionedScalar("cellSize", dimLength, 0),
|
||||
// zeroGradientPointPatchField<scalar>::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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -336,6 +336,7 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
|
||||
bool testForInside
|
||||
) const
|
||||
{
|
||||
Info<< "Enter wellInOutSide " << endl;
|
||||
List<List<searchableSurface::volumeType> > surfaceVolumeTests
|
||||
(
|
||||
surfaces_.size(),
|
||||
@ -402,11 +403,20 @@ Foam::Field<bool> 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<bool> Foam::conformationSurfaces::wellOutside
|
||||
const scalarField& testDistSqr
|
||||
) 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
|
||||
) 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