GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/examples/biomineralization/spatialparams.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 12 20 60.0%
Functions: 2 7 28.6%
Branches: 13 36 36.1%

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 #ifndef DUMUX_MICP_COLUMN_SIMPLE_CHEM_SPATIAL_PARAMS_HH
9 #define DUMUX_MICP_COLUMN_SIMPLE_CHEM_SPATIAL_PARAMS_HH
10
11 // ## Parameter distributions (`spatialparams_1p.hh`)
12 //
13 // [[content]]
14 //
15 // This file contains the __spatial parameters class__ which defines the
16 // distributions for the porous medium parameters permeability and porosity
17 // over the computational grid
18 //
19 // ### Include files
20 // [[details]] includes
21 // We include the basic spatial parameters for finite volumes file from which we will inherit
22 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
23 // We include the files for the two-phase laws: the Brooks-Corey pc-Sw and relative permeability laws
24 #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
25 // We include the laws for changing porosity due to precipitation
26 #include <dumux/material/fluidmatrixinteractions/porosityprecipitation.hh>
27 // We include the laws for changing permeability based on porosity change according to Kozeny-Carman
28 #include <dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh>
29 // [[/details]]
30 //
31 // ### The spatial parameters class
32 // In the `ICPSpatialParams` class, we define all functions needed to describe
33 // the porous medium, e.g. porosity and permeability.
34 // We inherit from the `FVPorousMediumFlowSpatialParamsMP` class which is the base class for spatial parameters using finite volume discretization schemes.
35
36 // [[codeblock]]
37 namespace Dumux {
38
39 // In the ICPSpatialParams class we define all functions needed to describe the spatial distributed parameters.
40 template<class GridGeometry, class Scalar>
41
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 class ICPSpatialParams
42 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ICPSpatialParams<GridGeometry, Scalar>>
43 {
44 // We introduce using declarations that are derived from the property system which we need in this class
45 using ThisType = ICPSpatialParams<GridGeometry, Scalar>;
46 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>;
47 using GridView = typename GridGeometry::GridView;
48 using SubControlVolume = typename GridGeometry::SubControlVolume;
49 using Element = typename GridView::template Codim<0>::Entity;
50 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
51 using PcKrSwCurve = FluidMatrix::BrooksCoreyDefault<Scalar>;
52
53 public:
54 // type used for the permeability (i.e. tensor or scalar)
55 using PermeabilityType = Scalar;
56 // [[/codeblock]]
57 // #### Using porosity and permeability laws to return the updated values
58 // Due due calcium carbonate precipitation the porosity and the permeability change with time. At first, the initial values for the porosity and permeability are defined. Moreover, the functions that return the updated values, based on the chosen laws are defined.
59 // [[codeblock]]
60 1 ICPSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
61 : ParentType(gridGeometry)
62
7/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
3 , pcKrSw_("SpatialParams") // initialize from input file
63 {
64 // We read reference values for porosity and permeability from the input
65
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 referencePorosity_ = getParam<Scalar>("SpatialParams.ReferencePorosity", 0.4);
66
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 referencePermeability_ = getParam<Scalar>("SpatialParams.ReferencePermeability", 2.e-10);
67
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 temperature_ = getParam<Scalar>("Problem.Temperature");
68 1 }
69
70 // We return the reference or initial porosity.
71 //This reference porosity is the porosity, for which the permeability is know and set as reference permeability
72 Scalar referencePorosity(const Element& element, const SubControlVolume &scv) const
73 { return referencePorosity_; }
74
75 // We return the volume fraction of the inert (unreactive) component
76 template<class SolidSystem>
77 Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const
78 2595772 { return 1.0-referencePorosity_; }
79
80 // [[codeblock]]
81 // We return the updated porosity using the specified porosity law
82 template<class ElementSolution>
83 Scalar porosity(const Element& element,
84 const SubControlVolume& scv,
85 const ElementSolution& elemSol) const
86 { return poroLaw_.evaluatePorosity(element, scv, elemSol, referencePorosity_); }
87
88 // We return the updated permeability using the specified permeability law
89 template<class ElementSolution>
90 2595772 PermeabilityType permeability(const Element& element,
91 const SubControlVolume& scv,
92 const ElementSolution& elemSol) const
93 {
94 2595772 const auto poro = porosity(element, scv, elemSol);
95 2595772 return permLaw_.evaluatePermeability(referencePermeability_, referencePorosity_, poro);
96 }
97 // [[/codeblock]]
98 // Return the fluid matrix interactions (here only Brooks-Corey curves)
99 auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
100
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2595772 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2595772 times.
10383088 { return makeFluidMatrixInteraction(pcKrSw_); }
101
102 // Define the wetting phase
103 template<class FluidSystem>
104 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
105 { return FluidSystem::H2OIdx; }
106
107 // Define the temperature field (constant here)
108 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
109 { return temperature_; }
110
111 // The remainder of this class contains the data members and defines the porosity law which describes the change of porosity due to calcium carbonate precipitation.
112 // Additionally the change of porosity results in a change of permeability. This relation is described in the permeability law, in this case the Kozeny-Carman porosity-permeability relation
113 // [[codeblock]]
114 private:
115
116 const PcKrSwCurve pcKrSw_;
117 // Setting porosity precipitation as the porosity law
118 PorosityPrecipitation<Scalar, /*numFluidComponents*/9, /*activeComponents*/2> poroLaw_;
119 // Setting the Kozeny-Carman porosity-permeability relation as the permeability law
120 PermeabilityKozenyCarman<PermeabilityType> permLaw_;
121 //The reference porosity is the porosity, for which the permeability is know and set as reference permeability
122 Scalar referencePorosity_;
123 //The reference permeability is the known (measured) permeability, of the porous medium in the initial condition, before the solid phases change during the simulation
124 PermeabilityType referencePermeability_ = 0.0;
125 // the reference temperature field (for fluid properties)
126 Scalar temperature_;
127 };// end class definition of ICPSpatialParams
128 } //end namespace Dumux
129 // [[/codeblock]]
130 // [[/content]]
131 #endif
132