GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/idealgas.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 0 0 -%
Branches: 14 14 100.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 Material
10 * \brief Relations valid for an ideal gas.
11 */
12 #ifndef DUMUX_IDEAL_GAS_HH
13 #define DUMUX_IDEAL_GAS_HH
14
15 #include <dumux/material/constants.hh>
16
17 namespace Dumux {
18
19 /*!
20 * \ingroup Material
21 * \brief Relations valid for an ideal gas.
22 */
23 template <class Scalar>
24 class IdealGas
25 {
26 public:
27 //! The ideal gas constant \f$\mathrm{[J/mol/K]}\f$
28 static constexpr Scalar R = Constants<Scalar>::R;
29
30 /*!
31 * \brief The density of the gas in \f$\mathrm{[kg/m^3]}\f$, depending on
32 * pressure, temperature and average molar mass of the gas.
33 * \param avgMolarMass The average molar mass of the gas
34 * \param temperature The temperature of the gas
35 * \param pressure The pressure of the gas
36 */
37 static constexpr Scalar density(Scalar avgMolarMass,
38 Scalar temperature,
39 Scalar pressure)
40 480152310 { return molarDensity(temperature,pressure)*avgMolarMass;}
41
42 /*!
43 * \brief The pressure of the gas in \f$\mathrm{[Pa]}\f$, depending on
44 * the molar density and temperature.
45 * \param temperature The temperature of the gas
46 * \param rhoMolar The molar density of the gas
47 */
48 static constexpr Scalar pressure(Scalar temperature,
49 Scalar rhoMolar)
50 3030677 { return R*temperature*rhoMolar; }
51
52 /*!
53 * \brief The molar density of the gas \f$\mathrm{[mol/m^3]}\f$,
54 * depending on pressure and temperature.
55 * \param temperature The temperature of the gas
56 * \param pressure The pressure of the gas
57 */
58 static constexpr Scalar molarDensity(Scalar temperature,
59 Scalar pressure)
60
14/14
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 2 times.
247482525 { return pressure/(R*temperature); }
61 };
62 } // end namespace
63
64 #endif
65