Clean-up of immersed boundary refinement

This commit is contained in:
Hrvoje Jasak 2018-05-17 12:04:26 +01:00
parent 3210c63bb1
commit 2a90c4f924
3 changed files with 23 additions and 17 deletions

View file

@ -130,8 +130,10 @@ bool immersedBoundaryDynamicRefineSolidBodyMotionFvMesh::update()
bool hasChanged = dynamicPolyRefinementFvMesh::update(); bool hasChanged = dynamicPolyRefinementFvMesh::update();
changing(hasChanged); // If the background mesh has not changed, execute dummy mesh sync
// and mesh motion to re-calculate immersed boundary parameters,
// since the immersed boundary has been moved
// HJ, 17/May/2018
if (!hasChanged) if (!hasChanged)
{ {
fvMesh::syncUpdateMesh(); fvMesh::syncUpdateMesh();

View file

@ -57,8 +57,14 @@ Foam::immersedBoundaryRefinement::immersedBoundaryRefinement
) )
: :
refinementSelection(mesh, dict), refinementSelection(mesh, dict),
refinementDistance_(readScalar(coeffDict().lookup("refinementDistance"))), refinementDistance_
coarseningDistance_(readScalar(coeffDict().lookup("coarseningDistance"))) (
readScalar(coeffDict().lookup("refinementDistance"))
),
unrefinementDistance_
(
readScalar(coeffDict().lookup("unrefinementDistance"))
)
{} {}
@ -110,7 +116,7 @@ Foam::immersedBoundaryRefinement::refinementCellCandidates() const
} }
Info<< "Cell distance (min, max): (" << min(cellDistance) Info<< "Cell distance (min, max): (" << min(cellDistance)
<< " " << max(cellDistance) << ")" << endl; << ", " << max(cellDistance) << ")" << endl;
// Create storage for collection of cells. Assume that almost all of the // Create storage for collection of cells. Assume that almost all of the
// cells will be marked to prevent excessive resizing. // cells will be marked to prevent excessive resizing.
@ -144,11 +150,8 @@ Foam::immersedBoundaryRefinement::refinementCellCandidates() const
Foam::Xfer<Foam::labelList> Foam::Xfer<Foam::labelList>
Foam::immersedBoundaryRefinement::unrefinementPointCandidates() const Foam::immersedBoundaryRefinement::unrefinementPointCandidates() const
{ {
// Mark all points as unrefinement candidates since only split points may be // All points are unrefinement candidates (not just split points, these are
// considered for actual unrefinement and since this refinement criterion // filtered out in polyhedralRefinement engine)
// will be usually used in combination with others. VV, 15/Mar/2018.
// All points are unrefinement candidates
dynamicLabelList unrefinementCandidates(mesh().nPoints()); dynamicLabelList unrefinementCandidates(mesh().nPoints());
// Calculate distance to immersed boundary // Calculate distance to immersed boundary
@ -185,15 +188,16 @@ Foam::immersedBoundaryRefinement::unrefinementPointCandidates() const
} }
Info<< "Split point distance(min, max): (" << min(pointDistance) Info<< "Split point distance(min, max): (" << min(pointDistance)
<< " " << max(pointDistance) << ")" << endl; << ", " << max(pointDistance) << ")" << endl;
forAll (pointDistance, pointI) forAll (pointDistance, pointI)
{ {
// Coarse live cells next to immersed boundary or dead cells // Unrefine both live cells and dead cells far from the immersed
// boundary or dead cells
if if
( (
pointDistance[pointI] < -coarseningDistance_ pointDistance[pointI] < -unrefinementDistance_
|| pointDistance[pointI] > SMALL || pointDistance[pointI] > unrefinementDistance_
) )
{ {
unrefinementCandidates.append(pointI); unrefinementCandidates.append(pointI);

View file

@ -58,8 +58,8 @@ class immersedBoundaryRefinement
//- Refinement distance to immersed boundary //- Refinement distance to immersed boundary
scalar refinementDistance_; scalar refinementDistance_;
//- Coarsening distance to immersed boundary //- Unrefinement distance to immersed boundary
scalar coarseningDistance_; scalar unrefinementDistance_;
// Private Member Functions // Private Member Functions