Added access functions to dynamic refinement

This commit is contained in:
Hrvoje Jasak 2018-05-16 15:10:10 +01:00
parent a800fbcc1a
commit e90bc3a893
3 changed files with 22 additions and 2 deletions

View file

@ -51,6 +51,7 @@ void Foam::dynamicPolyRefinementFvMesh::readDict()
{
// Read and check refinement and unrefinement intervals
refineInterval_ = readLabel(refinementDict_.lookup("refineInterval"));
if (refineInterval_ < 1)
{
FatalErrorIn("dynamicPolyRefinementFvMesh::readDict()")
@ -61,6 +62,7 @@ void Foam::dynamicPolyRefinementFvMesh::readDict()
}
unrefineInterval_ = readLabel(refinementDict_.lookup("unrefineInterval"));
if (refineInterval_ < 1)
{
FatalErrorIn("dynamicPolyRefinementFvMesh::readDict()")
@ -140,6 +142,12 @@ Foam::dynamicPolyRefinementFvMesh::~dynamicPolyRefinementFvMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::dynamicPolyRefinementFvMesh::firstUpdate() const
{
return curTimeIndex_ < time().timeIndex();
}
bool Foam::dynamicPolyRefinementFvMesh::update()
{
// Re-read the data from dictionary for on-the-fly changes

View file

@ -116,6 +116,15 @@ public:
// Member Functions
//- Return access to dictionary
inline const dictionary& refinementDict() const
{
return refinementDict_;
}
//- Is this the first update in the current time-step?
bool firstUpdate() const;
//- Update the mesh for topology change
virtual bool update();
};

View file

@ -111,7 +111,7 @@ Foam::fieldBoundsRefinement::refinementCellCandidates() const
// Create storage for collection of cells. Assume that one in five cells
// will be refined to prevent excessive resizing.
dynamicLabelList refinementCandidates(mesh().nCells()/5);
dynamicLabelList refinementCandidates(Foam::max(100, mesh().nCells()/5));
// Loop through internal field and collect cells to refine
const scalarField& vfIn = vf.internalField();
@ -157,7 +157,10 @@ Foam::fieldBoundsRefinement::unrefinementPointCandidates() const
// Create storage for collection of candidates. Assume that one in ten
// mesh points will be unrefined to prevent excessive resizing
dynamicLabelList unrefinementCandidates(mesh().nPoints()/10);
dynamicLabelList unrefinementCandidates
(
Foam::max(100, mesh().nPoints()/10)
);
// Loop through all split points and select candidates to unrefine
forAll (pField, pointI)