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 NavierStokesModel | ||
10 | * | ||
11 | * \copydoc Dumux::NavierStokesVolumeVariables | ||
12 | */ | ||
13 | #ifndef DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH | ||
14 | #define DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH | ||
15 | |||
16 | #include <dumux/freeflow/volumevariables.hh> | ||
17 | |||
18 | namespace Dumux { | ||
19 | |||
20 | /*! | ||
21 | * \ingroup NavierStokesModel | ||
22 | * \brief Volume variables for the single-phase Navier-Stokes model. | ||
23 | */ | ||
24 | template <class Traits> | ||
25 |
1/2✓ Branch 1 taken 51340 times.
✗ Branch 2 not taken.
|
137310 | class NavierStokesVolumeVariables : public FreeFlowVolumeVariables< Traits, NavierStokesVolumeVariables<Traits> > |
26 | { | ||
27 | using ThisType = NavierStokesVolumeVariables<Traits>; | ||
28 | using ParentType = FreeFlowVolumeVariables<Traits, ThisType>; | ||
29 | |||
30 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
31 | |||
32 | public: | ||
33 | //! export the underlying fluid system | ||
34 | using FluidSystem = typename Traits::FluidSystem; | ||
35 | //! export the fluid state type | ||
36 | using FluidState = typename Traits::FluidState; | ||
37 | //! export the indices type | ||
38 | using Indices = typename Traits::ModelTraits::Indices; | ||
39 | |||
40 | /*! | ||
41 | * \brief Update all quantities for a given control volume | ||
42 | * | ||
43 | * \param elemSol A vector containing all primary variables connected to the element | ||
44 | * \param problem The object specifying the problem which ought to | ||
45 | * be simulated | ||
46 | * \param element An element which contains part of the control volume | ||
47 | * \param scv The sub-control volume | ||
48 | */ | ||
49 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
50 | 69018834 | void update(const ElementSolution& elemSol, | |
51 | const Problem& problem, | ||
52 | const Element& element, | ||
53 | const SubControlVolume& scv) | ||
54 | { | ||
55 |
6/12✓ Branch 1 taken 735280 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3475900 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18365 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1393340 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 37140 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 334505 times.
✗ Branch 17 not taken.
|
69018834 | ParentType::update(elemSol, problem, element, scv); |
56 |
6/12✓ Branch 1 taken 735280 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3475900 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18365 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1393340 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 37140 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 334505 times.
✗ Branch 17 not taken.
|
69048914 | completeFluidState(elemSol, problem, element, scv, fluidState_); |
57 | 6024610 | } | |
58 | |||
59 | /*! | ||
60 | * \brief Update the fluid state | ||
61 | */ | ||
62 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
63 | 69020784 | static void completeFluidState(const ElementSolution& elemSol, | |
64 | const Problem& problem, | ||
65 | const Element& element, | ||
66 | const SubControlVolume& scv, | ||
67 | FluidState& fluidState) | ||
68 | { | ||
69 | 69020784 | const Scalar t = ParentType::temperature(elemSol, problem, element, scv); | |
70 | 69020784 | fluidState.setTemperature(t); | |
71 | |||
72 | 69020784 | fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]); | |
73 | |||
74 | // saturation in a single phase is always 1 and thus redundant | ||
75 | // to set. But since we use the fluid state shared by the | ||
76 | // immiscible multi-phase models, so we have to set it here... | ||
77 | 69020784 | fluidState.setSaturation(0, 1.0); | |
78 | |||
79 | typename FluidSystem::ParameterCache paramCache; | ||
80 | 69020784 | paramCache.updateAll(fluidState); | |
81 | |||
82 | 69020784 | Scalar value = FluidSystem::density(fluidState, paramCache, 0); | |
83 | 69020784 | fluidState.setDensity(0, value); | |
84 | |||
85 | 69020784 | value = FluidSystem::viscosity(fluidState, paramCache, 0); | |
86 | 69020784 | fluidState.setViscosity(0, value); | |
87 | |||
88 | // compute and set the enthalpy | ||
89 | 69020784 | value = ParentType::enthalpy(fluidState, paramCache); | |
90 | 69020784 | fluidState.setEnthalpy(0, value); | |
91 | 68990704 | } | |
92 | |||
93 | /*! | ||
94 | * \brief Return the effective pressure \f$\mathrm{[Pa]}\f$ of a given phase within | ||
95 | * the control volume. | ||
96 | */ | ||
97 | 97535056 | Scalar pressure(int phaseIdx = 0) const | |
98 | 97038920 | { return fluidState_.pressure(0); } | |
99 | |||
100 | /*! | ||
101 | * \brief Return the mass density \f$\mathrm{[kg/m^3]}\f$ of a given phase within the | ||
102 | * control volume. | ||
103 | */ | ||
104 | 1502643560 | Scalar density(int phaseIdx = 0) const | |
105 |
31/50✓ Branch 10 taken 119335207 times.
✓ Branch 11 taken 14198676 times.
✓ Branch 13 taken 35701 times.
✓ Branch 14 taken 11520 times.
✓ Branch 16 taken 20057 times.
✓ Branch 17 taken 30464 times.
✓ Branch 19 taken 25 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 25 times.
✓ Branch 23 taken 7840 times.
✓ Branch 25 taken 25 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 25 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 25 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 25 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 25 times.
✗ 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.
✗ Branch 44 not taken.
✓ Branch 45 taken 25 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 25 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 25 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 25 times.
✗ Branch 52 not taken.
✓ Branch 3 taken 43446343 times.
✓ Branch 4 taken 34392618 times.
✓ Branch 12 taken 12320 times.
✓ Branch 1 taken 2216760 times.
✓ Branch 2 taken 7879293 times.
✓ Branch 7 taken 20533568 times.
✓ Branch 8 taken 126997348 times.
✓ Branch 15 taken 51840 times.
✓ Branch 6 taken 3892705 times.
✓ Branch 9 taken 29419682 times.
✓ Branch 21 taken 13824 times.
✓ Branch 5 taken 3999967 times.
✓ Branch 18 taken 8512 times.
✗ Branch 24 not taken.
|
1285044850 | { return fluidState_.density(0); } |
106 | |||
107 | /*! | ||
108 | * \brief Return temperature \f$\mathrm{[K]}\f$ inside the sub-control volume. | ||
109 | * | ||
110 | */ | ||
111 | 35130534 | Scalar temperature() const | |
112 | 35076102 | { return fluidState_.temperature(); } | |
113 | |||
114 | /*! | ||
115 | * \brief Returns the molar mass of a given phase within the | ||
116 | * control volume. | ||
117 | */ | ||
118 | Scalar molarMass(int phaseIdx = 0) const | ||
119 | { | ||
120 | return fluidState_.averageMolarMass(0); | ||
121 | } | ||
122 | |||
123 | /*! | ||
124 | * \brief Return the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the | ||
125 | * control volume. | ||
126 | */ | ||
127 | 427949596 | Scalar viscosity(int phaseIdx = 0) const | |
128 |
15/34✓ Branch 2 taken 9024143 times.
✓ Branch 3 taken 16135370 times.
✓ Branch 4 taken 20057 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 20057 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 21689 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 25 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 25 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 25 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 25 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 25 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 25 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 25 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 25 times.
✗ Branch 33 not taken.
✓ Branch 0 taken 3700630 times.
✓ Branch 1 taken 64006518 times.
|
408362278 | { return fluidState_.viscosity(0); } |
129 | |||
130 | /*! | ||
131 | * \brief Return the effective dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the | ||
132 | * control volume. | ||
133 | */ | ||
134 | 48162600 | Scalar effectiveViscosity() const | |
135 | 48162600 | { return viscosity(); } | |
136 | |||
137 | /*! | ||
138 | * \brief Return the fluid state of the control volume. | ||
139 | */ | ||
140 | 850 | const FluidState& fluidState() const | |
141 | 138534642 | { return fluidState_; } | |
142 | |||
143 | protected: | ||
144 | FluidState fluidState_; | ||
145 | }; | ||
146 | |||
147 | } // end namespace Dumux | ||
148 | |||
149 | #endif | ||
150 |