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-FileCopyrightText: 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 |
1/2✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
|
394 | 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 |
2/3✓ Branch 3 taken 44 times.
✗ Branch 4 not taken.
✓ Branch 2 taken 27 times.
|
263726 | out.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, IOName::massFraction<FluidSystem>(0, j)); |
40 |
1/2✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
|
790 | 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 |
10/15✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 22 times.
✗ Branch 16 not taken.
✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
✓ Branch 8 taken 12 times.
✓ Branch 11 taken 12 times.
✓ Branch 14 taken 12 times.
|
144760 | 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 |
5/10✓ 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.
|
640 | 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 | 210 | 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 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 84 times.
|
210 | if (pvIdx > ModelTraits::dim() && pvIdx < ModelTraits::dim() + ModelTraits::numFluidComponents()) |
59 | return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(0, pvIdx - ModelTraits::dim()) | ||
60 | 50 | : IOName::massFraction<FluidSystem>(0, pvIdx - ModelTraits::dim()); | |
61 | else | ||
62 | 160 | return BaseOutputFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); | |
63 | |||
64 | } | ||
65 | |||
66 | template<class VolumeVariables> | ||
67 | 82150 | 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 |