GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/compositional/iofields.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 11 15 73.3%
Functions: 29 133 21.8%
Branches: 61 127 48.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 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 47 static void initOutputModule(OutputModule& out)
30 {
31 47 BaseOutputFields::initOutputModule(out);
32
33 // TODO only output molar density if we use mole fractions
34
4/12
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 35 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 35 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 35 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
694 out.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, IOName::molarDensity());
35
36 using FluidSystem = typename OutputModule::VolumeVariables::FluidSystem;
37
2/2
✓ Branch 0 taken 71 times.
✓ Branch 1 taken 35 times.
142 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 27 times.
✓ Branch 3 taken 34 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 27 times.
✓ Branch 6 taken 34 times.
✓ Branch 7 taken 37 times.
✓ Branch 8 taken 34 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 27 times.
✓ Branch 11 taken 34 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.
263726 out.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, IOName::massFraction<FluidSystem>(0, j));
40
4/12
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 71 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 71 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 71 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
1390 out.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, IOName::moleFraction<FluidSystem>(0, j));
41
42
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 35 times.
95 if (j != FluidSystem::getMainComponent(0))
43 {
44
24/42
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 12 times.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 12 times.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 12 times.
✓ Branch 18 taken 24 times.
✓ Branch 19 taken 12 times.
✓ Branch 20 taken 24 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 12 times.
✓ Branch 23 taken 24 times.
✓ Branch 24 taken 12 times.
✓ Branch 25 taken 24 times.
✓ Branch 26 taken 12 times.
✓ Branch 27 taken 24 times.
✓ Branch 28 taken 12 times.
✓ Branch 29 taken 24 times.
✓ Branch 30 taken 12 times.
✓ Branch 31 taken 24 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.
144664 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 25 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 25 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 25 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 25 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 25 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 25 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 25 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 25 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 25 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 25 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 25 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.
570 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 47 }
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 82150 return volVars.effectiveDiffusionCoefficient(phaseIdx, VolumeVariables::FluidSystem::getMainComponent(phaseIdx), compIdx);
70 }
71 };
72
73 } // end namespace Dumux
74
75 #endif
76