diff --git a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh index f98fdf52701befbc009bd06761688ad834439b84..fb5aaae2358b1e15b199607bd5d73f8dcc2fee82 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh @@ -323,11 +323,9 @@ public: (*j)[0][0] = 1; } f[i.index()] = 0; - continue; } - - // insert dirichlet ans processor boundary conditions - if (essential[i.index()][0]!=BoundaryConditions::neumann) + // insert dirichlet and processor boundary conditions + else if (essential[i.index()][0]!=BoundaryConditions::neumann) { coliterator endj=(*i).end(); for (coliterator j=(*i).begin(); j!=endj; ++j) diff --git a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh index ce89b8b9368c1d344b57677df607369ea7b80ba0..e73a52f193f45162bf1ad4a38f3da0715f83ada3 100644 --- a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh +++ b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh @@ -101,7 +101,7 @@ public: { case Sw: satI = problem_.variables().cellData(globalIdxI).saturation(wPhaseIdx); - break; + break; case Sn: satI = problem_.variables().cellData(globalIdxI).saturation(nPhaseIdx); break; @@ -115,31 +115,31 @@ public: for (IntersectionIterator isIt = problem_.gridView().ibegin(*eIt); isIt != isItend; ++isIt) { const typename IntersectionIterator::Intersection &intersection = *isIt; - // Steige aus, falls es sich nicht um einen Nachbarn handelt - if (!intersection.neighbor()) - continue; - - // Greife auf Nachbarn zu - ElementPointer outside = intersection.outside(); - int globalIdxJ = problem_.variables().index(*outside); - - // Jede Intersection nur von einer Seite betrachten - if (eIt->level() > outside->level() || (eIt->level() == outside->level() && globalIdxI < globalIdxJ)) + // Only consider internal intersections + if (intersection.neighbor()) { - Scalar satJ = 0.; - switch (saturationType_) + // Access neighbor + ElementPointer outside = intersection.outside(); + int globalIdxJ = problem_.variables().index(*outside); + + // Visit intersection only once + if (eIt->level() > outside->level() || (eIt->level() == outside->level() && globalIdxI < globalIdxJ)) { - case Sw: - satJ = problem_.variables().cellData(globalIdxJ).saturation(wPhaseIdx); - break; - case Sn: - satJ = problem_.variables().cellData(globalIdxJ).saturation(nPhaseIdx); - break; + Scalar satJ = 0.; + switch (saturationType_) + { + case Sw: + satJ = problem_.variables().cellData(globalIdxJ).saturation(wPhaseIdx); + break; + case Sn: + satJ = problem_.variables().cellData(globalIdxJ).saturation(nPhaseIdx); + break; + } + + Scalar localdelta = std::abs(satI - satJ); + indicatorVector_[globalIdxI][0] = std::max(indicatorVector_[globalIdxI][0], localdelta); + indicatorVector_[globalIdxJ][0] = std::max(indicatorVector_[globalIdxJ][0], localdelta); } - - Scalar localdelta = std::abs(satI - satJ); - indicatorVector_[globalIdxI][0] = std::max(indicatorVector_[globalIdxI][0], localdelta); - indicatorVector_[globalIdxJ][0] = std::max(indicatorVector_[globalIdxJ][0], localdelta); } } } diff --git a/dumux/decoupled/common/gridadapt.hh b/dumux/decoupled/common/gridadapt.hh index 442c18eb757bffc4720a693e3627e284646ec8a2..3102347a4e404ebee091d325b9582003404a0e53 100644 --- a/dumux/decoupled/common/gridadapt.hh +++ b/dumux/decoupled/common/gridadapt.hh @@ -213,29 +213,31 @@ public: for (LeafIterator eIt = problem_.gridView().template begin<0>(); eIt!=problem_.gridView().template end<0>(); ++eIt) { - if (indicator.coarsen(*eIt) && eIt->level() > levelMin_ && problem_.grid().getMark(*eIt) == 0) + if (indicator.coarsen(*eIt) + && eIt->level() > levelMin_ + && problem_.grid().getMark(*eIt) == 0 + && coarsenMarker[idSet.id(*(eIt->father()))] == eIt->geometry().corners()) { - if (coarsenMarker[idSet.id(*(eIt->father()))] == eIt->geometry().corners()) - { // check if coarsening is possible bool coarsenPossible = true; LeafIntersectionIterator isend = problem_.gridView().iend(*eIt); for(LeafIntersectionIterator is = problem_.gridView().ibegin(*eIt); is != isend; ++is) { - if(!is->neighbor()) - continue; - - ElementPointer outside = is->outside(); - if ((problem_.grid().getMark(*outside) > 0) - || (outside.level()>eIt.level())) - coarsenPossible = false; + if(is->neighbor()) + { + ElementPointer outside = is->outside(); + if ((problem_.grid().getMark(*outside) > 0) + || outside.level()>eIt.level())) + { + coarsenPossible = false; + } + } } if(coarsenPossible) - { - problem_.grid().mark( -1, *eIt ); - ++coarsened_; - } + { + problem_.grid().mark( -1, *eIt ); + ++coarsened_; } } }