3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porenetwork2p.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_PNM2P_SPATIAL_PARAMS_HH
26#define DUMUX_PNM2P_SPATIAL_PARAMS_HH
27
28#warning "This file is deprecated, use PoreNetwork::TwoPDefaultSpatialParams from dumux/porenetwork/2p/spatialparams.hh instead!"
29
32
35
36#include "porenetworkbase.hh"
37
38namespace Dumux::PoreNetwork {
39
48template<class GridGeometry, class Scalar, class LocalRules, class Implementation>
49class
50[[deprecated("Use PoreNetwork::TwoPSpatialParams from dumux/porenetwork/2p/spatialparams.hh instead. This class will be removed after 3.5.")]]
53{
55 using GridView = typename GridGeometry::GridView;
56 using SubControlVolume = typename GridGeometry::SubControlVolume;
57 using Element = typename GridView::template Codim<0>::Entity;
58
59public:
60
61 TwoPBaseSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
62 : ParentType(gridGeometry)
63 {
64 if (!gridGeometry->useSameGeometryForAllPores() && LocalRules::supportsMultipleGeometries())
65 DUNE_THROW(Dune::InvalidStateException, "Your MaterialLaw does not support multiple pore body shapes.");
66
67 if (this->gridGeometry().useSameShapeForAllThroats())
68 {
69 cornerHalfAngles_.resize(1);
70 const auto& shape = this->gridGeometry().throatCrossSectionShape(/*eIdx*/0);
71 cornerHalfAngles_[0] = Throat::cornerHalfAngles<Scalar>(shape);
72 }
73 else
74 {
75 cornerHalfAngles_.resize(this->gridGeometry().gridView().size(0));
76 for (auto&& element : elements(this->gridGeometry().gridView()))
77 {
78 const auto eIdx = this->gridGeometry().elementMapper().index(element);
79 const auto& shape = this->gridGeometry().throatCrossSectionShape(eIdx);
80 cornerHalfAngles_[eIdx] = Throat::cornerHalfAngles<Scalar>(shape);
81 }
82 }
83 }
84
88 template<class FS, class ElementVolumeVariables>
89 int wettingPhase(const Element&, const ElementVolumeVariables& elemVolVars) const
90 { return 0; }
91
95 template<class FS, class ElementSolutionVector>
96 int wettingPhase(const Element&, const SubControlVolume& scv, const ElementSolutionVector& elemSol) const
97 { return 0; }
98
106 template<class ElementVolumeVariables>
107 Scalar contactAngle(const Element& element,
108 const ElementVolumeVariables& elemVolVars) const
109 {
110 static const Scalar theta = getParam<Scalar>("SpatialParams.ContactAngle", 0.0);
111 return theta;
112 }
113
122 template<class ElementSolutionVector>
123 Scalar contactAngle(const Element& element,
124 const SubControlVolume& scv,
125 const ElementSolutionVector& elemSol) const
126 {
127 static const Scalar theta = getParam<Scalar>("SpatialParams.ContactAngle", 0.0);
128 return theta;
129 }
130
136 template<class ElementVolumeVariables>
137 const Scalar pcEntry(const Element& element, const ElementVolumeVariables& elemVolVars) const
138 {
139 const auto eIdx = this->gridGeometry().elementMapper().index(element);
140 // take the average of both adjacent pores TODO: is this correct?
141 const Scalar surfaceTension = 0.5*(elemVolVars[0].surfaceTension() + elemVolVars[1].surfaceTension());
142 return ThresholdCapillaryPressures::pcEntry(surfaceTension,
143 this->asImp_().contactAngle(element, elemVolVars),
144 this->asImp_().throatInscribedRadius(element, elemVolVars),
145 this->gridGeometry().throatShapeFactor(eIdx));
146 }
147
153 template<class ElementVolumeVariables>
154 const Scalar pcSnapoff(const Element& element, const ElementVolumeVariables& elemVolVars) const
155 {
156 // take the average of both adjacent pores TODO: is this correct?
157 const Scalar surfaceTension = 0.5*(elemVolVars[0].surfaceTension() + elemVolVars[1].surfaceTension());
158 return ThresholdCapillaryPressures::pcSnapoff(surfaceTension,
159 this->asImp_().contactAngle(element, elemVolVars),
160 this->asImp_().throatInscribedRadius(element, elemVolVars));
161 }
162
170 template<class ElementSolution>
171 Scalar surfaceTension(const Element& element,
172 const SubControlVolume& scv,
173 const ElementSolution& elemSol) const
174 {
175 static const Scalar gamma = getParam<Scalar>("SpatialParams.SurfaceTension", 0.0725); // default to surface tension of water/air
176 return gamma;
177 }
178
187 template<class ElementSolution>
188 auto fluidMatrixInteraction(const Element& element,
189 const SubControlVolume& scv,
190 const ElementSolution& elemSol) const
191 {
192 const auto params = typename LocalRules::BasicParams(*this, element, scv, elemSol);
193 return makeFluidMatrixInteraction(LocalRules(params, "SpatialParams"));
194 }
195
196 const Dune::ReservedVector<Scalar, 4>& cornerHalfAngles(const Element& element) const
197 {
198 if (this->gridGeometry().useSameShapeForAllThroats())
199 return cornerHalfAngles_[0];
200 else
201 {
202 const auto eIdx = this->gridGeometry().gridView().indexSet().index(element);
203 return cornerHalfAngles_[eIdx];
204 }
205 }
206
207private:
208 std::vector<Dune::ReservedVector<Scalar, 4>> cornerHalfAngles_;
209};
210
211// TODO docme
212template<class GridGeometry, class Scalar, class MaterialLawT>
213class
214[[deprecated("Use PoreNetwork::TwoPDefaultSpatialParams from dumux/porenetwork/2p/spatialparams.hh instead. This class will be removed after 3.5.")]]
215TwoPDefaultSpatialParams : public TwoPBaseSpatialParams<GridGeometry, Scalar, MaterialLawT,
217{
218 using ParentType = TwoPBaseSpatialParams<GridGeometry, Scalar, MaterialLawT,
220public:
222};
223
224} // namespace Dumux::PoreNetwork
225
226#endif
Wrapper type to combine an arbitrary number of different laws for fluid-matrix interaction (e....
Specification of threshold capillary pressures for the PNM.
The base class for spatial parameters for pore-network models.
This file contains functions related to calculate pore-body properties.
This file contains functions related to calculate pore-throat properties.
auto makeFluidMatrixInteraction(Laws &&... laws)
Helper function to create an FluidMatrixInteraction object containing an arbitrary number of fluid ma...
Definition: fluidmatrixinteraction.hh:51
Definition: discretization/porenetwork/fvelementgeometry.hh:34
constexpr Shape shape(const Scalar shapeFactor) noexcept
Returns the shape for a given shape factor.
Definition: throatproperties.hh:176
Base class for the finite volume geometry for porenetwork models.
Definition: discretization/porenetwork/gridgeometry.hh:489
static constexpr Scalar pcSnapoff(const Scalar surfaceTension, const Scalar contactAngle, const Scalar inscribedRadius) noexcept
The snap-off capillary pressure of a pore throat.
Definition: thresholdcapillarypressures.hh:37
static constexpr Scalar pcEntry(const Scalar surfaceTension, const Scalar contactAngle, const Scalar inscribedRadius, const Scalar shapeFactor) noexcept
The entry capillary pressure of a pore throat.
Definition: thresholdcapillarypressures.hh:55
The base class for spatial parameters for pore-network models.
Definition: porenetwork2p.hh:53
const Scalar pcSnapoff(const Element &element, const ElementVolumeVariables &elemVolVars) const
Return the element (throat) specific snap-off capillary pressure .
Definition: porenetwork2p.hh:154
int wettingPhase(const Element &, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
The index of the wetting phase within a pore body.
Definition: porenetwork2p.hh:96
int wettingPhase(const Element &, const ElementVolumeVariables &elemVolVars) const
The index of the wetting phase within a pore throat.
Definition: porenetwork2p.hh:89
Scalar contactAngle(const Element &element, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
The contact angle within a pore body .
Definition: porenetwork2p.hh:123
TwoPBaseSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porenetwork2p.hh:61
Scalar contactAngle(const Element &element, const ElementVolumeVariables &elemVolVars) const
The contact angle within a pore throat .
Definition: porenetwork2p.hh:107
auto fluidMatrixInteraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the parameter object for the pore-local pc-Sw law.
Definition: porenetwork2p.hh:188
const Dune::ReservedVector< Scalar, 4 > & cornerHalfAngles(const Element &element) const
Definition: porenetwork2p.hh:196
Scalar surfaceTension(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the surface tension .
Definition: porenetwork2p.hh:171
const Scalar pcEntry(const Element &element, const ElementVolumeVariables &elemVolVars) const
Return the element (throat) specific entry capillary pressure .
Definition: porenetwork2p.hh:137
The default class for spatial parameters for two-phase pore-network models.
Definition: porenetwork2p.hh:217
The base class for spatial parameters for pore-network models.
Definition: porenetworkbase.hh:94