Skip to content
Snippets Groups Projects
Commit b760a5b3 authored by Markus Wolff's avatar Markus Wolff
Browse files

stricter rules for coarsening in adaptive decoupled models

   - allow coarsening only if all leaf cells of a father element (new
     coarser element) are marked for coarsening
   - additionally: added refine and coarsen thresholds as parameter-properties



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8028 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent ef09c090
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,9 @@ public: ...@@ -147,6 +147,9 @@ public:
*/ */
int markElements() int markElements()
{ {
std::map<int, int> coarsenMarker;
const typename Grid::Traits::LocalIdSet& idSet(problem_.grid().localIdSet());
for (LeafIterator eIt = problem_.gridView().template begin<0>(); for (LeafIterator eIt = problem_.gridView().template begin<0>();
eIt!=problem_.gridView().template end<0>(); ++eIt) eIt!=problem_.gridView().template end<0>(); ++eIt)
{ {
...@@ -160,6 +163,19 @@ public: ...@@ -160,6 +163,19 @@ public:
// this also refines the neighbor elements // this also refines the neighbor elements
checkNeighborsRefine_(entity); checkNeighborsRefine_(entity);
} }
if (adaptionIndicator_.coarsen(*eIt) && eIt->hasFather())
{
int idx = idSet.id(*(eIt->father()));
std::map<int, int>::iterator it = coarsenMarker.find(idx);
if (it != coarsenMarker.end())
{
it->second++;
}
else
{
coarsenMarker[idx] = 1;
}
}
} }
// coarsen // coarsen
for (LeafIterator eIt = problem_.gridView().template begin<0>(); for (LeafIterator eIt = problem_.gridView().template begin<0>();
...@@ -167,6 +183,8 @@ public: ...@@ -167,6 +183,8 @@ public:
{ {
if (adaptionIndicator_.coarsen(*eIt) && eIt->level() > levelMin_ && problem_.grid().getMark(*eIt) == 0) if (adaptionIndicator_.coarsen(*eIt) && eIt->level() > levelMin_ && problem_.grid().getMark(*eIt) == 0)
{ {
if (coarsenMarker[idSet.id(*(eIt->father()))] == eIt->geometry().corners())
{
// check if coarsening is possible // check if coarsening is possible
bool coarsenPossible = true; bool coarsenPossible = true;
LeafIntersectionIterator isend = problem_.gridView().iend(*eIt); LeafIntersectionIterator isend = problem_.gridView().iend(*eIt);
...@@ -186,6 +204,7 @@ public: ...@@ -186,6 +204,7 @@ public:
problem_.grid().mark( -1, *eIt ); problem_.grid().mark( -1, *eIt );
++coarsened_; ++coarsened_;
} }
}
} }
} }
......
...@@ -57,6 +57,12 @@ NEW_PROP_TAG(RefineTolerance); ...@@ -57,6 +57,12 @@ NEW_PROP_TAG(RefineTolerance);
//! Tolerance for coarsening //! Tolerance for coarsening
NEW_PROP_TAG(CoarsenTolerance); NEW_PROP_TAG(CoarsenTolerance);
//! Tolerance for refinement
NEW_PROP_TAG(RefineThreshold);
//! Tolerance for coarsening
NEW_PROP_TAG(CoarsenThreshold);
//no adaptive grid //no adaptive grid
SET_BOOL_PROP(GridAdaptTypeTag, AdaptiveGrid, false); SET_BOOL_PROP(GridAdaptTypeTag, AdaptiveGrid, false);
...@@ -65,6 +71,8 @@ SET_INT_PROP(GridAdaptTypeTag, MinLevel, 0); ...@@ -65,6 +71,8 @@ SET_INT_PROP(GridAdaptTypeTag, MinLevel, 0);
SET_INT_PROP(GridAdaptTypeTag, MaxLevel, 1); SET_INT_PROP(GridAdaptTypeTag, MaxLevel, 1);
SET_SCALAR_PROP(GridAdaptTypeTag, RefineTolerance, 0.05); SET_SCALAR_PROP(GridAdaptTypeTag, RefineTolerance, 0.05);
SET_SCALAR_PROP(GridAdaptTypeTag, CoarsenTolerance, 0.001); SET_SCALAR_PROP(GridAdaptTypeTag, CoarsenTolerance, 0.001);
SET_SCALAR_PROP(GridAdaptTypeTag, RefineThreshold, 0.0);
SET_SCALAR_PROP(GridAdaptTypeTag, CoarsenThreshold, 0.0);
} // namespace Properties } // namespace Properties
} // namespace Dumux } // namespace Dumux
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment