3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/2pnc/implicit/diffusion/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 *****************************************************************************/
24#ifndef DUMUX_TWOPNC_DIFFUSION_PROBLEM_HH
25#define DUMUX_TWOPNC_DIFFUSION_PROBLEM_HH
26
27#include <dune/grid/yaspgrid.hh>
28
34
35#include "spatialparams.hh"
37
38#ifndef DIFFUSIONTYPE // default to Fick's law if not set through CMake
39#define DIFFUSIONTYPE FicksLaw<TypeTag>
40#endif
41
42namespace Dumux {
43
44template <class TypeTag>
45class TwoPNCDiffusionProblem;
46
47namespace Properties {
48// Create new type tags
49namespace TTag {
50struct TwoPNCDiffusion { using InheritsFrom = std::tuple<TwoPNC>; };
51struct TwoPNCDiffusionCC { using InheritsFrom = std::tuple<TwoPNCDiffusion, CCTpfaModel>; };
52} // end namespace TTag
53
54// Set the grid type
55template<class TypeTag>
56struct Grid<TypeTag, TTag::TwoPNCDiffusion> { using type = Dune::YaspGrid<2>; };
57
58// Set the problem property
59template<class TypeTag>
60struct Problem<TypeTag, TTag::TwoPNCDiffusion> { using type = TwoPNCDiffusionProblem<TypeTag>; };
61
62// // Set fluid configuration
63template<class TypeTag>
64struct FluidSystem<TypeTag, TTag::TwoPNCDiffusion>
65{
67 FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>;
68};
69
70// Set the spatial parameters
71template<class TypeTag>
72struct SpatialParams<TypeTag, TTag::TwoPNCDiffusion>
73{
77};
78
79// Define whether mole(true) or mass (false) fractions are used
80template<class TypeTag>
81struct UseMoles<TypeTag, TTag::TwoPNCDiffusion> { static constexpr bool value = true; };
82
84template<class TypeTag>
85struct MolecularDiffusionType<TypeTag, TTag::TwoPNCDiffusion> { using type = DIFFUSIONTYPE; };
86
88template<class TypeTag>
89struct Formulation<TypeTag, TTag::TwoPNCDiffusion>
90{ static constexpr auto value = TwoPFormulation::p0s1; };
91
92} // end namespace Properties
93
94
99template <class TypeTag>
101{
106
107 enum {
108 // Grid and world dimension
109 dim = GridView::dimension,
110 dimWorld = GridView::dimensionworld
111 };
112
117 using Element = typename GridView::template Codim<0>::Entity;
118 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
120
122 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
123
124public:
125 TwoPNCDiffusionProblem(std::shared_ptr<const GridGeometry> gridGeometry)
127 {
128 // initialize the tables of the fluid system
129 FluidSystem::init();
130
131 name_ = getParam<std::string>("Problem.Name");
132
133 // stating in the console whether mole or mass fractions are used
134 if(useMoles)
135 {
136 std::cout<<"problem uses mole-fractions"<<std::endl;
137 }
138 else
139 {
140 std::cout<<"problem uses mass-fractions"<<std::endl;
141 }
142 }
143
147 // \{
148
154 const std::string& name() const
155 { return name_; }
156
160 Scalar temperature() const
161 { return 293.15; }
162
163 // \}
164
168 // \{
169
176 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
177 {
178 BoundaryTypes bcTypes;
179 bcTypes.setAllDirichlet();
180 return bcTypes;
181 }
182
188 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
189 {
190 PrimaryVariables priVars;
191 priVars.setState(Indices::firstPhaseOnly);
192 priVars[Indices::pressureIdx] = 1e5;
193 priVars[Indices::switchIdx] = 1e-5 ;
194
195 if (globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_)
196 priVars[Indices::switchIdx] = 1e-3;
197
198 return priVars;
199 }
200
210 NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
211 {
212 NumEqVector values(0.0);
213 return values;
214 }
215
216 // \}
217
221 // \{
222
228 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
229 {
230 return initial_(globalPos);
231 }
232
233 // \}
234
235private:
243 PrimaryVariables initial_(const GlobalPosition &globalPos) const
244 {
245 PrimaryVariables priVars(0.0);
246 priVars.setState(Indices::firstPhaseOnly);
247
248 //mole-fraction formulation
249 priVars[Indices::switchIdx] = 1e-5;
250 priVars[Indices::pressureIdx] = 1e5;
251 return priVars;
252 }
253
254 Scalar temperature_;
255 static constexpr Scalar eps_ = 1e-6;
256
257 std::string name_ ;
258
259
260};
261
262} // end namespace Dumux
263
264#endif
Properties for all models using cell-centered finite volume scheme with mpfa.
Properties for all models using cell-centered finite volume scheme with TPFA.
This file contains the data which is required to calculate diffusive mass fluxes due to molecular dif...
@ p0s1
first phase pressure and second phase saturation as primary variables
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 for the calculation of the molecular diffusion fluxes.
Definition: common/properties.hh:212
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
The formulation of the model.
Definition: common/properties.hh:237
Policy for the H2O-N2 fluid system.
Definition: h2on2.hh:52
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
Definition: h2on2.hh:69
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Problem where air is injected under a low permeable layer in a depth of 2700m.
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:101
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:210
Scalar temperature() const
Returns the temperature [K].
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:160
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:188
TwoPNCDiffusionProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:125
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/2pnc/implicit/diffusion/problem.hh:176
const std::string & name() const
Returns the problem name.
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:154
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial values for a control volume.
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:228
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:50
std::tuple< TwoPNC > InheritsFrom
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:50
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:51
std::tuple< TwoPNCDiffusion, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:51
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:56
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:75
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:74
DIFFUSIONTYPE type
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:85
Definition of the spatial parameters for the TwoPNCDiffusion problem which uses the isothermal 2p2c b...
Definition: porousmediumflow/2pnc/implicit/diffusion/spatialparams.hh:46
Adaption of the fully implicit scheme to the two-phase n-component fully implicit model.
Base class for all porous media problems.
#define DIFFUSIONTYPE
Definition: test/porousmediumflow/2pnc/implicit/diffusion/problem.hh:39
Definition of the spatial parameters for the MaxwellStefan problem.