3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p_1p/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_HH
26#define DUMUX_DARCY_SUBPROBLEM_HH
27
28#include <dune/grid/yaspgrid.hh>
29
31
34
35#include "spatialparams.hh"
36
39
40namespace Dumux {
41template <class TypeTag>
42class DarcySubProblem;
43
44namespace Properties {
45// Create new type tags
46namespace TTag {
47struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; };
48} // end namespace TTag
49
50// Set the problem property
51template<class TypeTag>
52struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::DarcySubProblem<TypeTag>; };
53
54// the fluid system
55template<class TypeTag>
56struct FluidSystem<TypeTag, TTag::DarcyOneP>
57{
60};
61
62// Set the grid type
63template<class TypeTag>
64struct Grid<TypeTag, TTag::DarcyOneP> { using type = Dune::YaspGrid<2>; };
65
66template<class TypeTag>
67struct SpatialParams<TypeTag, TTag::DarcyOneP>
68{
72};
73} // end namespace Properties
74
75template <class TypeTag>
76class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
77{
78 using ParentType = PorousMediumFlowProblem<TypeTag>;
85 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
86 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
87 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
89
91
92 using Element = typename GridView::template Codim<0>::Entity;
93 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
94
96
97public:
98 DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
99 std::shared_ptr<CouplingManager> couplingManager)
100 : ParentType(gridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager)
101 {
102 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
103
104 // determine whether to simulate a vertical or horizontal flow configuration
105 verticalFlow_ = problemName_.find("vertical") != std::string::npos;
106 }
107
111 const std::string& name() const
112 {
113 return problemName_;
114 }
115
119 // \{
120
125 Scalar temperature() const
126 { return 273.15 + 10; } // 10°C
127 // \}
128
132 // \{
133
141 BoundaryTypes boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
142 {
143 BoundaryTypes values;
144 values.setAllNeumann();
145
146 if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
147 values.setAllCouplingNeumann();
148
149 if (verticalFlow_)
150 {
151 if (onLowerBoundary_(scvf.center()))
152 values.setAllDirichlet();
153 }
154
155 return values;
156 }
157
166 PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
167 {
168 return initial(element);
169 }
170
182 template<class ElementVolumeVariables, class ElementFluxVarsCache>
183 NumEqVector neumann(const Element& element,
184 const FVElementGeometry& fvGeometry,
185 const ElementVolumeVariables& elemVolVars,
186 const ElementFluxVarsCache& elemFluxVarsCache,
187 const SubControlVolumeFace& scvf) const
188 {
189 NumEqVector values(0.0);
190
191 if (couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
192 values[Indices::conti0EqIdx] = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf);
193
194 return values;
195 }
196
197 // \}
198
202 // \{
212 template<class ElementVolumeVariables>
213 NumEqVector source(const Element &element,
214 const FVElementGeometry& fvGeometry,
215 const ElementVolumeVariables& elemVolVars,
216 const SubControlVolume &scv) const
217 { return NumEqVector(0.0); }
218
219 // \}
220
229 PrimaryVariables initial(const Element &element) const
230 {
231 return PrimaryVariables(0.0);
232 }
233
234 // \}
235
237 const CouplingManager& couplingManager() const
238 { return *couplingManager_; }
239
240private:
241
242 bool onLowerBoundary_(const GlobalPosition &globalPos) const
243 { return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
244
245 Scalar eps_;
246 std::shared_ptr<CouplingManager> couplingManager_;
247 std::string problemName_;
248 bool verticalFlow_;
249};
250} // end namespace Dumux
251
252#endif //DUMUX_DARCY_SUBPROBLEM_HH
Properties for all models using cell-centered finite volume scheme with TPFA.
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
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
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 liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Definition: multidomain/couplingmanager.hh:46
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Definition: 1p_2p/problem_darcy.hh:79
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:266
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: 1p_1p/problem_darcy.hh:98
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: 1p_1p/problem_darcy.hh:183
PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: 1p_1p/problem_darcy.hh:166
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p_1p/problem_darcy.hh:125
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: 1p_1p/problem_darcy.hh:141
const std::string & name() const
The problem name.
Definition: 1p_1p/problem_darcy.hh:111
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: 1p_1p/problem_darcy.hh:213
The spatial parameters class for the test problem using the 1p cc model.
Definition: multidomain/boundary/stokesdarcy/1p2c_1p2c/spatialparams.hh:41
Definition: 1p_1p/problem_darcy.hh:47
std::tuple< OneP, CCTpfaModel > InheritsFrom
Definition: 1p_1p/problem_darcy.hh:47
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p_1p/problem_darcy.hh:58
Dune::YaspGrid< 2 > type
Definition: 1p_1p/problem_darcy.hh:64
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: 1p_1p/problem_darcy.hh:69
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p_1p/problem_darcy.hh:70
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.