24#ifndef DUMUX_GRIDADAPTIONINDICATOR2P_HH
25#define DUMUX_GRIDADAPTIONINDICATOR2P_HH
39template<
class TypeTag>
46 using Element =
typename GridView::Traits::template Codim<0>::Entity;
49 using ScalarSolutionType =
typename SolutionTypes::ScalarSolution;
50 using ElementMapper =
typename SolutionTypes::ElementMapper;
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);
108 for (
const auto& intersection : intersections(
problem_.gridView(), element))
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");
216 static const int saturationType_ = getPropValue<TypeTag, Properties::SaturationFormulation>();
Contains a class to exchange entries of a vector.
Base file for properties related to sequential IMPET algorithms.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition: propertysystem.hh:140
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
A data handle class to exchange entries of a vector.
Definition: vectorcommdatahandle.hh:78
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.