GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2p2c/chemicalnonequilibrium/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 10 23 43.5%
Functions: 2 16 12.5%
Branches: 20 50 40.0%

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 TwoPTwoCTests
10 * \brief The spatial parameters for the 2p2c chemical nonequilibrium problem.
11 */
12
13 #ifndef DUMUX_MPNC_COMPARISON_SPATIAL_PARAMS_HH
14 #define DUMUX_MPNC_COMPARISON_SPATIAL_PARAMS_HH
15
16 #include <dumux/porousmediumflow/properties.hh>
17 #include <dumux/porousmediumflow/fvspatialparams.hh>
18 #include <dumux/porousmediumflow/fvspatialparamsnonequilibrium.hh>
19
20 #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
21 #include <dumux/material/fluidmatrixinteractions/2p/interfacialarea/interfacialarea.hh>
22 #include <dumux/material/fluidmatrixinteractions/2p/interfacialarea/pcmax.hh>
23
24 namespace Dumux {
25
26 /**
27 * \ingroup TwoPTwoCTests
28 * \brief The spatial parameters for the 2p2c chemical nonequilibrium problem.
29 */
30 template<class GridGeometry, class Scalar>
31 class TwoPTwoCChemicalNonequilibriumSpatialParams
32 : public FVPorousMediumFlowSpatialParamsNonEquilibrium<GridGeometry, Scalar,
33 TwoPTwoCChemicalNonequilibriumSpatialParams<GridGeometry, Scalar>>
34 {
35 using GridView = typename GridGeometry::GridView;
36 using FVElementGeometry = typename GridGeometry::LocalView;
37 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
38
39 using Element = typename GridView::template Codim<0>::Entity;
40 using ThisType = TwoPTwoCChemicalNonequilibriumSpatialParams<GridGeometry, Scalar>;
41 using ParentType = FVPorousMediumFlowSpatialParamsNonEquilibrium<GridGeometry, Scalar, ThisType>;
42
43 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
44
45 enum {dimWorld=GridView::dimensionworld};
46
47 using PcKrSwCurve = FluidMatrix::BrooksCoreyDefault<Scalar>;
48
49 using WettingNonwettingInterfacialArea = FluidMatrix::InterfacialArea<Scalar,
50 FluidMatrix::InterfacialAreaPcMax,
51 FluidMatrix::WettingNonwettingInterfacialAreaPcSw>;
52 public:
53 //! Export permeability type
54 using PermeabilityType = Scalar;
55
56 2 TwoPTwoCChemicalNonequilibriumSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
57 : ParentType(gridGeometry)
58 , permeability_(1e-11)
59 , porosity_(0.4)
60
8/24
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
6 , pcKrSwCurve_("SpatialParams")
61 {
62
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 characteristicLength_ = getParam<Scalar>("SpatialParams.MeanPoreSize");
63
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 factorMassTransfer_ = getParam<Scalar>("SpatialParams.MassTransferFactor");
64 2 temperature_ = 273.15 + 25; // -> 25°C
65
66
4/10
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
6 auto anwParams = WettingNonwettingInterfacialArea::makeBasicParams("SpatialParams.WettingNonwettingArea");
67
68 // determine maximum capillary pressure for wetting-nonwetting surface
69
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 anwParams.setPcMax(pcKrSwCurve_.pc(/*sw = */0.0));
70
71
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
2 aNw_ = std::make_unique<WettingNonwettingInterfacialArea>(anwParams);
72 2 }
73
74 template<class ElementSolution>
75 PermeabilityType permeability(const Element& element,
76 const SubControlVolume& scv,
77 const ElementSolution& elemSol) const
78 {
79 return permeability_;
80 }
81
82 /*!
83 * \brief Defines the porosity \f$[-]\f$ of the soil
84 *
85 * \param globalPos The global position of the sub-control volume.
86 * \return the material parameters object
87 */
88 Scalar porosityAtPos(const GlobalPosition& globalPos) const
89 {
90 return porosity_;
91 }
92
93 /*!
94 * \brief Returns the fluid-matrix interaction law at a given location
95 */
96 auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
97 {
98
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 394268 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 394268 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 394268 times.
2365608 return makeFluidMatrixInteraction(pcKrSwCurve_, *aNw_);
99 }
100
101 /*!
102 * \brief Returns the characteristic length for the mass transfer.
103 *
104 * \param globalPos The position in global coordinates.
105 */
106 const Scalar characteristicLengthAtPos(const GlobalPosition & globalPos) const
107 { return characteristicLength_ ; }
108
109 /*!
110 * \brief Return the pre factor the the energy transfer.
111 *
112 * \param globalPos The position in global coordinates.
113 */
114 const Scalar factorMassTransferAtPos(const GlobalPosition & globalPos) const
115 { return factorMassTransfer_; }
116
117 /*!
118 * \brief Function for defining which phase is to be considered as the wetting phase.
119 *
120 * \param globalPos The global position of the sub-control volume.
121 * \return The wetting phase index
122 */
123 template<class FluidSystem>
124 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
125 { return FluidSystem::H2OIdx; }
126
127 /*!
128 * \brief Returns the temperature in the domain at the given position
129 * \param globalPos The position in global coordinates where the temperature should be specified.
130 */
131 Scalar temperatureAtPos (const GlobalPosition& globalPos) const
132 {
133 return temperature_;
134 }
135
136 private:
137
138 const Scalar permeability_;
139 const Scalar porosity_;
140 static constexpr Scalar eps_ = 1e-6;
141
142 const PcKrSwCurve pcKrSwCurve_;
143 std::unique_ptr<const WettingNonwettingInterfacialArea> aNw_;
144
145 Scalar factorMassTransfer_ ;
146 Scalar characteristicLength_ ;
147 Scalar temperature_;
148 };
149
150 } // end namespace Dumux
151
152 #endif
153