3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
spatialparams_2p.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_2P_TEST_SPATIALPARAMS_HH
26#define DUMUX_2P_TEST_SPATIALPARAMS_HH
27
29
36
37namespace Dumux {
38
43template<class GridGeometry, class Scalar, class CouplingManager>
44class TwoPSpatialParams : public FVSpatialParams<GridGeometry, Scalar,
45 TwoPSpatialParams<GridGeometry, Scalar, CouplingManager>>
46{
47 using SubControlVolume = typename GridGeometry::SubControlVolume;
48 using GridView = typename GridGeometry::GridView;
49 using Element = typename GridView::template Codim<0>::Entity;
50 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
51
54
55public:
59 // export permeability type
60 using PermeabilityType = Scalar;
61
62 TwoPSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
63 std::shared_ptr<CouplingManager> couplingManagerPtr)
65 , couplingManagerPtr_(couplingManagerPtr)
66 , initPermeability_(getParam<Scalar>("SpatialParams.Permeability"))
67 , initPorosity_(getParam<Scalar>("SpatialParams.InitialPorosity"))
68 {
69 // given Van Genuchten m
70 Scalar m = 0.457;
71 // Brooks Corey lambda
72 using std::pow;
73 Scalar brooksCoreyLambda = m / (1 - m) * (1 - pow(0.5, 1/m));
74
75 // residual saturations
76 myMaterialParams_.setSwr(0.3);
77 myMaterialParams_.setSnr(0.05);
78
79 // parameters for the Brooks Corey law
80 myMaterialParams_.setPe(1.99e4);
81 myMaterialParams_.setLambda(brooksCoreyLambda);
82 }
83
85 template< class ElementSolution >
86 Scalar porosity(const Element& element,
87 const SubControlVolume& scv,
88 const ElementSolution& elemSol) const
89 {
90 static constexpr auto poroMechId = CouplingManager::poroMechId;
91
92 const auto& poroMechGridGeom = couplingManagerPtr_->problem(poroMechId).gridGeometry();
93 const auto poroMechElemSol = elementSolution(element, couplingManagerPtr_->curSol()[poroMechId], poroMechGridGeom);
94
95 // evaluate the deformation-dependent porosity at the scv center
96 return PorosityDeformation<Scalar>::evaluatePorosity(poroMechGridGeom, element, scv.center(), poroMechElemSol, initPorosity_);
97 }
98
100 template< class ElementSolution >
101 PermeabilityType permeability(const Element& element,
102 const SubControlVolume& scv,
103 const ElementSolution& elemSol) const
104 {
106 return permLaw.evaluatePermeability(initPermeability_, initPorosity_, porosity(element, scv, elemSol));
107 }
108
119 template<class ElementSolution>
120 const MaterialLawParams& materialLawParams(const Element& element,
121 const SubControlVolume& scv,
122 const ElementSolution& elemSol) const
123 {
124 // do not use different parameters in the test with inverted wettability
125 return myMaterialParams_;
126 }
127
134 template<class FluidSystem>
135 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
136 {
137 return FluidSystem::phase0Idx;
138 }
139
142 { return *couplingManagerPtr_; }
143
144private:
145 std::shared_ptr<const CouplingManager> couplingManagerPtr_;
146 Scalar initPermeability_;
147 Scalar initPorosity_;
148
149 MaterialLawParams myMaterialParams_;
150};
151
152} // end namespace Dumux
153
154#endif
Element solution classes and factory functions.
Implementation of a regularized version of the Brooks-Corey capillary pressure / relative permeabilit...
The Kozeny-Carman relationship for the calculation of a porosity-dependent permeability.
A relationship for the porosity of a porous medium under mechanical deformation.
The base class for spatial parameters of multi-phase problems using a fully implicit discretization m...
Creating random fields using gstat.
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
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
This material law takes a material law defined for effective saturations and converts it to a materia...
Definition: 2p/efftoabslaw.hh:60
AbsParamsT Params
Definition: 2p/efftoabslaw.hh:64
Implementation of the regularized Brooks-Corey capillary pressure / relative permeability <-> saturat...
Definition: regularizedbrookscorey.hh:62
The Kozeny-Carman relationship for the calculation of a porosity-dependent permeability....
Definition: permeabilitykozenycarman.hh:42
PermeabilityType evaluatePermeability(PermeabilityType refPerm, Scalar refPoro, Scalar poro) const
calculates the permeability for a given sub-control volume
Definition: permeabilitykozenycarman.hh:51
static Scalar evaluatePorosity(const FVGridGeom &gridGeometry, const typename FVGridGeom::GridView::template Codim< 0 >::Entity &element, const typename FVGridGeom::GridView::template Codim< 0 >::Entity::Geometry::GlobalCoordinate &globalPos, const ElemSol &elemSol, Scalar refPoro, Scalar minPoro=0.0, Scalar maxPoro=1.0)
Calculates the porosity at a position inside an element.
Definition: porositydeformation.hh:65
The base class for spatial parameters of multi-phase problems using a fully implicit discretization m...
Definition: fv.hh:57
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fv1p.hh:334
Definition: multidomain/couplingmanager.hh:46
The spatial parameters class for the two-phase sub problem in the el2p test problem.
Definition: spatialparams_2p.hh:46
const MaterialLawParams & materialLawParams(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the parameter object for the Brooks-Corey material law.
Definition: spatialparams_2p.hh:120
PermeabilityType permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Functions for defining the (intrinsic) permeability .
Definition: spatialparams_2p.hh:101
const CouplingManager & couplingManager() const
Returns reference to the coupling manager.
Definition: spatialparams_2p.hh:141
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the porosity for a sub-control volume.
Definition: spatialparams_2p.hh:86
Scalar PermeabilityType
Definition: spatialparams_2p.hh:60
TwoPSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManagerPtr)
Definition: spatialparams_2p.hh:62
typename MaterialLaw::Params MaterialLawParams
Definition: spatialparams_2p.hh:58
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: spatialparams_2p.hh:135
This material law takes a material law defined for effective saturations and converts it to a materia...