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 NavierStokesModel | ||
10 | * | ||
11 | * \copydoc Dumux::NavierStokesVolumeVariables | ||
12 | */ | ||
13 | #ifndef DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH | ||
14 | #define DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH | ||
15 | |||
16 | #include <dumux/freeflow/navierstokes/scalarvolumevariables.hh> | ||
17 | #include <dumux/freeflow/navierstokes/energy/volumevariables.hh> | ||
18 | |||
19 | namespace Dumux { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup NavierStokesModel | ||
23 | * \brief Volume variables for the single-phase Navier-Stokes model. | ||
24 | */ | ||
25 | template <class Traits> | ||
26 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5472 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5472 times.
|
5099634 | class NavierStokesMassOnePVolumeVariables |
27 | : public NavierStokesScalarConservationModelVolumeVariables<Traits> | ||
28 | , public NavierStokesEnergyVolumeVariables<Traits, NavierStokesMassOnePVolumeVariables<Traits>> | ||
29 | { | ||
30 | using ParentType = NavierStokesScalarConservationModelVolumeVariables<Traits>; | ||
31 | using EnergyVolumeVariables = NavierStokesEnergyVolumeVariables<Traits, NavierStokesMassOnePVolumeVariables<Traits>>; | ||
32 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
33 | |||
34 | public: | ||
35 | //! export the type used for the primary variables | ||
36 | using PrimaryVariables = typename Traits::PrimaryVariables; | ||
37 | //! export the indices type | ||
38 | using Indices = typename Traits::ModelTraits::Indices; | ||
39 | //! Export the underlying fluid system | ||
40 | using FluidSystem = typename Traits::FluidSystem; | ||
41 | //! Export the fluid state type | ||
42 | using FluidState = typename Traits::FluidState; | ||
43 | |||
44 | //! Return number of phases considered by the model | ||
45 | static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); } | ||
46 | //! Return number of components considered by the model | ||
47 | static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); } | ||
48 | |||
49 | /*! | ||
50 | * \brief Update all quantities for a given control volume | ||
51 | * | ||
52 | * \param elemSol A vector containing all primary variables connected to the element | ||
53 | * \param problem The object specifying the problem which ought to | ||
54 | * be simulated | ||
55 | * \param element An element which contains part of the control volume | ||
56 | * \param scv The sub-control volume | ||
57 | */ | ||
58 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
59 | ✗ | void update(const ElementSolution& elemSol, | |
60 | const Problem& problem, | ||
61 | const Element& element, | ||
62 | const SubControlVolume& scv) | ||
63 | { | ||
64 |
3/7✓ Branch 1 taken 181376 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 6 taken 40896 times.
✓ Branch 7 taken 98904 times.
✗ Branch 8 not taken.
|
23484511 | ParentType::update(elemSol, problem, element, scv); |
65 |
3/7✓ Branch 1 taken 181376 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 6 taken 134496 times.
✓ Branch 7 taken 5304 times.
✗ Branch 8 not taken.
|
24647219 | completeFluidState(elemSol, problem, element,scv, fluidState_); |
66 |
0/2✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9396225 | EnergyVolumeVariables::updateEffectiveThermalConductivity(); |
67 | ✗ | } | |
68 | |||
69 | /*! | ||
70 | * \brief Sets complete fluid state | ||
71 | * | ||
72 | * \param elemSol A vector containing all primary variables connected to the element | ||
73 | * \param problem The object specifying the problem which ought to | ||
74 | * be simulated | ||
75 | * \param element An element which contains part of the control volume | ||
76 | * \param scv The sub-control volume | ||
77 | * \param fluidState A container with the current (physical) state of the fluid | ||
78 | */ | ||
79 | template<class ElemSol, class Problem, class Element, class Scv> | ||
80 | ✗ | void completeFluidState(const ElemSol& elemSol, | |
81 | const Problem& problem, | ||
82 | const Element& element, | ||
83 | const Scv& scv, | ||
84 | FluidState& fluidState) | ||
85 | { | ||
86 |
0/8✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
4017600 | fluidState.setTemperature(/*phaseIdx=*/0, EnergyVolumeVariables::getTemperature(elemSol, problem, element, scv)); |
87 | |||
88 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | const auto& priVars = elemSol[scv.localDofIndex()]; |
89 |
0/6✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
4017600 | fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]); |
90 | |||
91 | // saturation in a single phase is always 1 and thus redundant | ||
92 | // to set. But since we use the fluid state shared by the | ||
93 | // immiscible multi-phase models, so we have to set it here... | ||
94 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | fluidState.setSaturation(/*phaseIdx=*/0, 1.0); |
95 | |||
96 | typename FluidSystem::ParameterCache paramCache; | ||
97 | 2008800 | paramCache.updatePhase(fluidState, /*phaseIdx=*/0); | |
98 | |||
99 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0); |
100 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | fluidState.setDensity(/*phaseIdx=*/0, value); |
101 | |||
102 |
0/4✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0); |
103 |
0/2✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | fluidState.setViscosity(/*phaseIdx=*/0, value); |
104 | |||
105 | // compute and set the enthalpy | ||
106 |
0/2✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2008800 | value = EnergyVolumeVariables::enthalpy(fluidState, paramCache); |
107 | 657600 | fluidState.setEnthalpy(/*phaseIdx=*/0, value); | |
108 | ✗ | } | |
109 | |||
110 | /*! | ||
111 | * \brief Returns the effective pressure \f$\mathrm{[Pa]}\f$ of a given phase within | ||
112 | * the control volume. | ||
113 | */ | ||
114 | ✗ | Scalar pressure(int phaseIdx = 0) const | |
115 | 2105108 | { return fluidState_.pressure(phaseIdx); } | |
116 | |||
117 | /*! | ||
118 | * \brief Returns the fluid state of the control volume. | ||
119 | */ | ||
120 | const FluidState& fluidState() const | ||
121 | 14245500 | { return fluidState_; } | |
122 | |||
123 | /*! | ||
124 | * \brief Returns the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the | ||
125 | * control volume. | ||
126 | */ | ||
127 | ✗ | Scalar viscosity(int phaseIdx = 0) const | |
128 | 228710228 | { return fluidState_.viscosity(phaseIdx); } | |
129 | |||
130 | /*! | ||
131 | * \brief Returns the mass density \f$\mathrm{[kg/m^3]}\f$ of a given phase within the | ||
132 | * control volume. | ||
133 | */ | ||
134 | ✗ | Scalar density(int phaseIdx = 0) const | |
135 |
2/6✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 344 times.
✓ Branch 8 taken 304 times.
|
549909262 | { return fluidState_.density(phaseIdx); } |
136 | |||
137 | /*! | ||
138 | * \brief Returns the temperature \f$\mathrm{[K]}\f$ inside the sub-control volume. | ||
139 | * | ||
140 | */ | ||
141 | Scalar temperature() const | ||
142 |
1/2✓ Branch 0 taken 5803350 times.
✗ Branch 1 not taken.
|
11606700 | { return fluidState_.temperature(); } |
143 | |||
144 | protected: | ||
145 | FluidState fluidState_; | ||
146 | }; | ||
147 | |||
148 | } // end namespace Dumux | ||
149 | |||
150 | #endif | ||
151 |