GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/mpnc/iofields.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 12 12 100.0%
Functions: 3 32 9.4%
Branches: 36 96 37.5%

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 MPNCModel
10 * \brief Adds I/O fields specific to the mpnc model.
11 */
12
13 #ifndef DUMUX_MPNC_IO_FIELDS_HH
14 #define DUMUX_MPNC_IO_FIELDS_HH
15
16 #include <dune/common/exceptions.hh>
17
18 #include <dumux/io/name.hh>
19 #include "pressureformulation.hh"
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup MPNCModel
25 * \brief Adds I/O fields specific to the mpnc model.
26 */
27 class MPNCIOFields
28 {
29 public:
30 template <class OutputModule>
31 3 static void initOutputModule(OutputModule& out)
32 {
33 using VolumeVariables = typename OutputModule::VolumeVariables;
34 using FluidSystem = typename VolumeVariables::FluidSystem;
35
36
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
9 for (int i = 0; i < VolumeVariables::numFluidPhases(); ++i)
37 {
38
4/12
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
12 out.addVolumeVariable([i](const auto& v){ return v.saturation(i); },
39 IOName::saturation<FluidSystem>(i));
40
4/12
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
12 out.addVolumeVariable([i](const auto& v){ return v.pressure(i); },
41 IOName::pressure<FluidSystem>(i));
42
4/12
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
12 out.addVolumeVariable([i](const auto& v){ return v.density(i); },
43 IOName::density<FluidSystem>(i));
44
4/12
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
12 out.addVolumeVariable([i](const auto& v){ return v.mobility(i); },
45 IOName::mobility<FluidSystem>(i));
46
47
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
48
4/12
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
24 out.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },
49 IOName::moleFraction<FluidSystem>(i, j));
50 }
51
52
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
9 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
53
6/18
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
12 out.addVolumeVariable([j](const auto& v){ return v.fugacity(j); },
54 "fugacity^"+ FluidSystem::componentName(j));
55
56
57
4/12
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
6 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
58 IOName::porosity());
59 3 }
60
61 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
62 static std::string primaryVariableName(int pvIdx, int state=0)
63 {
64 if (pvIdx < ModelTraits::numFluidComponents())
65 return "fugacity^"+ FluidSystem::componentName(pvIdx);
66 else if (pvIdx < ModelTraits::numEq()-1)
67 return "S_"+ FluidSystem::phaseName(pvIdx - ModelTraits::numFluidComponents());
68 else
69 {
70 switch (ModelTraits::pressureFormulation())
71 {
72 case MpNcPressureFormulation::mostWettingFirst :
73 return "p_"+ FluidSystem::phaseName(0);
74 case MpNcPressureFormulation::leastWettingFirst :
75 return "p_"+ FluidSystem::phaseName(ModelTraits::numFluidPhases()-1);
76 default: DUNE_THROW(Dune::InvalidStateException, "Invalid formulation ");
77 }
78 }
79 }
80
81 };
82
83 } // end namespace Dumux
84
85 #endif
86