3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
sequential/celldataadaptive.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_ELEMENTDATA2P_ADAPTIVE_HH
25#define DUMUX_ELEMENTDATA2P_ADAPTIVE_HH
26
27#include <dune/grid/utility/persistentcontainer.hh>
28#include "celldata.hh"
29
30namespace Dumux {
41template<class TypeTag, bool enableCompressibility = getPropValue<TypeTag, Properties::EnableCompressibility>()>
42class CellData2PAdaptive: public CellData2P<TypeTag, enableCompressibility>
43{
44private:
47 using Grid = typename GridView::Grid;
49
50 using Element = typename GridView::Traits::template Codim<0>::Entity;
51
53
54 enum
55 {
56 wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
57 };
58
59public:
66 {
69 Scalar pressW;
70 Scalar pressNw;
71 Scalar potW;
72 Scalar potNw;
73 Scalar volCorr;
74 int count;
76 {
77 saturationW = 0.;
78 saturationNw = 0.;
79 pressW = 0.;
80 pressNw = 0.;
81 potW = 0.;
82 potNw = 0.;
83 count = 0;
84 volCorr = 0;
85 }
86 };
87
89
92 {}
93
103 void storeAdaptionValues(AdaptedValues& adaptedValues, const Element& element)
104 {
105 adaptedValues.saturationW = this->saturation(wPhaseIdx);
106 adaptedValues.saturationNw = this->saturation(nPhaseIdx);
107 adaptedValues.pressW = this->pressure(wPhaseIdx);
108 adaptedValues.pressNw = this->pressure(nPhaseIdx);
109 adaptedValues.potW = this->potential(wPhaseIdx);
110 adaptedValues.potNw = this->potential(nPhaseIdx);
111 adaptedValues.volCorr = this->volumeCorrection();
112 }
113
125 static void storeAdaptionValues(AdaptedValues& adaptedValues,
126 AdaptedValues& adaptedValuesFather,
127 const Element& fatherElement)
128 {
129 adaptedValuesFather.saturationW += adaptedValues.saturationW / adaptedValues.count;
130 adaptedValuesFather.saturationNw += adaptedValues.saturationNw / adaptedValues.count;
131 adaptedValuesFather.pressW += adaptedValues.pressW / adaptedValues.count;
132 adaptedValuesFather.pressNw += adaptedValues.pressNw / adaptedValues.count;
133 adaptedValuesFather.potW += adaptedValues.potW / adaptedValues.count;
134 adaptedValuesFather.potNw += adaptedValues.potNw / adaptedValues.count;
135 adaptedValuesFather.volCorr += adaptedValues.volCorr / adaptedValues.count;
136 }
137
148 void setAdaptionValues(AdaptedValues& adaptedValues, const Element& element)
149 {
150 this->setSaturation(wPhaseIdx, adaptedValues.saturationW / adaptedValues.count);
151 this->setSaturation(nPhaseIdx, adaptedValues.saturationNw / adaptedValues.count);
152 this->setPressure(wPhaseIdx, adaptedValues.pressW / adaptedValues.count);
153 this->setPressure(nPhaseIdx, adaptedValues.pressNw / adaptedValues.count);
154 this->setPotential(wPhaseIdx, adaptedValues.potW / adaptedValues.count);
155 this->setPotential(nPhaseIdx, adaptedValues.potNw / adaptedValues.count);
156 this->setUpdate(adaptedValues.volCorr / adaptedValues.count);
157 }
158
171 static void reconstructAdaptionValues(Dune::PersistentContainer<Grid, AdaptedValues>& adaptionMap,
172 const Element& father, const Element& son, const Problem& problem)
173 {
174 AdaptedValues& adaptedValues = adaptionMap[son];
175 AdaptedValues& adaptedValuesFather = adaptionMap[father];
176 adaptedValues.saturationW = adaptedValuesFather.saturationW / adaptedValuesFather.count;
177 adaptedValues.saturationNw = adaptedValuesFather.saturationNw / adaptedValuesFather.count;
178 adaptedValues.pressW = adaptedValuesFather.pressW / adaptedValuesFather.count;
179 adaptedValues.pressNw = adaptedValuesFather.pressNw / adaptedValuesFather.count;
180 adaptedValues.potW = adaptedValuesFather.potW / adaptedValuesFather.count;
181 adaptedValues.potNw = adaptedValuesFather.potNw / adaptedValuesFather.count;
182 adaptedValues.volCorr = adaptedValuesFather.volCorr / adaptedValuesFather.count;
183 }
184
185};
186
187} // end namespace Dumux
188#endif
Definition: adapt.hh:29
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
std::string saturation(int phaseIdx) noexcept
I/O name of saturation for multiphase systems.
Definition: name.hh:43
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
Class including data of one grid cell.
Definition: 2p/sequential/celldata.hh:47
Class including the data of a grid cell needed if an adaptive grid is used.
Definition: sequential/celldataadaptive.hh:43
CellData2PAdaptive()
Constructs an adaptive CellData object.
Definition: sequential/celldataadaptive.hh:91
static void storeAdaptionValues(AdaptedValues &adaptedValues, AdaptedValues &adaptedValuesFather, const Element &fatherElement)
Stores sons entries into father element for averaging.
Definition: sequential/celldataadaptive.hh:125
static void reconstructAdaptionValues(Dune::PersistentContainer< Grid, AdaptedValues > &adaptionMap, const Element &father, const Element &son, const Problem &problem)
Reconstructs sons entries from data of father cell.
Definition: sequential/celldataadaptive.hh:171
void setAdaptionValues(AdaptedValues &adaptedValues, const Element &element)
Set adapted values in CellData.
Definition: sequential/celldataadaptive.hh:148
void storeAdaptionValues(AdaptedValues &adaptedValues, const Element &element)
Stores values to be adapted in an adaptedValues container.
Definition: sequential/celldataadaptive.hh:103
Collection of variables that have to be mapped if the grid is adapted For an immiscible two-phase mod...
Definition: sequential/celldataadaptive.hh:66
Scalar saturationNw
Definition: sequential/celldataadaptive.hh:68
Scalar volCorr
Definition: sequential/celldataadaptive.hh:73
Scalar saturationW
Definition: sequential/celldataadaptive.hh:67
int count
Definition: sequential/celldataadaptive.hh:74
Scalar potNw
Definition: sequential/celldataadaptive.hh:72
Scalar pressNw
Definition: sequential/celldataadaptive.hh:70
Scalar pressW
Definition: sequential/celldataadaptive.hh:69
AdaptedValues()
Definition: sequential/celldataadaptive.hh:75
Scalar potW
Definition: sequential/celldataadaptive.hh:71
Storage container for discretized data of the constitutive relations for one element.