GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidmatrixinteractions/3p/napladsorption.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 7 9 77.8%
Functions: 1 3 33.3%
Branches: 1 2 50.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 Fluidmatrixinteractions
10 * \brief Implementation of a NAPL adsorption model.
11 */
12 #ifndef DUMUX_MATERIAL_FLUIDMATRIX_INTERACTIONS_3P_NAPL_ADSORPTION
13 #define DUMUX_MATERIAL_FLUIDMATRIX_INTERACTIONS_3P_NAPL_ADSORPTION
14
15 #include <algorithm>
16 #include <dune/common/float_cmp.hh>
17 #include <dumux/common/parameters.hh>
18 #include <dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh>
19
20 namespace Dumux::FluidMatrix {
21 /*!
22 * \ingroup Fluidmatrixinteractions
23 * \brief Implementation of a NAPL adsorption model
24 */
25 template<class Scalar>
26 class ThreePNAPLAdsorption : Adapter<ThreePNAPLAdsorption<Scalar>, Adsorption>
27 {
28 public:
29
30 struct Params
31 {
32 Params(const Scalar rhoBulk, const Scalar kdNAPL)
33 : rhoBulk_(rhoBulk), kdNAPL_(kdNAPL) {}
34
35 Scalar rhoBulk() const { return rhoBulk_; }
36 void setRhoBulk(const Scalar rhoBulk) { rhoBulk_ = rhoBulk; }
37
38 Scalar kdNAPL() const { return kdNAPL_; }
39 void setKdNAPL(const Scalar kdNAPL) { kdNAPL_ = kdNAPL; }
40
41 bool operator== (const Params& p) const
42 {
43 return Dune::FloatCmp::eq(kdNAPL(), p.kdNAPL(), 1e-6)
44 && Dune::FloatCmp::eq(rhoBulk(), p.rhoBulk(), 1e-6);
45 }
46
47 private:
48 Scalar rhoBulk_, kdNAPL_;
49 };
50
51 /*!
52 * \brief Construct from a subgroup from the global parameter tree
53 * \note This will give you nice error messages if a mandatory parameter is missing
54 */
55 2 static Params makeParams(const std::string& paramGroup)
56 {
57 2 const auto rhoBulk = getParamFromGroup<Scalar>(paramGroup, "ThreePNAPLAdsorptionRhoBulk");
58 2 const auto kdNAPL = getParamFromGroup<Scalar>(paramGroup, "ThreePNAPLAdsorptionKdNAPL");
59 2 return {rhoBulk, kdNAPL};
60 }
61
62 ThreePNAPLAdsorption(const Params& params): params_(params) {}
63
64 2 ThreePNAPLAdsorption(const std::string& paramGroup)
65
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 : params_(makeParams(paramGroup)) {}
66
67 /*!
68 * \brief the basis for calculating adsorbed NAPL in storage term
69 */
70 Scalar bulkDensTimesAdsorpCoeff () const
71 {
72 1179193 return params_.rhoBulk() * params_.kdNAPL();
73 }
74
75 private:
76 Params params_;
77 };
78 } // end namespace Dumux::FluidMatrix
79
80 #endif
81