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 FluidStates | ||
10 | * \brief This is a fluid state which allows to set the fluid | ||
11 | * temperatures and takes all other quantities from an other | ||
12 | * fluid state. | ||
13 | */ | ||
14 | #ifndef DUMUX_TEMPERATURE_OVERLAY_FLUID_STATE_HH | ||
15 | #define DUMUX_TEMPERATURE_OVERLAY_FLUID_STATE_HH | ||
16 | |||
17 | namespace Dumux { | ||
18 | |||
19 | /*! | ||
20 | * \ingroup FluidStates | ||
21 | * \brief This is a fluid state which allows to set the fluid | ||
22 | * temperatures and takes all other quantities from an other | ||
23 | * fluid state. | ||
24 | */ | ||
25 | template <class FluidState> | ||
26 | class TemperatureOverlayFluidState | ||
27 | { | ||
28 | public: | ||
29 | static constexpr int numPhases = FluidState::numPhases; | ||
30 | static constexpr int numComponents = FluidState::numComponents; | ||
31 | |||
32 | //! export the scalar type | ||
33 | using Scalar = typename FluidState::Scalar; | ||
34 | |||
35 | /*! | ||
36 | * \brief Constructor | ||
37 | * | ||
38 | * \param fs Fluidstate | ||
39 | * The overlay fluid state copies the saturation from the argument, | ||
40 | * so it initially behaves exactly like the underlying fluid | ||
41 | * state. | ||
42 | */ | ||
43 | 1 | TemperatureOverlayFluidState(const FluidState &fs) | |
44 | 1 | : fs_(&fs) | |
45 | { | ||
46 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | temperature_ = fs.temperature(/*phaseIdx=*/0); |
47 | } | ||
48 | |||
49 | TemperatureOverlayFluidState(Scalar T, const FluidState &fs) | ||
50 | : fs_(&fs), temperature_(T) | ||
51 | {} | ||
52 | |||
53 | // copy & move constructor / assignment operators | ||
54 | TemperatureOverlayFluidState(const TemperatureOverlayFluidState &fs) = default; | ||
55 | TemperatureOverlayFluidState(TemperatureOverlayFluidState &&fs) = default; | ||
56 | TemperatureOverlayFluidState& operator=(const TemperatureOverlayFluidState &fs) = default; | ||
57 | TemperatureOverlayFluidState& operator=(TemperatureOverlayFluidState &&fs) = default; | ||
58 | |||
59 | /***************************************************** | ||
60 | * Generic access to fluid properties (No assumptions | ||
61 | * on thermodynamic equilibrium required) | ||
62 | *****************************************************/ | ||
63 | /*! | ||
64 | * @copydoc CompositionalFluidState::saturation() | ||
65 | */ | ||
66 | ✗ | Scalar saturation(int phaseIdx) const | |
67 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->saturation(phaseIdx); } |
68 | |||
69 | /*! | ||
70 | * @copydoc CompositionalFluidState::moleFraction() | ||
71 | */ | ||
72 | ✗ | Scalar moleFraction(int phaseIdx, int compIdx) const | |
73 | 2 | { return fs_->moleFraction(phaseIdx, compIdx); } | |
74 | |||
75 | /*! | ||
76 | * @copydoc CompositionalFluidState::massFraction() | ||
77 | */ | ||
78 | ✗ | Scalar massFraction(int phaseIdx, int compIdx) const | |
79 | 1 | { return fs_->massFraction(phaseIdx, compIdx); } | |
80 | |||
81 | /*! | ||
82 | * @copydoc CompositionalFluidState::averageMolarMass() | ||
83 | */ | ||
84 | ✗ | Scalar averageMolarMass(int phaseIdx) const | |
85 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->averageMolarMass(phaseIdx); } |
86 | |||
87 | /*! | ||
88 | * @copydoc CompositionalFluidState::molarity() | ||
89 | */ | ||
90 | ✗ | Scalar molarity(int phaseIdx, int compIdx) const | |
91 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->molarity(phaseIdx, compIdx); } |
92 | |||
93 | /*! | ||
94 | * @copydoc CompositionalFluidState::fugacity() | ||
95 | */ | ||
96 | ✗ | Scalar fugacity(int phaseIdx, int compIdx) const | |
97 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->fugacity(phaseIdx, compIdx); } |
98 | |||
99 | /*! | ||
100 | * @copydoc CompositionalFluidState::fugacityCoefficient() | ||
101 | */ | ||
102 | ✗ | Scalar fugacityCoefficient(int phaseIdx, int compIdx) const | |
103 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->fugacityCoefficient(phaseIdx, compIdx); } |
104 | |||
105 | /*! | ||
106 | * @copydoc CompositionalFluidState::molarVolume() | ||
107 | */ | ||
108 | ✗ | Scalar molarVolume(int phaseIdx) const | |
109 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->molarVolume(phaseIdx); } |
110 | |||
111 | /*! | ||
112 | * @copydoc CompositionalFluidState::density() | ||
113 | */ | ||
114 | ✗ | Scalar density(int phaseIdx) const | |
115 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->density(phaseIdx); } |
116 | |||
117 | /*! | ||
118 | * @copydoc CompositionalFluidState::molarDensity() | ||
119 | */ | ||
120 | ✗ | Scalar molarDensity(int phaseIdx) const | |
121 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->molarDensity(phaseIdx); } |
122 | |||
123 | /*! | ||
124 | * \brief The temperature of a fluid phase \f$\mathrm{[K]}\f$ | ||
125 | */ | ||
126 | ✗ | Scalar temperature(int phaseIdx) const | |
127 | ✗ | { return temperature_; } | |
128 | |||
129 | /*! | ||
130 | * @copydoc CompositionalFluidState::pressure() | ||
131 | */ | ||
132 | ✗ | Scalar pressure(int phaseIdx) const | |
133 | 2 | { return fs_->pressure(phaseIdx); } | |
134 | |||
135 | /*! | ||
136 | * @copydoc CompositionalFluidState::enthalpy() | ||
137 | */ | ||
138 | ✗ | Scalar enthalpy(int phaseIdx) const | |
139 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->enthalpy(phaseIdx); } |
140 | |||
141 | /*! | ||
142 | * @copydoc CompositionalFluidState::internalEnergy() | ||
143 | */ | ||
144 | ✗ | Scalar internalEnergy(int phaseIdx) const | |
145 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->internalEnergy(phaseIdx); } |
146 | |||
147 | /*! | ||
148 | * @copydoc CompositionalFluidState::viscosity() | ||
149 | */ | ||
150 | ✗ | Scalar viscosity(int phaseIdx) const | |
151 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { return fs_->viscosity(phaseIdx); } |
152 | |||
153 | |||
154 | /***************************************************** | ||
155 | * Setter methods. Note that these are not part of the | ||
156 | * generic FluidState interface but specific for each | ||
157 | * implementation... | ||
158 | *****************************************************/ | ||
159 | /*! | ||
160 | * \brief Set the temperature \f$\mathrm{[K]}\f$ of a fluid phase | ||
161 | */ | ||
162 | void setTemperature(Scalar value) | ||
163 | { temperature_ = value; } | ||
164 | |||
165 | protected: | ||
166 | const FluidState *fs_; | ||
167 | Scalar temperature_; | ||
168 | }; | ||
169 | |||
170 | } // end namespace Dumux | ||
171 | |||
172 | #endif | ||
173 |