Line | Branch | Exec | Source |
---|---|---|---|
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 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup Fluidmatrixinteractions | ||
10 | * \brief A relationship for the porosity of a porous medium under mechanical deformation. | ||
11 | */ | ||
12 | #ifndef DUMUX_MATERIAL_POROSITY_DEFORMATION_HH | ||
13 | #define DUMUX_MATERIAL_POROSITY_DEFORMATION_HH | ||
14 | |||
15 | #include <dumux/discretization/evalgradients.hh> | ||
16 | |||
17 | namespace Dumux { | ||
18 | |||
19 | /*! | ||
20 | * \ingroup Fluidmatrixinteractions | ||
21 | * \brief A relationship for the porosity of a porous medium under mechanical deformation. | ||
22 | * | ||
23 | * \tparam Scalar The type used for scalar values | ||
24 | */ | ||
25 | template<class Scalar> | ||
26 | class PorosityDeformation | ||
27 | { | ||
28 | public: | ||
29 | /*! | ||
30 | * \brief Calculates the porosity at a position inside an element | ||
31 | * \note This assumes the primary variables to be organized such that | ||
32 | * the displacements in the different grid directions are stored | ||
33 | * in the first entries of the primary variable vector. | ||
34 | * | ||
35 | * \param gridGeometry The finite volume grid geometry | ||
36 | * \param element The finite element | ||
37 | * \param elemSol The element solution | ||
38 | * \param globalPos The global position (in the element) | ||
39 | * \param refPoro The solid matrix porosity without deformation | ||
40 | * \param minPoro A minimum porosity value | ||
41 | * \param maxPoro A maximum porosity value | ||
42 | * | ||
43 | * \note \cite han2003 ( https://doi.org/10.1016/S0920-4105(03)00047-0 ) | ||
44 | * provide a derivation for \f$\text{d} \phi = -(1 - \phi ) \text{d} \epsilon_v \f$. | ||
45 | * Here, \f$\epsilon_v\f$ is equal to \f$\nabla \cdot \mathbf{u}\f$. | ||
46 | * By using an initial porosity \f$\phi_0\f$ and assuming \f$ \epsilon_{v, 0} = 0 \f$, | ||
47 | * one obtains \f$\phi = \frac{\phi_0 - \nabla \cdot \mathbf{u}}{1 - \nabla \cdot \mathbf{u}}\f$, | ||
48 | * which is the formulation for the rock mechanics sign convention. Here we are | ||
49 | * using the continuum mechanics sign convention, thus, the final formula reads: | ||
50 | * \f$\phi = \frac{\phi_0 + \nabla \cdot \mathbf{u}}{1 + \nabla \cdot \mathbf{u}}\f$. | ||
51 | */ | ||
52 | template< class FVGridGeom, class ElemSol > | ||
53 | 5602020 | static Scalar evaluatePorosity(const FVGridGeom& gridGeometry, | |
54 | const typename FVGridGeom::GridView::template Codim<0>::Entity& element, | ||
55 | const typename FVGridGeom::GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate& globalPos, | ||
56 | const ElemSol& elemSol, | ||
57 | Scalar refPoro, | ||
58 | Scalar minPoro = 0.0, | ||
59 | Scalar maxPoro = 1.0) | ||
60 | { | ||
61 | // compute divergence of displacement at the given position | ||
62 | 5602020 | Scalar divU = 0.0; | |
63 | 5602020 | const auto gradU = evalGradients(element, element.geometry(), gridGeometry, elemSol, globalPos); | |
64 |
2/2✓ Branch 0 taken 16737160 times.
✓ Branch 1 taken 5602020 times.
|
22339180 | for (int dir = 0; dir < FVGridGeom::GridView::dimension; ++dir) |
65 | 50211480 | divU += gradU[dir][dir]; | |
66 | |||
67 | using std::clamp; | ||
68 |
2/2✓ Branch 0 taken 5601780 times.
✓ Branch 1 taken 240 times.
|
5602020 | return clamp((refPoro+divU)/(1.0+divU), minPoro, maxPoro); |
69 | } | ||
70 | |||
71 | /*! | ||
72 | * \brief Calculates the porosity at a position inside an element | ||
73 | * \note This assumes the primary variables to be organized such that | ||
74 | * the displacements in the different grid directions are stored | ||
75 | * in the first entries of the primary variable vector. | ||
76 | * | ||
77 | * | ||
78 | * \param gridGeometry The finite volume grid geometry | ||
79 | * \param element The finite element | ||
80 | * \param elemSol The element solution | ||
81 | * \param scv The sub-control volume | ||
82 | * \param refPoro The solid matrix porosity without deformation | ||
83 | * \param minPoro A minimum porosity value | ||
84 | */ | ||
85 | template< class FVGridGeom, class ElemSol > | ||
86 | static Scalar evaluatePorosity(const FVGridGeom& gridGeometry, | ||
87 | const typename FVGridGeom::GridView::template Codim<0>::Entity& element, | ||
88 | const typename FVGridGeom::SubControlVolume& scv, | ||
89 | const ElemSol& elemSol, | ||
90 | Scalar refPoro, | ||
91 | Scalar minPoro = 0.0) | ||
92 | { | ||
93 | // evaluate the porosity at the scv center | ||
94 | 451680 | return evaluatePorosity(gridGeometry, element, scv.center(), elemSol, refPoro, minPoro); | |
95 | } | ||
96 | }; | ||
97 | |||
98 | } // namespace Dumux | ||
99 | |||
100 | #endif | ||
101 |