GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/3pwateroil/iofields.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 1 10 10.0%
Branches: 40 112 35.7%

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