3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p3c_1p3c/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 *****************************************************************************/
25#ifndef DUMUX_DARCY_SUBPROBLEM_ONEPTHREEC_HH
26#define DUMUX_DARCY_SUBPROBLEM_ONEPTHREEC_HH
27
28#include <dune/grid/yaspgrid.hh>
29
32
35
37
38// for StokesDarcyCouplingOptions
40
41#include "../1p2c_1p2c/spatialparams.hh"
42#include "h2n2co2fluidsystem.hh"
43
44namespace Dumux {
45
46template <class TypeTag>
47class DarcySubProblem;
48
49namespace Properties {
50
51// Create new type tags
52namespace TTag {
53struct DarcyOnePThreeC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; };
54} // end namespace TTag
55
56// Set the problem property
57template<class TypeTag>
58struct Problem<TypeTag, TTag::DarcyOnePThreeC> { using type = Dumux::DarcySubProblem<TypeTag>; };
59
60template<class TypeTag>
62
63// Use moles
64template<class TypeTag>
65struct UseMoles<TypeTag, TTag::DarcyOnePThreeC> { static constexpr bool value = true; };
66
67// Do not replace one equation with a total mass balance
68template<class TypeTag>
69struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePThreeC> { static constexpr int value = 3; };
70
72template<class TypeTag>
73struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePThreeC>
75
76// Set the grid type
77template<class TypeTag>
78struct Grid<TypeTag, TTag::DarcyOnePThreeC> { using type = Dune::YaspGrid<2>; };
79
80//Set the diffusion type
81template<class TypeTag>
82struct MolecularDiffusionType<TypeTag, TTag::DarcyOnePThreeC> { using type = MaxwellStefansLaw<TypeTag>; };
83
84// Set the spatial paramaters type
85template<class TypeTag>
86struct SpatialParams<TypeTag, TTag::DarcyOnePThreeC>
87{
91};
92
93} // end namespace Properties
94
95template <class TypeTag>
96class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
97{
98 using ParentType = PorousMediumFlowProblem<TypeTag>;
105 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
106 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
107 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
109 using DiffusionCoefficientAveragingType = typename StokesDarcyCouplingOptions::DiffusionCoefficientAveragingType;
110
111 // copy some indices for convenience
113 enum {
114 // grid and world dimension
115 dim = GridView::dimension,
116 dimworld = GridView::dimensionworld,
117
118 // primary variable indices
119 conti0EqIdx = Indices::conti0EqIdx,
120 pressureIdx = Indices::pressureIdx,
121 };
122
123 using Element = typename GridView::template Codim<0>::Entity;
124 using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
125
126 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
127
128public:
129 DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
130 std::shared_ptr<CouplingManager> couplingManager)
131 : ParentType(gridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager)
132 {
133 pressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Pressure");
134 initialMoleFractionN2_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialMoleFractionN2");
135 initialMoleFractionCO2_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialMoleFractionCO2");
136 }
137
141 // \{
142
147 { return false; }
148
152 // \{
153
154 bool shouldWriteOutput() const // define output
155 { return true; }
156
161 Scalar temperature() const
162 { return 273.15 + 10; } // 10°C
163 // \}
164
168 // \{
169
177 BoundaryTypes boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
178 {
179 BoundaryTypes values;
180 values.setAllNeumann();
181
182 if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
183 values.setAllCouplingNeumann();
184
185
186 return values;
187 }
188
200 template<class ElementVolumeVariables, class ElementFluxVarsCache>
201 NumEqVector neumann(const Element& element,
202 const FVElementGeometry& fvGeometry,
203 const ElementVolumeVariables& elemVolVars,
204 const ElementFluxVarsCache& elemFluxVarsCache,
205 const SubControlVolumeFace& scvf) const
206 {
207 NumEqVector values(0.0);
208
209 if (couplingManager().isCoupledEntity(couplingManager().darcyIdx, scvf))
210 values = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf, DiffusionCoefficientAveragingType::harmonic);
211
212 return values;
213 }
214
215 // \}
216
220 // \{
230 template<class ElementVolumeVariables>
231 NumEqVector source(const Element &element,
232 const FVElementGeometry& fvGeometry,
233 const ElementVolumeVariables& elemVolVars,
234 const SubControlVolume &scv) const
235 { return NumEqVector(0.0); }
236
237 // \}
238
245 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
246 {
247 PrimaryVariables values(0.0);
248 values[pressureIdx] = pressure_;
249 values[conti0EqIdx + 1] = initialMoleFractionN2_;
250 values[conti0EqIdx + 2] = initialMoleFractionCO2_;
251
252 return values;
253 }
254
255 // \}
256
258 const CouplingManager& couplingManager() const
259 { return *couplingManager_; }
260
261private:
262 bool onLeftBoundary_(const GlobalPosition &globalPos) const
263 { return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; }
264
265 bool onRightBoundary_(const GlobalPosition &globalPos) const
266 { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; }
267
268 bool onLowerBoundary_(const GlobalPosition &globalPos) const
269 { return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
270
271 bool onUpperBoundary_(const GlobalPosition &globalPos) const
272 { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; }
273
274 Scalar eps_;
275 Scalar pressure_;
276 Scalar initialMoleFractionN2_;
277 Scalar initialMoleFractionCO2_;
278
279
280 std::shared_ptr<CouplingManager> couplingManager_;
281};
282} // end namespace Dumux
283
284#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.
A fluid system for one phase with the components h2, n2 and co2.
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
Definition: maxwellstefanslaw.hh:37
Relation for the saturation-dependent effective diffusion coefficient.
Definition: diffusivityconstanttortuosity.hh:49
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: 1p3c_1p3c/problem_darcy.hh:154
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: 1p3c_1p3c/problem_darcy.hh:146
DarcySubProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager)
Definition: 1p3c_1p3c/problem_darcy.hh:129
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: 1p3c_1p3c/problem_darcy.hh:245
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: 1p3c_1p3c/problem_darcy.hh:201
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p3c_1p3c/problem_darcy.hh:161
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: 1p3c_1p3c/problem_darcy.hh:177
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: 1p3c_1p3c/problem_darcy.hh:231
The spatial parameters class for the test problem using the 1p cc model.
Definition: multidomain/boundary/stokesdarcy/1p2c_1p2c/spatialparams.hh:41
A simple fluid system with one Maxwell-Stefan component.
Definition: h2n2co2fluidsystem.hh:39
Definition: 1p3c_1p3c/problem_darcy.hh:53
std::tuple< OnePNC, CCTpfaModel > InheritsFrom
Definition: 1p3c_1p3c/problem_darcy.hh:53
Dune::YaspGrid< 2 > type
Definition: 1p3c_1p3c/problem_darcy.hh:78
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: 1p3c_1p3c/problem_darcy.hh:88
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p3c_1p3c/problem_darcy.hh:89
Adaption of the fully implicit model to the one-phase n-component flow model.
Base class for all porous media problems.