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 Flux | ||
10 | * \brief The reference frameworks and formulations available for splitting total fluxes into a advective and diffusive part | ||
11 | */ | ||
12 | |||
13 | #ifndef DUMUX_FLUX_REFERENCESYSTEMFORMULATION_HH | ||
14 | #define DUMUX_FLUX_REFERENCESYSTEMFORMULATION_HH | ||
15 | |||
16 | namespace Dumux { | ||
17 | |||
18 | /*! | ||
19 | * \brief The formulations available for Fick's law related to the reference system | ||
20 | * \ingroup Flux | ||
21 | * \note The total flux of a component can be split into an advective and a diffusive part. | ||
22 | * In our framework, the advective part is based on a momentum balance. Standard momentum balances, e.g., | ||
23 | * the Navier-Stokes equations or Darcy's law yield mass-averaged velocities (see Multicomponent Mass Transfer, Taylor & Krishna, 1993 \cite taylor1993a), | ||
24 | * therefore we use the appropriate formulation of Fick's law (mass averaged formulation) per default. | ||
25 | * | ||
26 | * This means that the diffusive fluxes are calculated with the mass fraction gradients and the unit of the fluxes is kg/s. | ||
27 | * It is also possible to use a molar-averaged reference system, which can be beneficial, e.g., | ||
28 | * when it is known that the molar-averaged advective velocity would be zero. When using a molar-averaged reference velocity, | ||
29 | * Fick's law is formulated with mole fraction gradients and the unit of the flux is moles/s. This means that depending on the reference system, | ||
30 | * the units of the fluxes need to be adapted to be used in mass or mole balances. | ||
31 | */ | ||
32 | enum class ReferenceSystemFormulation | ||
33 | { | ||
34 | massAveraged, molarAveraged | ||
35 | }; | ||
36 | |||
37 | /*! | ||
38 | * \ingroup Flux | ||
39 | * \brief evaluates the density to be used in Fick's law based on the reference system | ||
40 | */ | ||
41 | template<class VolumeVariables> | ||
42 | typename VolumeVariables::PrimaryVariables::value_type | ||
43 | ✗ | massOrMolarDensity(const VolumeVariables& volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx) | |
44 | { | ||
45 |
13/16✓ Branch 0 taken 34381722 times.
✓ Branch 1 taken 30942 times.
✓ Branch 2 taken 74752148 times.
✓ Branch 3 taken 83314 times.
✓ Branch 4 taken 74352118 times.
✓ Branch 5 taken 52372 times.
✓ Branch 6 taken 6425180 times.
✓ Branch 7 taken 51510 times.
✓ Branch 8 taken 739932 times.
✓ Branch 9 taken 51510 times.
✓ Branch 10 taken 7855048 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7855048 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 72444 times.
✗ Branch 15 not taken.
|
5424702492 | return (referenceSys == ReferenceSystemFormulation::massAveraged) ? volVars.density(phaseIdx) : volVars.molarDensity(phaseIdx); |
46 | } | ||
47 | |||
48 | /*! | ||
49 | * \ingroup Flux | ||
50 | * \brief returns the mass or mole fraction to be used in Fick's law based on the reference system | ||
51 | */ | ||
52 | template<class VolumeVariables> | ||
53 | typename VolumeVariables::PrimaryVariables::value_type | ||
54 | ✗ | massOrMoleFraction(const VolumeVariables& volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx, const int compIdx) | |
55 | { | ||
56 |
6/14✓ Branch 0 taken 75998904 times.
✓ Branch 1 taken 8458800 times.
✓ Branch 2 taken 3957600 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4040766 times.
✓ Branch 8 taken 314150 times.
✓ Branch 9 taken 4009824 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
2251473501 | return (referenceSys == ReferenceSystemFormulation::massAveraged) ? volVars.massFraction(phaseIdx, compIdx) : volVars.moleFraction(phaseIdx, compIdx); |
57 | } | ||
58 | |||
59 | } // end namespace Dumux | ||
60 | |||
61 | #endif | ||
62 |