Added minimum protected level to protectedInitialRefinement

This commit is contained in:
Vuko Vukcevic 2019-01-23 09:39:20 +01:00
parent 46756467b4
commit 9871df3d78
2 changed files with 18 additions and 18 deletions

View file

@ -105,8 +105,16 @@ Foam::protectedInitialRefinement::protectedInitialRefinement
IOobject::AUTO_WRITE
),
cellLevelAsField()()
),
// Note: conversion from label to scalar
minProtectedLevel_
(
coeffDict().lookupOrDefault<label>("minProtectedLevel", 0)
)
{}
{
Info<< "Will not allow initial refinement below level: "
<< minProtectedLevel_ << endl;
}
// * * * * * * * * * * * * * * * * Destructor* * * * * * * * * * * * * * * * //
@ -163,9 +171,13 @@ Foam::protectedInitialRefinement::unrefinementPointCandidates() const
forAll (initialCellLevelIn, cellI)
{
const scalar& cl = initialCellLevelIn[cellI];
const scalar curcl = curCellLevel[cellI];
const scalar& curcl = curCellLevel[cellI];
if ((cl > SMALL) && equal(cl, curcl))
if
(
(cl > SMALL)
&& (curcl - minProtectedLevel_ < 0.5)
)
{
// Cell has been refined during meshing and the original level is
// equal to the current level, mark all of its points
@ -185,21 +197,6 @@ Foam::protectedInitialRefinement::unrefinementPointCandidates() const
}
}
}
else if (cl > (curcl + SMALL))
{
FatalErrorIn
(
"Xfer<labelList>\n"
"protectedInitialRefinement::unrefinementPointCandidates()"
" const"
) << "Detected a cell with initial refinement level greater"
<< " than current refinement level." << nl
<< "cellI: " << cellI << nl
<< "current level: " << curcl << nl
<< "initial level: " << cl << nl
<< "This should not happen."
<< abort(FatalError);
}
}
// Create the list for unrefinement candidates

View file

@ -70,6 +70,9 @@ class protectedInitialRefinement
// transfer for dynamic load balancing
volScalarField initialCellLevel_;
//- Minimum refinement level to protect
scalar minProtectedLevel_;
// Private Member Functions