mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Checking to avoid infinite recursion in displacement limit function.
Modification to relaxation function produce the desired first and last values. Moved writeInternalDelaunayVertices back to being called from writeMesh, but option to write to constant.
This commit is contained in:
@ -989,14 +989,14 @@ void Foam::conformalVoronoiMesh::limitDisplacement
|
||||
// If dispPt is outside bounding box then displacement cuts boundary
|
||||
limit = true;
|
||||
|
||||
Info<< "bb limit" << endl;
|
||||
Info<< " bb limit" << endl;
|
||||
}
|
||||
else if (geometryToConformTo_.findSurfaceAnyIntersection(pt, dispPt))
|
||||
{
|
||||
// Full surface penetration test
|
||||
limit = true;
|
||||
|
||||
Info<< "intersection limit" << endl;
|
||||
Info<< " intersection limit" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1004,23 +1004,33 @@ void Foam::conformalVoronoiMesh::limitDisplacement
|
||||
// Within twice the local surface point pair insertion distance is
|
||||
// considered "too close"
|
||||
|
||||
scalar searchDistanceSqr = sqr
|
||||
(
|
||||
2*vit->targetCellSize()
|
||||
*cvMeshControls().pointPairDistanceCoeff()
|
||||
);
|
||||
|
||||
geometryToConformTo_.findSurfaceNearest
|
||||
(
|
||||
dispPt,
|
||||
sqr
|
||||
(
|
||||
2*vit->targetCellSize()
|
||||
*cvMeshControls().pointPairDistanceCoeff()
|
||||
),
|
||||
searchDistanceSqr,
|
||||
surfHit,
|
||||
hitSurface
|
||||
);
|
||||
|
||||
limit = surfHit.hit();
|
||||
|
||||
if (limit)
|
||||
if (surfHit.hit())
|
||||
{
|
||||
Info<< "proximity limit" << endl;
|
||||
Info<< " proximity limit" << endl;
|
||||
|
||||
limit = true;
|
||||
|
||||
if (magSqr(pt - surfHit.hitPoint()) <= searchDistanceSqr)
|
||||
{
|
||||
Info<< " Cannot limit displacement, point " << pt
|
||||
<< "closer than tolerance." << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2356,8 +2366,6 @@ void Foam::conformalVoronoiMesh::move()
|
||||
// indexing of the tessellation.
|
||||
if (runTime_.outputTime())
|
||||
{
|
||||
writeInternalDelaunayVertices();
|
||||
|
||||
writeMesh(false);
|
||||
|
||||
writeTargetCellSize();
|
||||
|
||||
@ -430,7 +430,7 @@ public:
|
||||
|
||||
//- Write the internal Delaunay vertices of the tessellation as a
|
||||
// pointField that may be used to restart the meshing process
|
||||
void writeInternalDelaunayVertices() const;
|
||||
void writeInternalDelaunayVertices(bool writeToConstant) const;
|
||||
|
||||
//- Write polyMesh
|
||||
void writeMesh(bool writeToConstant = true);
|
||||
|
||||
@ -77,11 +77,11 @@ void Foam::conformalVoronoiMesh::writePoints
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices() const
|
||||
void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices
|
||||
(
|
||||
bool writeToConstant
|
||||
) const
|
||||
{
|
||||
Info<< nl << " Writing internal Delaunay vertices to pointField "
|
||||
<< "ADD NAME CHOICE ARGUMENT" << endl;
|
||||
|
||||
pointField internalDelaunayVertices(number_of_vertices());
|
||||
|
||||
label vertI = 0;
|
||||
@ -101,18 +101,30 @@ void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices() const
|
||||
|
||||
internalDelaunayVertices.setSize(vertI);
|
||||
|
||||
pointIOField internalDVs
|
||||
IOobject io
|
||||
(
|
||||
IOobject
|
||||
"internalDelaunayVertices",
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (writeToConstant)
|
||||
{
|
||||
io = IOobject
|
||||
(
|
||||
"internalDelaunayVertices",
|
||||
runTime_.timeName(),
|
||||
runTime_.constant(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
internalDelaunayVertices
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Info<< nl << " Writing " << io.name() << " to " << io.instance() << endl;
|
||||
|
||||
pointIOField internalDVs(io, internalDelaunayVertices);
|
||||
|
||||
internalDVs.write();
|
||||
}
|
||||
@ -128,6 +140,8 @@ void Foam::conformalVoronoiMesh::writeMesh(bool writeToConstant)
|
||||
labelList patchSizes(0);
|
||||
labelList patchStarts(0);
|
||||
|
||||
writeInternalDelaunayVertices(writeToConstant);
|
||||
|
||||
calcDualMesh
|
||||
(
|
||||
points,
|
||||
@ -165,7 +179,6 @@ void Foam::conformalVoronoiMesh::writeMesh(bool writeToConstant)
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -59,18 +59,22 @@ scalar adaptiveLinear::relaxation()
|
||||
{
|
||||
if (cvMesh_.time().timeOutputValue() > lastTimeValue_)
|
||||
{
|
||||
scalar currentRelxation = relaxation_;
|
||||
|
||||
relaxation_ -=
|
||||
(relaxation_ - relaxationEnd_)
|
||||
/(
|
||||
(
|
||||
cvMesh_.time().endTime().value()
|
||||
- cvMesh_.time().timeOutputValue()
|
||||
)
|
||||
/(cvMesh_.time().timeOutputValue() - lastTimeValue_)
|
||||
+ 1
|
||||
);
|
||||
(relaxation_ - relaxationEnd_)
|
||||
/(
|
||||
(
|
||||
cvMesh_.time().endTime().value()
|
||||
- cvMesh_.time().timeOutputValue()
|
||||
)
|
||||
/(cvMesh_.time().timeOutputValue() - lastTimeValue_)
|
||||
+ 1
|
||||
);
|
||||
|
||||
lastTimeValue_ = cvMesh_.time().timeOutputValue();
|
||||
|
||||
return currentRelxation;
|
||||
}
|
||||
|
||||
return relaxation_;
|
||||
|
||||
Reference in New Issue
Block a user