3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/richards/implicit/nonisothermal/evaporation/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_RICHARDS_EVAPORATION_PROBLEM_HH
27#define DUMUX_RICHARDS_EVAPORATION_PROBLEM_HH
28
29#include <cmath>
30#include <dune/grid/yaspgrid.hh>
31
35
40#include "../spatialparams.hh"
41
42namespace Dumux {
43
48template <class TypeTag>
49class RichardsNIEvaporationProblem;
50
51namespace Properties {
52// Create new type tags
53namespace TTag {
54struct RichardsNIEvaporation { using InheritsFrom = std::tuple<RichardsNI>; };
55struct RichardsNIEvaporationBox { using InheritsFrom = std::tuple<RichardsNIEvaporation, BoxModel>; };
56struct RichardsNIEvaporationCC { using InheritsFrom = std::tuple<RichardsNIEvaporation, CCTpfaModel>; };
57} // end namespace TTag
58
59// Set the grid type
60template<class TypeTag>
61struct Grid<TypeTag, TTag::RichardsNIEvaporation> { using type = Dune::YaspGrid<2>; };
62
63// Set the problem property
64template<class TypeTag>
65struct Problem<TypeTag, TTag::RichardsNIEvaporation> { using type = RichardsNIEvaporationProblem<TypeTag>; };
66
67// Set the fluid system
68template<class TypeTag>
69struct FluidSystem<TypeTag, TTag::RichardsNIEvaporation> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; };
70
71// Set the spatial parameters
72template<class TypeTag>
73struct SpatialParams<TypeTag, TTag::RichardsNIEvaporation>
74{
78};
79
80template<class TypeTag>
81struct EnableWaterDiffusionInAir<TypeTag, TTag::RichardsNIEvaporation> { static constexpr bool value = true; };
82} // end namespace Properties
83
96template <class TypeTag>
98{
100
104 using FVElementGeometry = typename GridGeometry::LocalView;
105 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
110 using ThermalConductivityModel = GetPropType<TypeTag, Properties::ThermalConductivityModel>;
112 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
113 using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
114 using VolumeVariables = typename GridVariables::GridVolumeVariables::VolumeVariables;
117
118 // copy some indices for convenience
120 enum { dimWorld = GridView::dimensionworld };
121
122 enum {
123 pressureIdx = Indices::pressureIdx,
124 conti0EqIdx = Indices::conti0EqIdx,
125 temperatureIdx = Indices::temperatureIdx,
126 energyEqIdx = Indices::energyEqIdx
127 };
128
129 using Element = typename GridView::template Codim<0>::Entity;
130 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
131
132public:
133 RichardsNIEvaporationProblem(std::shared_ptr<const GridGeometry> gridGeometry)
135 {
136 // initialize fluid system
137 FluidSystem::init();
138
139 name_ = getParam<std::string>("Problem.Name");
140 pressure_ = 9.9e4;
141 temperatureInitial_ = 291;
142 }
143
147 // \{
148
154 const std::string& name() const
155 {
156 return name_;
157 }
158
159 // \}
160
164 // \{
165
172 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
173 {
174 BoundaryTypes values;
175 if(globalPos[1] < eps_)
176 {
177 values.setAllDirichlet();
178 }
179 else
180 {
181 values.setAllNeumann();
182 }
183 return values;
184 }
185
193 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
194 {
195 return initial_(globalPos);
196 }
197
208 NumEqVector neumann(const Element &element,
209 const FVElementGeometry& fvGeometry,
210 const ElementVolumeVariables& elemVolVars,
211 const ElementFluxVariablesCache& elemFluxVarsCache,
212 const SubControlVolumeFace& scvf) const
213 {
214 NumEqVector values(0.0);
215 const auto globalPos = scvf.ipGlobal();
216 const auto& volVars = elemVolVars[scvf.insideScvIdx()];
217 Scalar boundaryLayerThickness = 0.0016;
218
219 if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_)
220 {
221 values[conti0EqIdx] = 1e-3;
222 values[energyEqIdx] = FluidSystem::enthalpy( volVars.fluidState(), FluidSystem::gasPhaseIdx) * values[conti0EqIdx];
223 values[energyEqIdx] += FluidSystem::thermalConductivity(volVars.fluidState(), FluidSystem::gasPhaseIdx)
224 * (volVars.temperature() - temperatureInitial_)/boundaryLayerThickness;
225 }
226 return values;
227 }
228
229 // \}
230
234 // \{
235
236
244 { return 1e5; };
245
254 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
255 {
256 return initial_(globalPos);
257 }
258
259 // \}
260
261private:
262 PrimaryVariables initial_(const GlobalPosition &globalPos) const
263 {
264 PrimaryVariables priVars(0.0);
265 priVars.setState(Indices::bothPhases);
266 priVars[pressureIdx] = pressure_; // initial condition for the pressure
267 priVars[temperatureIdx] = temperatureInitial_;
268 return priVars;
269 }
270
271 Scalar temperatureInitial_;
272 Scalar pressure_;
273 static constexpr Scalar eps_ = 1e-6;
274 std::string name_;
275};
276
277} // end namespace Dumux
278
279#endif
Element solution classes and factory functions.
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with TPFA.
Relation for the saturation-dependent effective thermal conductivity.
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
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
Property for turning Richards into extended Richards.
Definition: common/properties.hh:258
Material properties of pure water .
Definition: h2o.hh:61
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
Test for the RichardsModel in combination with the NI model for evaporation.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:98
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:154
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:208
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:193
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/richards/implicit/nonisothermal/evaporation/problem.hh:172
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:254
Scalar nonWettingReferencePressure() const
Returns the reference pressure [Pa] of the non-wetting fluid phase within a finite volume.
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:243
RichardsNIEvaporationProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:133
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:54
std::tuple< RichardsNI > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:54
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:55
std::tuple< RichardsNIEvaporation, BoxModel > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:55
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:56
std::tuple< RichardsNIEvaporation, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:56
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:61
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:75
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/richards/implicit/nonisothermal/evaporation/problem.hh:76
Definition: porousmediumflow/richards/implicit/nonisothermal/spatialparams.hh:40
This model implements a variant of the Richards' equation for quasi-twophase flow.
Base class for all porous media problems.