3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/1p/implicit/internaldirichlet/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_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH
26#define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH
27
29
30namespace Dumux {
31// forward declarations
32template<class TypeTag> class OnePTestProblemInternalDirichlet;
33
34namespace Properties {
35// Create new type tags
36namespace TTag {
38// internal Dirichlet BC are currently not implemented for cc-models
39//struct OnePInternalDirichletTpfa { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleTpfa>; };
40struct OnePInternalDirichletBox { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleBox>; };
41} // end namespace TTag
42
43// Set the problem type
44template<class TypeTag>
45struct Problem<TypeTag, TTag::OnePInternalDirichlet>
47
48} // end namespace Properties
49
54template<class TypeTag>
56{
59 using Element = typename GridView::template Codim<0>::Entity;
65 using SubControlVolume = typename GridGeometry::SubControlVolume;
66 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
67
68public:
69 OnePTestProblemInternalDirichlet(std::shared_ptr<const GridGeometry> gridGeometry)
71 {}
72
79 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
80 {
81 BoundaryTypes values;
82 values.setAllNeumann();
83 return values;
84 }
85
95 NeumannValues neumannAtPos(const GlobalPosition& globalPos) const
96 {
97 const auto& gg = this->gridGeometry();
98 if (globalPos[0] < gg.bBoxMin()[0] + eps_)
99 return NeumannValues(1e3);
100 else if (globalPos[1] < gg.bBoxMin()[1] + eps_)
101 return NeumannValues(-1e3);
102 else
103 return NeumannValues(0.0);
104 }
105
108 { return true; }
109
120 bool hasInternalDirichletConstraint(const Element& element, const SubControlVolume& scv) const
121 {
122 // the pure Neumann problem is only defined up to a constant
123 // we create a well-posed problem by fixing the pressure at one dof in the middle of the domain
124 return (scv.dofIndex() == static_cast<std::size_t>(this->gridGeometry().numDofs()/2));
125 }
126
132 PrimaryVariables internalDirichlet(const Element& element, const SubControlVolume& scv) const
133 { return PrimaryVariables(1e5); }
134
135private:
136 static constexpr Scalar eps_ = 1.5e-7;
137};
138
139} // end namespace Dumux
140
141#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 GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Multidomain test problem for the incompressible one-phase model.
Definition: test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:45
A test for internal Dirichlet constraints.
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:56
bool hasInternalDirichletConstraint(const Element &element, const SubControlVolume &scv) const
Tag a degree of freedom to carry internal Dirichlet constraints. If true is returned for a dof,...
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:120
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary cont...
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:79
OnePTestProblemInternalDirichlet(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:69
static constexpr bool enableInternalDirichletConstraints()
Enable internal Dirichlet constraints.
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:107
PrimaryVariables internalDirichlet(const Element &element, const SubControlVolume &scv) const
Define the values of internal Dirichlet constraints for a degree of freedom.
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:132
NeumannValues neumannAtPos(const GlobalPosition &globalPos) const
Evaluate the boundary conditions for a neumann boundary segment.
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:95
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:37
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:40
std::tuple< OnePInternalDirichlet, OnePIncompressibleBox > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh:40
The properties for the incompressible test.