GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/material/fluidsystems/h2on2kinetic.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 16 21 76.2%
Functions: 1 1 100.0%
Branches: 10 75 13.3%

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-FileCopyrightText: 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 FluidSystems
10 * \brief @copydoc Dumux::FluidSystems::H2ON2Kinetic
11 */
12 #ifndef DUMUX_H2O_N2_FLUID_SYSTEM_KINETIC_HH
13 #define DUMUX_H2O_N2_FLUID_SYSTEM_KINETIC_HH
14
15 #include <dumux/material/components/simpleh2o.hh>
16 #include <dumux/material/components/h2o.hh>
17 #include <dumux/material/components/n2.hh>
18 #include <dumux/material/components/tabulatedcomponent.hh>
19 #include <dumux/material/idealgas.hh>
20
21 #include <dumux/material/binarycoefficients/h2o_n2.hh>
22
23 #include <dumux/material/fluidsystems/base.hh>
24 #include <dumux/material/fluidsystems/h2on2.hh>
25
26 namespace Dumux::FluidSystems {
27
28 /*!
29 * \ingroup FluidSystems
30 * \brief A two-phase fluid system with two components water \f$(\mathrm{H_2O})\f$
31 * Nitrogen \f$(\mathrm{N_2})\f$ for non-equilibrium models. TODO: Is this fluid system necessary??
32 */
33 template <class Scalar, class Policy = H2ON2DefaultPolicy<>>
34 class H2ON2Kinetic :
35 public FluidSystems::H2ON2<Scalar, Policy>
36 {
37 private:
38 using ParentType = FluidSystems::H2ON2<Scalar, Policy>;
39
40 using IdealGas = Dumux::IdealGas<Scalar>;
41 public:
42 //! The type of parameter cache objects
43 using ParameterCache = NullParameterCache;
44
45 /*!
46 * \brief Return the enthalpy of a component in a phase.
47 * \param fluidState A container with the current (physical) state of the fluid
48 * \param phaseIdx The index of the phase to consider
49 * \param compIdx The index of the component to consider
50 */
51 template <class FluidState>
52
2/3
✓ Branch 0 taken 4724160 times.
✓ Branch 1 taken 4724160 times.
✗ Branch 2 not taken.
9448320 static Scalar componentEnthalpy(FluidState &fluidState,
53 const int phaseIdx,
54 const int compIdx)
55 {
56
2/3
✓ Branch 0 taken 4724160 times.
✓ Branch 1 taken 4724160 times.
✗ Branch 2 not taken.
9448320 const Scalar T = fluidState.temperature(phaseIdx);
57 9448320 const Scalar p = fluidState.pressure(phaseIdx);
58
59
2/3
✓ Branch 0 taken 4724160 times.
✓ Branch 1 taken 4724160 times.
✗ Branch 2 not taken.
9448320 switch (phaseIdx) {
60 4724160 case ParentType::liquidPhaseIdx:
61
2/3
✓ Branch 0 taken 2362080 times.
✓ Branch 1 taken 2362080 times.
✗ Branch 2 not taken.
4724160 switch(compIdx) {
62 2362080 case ParentType::H2OIdx:
63 2362080 return ParentType::H2O::liquidEnthalpy(T, p);
64 2362080 case ParentType::N2Idx:
65 2362080 return ParentType::N2::gasEnthalpy(T, p); // TODO: should be liquid enthalpy
66 default:
67 DUNE_THROW(Dune::NotImplemented, "wrong index");
68 }
69 4724160 case ParentType::gasPhaseIdx:
70
2/3
✓ Branch 0 taken 2362080 times.
✓ Branch 1 taken 2362080 times.
✗ Branch 2 not taken.
4724160 switch(compIdx) {
71 2362080 case ParentType::H2OIdx:
72 2362080 return ParentType::H2O::gasEnthalpy(T, p);
73 2362080 case ParentType::N2Idx:
74 2362080 return ParentType::N2::gasEnthalpy(T, p);
75 default:
76 DUNE_THROW(Dune::NotImplemented, "wrong index");
77 }
78 default:
79 DUNE_THROW(Dune::NotImplemented, "wrong index");
80 }
81 }
82
83 /*!
84 * \brief Return the Henry constant for a component in a phase. \f$\mathrm{[Pa]}\f$
85 * \param temperature The given temperature
86 */
87 static Scalar henry(Scalar temperature)
88 {
89 return BinaryCoeff::H2O_N2::henry(temperature);
90 }
91
92 /*!
93 * \brief Return the vapor pressure of a component above one phase. \f$\mathrm{[Pa]}\f$
94 * \param temperature The given temperature
95 */
96 static Scalar vaporPressure(Scalar temperature)
97 {
98 return ParentType::H2O::vaporPressure(temperature);
99 }
100 };
101
102 } // end namespace Dumux::FluidSystems
103
104 #endif
105