3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porositydeformation.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 *****************************************************************************/
24#ifndef DUMUX_MATERIAL_POROSITY_DEFORMATION_HH
25#define DUMUX_MATERIAL_POROSITY_DEFORMATION_HH
26
28
29namespace Dumux {
30
37template<class Scalar>
39{
40public:
64 template< class FVGridGeom, class ElemSol >
65 static Scalar evaluatePorosity(const FVGridGeom& gridGeometry,
66 const typename FVGridGeom::GridView::template Codim<0>::Entity& element,
67 const typename FVGridGeom::GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate& globalPos,
68 const ElemSol& elemSol,
69 Scalar refPoro,
70 Scalar minPoro = 0.0,
71 Scalar maxPoro = 1.0)
72 {
73 // compute divergence of displacement at the given position
74 Scalar divU = 0.0;
75 const auto gradU = evalGradients(element, element.geometry(), gridGeometry, elemSol, globalPos);
76 for (int dir = 0; dir < FVGridGeom::GridView::dimension; ++dir)
77 divU += gradU[dir][dir];
78
79 using std::clamp;
80 return clamp((refPoro+divU)/(1.0+divU), minPoro, maxPoro);
81 }
82
97 template< class FVGridGeom, class ElemSol >
98 static Scalar evaluatePorosity(const FVGridGeom& gridGeometry,
99 const typename FVGridGeom::GridView::template Codim<0>::Entity& element,
100 const typename FVGridGeom::SubControlVolume& scv,
101 const ElemSol& elemSol,
102 Scalar refPoro,
103 Scalar minPoro = 0.0)
104 {
105 // evaluate the porosity at the scv center
106 return evaluatePorosity(gridGeometry, element, scv.center(), elemSol, refPoro, minPoro);
107 }
108};
109
110} // namespace Dumux
111
112#endif
free functions for the evaluation of primary variable gradients inside elements.
auto evalGradients(const Element &element, const typename Element::Geometry &geometry, const typename FVElementGeometry::GridGeometry &gridGeometry, const BoxElementSolution< FVElementGeometry, PrimaryVariables > &elemSol, const typename Element::Geometry::GlobalCoordinate &globalPos, bool ignoreState=false)
Evaluates the gradient of a given box element solution to a given global position.
Definition: evalgradients.hh:55
Definition: adapt.hh:29
A relationship for the porosity of a porous medium under mechanical deformation.
Definition: porositydeformation.hh:39
static Scalar evaluatePorosity(const FVGridGeom &gridGeometry, const typename FVGridGeom::GridView::template Codim< 0 >::Entity &element, const typename FVGridGeom::SubControlVolume &scv, const ElemSol &elemSol, Scalar refPoro, Scalar minPoro=0.0)
Calculates the porosity at a position inside an element.
Definition: porositydeformation.hh:98
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