3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_diffusionspatialparams.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 TEST_DIFFUSION_SPATIALPARAMS_HH
25#define TEST_DIFFUSION_SPATIALPARAMS_HH
26
31
32namespace Dumux
33{
34
35//forward declaration
36template<class TypeTag>
38
39namespace Properties
40{
41// The spatial parameters TypeTag
43
44// Set the spatial parameters
46
47// Set the material law
48template<class TypeTag>
50{
51private:
52 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
54public:
56};
57}
58
63template<class TypeTag>
65{
67 using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
68 using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
69 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
70 using IndexSet = typename GridView::IndexSet;
71 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
72 using CoordScalar = typename Grid::ctype;
74 using ScalarSolution = typename GET_PROP(TypeTag, SolutionTypes)::ScalarSolution;
76 enum
77 {dim=Grid::dimension, dimWorld=Grid::dimensionworld};
78 using Element = typename Grid::Traits::template Codim<0>::Entity;
79
80 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
81 using FieldMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
82
83public:
84 using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw);
85 using MaterialLawParams = typename MaterialLaw::Params;
86
87 const FieldMatrix& intrinsicPermeability (const Element& element) const
88 {
89 return permeability_[indexSet_.index(element)];
90 }
91
92 double porosity(const Element& element) const
93 {
94 return 0.2;
95 }
96
97
98 // return the parameter object for the Brooks-Corey material law which depends on the position
99 const MaterialLawParams& materialLawParams(const Element &element) const
100 {
101 return materialLawParams_;
102 }
103
104 void initialize(const double delta)
105 {
106 delta_ = delta;
107 permeability_.resize(gridView_.size(0));
108
109 for(const auto& element : elements(gridView_))
110 {
111 perm(permeability_[indexSet_.index(element)], element.geometry().center());
112 }
113
114 }
115
116 template<class Writer>
117 void addOutputVtkFields(Writer& writer)
118 {
119 ScalarSolution *permXX = writer.allocateManagedBuffer(gridView_.size(0));
120 ScalarSolution *permXY = writer.allocateManagedBuffer(gridView_.size(0));
121 ScalarSolution *permYY = writer.allocateManagedBuffer(gridView_.size(0));
122
123 for(const auto& element : elements(gridView_))
124 {
125 int eIdxGlobal = indexSet_.index(element);
126 (*permXX)[eIdxGlobal][0] = permeability_[eIdxGlobal][0][0];
127 (*permXY)[eIdxGlobal][0] = permeability_[eIdxGlobal][0][1];
128 (*permYY)[eIdxGlobal][0] = permeability_[eIdxGlobal][1][1];
129 }
130
131 writer.attachCellData(*permXX, "permeability-X");
132 writer.attachCellData(*permYY, "permeability-Y");
133 writer.attachCellData(*permXY, "permeability-Offdiagonal");
134
135 return;
136 }
137
138 TestDiffusionSpatialParams(const Problem& problem)
139 : ParentType(problem),gridView_(problem.gridView()), indexSet_(problem.gridView().indexSet()), permeability_(0)
140 {
141 // residual saturations
142 materialLawParams_.setSwr(0.0);
143 materialLawParams_.setSnr(0.0);
144
145 // parameters for the linear entry pressure function
146 materialLawParams_.setEntryPc(0);
147 materialLawParams_.setMaxPc(0);
148 }
149
150private:
151 void perm (FieldMatrix& perm, const GlobalPosition& globalPos) const
152 {
153 double rt = globalPos[0]*globalPos[0]+globalPos[1]*globalPos[1];
154 perm[0][0] = (delta_*globalPos[0]*globalPos[0] + globalPos[1]*globalPos[1])/rt;
155 perm[0][1] = -(1.0 - delta_)*globalPos[0]*globalPos[1]/rt;
156 perm[1][0] = perm[0][1];
157 perm[1][1] = (globalPos[0]*globalPos[0] + delta_*globalPos[1]*globalPos[1])/rt;
158 }
159
160 const GridView gridView_;
161 const IndexSet& indexSet_;
162 MaterialLawParams materialLawParams_;
163 std::vector<FieldMatrix> permeability_;
164 double delta_;
165};
166
167} // end namespace
168#endif
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
#define NEW_TYPE_TAG(...)
Definition: propertysystemmacros.hh:130
Linear capillary pressure and relative permeability <-> saturation relations.
The base class for spatial parameters of problems using the fv method.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
SET_TYPE_PROP(FVPressureOneP, Velocity, FVVelocity1P< TypeTag >)
Set velocity reconstruction implementation standard cell centered finite volume schemes as default.
Type tag TestDiffusionSpatialParams
Definition: test_diffusionspatialparams.hh:42
Property tag SolutionTypes
Definition: porousmediumflow/sequential/properties.hh:58
The type of the spatial parameters object.
Definition: common/properties.hh:221
This material law takes a material law defined for effective saturations and converts it to a materia...
Definition: 2p/efftoabslaw.hh:60
Linear capillary pressure and relative permeability <-> saturation relations.
Definition: linearmaterial.hh:48
Definition: sequentialfv.hh:34
The base class for spatial parameters of a multi-phase problem using the fv method.
Definition: sequentialfv.hh:43
spatial parameters for the test problem for diffusion models.
Definition: test_diffusionspatialparams.hh:65
typename MaterialLaw::Params MaterialLawParams
Definition: test_diffusionspatialparams.hh:85
TestDiffusionSpatialParams(const Problem &problem)
Definition: test_diffusionspatialparams.hh:138
const MaterialLawParams & materialLawParams(const Element &element) const
Definition: test_diffusionspatialparams.hh:99
const FieldMatrix & intrinsicPermeability(const Element &element) const
Definition: test_diffusionspatialparams.hh:87
void initialize(const double delta)
Definition: test_diffusionspatialparams.hh:104
void addOutputVtkFields(Writer &writer)
Definition: test_diffusionspatialparams.hh:117
double porosity(const Element &element) const
Definition: test_diffusionspatialparams.hh:92
typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw
Definition: test_diffusionspatialparams.hh:84
Base file for properties related to sequential models.
This material law takes a material law defined for effective saturations and converts it to a materia...