3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p2c_1p2c/diffusionlawcomparison/problem_darcy.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_DARCY_SUBPROBLEM_DIFFUSION_COMPARISON_HH
27#define DUMUX_DARCY_SUBPROBLEM_DIFFUSION_COMPARISON_HH
28
29#include <dune/grid/yaspgrid.hh>
30
33
36
37#include "./../spatialparams.hh"
38
42
43// for StokesDarcyCouplingOptions
45
46#ifndef DIFFUSIONTYPE
47#define DIFFUSIONTYPE FicksLaw<TypeTag>
48#endif
49
50namespace Dumux {
51template <class TypeTag>
52class DarcySubProblem;
53
54namespace Properties {
55// Create new type tags
56namespace TTag {
57struct DarcyOnePTwoC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; };
58} // end namespace TTag
59
60// Set the problem property
61template<class TypeTag>
62struct Problem<TypeTag, TTag::DarcyOnePTwoC> { using type = Dumux::DarcySubProblem<TypeTag>; };
63
64// The fluid system
65template<class TypeTag>
66struct FluidSystem<TypeTag, TTag::DarcyOnePTwoC>
67{
69 static constexpr auto phaseIdx = H2OAir::liquidPhaseIdx; // simulate the water phase
71};
72
73// Use moles
74template<class TypeTag>
75struct UseMoles<TypeTag, TTag::DarcyOnePTwoC> { static constexpr bool value = true; };
76
77// Do not replace one equation with a total mass balance
78template<class TypeTag>
79struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePTwoC> { static constexpr int value = 3; };
80
82template<class TypeTag>
83struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePTwoC>
85
86// Set the grid type
87template<class TypeTag>
88struct Grid<TypeTag, TTag::DarcyOnePTwoC> { using type = Dune::YaspGrid<2>; };
89
90// Set the diffusion type
91template<class TypeTag>
92struct MolecularDiffusionType<TypeTag, TTag::DarcyOnePTwoC> { using type = DIFFUSIONTYPE; };
93
94// Set the spatial paramaters type
95template<class TypeTag>
96struct SpatialParams<TypeTag, TTag::DarcyOnePTwoC>
97{
101};
102} // end namespace Properties
103
104template <class TypeTag>
105class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
106{
107 using ParentType = PorousMediumFlowProblem<TypeTag>;
114 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
115 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
116 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
118 using DiffusionCoefficientAveragingType = typename StokesDarcyCouplingOptions::DiffusionCoefficientAveragingType;
119
120 // copy some indices for convenience
122 enum {
123 // grid and world dimension
124 dim = GridView::dimension,
125 dimworld = GridView::dimensionworld,
126
127 // primary variable indices
128 conti0EqIdx = Indices::conti0EqIdx,
129 pressureIdx = Indices::pressureIdx,
130 };
131
132 using Element = typename GridView::template Codim<0>::Entity;
133 using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
134
135 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
136
137public:
138 DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
139 std::shared_ptr<CouplingManager> couplingManager)
140 : ParentType(gridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager)
141 {
142 pressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Pressure");
143 initialMoleFraction_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialMoleFraction");
144 }
145
149 // \{
150
155 { return false; }
156
160 // \{
161
162 bool shouldWriteOutput() const // define output
163 { return true; }
164
169 Scalar temperature() const
170 { return 273.15 + 10; } // 10°C
171 // \}
172
176 // \{
177
185 BoundaryTypes boundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
186 {
187 BoundaryTypes values;
188 values.setAllNeumann();
189
190 if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
191 values.setAllCouplingNeumann();
192
193 return values;
194 }
195
207 template<class ElementVolumeVariables, class ElementFluxVarsCache>
208 NumEqVector neumann(const Element& element,
209 const FVElementGeometry& fvGeometry,
210 const ElementVolumeVariables& elemVolVars,
211 const ElementFluxVarsCache& elemFluxVarsCache,
212 const SubControlVolumeFace& scvf) const
213 {
214 NumEqVector values(0.0);
215
216 if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
217 values = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf, DiffusionCoefficientAveragingType::harmonic);
218
219 return values;
220 }
221
222 // \}
223
227 // \{
237 template<class ElementVolumeVariables>
238 NumEqVector source(const Element &element,
239 const FVElementGeometry& fvGeometry,
240 const ElementVolumeVariables& elemVolVars,
241 const SubControlVolume &scv) const
242 { return NumEqVector(0.0); }
243
244 // \}
245
254 PrimaryVariables initial(const Element &element) const
255 {
256 PrimaryVariables values(0.0);
257 values[pressureIdx] = pressure_;
258 values[conti0EqIdx + 1] = initialMoleFraction_;
259
260 return values;
261 }
262
263 // \}
264
266 const CouplingManager& couplingManager() const
267 { return *couplingManager_; }
268
269private:
270 bool onLeftBoundary_(const GlobalPosition &globalPos) const
271 { return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; }
272
273 bool onRightBoundary_(const GlobalPosition &globalPos) const
274 { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; }
275
276 bool onLowerBoundary_(const GlobalPosition &globalPos) const
277 { return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
278
279 bool onUpperBoundary_(const GlobalPosition &globalPos) const
280 { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; }
281
282 Scalar eps_;
283 Scalar pressure_;
284 Scalar initialMoleFraction_;
285
286 std::shared_ptr<CouplingManager> couplingManager_;
287};
288} // end namespace Dumux
289
290#endif //DUMUX_DARCY_SUBPROBLEM_HH
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...
Relation for the saturation-dependent effective diffusion coefficient.
An adapter for multi-phase fluid systems to be used with (compositional) one-phase models.
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
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
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
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 component balance index that should be replaced by the total mass/mole balance.
Definition: common/properties.hh:104
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 employed model for the computation of the effective diffusivity.
Definition: common/properties.hh:231
Relation for the saturation-dependent effective diffusion coefficient.
Definition: diffusivityconstanttortuosity.hh:49
An adapter for multi-phase fluid systems to be used with (compositional) one-phase models.
Definition: 1padapter.hh:46
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
Definition: h2oair.hh:75
DiffusionCoefficientAveragingType
Defines which kind of averanging of diffusion coefficiencients (moleculat diffusion or thermal conduc...
Definition: couplingdata.hh:52
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Definition: 1p_2p/problem_darcy.hh:79
bool shouldWriteOutput() const
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:162
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:266
bool shouldWriteRestartFile() const
Returns true if a restart file should be written to disk.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:154
PrimaryVariables initial(const Element &element) const
Evaluates the initial value for a control volume.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:254
DarcySubProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager)
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:138
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann control volume.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:208
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:169
BoundaryTypes boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
Specifies which kind of boundary condition should be used for which equation on a given boundary cont...
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:185
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all phases within a given sub control volume.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:238
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:57
std::tuple< OnePNC, CCTpfaModel > InheritsFrom
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:57
Dune::YaspGrid< 2 > type
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:88
DIFFUSIONTYPE type
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:92
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:99
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:98
The spatial parameters class for the test problem using the 1p cc model.
Definition: multidomain/boundary/stokesdarcy/1p2c_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.
#define DIFFUSIONTYPE
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:47