GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/navierstokes/mass/1pnc/iofields.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 9 9 100.0%
Functions: 5 25 20.0%
Branches: 34 83 41.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_NAVIERSTOKES_MASS_1PNC_IO_FIELDS_HH
13 #define DUMUX_NAVIERSTOKES_MASS_1PNC_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 NavierStokesMassOnePNCIOFields
26 {
27 //! Initialize the FreeflowNC specific output fields.
28 template <class OutputModule>
29 8 static void initOutputModule(OutputModule& out)
30 {
31 8 BaseOutputFields::initOutputModule(out);
32
33 // TODO only output molar density if we use mole fractions
34
4/12
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
16 out.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, IOName::molarDensity());
35
36 using FluidSystem = typename OutputModule::VolumeVariables::FluidSystem;
37
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 8 times.
25 for (int j = 0; j < FluidSystem::numComponents; ++j)
38 {
39
8/19
✓ Branch 0 taken 96700 times.
✓ Branch 1 taken 96700 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 17 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 14 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.
193434 out.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, IOName::massFraction<FluidSystem>(0, j));
40
5/12
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 17 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 14 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
34 out.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, IOName::moleFraction<FluidSystem>(0, j));
41
42
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 8 times.
17 if (j != FluidSystem::getMainComponent(0))
43 {
44
13/36
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 9 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 9 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 9 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 9 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 2 times.
✓ Branch 23 taken 7 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 9 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 9 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 9 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 9 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.
107520 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 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 8 }
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 return volVars.effectiveDiffusionCoefficient(phaseIdx, VolumeVariables::FluidSystem::getMainComponent(phaseIdx), compIdx);
70 }
71 };
72
73 } // end namespace Dumux
74
75 #endif
76