3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/multidomain/boundary/darcydarcy/1p_1p/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
42template<class TypeTag, std::size_t tag>
44: public PorousMediumFlowProblem<TypeTag>
45{
49 using FVElementGeometry = typename GridGeometry::LocalView;
50 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
51 using GridView = typename GridGeometry::GridView;
52 using Element = typename GridView::template Codim<0>::Entity;
58 static constexpr int dimWorld = GridView::dimensionworld;
59 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
60 static constexpr auto domainIdx = Dune::index_constant<tag>{};
61
62public:
63 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry,
64 std::shared_ptr<CouplingManager> couplingManager,
65 const std::string& paramGroup = "")
67 , couplingManager_(couplingManager)
68 {
69 // set a default name for the problem
70 problemName_ = getParam<std::string>("Vtk.OutputName")+ "_" + getParamFromGroup<std::string>(paramGroup, "Problem.Name");
71 }
72
76 const std::string& name() const
77 {
78 return problemName_;
79 }
80
88 BoundaryTypes boundaryTypes(const Element &element,
89 const SubControlVolumeFace &scvf) const
90 {
91 BoundaryTypes values;
92 const auto& globalPos = scvf.ipGlobal();
93
94 if (globalPos[dimWorld-1] < this->gridGeometry().bBoxMin()[dimWorld-1] + eps_
95 || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps_)
96 values.setAllDirichlet();
97 else
98 values.setAllNeumann();
99
100 if (couplingManager_->isCoupled(domainIdx, scvf))
101 values.setAllCouplingNeumann();
102
103 return values;
104 }
105
121 template<class ElementVolumeVariables, class ElementFluxVarsCache>
122 NumEqVector neumann(const Element& element,
123 const FVElementGeometry& fvGeometry,
124 const ElementVolumeVariables& elemVolVars,
125 const ElementFluxVarsCache& elemFluxVarsCache,
126 const SubControlVolumeFace& scvf) const
127 {
128 NumEqVector values(0.0);
129 const auto bcTypes = boundaryTypes(element, scvf);
130 if (bcTypes.hasCouplingNeumann())
131 values[Indices::conti0EqIdx] = couplingManager_->advectiveFluxCoupling(domainIdx, element, fvGeometry, elemVolVars, scvf);
132
133 return values;
134 }
135
143 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
144 {
145 PrimaryVariables values(0.0);
146 values[0] = 1.0e+5*(2.0 - globalPos[dimWorld-1]);
147 return values;
148 }
149
157 Scalar temperature() const
158 {
159 return 283.15; // 10°C
160 }
161
167 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
168 { return dirichletAtPos(globalPos); }
169
170
171private:
172 std::shared_ptr<CouplingManager> couplingManager_;
173 static constexpr Scalar eps_ = 1e-7;
174 std::string problemName_;
175
176};
177
178} // end namespace Dumux
179
180#endif
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
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
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Multidomain test problem for the incompressible one-phase model.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:45
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_1p/problem.hh:88
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:143
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:167
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:157
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_1p/problem.hh:122
const std::string & name() const
The problem name.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:76
OnePTestProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:63
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.