3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.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 *****************************************************************************/
26#ifndef DUMUX_SALTWATERINTRUSION_TEST_PROBLEM_HH
27#define DUMUX_SALTWATERINTRUSION_TEST_PROBLEM_HH
28
29#include <dune/grid/yaspgrid.hh>
30
34
36#include "../../spatialparams.hh"
37
38namespace Dumux {
39
40template <class TypeTag>
41class SaltWaterIntrusionTestProblem;
42
43namespace Properties {
44// Create new type tags
45namespace TTag {
46struct SaltWaterIntrusionTest { using InheritsFrom = std::tuple<OnePNC, BoxModel>; };
47} // end namespace TTag
48
49// Use a structured yasp grid
50template<class TypeTag>
51struct Grid<TypeTag, TTag::SaltWaterIntrusionTest> { using type = Dune::YaspGrid<2>; };
52
53// Set the problem property
54template<class TypeTag>
55struct Problem<TypeTag, TTag::SaltWaterIntrusionTest> { using type = SaltWaterIntrusionTestProblem<TypeTag>; };
56
57// Set fluid configuration
58template<class TypeTag>
59struct FluidSystem<TypeTag, TTag::SaltWaterIntrusionTest>
61
62// Set the spatial parameters
63template<class TypeTag>
64struct SpatialParams<TypeTag, TTag::SaltWaterIntrusionTest>
65{
69};
70
71// Use mass fractions to set salinity conveniently
72template<class TypeTag>
73struct UseMoles<TypeTag, TTag::SaltWaterIntrusionTest> { static constexpr bool value = false; };
74
75} // end namespace Properties
76
87template <class TypeTag>
89{
91
95 using Element = typename GridView::template Codim<0>::Entity;
96 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
101
102 // copy pressure index for convenience
103 enum { pressureIdx = Indices::pressureIdx };
104
106 static_assert(!getPropValue<TypeTag, Properties::UseMoles>(), "This test uses mass fractions!");
107
108public:
109 SaltWaterIntrusionTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
111 {
112 //initialize fluid system
113 FluidSystem::init();
114 }
115
119 // \{
120
125 Scalar temperature() const
126 { return 273.15 + 20; } // in [K]
127
128 // \}
129
133 // \{
134
141 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
142 {
143 BoundaryTypes values;
144 values.setAllNeumann();
145
146 // use Dirichlet BCs on the left and right boundary
147 if(globalPos[0] < eps_ || globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
148 values.setAllDirichlet();
149
150 return values;
151 }
152
158 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
159 {
160 PrimaryVariables values = initialAtPos(globalPos);
161
162 // salt water is in contact on the right boundary
163 if (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
164 values[FluidSystem::NaClIdx] = 0.035; // 3.5% salinity (sea water)
165
166 return values;
167 }
168
169 // \}
170
174 // \{
175
181 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
182 {
183 const Scalar depth = this->gridGeometry().bBoxMax()[1] - globalPos[1];
184 PrimaryVariables priVars;
185 priVars[pressureIdx] = 1e5 + depth*9.81*1000; // hydrostatic pressure (assume rho_water = 1000.0)
186 priVars[FluidSystem::NaClIdx] = 0.0; // initially only fresh water is present
187 return priVars;
188 }
189
190 // \}
191
192private:
193 static constexpr Scalar eps_ = 1e-6;
194};
195
196} // end namespace Dumux
197
198#endif
Defines a type tag and some properties for models using the box scheme.
make the local view function available whenever we use the grid geometry
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
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Property whether to use moles or kg as amount unit for balance equations.
Definition: common/properties.hh:102
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
A compositional single phase fluid system consisting of two components, which are H2O and NaCl.
Definition: fluidsystems/brine.hh:48
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Definition of a problem involving salt water intrusion into a fresh water aquifer.
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:89
Scalar temperature() const
Returns the temperature within the domain [K]. This problem assumes a temperature of 20 degrees Celsi...
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:125
SaltWaterIntrusionTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
The test is defined using mass fractions.
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:109
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:141
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:158
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:181
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:46
std::tuple< OnePNC, BoxModel > InheritsFrom
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:46
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:51
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:67
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/1pnc/implicit/1p2c/isothermal/saltwaterintrusion/problem.hh:66
Definition of the spatial parameters for the 1pnc test problems.
Definition: porousmediumflow/1pnc/implicit/1p2c/spatialparams.hh:41
Adaption of the fully implicit model to the one-phase n-component flow model.
Base class for all porous media problems.
A fluid system for brine, i.e. H2O with dissolved NaCl.