24#ifndef DUMUX_GRIDADAPTIONINDICATOR2P_HH
25#define DUMUX_GRIDADAPTIONINDICATOR2P_HH
39template<
class TypeTag>
46 using Element =
typename GridView::Traits::template Codim<0>::Entity;
48 using SolutionTypes =
typename GET_PROP(TypeTag, SolutionTypes);
49 using ScalarSolutionType =
typename SolutionTypes::ScalarSolution;
50 using ElementMapper =
typename SolutionTypes::ElementMapper;
52 using Indices =
typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
56 sw = Indices::saturationW,
57 sn = Indices::saturationNw
61 wPhaseIdx = Indices::wPhaseIdx,
62 nPhaseIdx = Indices::nPhaseIdx
80 Scalar globalMax = -1e100;
81 Scalar globalMin = 1e100;
85 for (
const auto& element : elements(
problem_.gridView()))
89 int globalIdxI =
problem_.variables().index(element);
95 satI =
problem_.variables().cellData(globalIdxI).saturation(wPhaseIdx);
98 satI =
problem_.variables().cellData(globalIdxI).saturation(nPhaseIdx);
103 globalMin = min(satI, globalMin);
105 globalMax = max(satI, globalMax);
111 if (intersection.neighbor())
114 auto outside = intersection.outside();
115 int globalIdxJ =
problem_.variables().index(outside);
118 if (element.level() > outside.level() || (element.level() == outside.level() && globalIdxI < globalIdxJ))
124 satJ =
problem_.variables().cellData(globalIdxJ).saturation(wPhaseIdx);
127 satJ =
problem_.variables().cellData(globalIdxJ).saturation(nPhaseIdx);
132 Scalar localdelta = abs(satI - satJ);
140 Scalar globaldelta = globalMax - globalMin;
149 problem_.gridView().template communicate<DataHandle>(dataHandle,
150 Dune::InteriorBorder_All_Interface,
151 Dune::ForwardCommunication);
205 refinetol_ = getParam<Scalar>(
"GridAdapt.RefineTolerance");
206 coarsentol_ = getParam<Scalar>(
"GridAdapt.CoarsenTolerance");
#define GET_PROP_VALUE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:282
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
Contains a class to exchange entries of a vector.
Base file for properties related to sequential IMPET algorithms.
Dune::IteratorRange< typename MultiDomainGlue< DomainGridView, TargetGridView, DomainMapper, TargetMapper >::Intersections::const_iterator > intersections(const MultiDomainGlue< DomainGridView, TargetGridView, DomainMapper, TargetMapper > &glue)
Range generator to iterate with range-based for loops over all intersections as follows: for (const a...
Definition: glue.hh:62
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag SaturationFormulation
The formulation of the saturation model.
Definition: porousmediumflow/2p/sequential/properties.hh:53
A data handle class to exchange entries of a vector.
Definition: vectorexchange.hh:40
Class defining a standard, saturation dependent indicator for grid adaption.
Definition: gridadaptionindicator.hh:41
Problem & problem_
Definition: gridadaptionindicator.hh:210
GridAdaptionIndicator2P(Problem &problem)
Constructs a GridAdaptionIndicator instance.
Definition: gridadaptionindicator.hh:202
Scalar refinetol_
Definition: gridadaptionindicator.hh:211
bool coarsen(const Element &element)
Indicator function for marking of grid cells for coarsening.
Definition: gridadaptionindicator.hh:179
Scalar coarsentol_
Definition: gridadaptionindicator.hh:212
static const int saturationType_
Definition: gridadaptionindicator.hh:216
Scalar refineBound_
Definition: gridadaptionindicator.hh:213
void calculateIndicator()
Calculates the indicator used for refinement/coarsening for each grid cell.
Definition: gridadaptionindicator.hh:71
ScalarSolutionType indicatorVector_
Definition: gridadaptionindicator.hh:215
void init()
Initializes the adaption indicator class.
Definition: gridadaptionindicator.hh:186
Scalar coarsenBound_
Definition: gridadaptionindicator.hh:214
bool refine(const Element &element)
Indicator function for marking of grid cells for refinement.
Definition: gridadaptionindicator.hh:167
Defines the properties required for (immiscible) two-phase sequential models.