3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
analytical/problem_bulk.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_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH
26#define DUMUX_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH
27
28#include <dune/alugrid/grid.hh>
29
32
35
38
39#include "spatialparams.hh"
40
41namespace Dumux {
42// forward declarations
43template<class TypeTag> class OnePBulkProblem;
44
45namespace Properties {
46// create the type tag nodes
47// Create new type tags
48namespace TTag {
49struct OnePBulk { using InheritsFrom = std::tuple<OneP>; };
50struct OnePBulkTpfa { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, OnePBulk>; };
51struct OnePBulkBox { using InheritsFrom = std::tuple<BoxFacetCouplingModel, OnePBulk>; };
52} // end namespace TTag
53
54// Set the grid type
55template<class TypeTag>
56struct Grid<TypeTag, TTag::OnePBulk> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; };
57// Set the problem type
58template<class TypeTag>
59struct Problem<TypeTag, TTag::OnePBulk> { using type = OnePBulkProblem<TypeTag>; };
60// set the spatial params
61template<class TypeTag>
62struct SpatialParams<TypeTag, TTag::OnePBulk>
63{
66};
67
68// the fluid system
69template<class TypeTag>
70struct FluidSystem<TypeTag, TTag::OnePBulk>
71{
72private:
74public:
76};
77
78} // end namespace Properties
79
85template<class TypeTag>
86class OnePBulkProblem : public PorousMediumFlowProblem<TypeTag>
87{
88 using ParentType = PorousMediumFlowProblem<TypeTag>;
89
91 using PrimaryVariables = typename GridVariables::PrimaryVariables;
92 using Scalar = typename GridVariables::Scalar;
93
94 using GridGeometry = typename GridVariables::GridGeometry;
95 using FVElementGeometry = typename GridGeometry::LocalView;
96 using SubControlVolume = typename GridGeometry::SubControlVolume;
97 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
98 using GridView = typename GridGeometry::GridView;
99 using Element = typename GridView::template Codim<0>::Entity;
100 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
101
105
106public:
107 OnePBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry,
108 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
109 std::shared_ptr<CouplingManager> couplingManagerPtr,
110 const std::string& paramGroup = "Bulk")
112 , couplingManagerPtr_(couplingManagerPtr)
113 , lowDimPermeability_(getParam<Scalar>("LowDim.SpatialParams.Permeability"))
114 , aperture_(getParam<Scalar>("Problem.FractureAperture"))
115 {
116 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
117 }
118
122 const std::string& name() const
123 {
124 return problemName_;
125 }
126
128 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
129 {
130 BoundaryTypes values;
131 values.setAllDirichlet();
132 return values;
133 }
134
136 BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
137 {
138 BoundaryTypes values;
139 values.setAllNeumann();
140 return values;
141 }
142
144 NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
145 {
146 using std::cos;
147 using std::cosh;
148 Scalar u = (1.0 - lowDimPermeability_)*cos(globalPos[0])*cosh(aperture_/2);
149 return NumEqVector(u);
150 }
151
153 Scalar exact(const GlobalPosition& globalPos) const
154 {
155 using std::cos;
156 using std::cosh;
157 const auto x = globalPos[0];
158 const auto y = globalPos[1];
159 return lowDimPermeability_*cos(x)*cosh(y) + (1.0 - lowDimPermeability_)*cos(x)*cosh(aperture_/2);
160 }
161
163 GlobalPosition exactGradient(const GlobalPosition& globalPos) const
164 {
165 using std::cos;
166 using std::sin;
167 using std::cosh;
168 using std::sinh;
169
170 const auto x = globalPos[0];
171 const auto y = globalPos[1];
172
173 GlobalPosition gradU;
174 gradU[0] = -lowDimPermeability_*sin(x)*cosh(y) + (lowDimPermeability_ - 1.0)*sin(x)*cosh(aperture_/2);
175 gradU[1] = lowDimPermeability_*cos(x)*sinh(y);
176
177 return gradU;
178 }
179
181 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
182 { return PrimaryVariables(exact(globalPos)); }
183
185 template<class ElementVolumeVariables, class ElementFluxVarsCache>
186 NumEqVector neumann(const Element& element,
187 const FVElementGeometry& fvGeometry,
188 const ElementVolumeVariables& elemVolVars,
189 const ElementFluxVarsCache& elemFluxVarsCache,
190 const SubControlVolumeFace& scvf) const
191 {
192 auto pos = scvf.ipGlobal();
193 const Scalar k = this->spatialParams().permeabilityAtPos(pos);
194 const auto gradU = exactGradient(pos);
195 return NumEqVector( -1.0*k*(gradU*scvf.unitOuterNormal()) );
196 }
197
199 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
200 { return PrimaryVariables(1.0); }
201
203 Scalar temperature() const
204 { return 283.15; /*10°*/ }
205
207 const CouplingManager& couplingManager() const
208 { return *couplingManagerPtr_; }
209
210private:
211 std::shared_ptr<CouplingManager> couplingManagerPtr_;
212 Scalar lowDimPermeability_;
213 Scalar aperture_;
214 std::string problemName_;
215};
216
217} // end namespace Dumux
218
219#endif
Setting constant fluid properties via the input file.
A liquid phase consisting of a single component.
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition: parameters.hh:428
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
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
The spatial parameters class for the test problem using the 1p cc model.
Definition: multidomain/boundary/stokesdarcy/1p2c_1p2c/spatialparams.hh:41
Test problem for the incompressible one-phase model with coupling across the bulk grid facets.
Definition: problem_1p_bulk.hh:90
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the Dirichlet boundary condition for a given position.
Definition: analytical/problem_bulk.hh:181
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Evaluates the source term at a given position.
Definition: analytical/problem_bulk.hh:144
const std::string & name() const
The problem name.
Definition: analytical/problem_bulk.hh:122
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies the type of boundary condition at a given position.
Definition: analytical/problem_bulk.hh:128
BoundaryTypes interiorBoundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
Specifies the type of interior boundary condition at a given position.
Definition: analytical/problem_bulk.hh:136
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the Neumann boundary condition for a boundary segment.
Definition: analytical/problem_bulk.hh:186
Scalar temperature() const
Returns the temperature in in the domain.
Definition: analytical/problem_bulk.hh:203
const CouplingManager & couplingManager() const
Returns reference to the coupling manager.
Definition: analytical/problem_bulk.hh:207
GlobalPosition exactGradient(const GlobalPosition &globalPos) const
Evaluates the exact gradient at a given position.
Definition: analytical/problem_bulk.hh:163
Scalar exact(const GlobalPosition &globalPos) const
Evaluates the exact solution at a given position.
Definition: analytical/problem_bulk.hh:153
OnePBulkProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< typename ParentType::SpatialParams > spatialParams, std::shared_ptr< CouplingManager > couplingManagerPtr, const std::string &paramGroup="Bulk")
Definition: analytical/problem_bulk.hh:107
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial conditions.
Definition: analytical/problem_bulk.hh:199
Definition: analytical/problem_bulk.hh:49
std::tuple< OneP > InheritsFrom
Definition: analytical/problem_bulk.hh:49
Definition: analytical/problem_bulk.hh:50
std::tuple< CCTpfaFacetCouplingModel, OnePBulk > InheritsFrom
Definition: analytical/problem_bulk.hh:50
Definition: analytical/problem_bulk.hh:51
std::tuple< BoxFacetCouplingModel, OnePBulk > InheritsFrom
Definition: analytical/problem_bulk.hh:51
Dune::ALUGrid< 2, 2, Dune::cube, Dune::nonconforming > type
Definition: analytical/problem_bulk.hh:56
Properties (and default properties) for all models using the box scheme together with coupling across...
Properties (and default properties) for all models using cell-centered finite volume scheme with TPFA...
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.