3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/2p/implicit/cornerpoint/spatialparams.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_TWOP_CORNERPOINT_TEST_SPATIAL_PARAMS_HH
25#define DUMUX_TWOP_CORNERPOINT_TEST_SPATIAL_PARAMS_HH
26
27#if HAVE_OPM_GRID
28#include <opm/parser/eclipse/Deck/Deck.hpp>
29
33
34namespace Dumux {
35
40template<class GridGeometry, class Scalar>
41class TwoPCornerPointTestSpatialParams
42: public FVSpatialParams<GridGeometry, Scalar, TwoPCornerPointTestSpatialParams<GridGeometry, Scalar>>
43{
44 using GridView = typename GridGeometry::GridView;
45 using Element = typename GridView::template Codim<0>::Entity;
46 using FVElementGeometry = typename GridGeometry::LocalView;
47 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
48 using ThisType = TwoPCornerPointTestSpatialParams<GridGeometry, Scalar>;
49 using ParentType = FVSpatialParams<GridGeometry, Scalar, ThisType>;
50
51 static constexpr int dimWorld = GridView::dimensionworld;
52 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
53
54 using EffectiveLaw = RegularizedVanGenuchten<Scalar>;
55
56 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
57
58public:
59 using MaterialLaw = EffToAbsLaw<EffectiveLaw>;
60 using MaterialLawParams = typename MaterialLaw::Params;
61 using PermeabilityType = DimWorldMatrix;
62
63 TwoPCornerPointTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
64 std::shared_ptr<const Opm::Deck> deck)
65 : ParentType(gridGeometry)
66 , deck_(deck)
67 {
68 homogeneous_ = getParam<bool>("Problem.Homogeneous");
69
70 const std::vector<int>& globalCell = this->gridGeometry().gridView().grid().globalCell();
71
72 if (deck_->hasKeyword("PORO")) {
73 std::cout << "Found PORO..." << std::endl;
74 std::vector<double> eclVector = deck_->getKeyword("PORO").getRawDoubleData();
75 porosity_.resize(globalCell.size());
76
77 for (size_t i = 0; i < globalCell.size(); ++i) {
78 if (homogeneous_)
79 porosity_[i] = 0.2;
80 else
81 porosity_[i] = eclVector[globalCell[i]];
82 }
83 }
84
85 if (deck_->hasKeyword("PERMX")) {
86 std::cout << "Found PERMX..." << std::endl;
87 std::vector<double> eclVector = deck_->getKeyword("PERMX").getRawDoubleData();
88 permX_.resize(globalCell.size());
89
90 for (size_t i = 0; i < globalCell.size(); ++i) {
91 // assume that values are given in mD = 9.86923e-16 m^2
92 if (homogeneous_)
93 permX_[i] = 9.86923e-16;
94 else
95 permX_[i] = 9.86923e-16*eclVector[globalCell[i]];
96 }
97 }
98
99 if (deck_->hasKeyword("PERMZ")) {
100 std::cout << "Found PERMZ..." << std::endl;
101 std::vector<double> eclVector = deck_->getKeyword("PERMZ").getRawDoubleData();
102 permZ_.resize(globalCell.size());
103
104 for (size_t i = 0; i < globalCell.size(); ++i) {
105 // assume that values are given in mD = 9.86923e-16 m^2
106 if (homogeneous_)
107 permZ_[i] = 9.86923e-16;
108 else
109 permZ_[i] = 9.86923e-16*eclVector[globalCell[i]];
110 }
111 }
112 else {
113 std::cout << "PERMZ not found, set equal to PERMX..." << std::endl;
114 permZ_ = permX_;
115 }
116
117 // parameters for the Van Genuchten law
118 materialParams_.setVgAlpha(0.00045);
119 materialParams_.setVgn(7.3);
120 }
121
132 template<class ElementSolution>
133 PermeabilityType permeability(const Element& element,
134 const SubControlVolume& scv,
135 const ElementSolution& elemSol) const
136 {
137 int eIdx = this->gridGeometry().gridView().indexSet().index(element);
138
139 PermeabilityType K(0);
140 K[0][0] = K[1][1] = permX_[eIdx];
141 K[2][2] = permZ_[eIdx];
142
143 return K;
144 }
145
154 template<class ElementSolution>
155 Scalar porosity(const Element& element,
156 const SubControlVolume& scv,
157 const ElementSolution& elemSol) const
158 {
159 int eIdx = this->gridGeometry().gridView().indexSet().index(element);
160 return porosity_[eIdx];
161 }
162
171 template<class ElementSolution>
172 const MaterialLawParams& materialLawParams(const Element& element,
173 const SubControlVolume& scv,
174 const ElementSolution& elemSol) const
175 {
176 return materialParams_;
177 }
178
185 template<class FluidSystem>
186 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
187 {
188 return FluidSystem::phase0Idx;
189 }
190
191 Scalar permeabilityX(int eIdx)
192 { return permX_[eIdx]; }
193
194 Scalar permeabilityZ(int eIdx)
195 { return permZ_[eIdx]; }
196
197private:
198 std::shared_ptr<const Opm::Deck> deck_;
199 MaterialLawParams materialParams_;
200 std::vector<Scalar> porosity_;
201 std::vector<Scalar> permX_;
202 std::vector<Scalar> permZ_;
203 bool homogeneous_;
204};
205
206} // end namespace Dumux
207
208#else
209#warning "The opm-grid module is needed to use this class!"
210#endif
211
212#endif
Implementation of the regularized version of the van Genuchten's capillary pressure / relative permea...
The base class for spatial parameters of multi-phase problems using a fully implicit discretization m...
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
std::string permeability() noexcept
I/O name of permeability.
Definition: name.hh:143
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:139
This material law takes a material law defined for effective saturations and converts it to a materia...