3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/multidomain/boundary/darcydarcy/1p_2p/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 *****************************************************************************/
25#ifndef DUMUX_ONEP_SUB_TEST_PROBLEM_HH
26#define DUMUX_ONEP_SUB_TEST_PROBLEM_HH
27
28#include <dune/common/indices.hh>
30#include "spatialparams.hh"
31
32namespace Dumux {
33
43template<class TypeTag, std::size_t tag>
44class OnePTestProblem
45: public PorousMediumFlowProblem<TypeTag>
46{
47 using ParentType = PorousMediumFlowProblem<TypeTag>;
48 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
49 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
50 using FVElementGeometry = typename GridGeometry::LocalView;
51 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
52 using GridView = typename GridGeometry::GridView;
53 using Element = typename GridView::template Codim<0>::Entity;
54 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
55 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
56 using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
58 using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
59 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
60 static constexpr int dimWorld = GridView::dimensionworld;
61 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
62 static constexpr auto domainIdx = Dune::index_constant<tag>{};
63
64public:
65 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry,
66 std::shared_ptr<CouplingManager> couplingManager,
67 const std::string& paramGroup = "")
69 , couplingManager_(couplingManager)
70 {
71 injectionRate_ = getParam<double>("Problem.InjectionRate");
72 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(paramGroup, "Problem.Name");
73 }
74
78 const std::string& name() const
79 {
80 return problemName_;
81 }
82
90 BoundaryTypes boundaryTypes(const Element &element,
91 const SubControlVolumeFace &scvf) const
92 {
93 BoundaryTypes values;
94 values.setAllDirichlet();
95
96 if (couplingManager_->isCoupled(domainIdx, scvf))
97 values.setAllCouplingNeumann();
98
99 return values;
100 }
101
117 template<class ElementVolumeVariables, class ElementFluxVarsCache>
118 NumEqVector neumann(const Element& element,
119 const FVElementGeometry& fvGeometry,
120 const ElementVolumeVariables& elemVolVars,
121 const ElementFluxVarsCache& elemFluxVarsCache,
122 const SubControlVolumeFace& scvf) const
123 {
124 NumEqVector values(0.0);
125 const auto bcTypes = boundaryTypes(element, scvf);
126 if (bcTypes.hasCouplingNeumann())
127 values[Indices::conti0EqIdx] = couplingManager_->advectiveFluxCoupling(domainIdx, element, fvGeometry, elemVolVars, scvf, FluidSystem::phase0Idx);
128
129 return values;
130 }
131
139 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
140 {
141 PrimaryVariables values(0.0);
142 values[Indices::pressureIdx] = 1.0e6;
143 if (NumEqVector::dimension > 1)
144 values[Indices::pressureIdx + 1] = 1e-10; // fully saturated
145 return values;
146 }
147
160 template<class PointSource>
161 void addPointSources(std::vector<PointSource>& pointSources) const
162 {
163 NumEqVector values(0.0);
164 // if this is the 2p problem inject methane
165 if (NumEqVector::dimension > 1)
166 values[Indices::conti0EqIdx + 1] = injectionRate_; // kg/s
167 pointSources.emplace_back(GlobalPosition(0.0), values);
168 }
169
177 Scalar temperature() const
178 {
179 return 283.15; // 10°C
180 }
181
187 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
188 { return dirichletAtPos(globalPos); }
189
190
191private:
192 Scalar injectionRate_;
193 std::shared_ptr<CouplingManager> couplingManager_;
194 static constexpr Scalar eps_ = 1e-7;
195 std::string problemName_;
196};
197
198} // end namespace Dumux
199
200#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
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
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 segm...
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:90
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:139
void addPointSources(std::vector< PointSource > &pointSources) const
Applies a vector of point sources which are possibly solution dependent.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:161
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:187
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:177
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 boundary segment.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:118
const std::string & name() const
The problem name.
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:78
OnePTestProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
Definition: test/multidomain/boundary/darcydarcy/1p_2p/problem.hh:65
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.