3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/1p/implicit/periodicbc/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_HH
26#define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
27
28#if HAVE_DUNE_SPGRID
29#include <dune/grid/spgrid.hh>
30#endif
31#if HAVE_DUNE_ALUGRID
32#include <dune/alugrid/grid.hh>
33#endif
34
38
42
45
46#include "spatialparams.hh"
47
48#ifndef FVGEOMCACHING
49#define FVGEOMCACHING 0
50#endif
51
52namespace Dumux {
53// forward declarations
54template<class TypeTag> class OnePTestProblem;
55
56namespace Properties {
57// create the type tag nodes
58// Create new type tags
59namespace TTag {
60struct OnePIncompressible { using InheritsFrom = std::tuple<OneP>; };
61struct OnePIncompressibleTpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCTpfaModel>; };
62struct OnePIncompressibleMpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCMpfaModel>; };
63struct OnePIncompressibleBox { using InheritsFrom = std::tuple<OnePIncompressible, BoxModel>; };
64} // end namespace TTag
65
66// Set the grid type
67template<class TypeTag>
68struct Grid<TypeTag, TTag::OnePIncompressible> { using type = Dune::SPGrid<double, 2>; };
69// struct Grid<TypeTag, TTag::OnePIncompressible> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; };
70
71// Set the problem type
72template<class TypeTag>
73struct Problem<TypeTag, TTag::OnePIncompressible> { using type = OnePTestProblem<TypeTag>; };
74
75// set the spatial params
76template<class TypeTag>
77struct SpatialParams<TypeTag, TTag::OnePIncompressible> { using type = OnePTestSpatialParams<TypeTag>; };
78
79// use the incompressible local residual (provides analytic jacobian)
80template<class TypeTag>
81struct LocalResidual<TypeTag, TTag::OnePIncompressible> { using type = OnePIncompressibleLocalResidual<TypeTag>; };
82
83// the fluid system
84template<class TypeTag>
85struct FluidSystem<TypeTag, TTag::OnePIncompressible>
86{
89};
90
91// Enable caching
92template<class TypeTag>
93struct EnableGridVolumeVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
94template<class TypeTag>
95struct EnableGridFluxVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
96template<class TypeTag>
97struct EnableGridGeometryCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = FVGEOMCACHING; };
98} // end namespace Properties
99
107template<class TypeTag>
108class OnePTestProblem : public PorousMediumFlowProblem<TypeTag>
109{
110 using ParentType = PorousMediumFlowProblem<TypeTag>;
111 using GridView = GetPropType<TypeTag, Properties::GridView>;
112 using Element = typename GridView::template Codim<0>::Entity;
113 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
114 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
115 using SourceValues = GetPropType<TypeTag, Properties::NumEqVector>;
116 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
117 using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
118 static constexpr int dimWorld = GridView::dimensionworld;
119 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
120
121public:
122 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
124 {
125 sourcePosition_ = getParam<GlobalPosition>("Source.Position");
126 sourceValues_ = getParam<SourceValues>("Source.Values");
127 sourceRadius_ = getParam<Scalar>("Source.Radius", 0.1);
128 }
129
136 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
137 {
138 BoundaryTypes values;
139 values.setAllDirichlet();
140 return values;
141 }
142
156 template<class PointSource>
157 void addPointSources(std::vector<PointSource>& pointSources) const
158 {
159 constexpr std::size_t numS = 20;
160 pointSources.reserve(numS);
161 for (int i = 0; i < numS; ++i)
162 {
163 const double angle = double(i)/numS*M_PI*2.0;
164 const double weight = 1.0/double(numS);
165 auto values = sourceValues_;
166 values *= weight;
167 auto pos = sourcePosition_;
168 pos.axpy(sourceRadius_, GlobalPosition({std::cos(angle), std::sin(angle)}));
169 pointSources.emplace_back(pos, values);
170 }
171 }
172
180 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
181 {
182 PrimaryVariables values(0);
183 values[0] = 1.0e+5*(2.0 - globalPos[dimWorld-1]);
184 return values;
185 }
186
194 Scalar temperature() const
195 {
196 return 283.15; // 10°C
197 }
198
199private:
200 GlobalPosition sourcePosition_;
201 SourceValues sourceValues_;
202 Scalar sourceRadius_;
203};
204
205} // end namespace Dumux
206
207#endif
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with mpfa.
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
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
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
Definition: common/properties.hh:91
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
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
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition: 1p/incompressiblelocalresidual.hh:41
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/porousmediumflow/1p/implicit/periodicbc/problem.hh:180
OnePTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/1p/implicit/periodicbc/problem.hh:122
void addPointSources(std::vector< PointSource > &pointSources) const
Applies a vector of point sources. The point sources are possibly solution dependent.
Definition: test/porousmediumflow/1p/implicit/periodicbc/problem.hh:157
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/periodicbc/problem.hh:136
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: test/porousmediumflow/1p/implicit/periodicbc/problem.hh:194
The spatial parameters class for the test problem using the incompressible 1p model.
Definition: multidomain/boundary/darcydarcy/1p_1p/spatialparams.hh:62
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:52
std::tuple< OneP > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:52
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:53
std::tuple< OnePIncompressible, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:53
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:54
std::tuple< OnePIncompressible, CCMpfaModel > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:54
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:55
std::tuple< OnePIncompressible, BoxModel > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:55
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:60
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/1p/implicit/convergence/problem.hh:83
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
#define FVGEOMCACHING
Definition: test/porousmediumflow/1p/implicit/periodicbc/problem.hh:49
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition of the spatial parameters for the MaxwellStefan problem.