GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/3p3c/iofields.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 6 48 12.5%
Branches: 33 88 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 ThreePThreeCModel
10 * \brief Adds I/O fields specific to the three-phase three-component model.
11 */
12
13 #ifndef DUMUX_THREEPTHREEC_IO_FIELDS_HH
14 #define DUMUX_THREEPTHREEC_IO_FIELDS_HH
15
16 #include <array>
17 #include <dumux/io/name.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup ThreePThreeCModel
23 * \brief Adds I/O fields specific to the three-phase three-component model.
24 */
25 class ThreePThreeCIOFields
26 {
27 public:
28 template <class OutputModule>
29 6 static void initOutputModule(OutputModule& out)
30 {
31 using VolumeVariables = typename OutputModule::VolumeVariables;
32 using FluidSystem = typename VolumeVariables::FluidSystem;
33
34 // register standardized output fields
35
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
24 for (int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
36 {
37
4/12
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 18 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
36 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.saturation(phaseIdx); },
38 IOName::saturation<FluidSystem>(phaseIdx));
39
4/12
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 18 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
36 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.pressure(phaseIdx); },
40 IOName::pressure<FluidSystem>(phaseIdx));
41
4/12
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 18 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
36 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.density(phaseIdx); },
42 IOName::density<FluidSystem>(phaseIdx));
43
44
2/2
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 18 times.
72 for (int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
45
5/12
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 54 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 54 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
✓ Branch 10 taken 46 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
116 out.addVolumeVariable([phaseIdx, compIdx](const auto& v){ return v.moleFraction(phaseIdx, compIdx); },
46 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
47 }
48
49
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( [](const auto& v){ return v.porosity(); },
50 IOName::porosity());
51
4/12
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
95772 out.addVolumeVariable( [](const auto& v){ return v.priVars().state(); },
52 IOName::phasePresence());
53
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( [](const auto& v){ return v.permeability(); },
54 IOName::permeability());
55 6 }
56
57 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
58 static std::string primaryVariableName(int pvIdx, int state)
59 {
60 using Indices = typename ModelTraits::Indices;
61 static constexpr auto numEq = ModelTraits::numEq();
62 using StringVec = std::array<std::string, numEq>;
63
64 switch (state)
65 {
66 case Indices::threePhases:
67 {
68 static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
69 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
70 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
71 return s1[pvIdx];
72 }
73 case Indices::wPhaseOnly:
74 {
75 static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
76 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
77 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)};
78 return s2[pvIdx];
79 }
80 case Indices::gnPhaseOnly:
81 {
82 static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
83 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
84 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
85 return s3[pvIdx];
86 }
87 case Indices::wnPhaseOnly:
88 {
89 static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
90 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
91 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
92 return s4[pvIdx];
93 }
94 case Indices::gPhaseOnly:
95 {
96 static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
97 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
98 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
99 return s5[pvIdx];
100 }
101 case Indices::wgPhaseOnly:
102 {
103 static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
104 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
105 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
106 return s6[pvIdx];
107 }
108 }
109 }
110 };
111
112 } // end namespace Dumux
113
114 #endif
115