GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/compositional/iofields.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 11 15 73.3%
Functions: 17 133 12.8%
Branches: 49 127 38.6%

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 FreeflowNCModel
10 * \copydoc Dumux::FreeflowNCIOFields
11 */
12 #ifndef DUMUX_FREEFLOW_NC_IO_FIELDS_HH
13 #define DUMUX_FREEFLOW_NC_IO_FIELDS_HH
14
15 #include <dumux/io/name.hh>
16 #include <dumux/freeflow/navierstokes/iofields.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup FreeflowNCModel
22 * \brief Adds I/O fields specific to the FreeflowNC model
23 */
24 template<class BaseOutputFields, bool turbulenceModel = false>
25 struct FreeflowNCIOFields
26 {
27 //! Initialize the FreeflowNC specific output fields.
28 template <class OutputModule>
29 22 static void initOutputModule(OutputModule& out)
30 {
31 22 BaseOutputFields::initOutputModule(out);
32
33 // TODO only output molar density if we use mole fractions
34
4/12
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 22 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 22 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 22 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
44 out.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, IOName::molarDensity());
35
36 using FluidSystem = typename OutputModule::VolumeVariables::FluidSystem;
37
2/2
✓ Branch 0 taken 45 times.
✓ Branch 1 taken 22 times.
67 for (int j = 0; j < FluidSystem::numComponents; ++j)
38 {
39
13/19
✓ Branch 0 taken 39200 times.
✓ Branch 1 taken 39200 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 32 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 32 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 32 times.
✓ Branch 12 taken 10 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
259426 out.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, IOName::massFraction<FluidSystem>(0, j));
40
4/12
✓ Branch 2 taken 45 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 45 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 45 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 45 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
90 out.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, IOName::moleFraction<FluidSystem>(0, j));
41
42
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 22 times.
45 if (j != FluidSystem::getMainComponent(0))
43 {
44
12/42
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 23 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 23 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 23 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 23 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 23 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 23 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 23 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 23 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 23 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 23 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 23 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
142514 out.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(0,0, j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
45
46 // the eddy diffusivity is recalculated for an arbitrary component which is not the phase component
47 if (turbulenceModel)
48
12/36
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 14 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 14 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 14 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 14 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 14 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 14 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 14 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 14 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
28 out.addVolumeVariable([j](const auto& v){ return getEffectiveDiffusionCoefficient_(v, 0, j) - v.diffusionCoefficient(0,0, j); }, "D_t^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
49 }
50 }
51 22 }
52
53 //! return the names of the primary variables
54 template <class ModelTraits, class FluidSystem>
55 static std::string primaryVariableName(int pvIdx = 0, int state = 0)
56 {
57 // priVars: v_0, ..., v_dim-1, p, x_0, ..., x_numComp-1, otherPv ..., T
58 if (pvIdx > ModelTraits::dim() && pvIdx < ModelTraits::dim() + ModelTraits::numFluidComponents())
59 return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(0, pvIdx - ModelTraits::dim())
60 : IOName::massFraction<FluidSystem>(0, pvIdx - ModelTraits::dim());
61 else
62 return BaseOutputFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state);
63
64 }
65
66 template<class VolumeVariables>
67 static double getEffectiveDiffusionCoefficient_(const VolumeVariables& volVars, const int phaseIdx, const int compIdx)
68 {
69 80100 return volVars.effectiveDiffusionCoefficient(phaseIdx, VolumeVariables::FluidSystem::getMainComponent(phaseIdx), compIdx);
70 }
71 };
72
73 } // end namespace Dumux
74
75 #endif
76