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 TwoPNCModel | ||
10 | * \brief Contains the quantities which are constant within a | ||
11 | * finite volume in the two-phase, n-component model. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_2PNC_VOLUME_VARIABLES_HH | ||
15 | #define DUMUX_2PNC_VOLUME_VARIABLES_HH | ||
16 | |||
17 | #include <iostream> | ||
18 | #include <vector> | ||
19 | |||
20 | #include <dumux/common/math.hh> | ||
21 | #include <dumux/discretization/method.hh> | ||
22 | |||
23 | #include <dumux/porousmediumflow/volumevariables.hh> | ||
24 | #include <dumux/porousmediumflow/nonisothermal/volumevariables.hh> | ||
25 | |||
26 | #include <dumux/material/fluidstates/compositional.hh> | ||
27 | #include <dumux/material/solidstates/updatesolidvolumefractions.hh> | ||
28 | #include <dumux/material/constraintsolvers/computefromreferencephase.hh> | ||
29 | #include <dumux/material/constraintsolvers/misciblemultiphasecomposition.hh> | ||
30 | |||
31 | #include <dumux/porousmediumflow/2p/formulation.hh> | ||
32 | |||
33 | #include "primaryvariableswitch.hh" | ||
34 | |||
35 | namespace Dumux { | ||
36 | |||
37 | /*! | ||
38 | * \ingroup TwoPNCModel | ||
39 | * \brief Contains the quantities which are are constant within a | ||
40 | * finite volume in the two-phase, n-component model. | ||
41 | */ | ||
42 | template <class Traits> | ||
43 | 828574 | class TwoPNCVolumeVariables | |
44 | : public PorousMediumFlowVolumeVariables<Traits> | ||
45 | , public EnergyVolumeVariables<Traits, TwoPNCVolumeVariables<Traits> > | ||
46 | { | ||
47 | using ParentType = PorousMediumFlowVolumeVariables<Traits>; | ||
48 | using EnergyVolVars = EnergyVolumeVariables<Traits, TwoPNCVolumeVariables<Traits> >; | ||
49 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
50 | using PermeabilityType = typename Traits::PermeabilityType; | ||
51 | using FS = typename Traits::FluidSystem; | ||
52 | using ModelTraits = typename Traits::ModelTraits; | ||
53 | static constexpr int numFluidComps = ParentType::numFluidComponents(); | ||
54 | enum | ||
55 | { | ||
56 | numMajorComponents = ModelTraits::numFluidPhases(), | ||
57 | |||
58 | // phase indices | ||
59 | phase0Idx = FS::phase0Idx, | ||
60 | phase1Idx = FS::phase1Idx, | ||
61 | |||
62 | // component indices | ||
63 | comp0Idx = FS::comp0Idx, | ||
64 | comp1Idx = FS::comp1Idx, | ||
65 | |||
66 | // phase presence enums | ||
67 | secondPhaseOnly = ModelTraits::Indices::secondPhaseOnly, | ||
68 | firstPhaseOnly = ModelTraits::Indices::firstPhaseOnly, | ||
69 | bothPhases = ModelTraits::Indices::bothPhases, | ||
70 | |||
71 | // primary variable indices | ||
72 | pressureIdx = ModelTraits::Indices::pressureIdx, | ||
73 | switchIdx = ModelTraits::Indices::switchIdx | ||
74 | }; | ||
75 | |||
76 | static constexpr auto formulation = ModelTraits::priVarFormulation(); | ||
77 | static constexpr bool setFirstPhaseMoleFractions = ModelTraits::setMoleFractionsForFirstPhase(); | ||
78 | |||
79 | using MiscibleMultiPhaseComposition = Dumux::MiscibleMultiPhaseComposition<Scalar, FS>; | ||
80 | using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, FS>; | ||
81 | using EffDiffModel = typename Traits::EffectiveDiffusivityModel; | ||
82 | using DiffusionCoefficients = typename Traits::DiffusionType::DiffusionCoefficientsContainer; | ||
83 | |||
84 | public: | ||
85 | //! Export fluid state type | ||
86 | using FluidState = typename Traits::FluidState; | ||
87 | //! Export fluid system type | ||
88 | using FluidSystem = typename Traits::FluidSystem; | ||
89 | //! Export the indices | ||
90 | using Indices = typename ModelTraits::Indices; | ||
91 | //! Export type of solid state | ||
92 | using SolidState = typename Traits::SolidState; | ||
93 | //! Export type of solid system | ||
94 | using SolidSystem = typename Traits::SolidSystem; | ||
95 | //! Export the primary variable switch | ||
96 | using PrimaryVariableSwitch = TwoPNCPrimaryVariableSwitch; | ||
97 | |||
98 | //! Return whether moles or masses are balanced | ||
99 | static constexpr bool useMoles() { return Traits::ModelTraits::useMoles(); } | ||
100 | //! Return the two-phase formulation used here | ||
101 | static constexpr TwoPFormulation priVarFormulation() { return formulation; } | ||
102 | |||
103 | // check for permissive specifications | ||
104 | static_assert(useMoles(), "use moles has to be set true in the 2pnc model"); | ||
105 | static_assert(ModelTraits::numFluidPhases() == 2, "NumPhases set in the model is not two!"); | ||
106 | static_assert((formulation == TwoPFormulation::p0s1 || formulation == TwoPFormulation::p1s0), "Chosen TwoPFormulation not supported!"); | ||
107 | |||
108 | /*! | ||
109 | * \brief Updates all quantities for a given control volume. | ||
110 | * | ||
111 | * \param elemSol A vector containing all primary variables connected to the element | ||
112 | * \param problem The object specifying the problem which ought to | ||
113 | * be simulated | ||
114 | * \param element An element which contains part of the control volume | ||
115 | * \param scv The sub control volume | ||
116 | */ | ||
117 | template<class ElemSol, class Problem, class Element, class Scv> | ||
118 | 14710884 | void update(const ElemSol &elemSol, | |
119 | const Problem &problem, | ||
120 | const Element &element, | ||
121 | const Scv& scv) | ||
122 | { | ||
123 | 14710884 | ParentType::update(elemSol, problem, element, scv); | |
124 | |||
125 | 14710884 | completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_); | |
126 | |||
127 | ///////////// | ||
128 | // calculate the remaining quantities | ||
129 | ///////////// | ||
130 | |||
131 | 14710884 | const auto& spatialParams = problem.spatialParams(); | |
132 | 14710897 | const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol); | |
133 | |||
134 | 14710884 | const int wPhaseIdx = fluidState_.wettingPhase(); | |
135 | 14710884 | const int nPhaseIdx = 1 - wPhaseIdx; | |
136 | |||
137 | // mobilities -> require wetting phase saturation as parameter! | ||
138 |
1/2✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
|
32849368 | mobility_[wPhaseIdx] = fluidMatrixInteraction.krw(saturation(wPhaseIdx))/fluidState_.viscosity(wPhaseIdx); |
139 |
1/2✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
|
32849368 | mobility_[nPhaseIdx] = fluidMatrixInteraction.krn(saturation(wPhaseIdx))/fluidState_.viscosity(nPhaseIdx); |
140 | |||
141 | //update porosity before calculating the effective properties depending on it | ||
142 |
1/2✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
|
14710884 | updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps); |
143 | |||
144 | 14710884 | auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx) | |
145 | { | ||
146 | 89111480 | return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx); | |
147 | }; | ||
148 | |||
149 |
1/2✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
|
14710884 | effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient); |
150 | |||
151 | // calculate the remaining quantities | ||
152 |
1/2✓ Branch 1 taken 19234 times.
✗ Branch 2 not taken.
|
14710884 | EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_); |
153 |
2/2✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
|
24341435 | permeability_ = spatialParams.permeability(element, scv, elemSol); |
154 |
2/2✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
|
14710884 | EnergyVolVars::updateEffectiveThermalConductivity(); |
155 | 14710871 | } | |
156 | |||
157 | /*! | ||
158 | * \brief Sets complete fluid state. | ||
159 | * | ||
160 | * \param elemSol A vector containing all primary variables connected to the element | ||
161 | * \param problem The object specifying the problem which ought to be simulated | ||
162 | * \param element An element which contains part of the control volume | ||
163 | * \param scv The sub-control volume | ||
164 | * \param fluidState A container with the current (physical) state of the fluid | ||
165 | * \param solidState A container with the current (physical) state of the solid | ||
166 | * | ||
167 | * Set temperature, saturations, capillary pressures, viscosities, densities and enthalpies. | ||
168 | */ | ||
169 | template<class ElemSol, class Problem, class Element, class Scv> | ||
170 | 14710884 | void completeFluidState(const ElemSol& elemSol, | |
171 | const Problem& problem, | ||
172 | const Element& element, | ||
173 | const Scv& scv, | ||
174 | FluidState& fluidState, | ||
175 | SolidState& solidState) | ||
176 | { | ||
177 | 14710884 | EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState); | |
178 | |||
179 | 14710884 | const auto& priVars = elemSol[scv.localDofIndex()]; | |
180 | 14710884 | const auto phasePresence = priVars.state(); | |
181 | |||
182 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5599982 times.
|
14710884 | const auto& spatialParams = problem.spatialParams(); |
183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5599982 times.
|
14752544 | const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol); |
184 |
2/2✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14708483 times.
|
14710884 | const auto wPhaseIdx = spatialParams.template wettingPhase<FluidSystem>(element, scv, elemSol); |
185 |
2/2✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14708483 times.
|
14710884 | fluidState.setWettingPhase(wPhaseIdx); |
186 | |||
187 | // set the saturations | ||
188 |
2/2✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14708483 times.
|
14710884 | if (phasePresence == secondPhaseOnly) |
189 | { | ||
190 | 2401 | fluidState.setSaturation(phase0Idx, 0.0); | |
191 | 2401 | fluidState.setSaturation(phase1Idx, 1.0); | |
192 | } | ||
193 |
2/2✓ Branch 0 taken 3444959 times.
✓ Branch 1 taken 11263524 times.
|
14708483 | else if (phasePresence == firstPhaseOnly) |
194 | { | ||
195 | 3444959 | fluidState.setSaturation(phase0Idx, 1.0); | |
196 | 3444959 | fluidState.setSaturation(phase1Idx, 0.0); | |
197 | } | ||
198 |
1/2✓ Branch 0 taken 11263524 times.
✗ Branch 1 not taken.
|
11263524 | else if (phasePresence == bothPhases) |
199 | { | ||
200 | if (formulation == TwoPFormulation::p0s1) | ||
201 | { | ||
202 | 18394106 | fluidState.setSaturation(phase1Idx, priVars[switchIdx]); | |
203 | 18394106 | fluidState.setSaturation(phase0Idx, 1 - priVars[switchIdx]); | |
204 | } | ||
205 | else | ||
206 | { | ||
207 | 4132942 | fluidState.setSaturation(phase0Idx, priVars[switchIdx]); | |
208 | 4132942 | fluidState.setSaturation(phase1Idx, 1 - priVars[switchIdx]); | |
209 | } | ||
210 | } | ||
211 | else | ||
212 | ✗ | DUNE_THROW(Dune::InvalidStateException, "phasePresence: " << phasePresence << " is invalid."); | |
213 | |||
214 | // set pressures of the fluid phases | ||
215 |
3/5✓ Branch 0 taken 9069242 times.
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 41660 times.
✗ Branch 5 not taken.
|
20352526 | pc_ = fluidMatrixInteraction.pc(fluidState.saturation(wPhaseIdx)); |
216 | if (formulation == TwoPFormulation::p0s1) | ||
217 | { | ||
218 |
4/4✓ Branch 0 taken 9197053 times.
✓ Branch 1 taken 2994937 times.
✓ Branch 2 taken 9197053 times.
✓ Branch 3 taken 2994937 times.
|
24383980 | fluidState.setPressure(phase0Idx, priVars[pressureIdx]); |
219 |
4/4✓ Branch 0 taken 9197053 times.
✓ Branch 1 taken 2994937 times.
✓ Branch 2 taken 9197053 times.
✓ Branch 3 taken 2994937 times.
|
24383980 | fluidState.setPressure(phase1Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] + pc_ |
220 | : priVars[pressureIdx] - pc_); | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 |
4/4✓ Branch 0 taken 2066471 times.
✓ Branch 1 taken 452423 times.
✓ Branch 2 taken 2066471 times.
✓ Branch 3 taken 452423 times.
|
5037788 | fluidState.setPressure(phase1Idx, priVars[pressureIdx]); |
225 |
4/4✓ Branch 0 taken 1764758 times.
✓ Branch 1 taken 452423 times.
✓ Branch 2 taken 1764758 times.
✓ Branch 3 taken 452423 times.
|
5037788 | fluidState.setPressure(phase0Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] - pc_ |
226 |
2/4✓ Branch 0 taken 301713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 301713 times.
✗ Branch 3 not taken.
|
603426 | : priVars[pressureIdx] + pc_); |
227 | } | ||
228 | |||
229 | // calculate the phase compositions | ||
230 | typename FluidSystem::ParameterCache paramCache; | ||
231 | |||
232 | // now comes the tricky part: calculate phase composition | ||
233 |
2/2✓ Branch 0 taken 11263524 times.
✓ Branch 1 taken 3447360 times.
|
14710884 | if (phasePresence == bothPhases) |
234 | { | ||
235 | // both phases are present, phase composition results from | ||
236 | // the first <-> second phase equilibrium. This is the job | ||
237 | // of the "MiscibleMultiPhaseComposition" constraint solver | ||
238 | |||
239 | // set the known mole fractions in the fluidState so that they | ||
240 | // can be used by the MiscibleMultiPhaseComposition constraint solver | ||
241 | |||
242 | 41495 | const int knownPhaseIdx = setFirstPhaseMoleFractions ? phase0Idx : phase1Idx; | |
243 |
2/2✓ Branch 0 taken 11222029 times.
✓ Branch 1 taken 11222029 times.
|
22485553 | for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx) |
244 | 22444058 | fluidState.setMoleFraction(knownPhaseIdx, compIdx, priVars[compIdx]); | |
245 | |||
246 |
1/2✓ Branch 1 taken 34443 times.
✗ Branch 2 not taken.
|
11263524 | MiscibleMultiPhaseComposition::solve(fluidState, |
247 | paramCache, | ||
248 | knownPhaseIdx); | ||
249 | } | ||
250 |
2/2✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 3444959 times.
|
3447360 | else if (phasePresence == secondPhaseOnly) |
251 | { | ||
252 | ✗ | Dune::FieldVector<Scalar, ModelTraits::numFluidComponents()> moleFrac; | |
253 | |||
254 | 4802 | moleFrac[comp0Idx] = priVars[switchIdx]; | |
255 | 2401 | Scalar sumMoleFracOtherComponents = moleFrac[comp0Idx]; | |
256 | |||
257 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
2401 | for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx) |
258 | { | ||
259 | ✗ | moleFrac[compIdx] = priVars[compIdx]; | |
260 | ✗ | sumMoleFracOtherComponents += moleFrac[compIdx]; | |
261 | } | ||
262 | |||
263 | 2401 | moleFrac[comp1Idx] = 1 - sumMoleFracOtherComponents; | |
264 | |||
265 | // Set fluid state mole fractions | ||
266 |
2/2✓ Branch 0 taken 4802 times.
✓ Branch 1 taken 2401 times.
|
7203 | for (int compIdx = 0; compIdx < ModelTraits::numFluidComponents(); ++compIdx) |
267 |
2/4✓ Branch 1 taken 4802 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4802 times.
✗ Branch 5 not taken.
|
9604 | fluidState.setMoleFraction(phase1Idx, compIdx, moleFrac[compIdx]); |
268 | |||
269 | // calculate the composition of the remaining phases (as | ||
270 | // well as the densities of all phases). this is the job | ||
271 | // of the "ComputeFromReferencePhase" constraint solver | ||
272 |
1/2✓ Branch 1 taken 2401 times.
✗ Branch 2 not taken.
|
2401 | ComputeFromReferencePhase::solve(fluidState, |
273 | paramCache, | ||
274 | phase1Idx); | ||
275 | } | ||
276 |
1/2✓ Branch 0 taken 3444959 times.
✗ Branch 1 not taken.
|
3444959 | else if (phasePresence == firstPhaseOnly) |
277 | { | ||
278 | // only the first phase is present, i.e. first phase composition | ||
279 | // is stored explicitly. extract _mass_ fractions in the second phase | ||
280 | 3048195 | Dune::FieldVector<Scalar, ModelTraits::numFluidComponents()> moleFrac; | |
281 | |||
282 | 6889918 | moleFrac[comp1Idx] = priVars[switchIdx]; | |
283 | 3444959 | Scalar sumMoleFracOtherComponents = moleFrac[comp1Idx]; | |
284 |
2/2✓ Branch 0 taken 18622827 times.
✓ Branch 1 taken 3048195 times.
|
22067786 | for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx) |
285 | { | ||
286 | 37245654 | moleFrac[compIdx] = priVars[compIdx]; | |
287 | |||
288 | 37245654 | sumMoleFracOtherComponents += moleFrac[compIdx]; | |
289 | } | ||
290 | |||
291 | 3444959 | moleFrac[comp0Idx] = 1 - sumMoleFracOtherComponents; | |
292 | |||
293 | // convert mass to mole fractions and set the fluid state | ||
294 |
2/2✓ Branch 0 taken 25512745 times.
✓ Branch 1 taken 3444959 times.
|
28957704 | for (int compIdx = 0; compIdx < ModelTraits::numFluidComponents(); ++compIdx) |
295 |
2/4✓ Branch 1 taken 9632 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9632 times.
✗ Branch 5 not taken.
|
51809386 | fluidState.setMoleFraction(phase0Idx, compIdx, moleFrac[compIdx]); |
296 | |||
297 | // calculate the composition of the remaining phases (as | ||
298 | // well as the densities of all phases). this is the job | ||
299 | // of the "ComputeFromReferencePhase" constraint solver | ||
300 |
1/2✓ Branch 1 taken 4816 times.
✗ Branch 2 not taken.
|
3444959 | ComputeFromReferencePhase::solve(fluidState, |
301 | paramCache, | ||
302 | phase0Idx); | ||
303 | } | ||
304 | paramCache.updateAll(fluidState); | ||
305 |
2/2✓ Branch 0 taken 29421768 times.
✓ Branch 1 taken 14710884 times.
|
44132652 | for (int phaseIdx = 0; phaseIdx < ModelTraits::numFluidPhases(); ++phaseIdx) |
306 | { | ||
307 |
1/2✓ Branch 1 taken 83320 times.
✗ Branch 2 not taken.
|
29421768 | Scalar mu = FluidSystem::viscosity(fluidState, paramCache, phaseIdx); |
308 |
1/2✓ Branch 1 taken 38468 times.
✗ Branch 2 not taken.
|
29421768 | Scalar h = EnergyVolVars::enthalpy(fluidState, paramCache, phaseIdx); |
309 | 29421768 | fluidState.setViscosity(phaseIdx, mu); | |
310 | 58843536 | fluidState.setEnthalpy(phaseIdx, h); | |
311 | } | ||
312 | 14710884 | } | |
313 | |||
314 | /*! | ||
315 | * \brief Returns the phase state for the control-volume. | ||
316 | */ | ||
317 | const FluidState &fluidState() const | ||
318 | 4808980 | { return fluidState_; } | |
319 | |||
320 | /*! | ||
321 | * \brief Returns the phase state for the control-volume. | ||
322 | */ | ||
323 | const SolidState &solidState() const | ||
324 | 874461 | { return solidState_; } | |
325 | |||
326 | /*! | ||
327 | * \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$ of the fluid phase. | ||
328 | * | ||
329 | * \param phaseIdx The phase index | ||
330 | */ | ||
331 | Scalar averageMolarMass(int phaseIdx) const | ||
332 | 1718244 | { return fluidState_.averageMolarMass(phaseIdx); } | |
333 | |||
334 | /*! | ||
335 | * \brief Returns the saturation of a given phase within | ||
336 | * the control volume in \f$[-]\f$. | ||
337 | * | ||
338 | * \param phaseIdx The phase index | ||
339 | */ | ||
340 | Scalar saturation(int phaseIdx) const | ||
341 |
44/56✗ Branch 0 not taken.
✓ Branch 1 taken 859122 times.
✓ Branch 2 taken 1498298 times.
✓ Branch 3 taken 4174020 times.
✓ Branch 4 taken 1653014 times.
✓ Branch 5 taken 3317562 times.
✓ Branch 6 taken 599424 times.
✓ Branch 7 taken 512786 times.
✓ Branch 8 taken 444708 times.
✓ Branch 9 taken 515176 times.
✓ Branch 10 taken 442266 times.
✓ Branch 11 taken 7496 times.
✓ Branch 12 taken 442266 times.
✓ Branch 13 taken 625212 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1021770 times.
✓ Branch 16 taken 275 times.
✓ Branch 17 taken 480375 times.
✓ Branch 18 taken 329 times.
✓ Branch 19 taken 87561 times.
✓ Branch 20 taken 71 times.
✓ Branch 21 taken 6903 times.
✓ Branch 22 taken 17 times.
✓ Branch 23 taken 717 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 42181588 times.
✓ Branch 26 taken 1148 times.
✓ Branch 27 taken 51606780 times.
✓ Branch 28 taken 1163 times.
✓ Branch 29 taken 9426483 times.
✓ Branch 30 taken 18 times.
✓ Branch 31 taken 347269 times.
✓ Branch 32 taken 3 times.
✓ Branch 33 taken 345978 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 38 taken 651 times.
✓ Branch 39 taken 44201 times.
✓ Branch 40 taken 1008 times.
✓ Branch 41 taken 82312 times.
✓ Branch 42 taken 357 times.
✓ Branch 43 taken 60537 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 19234 times.
✓ Branch 46 taken 22426 times.
✗ Branch 47 not taken.
✓ Branch 48 taken 19234 times.
✓ Branch 49 taken 22426 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 19234 times.
✓ Branch 52 taken 22426 times.
✗ Branch 53 not taken.
✓ Branch 54 taken 19234 times.
✗ Branch 55 not taken.
|
782714516 | { return fluidState_.saturation(phaseIdx); } |
342 | |||
343 | /*! | ||
344 | * \brief Returns the mass density of a given phase within the | ||
345 | * control volume. | ||
346 | * | ||
347 | * \param phaseIdx The phase index | ||
348 | */ | ||
349 | Scalar density(int phaseIdx) const | ||
350 | 287126400 | { return fluidState_.density(phaseIdx); } | |
351 | |||
352 | /*! | ||
353 | * \brief Returns the dynamic viscosity of a given phase within the | ||
354 | * control volume. | ||
355 | * | ||
356 | * \param phaseIdx The phase index | ||
357 | */ | ||
358 | Scalar viscosity(int phaseIdx) const | ||
359 | { return fluidState_.viscosity(phaseIdx); } | ||
360 | |||
361 | /*! | ||
362 | * \brief Returns the molar density of a given phase within the | ||
363 | * control volume. | ||
364 | * | ||
365 | * \param phaseIdx The phase index | ||
366 | */ | ||
367 | 511374288 | Scalar molarDensity(int phaseIdx) const | |
368 | { | ||
369 |
1/2✓ Branch 0 taken 511374288 times.
✗ Branch 1 not taken.
|
511374288 | if (phaseIdx < ModelTraits::numFluidPhases()) |
370 |
4/4✓ Branch 6 taken 1126645 times.
✓ Branch 7 taken 2933131 times.
✓ Branch 8 taken 1126645 times.
✓ Branch 9 taken 2933131 times.
|
1055548340 | return fluidState_.molarDensity(phaseIdx); |
371 | |||
372 | else | ||
373 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); | |
374 | } | ||
375 | |||
376 | /*! | ||
377 | * \brief Returns the effective pressure of a given phase within | ||
378 | * the control volume. | ||
379 | * | ||
380 | * \param phaseIdx The phase index | ||
381 | */ | ||
382 | Scalar pressure(int phaseIdx) const | ||
383 |
8/12✓ Branch 0 taken 59242 times.
✓ Branch 1 taken 77512 times.
✓ Branch 2 taken 59242 times.
✓ Branch 3 taken 77512 times.
✓ Branch 4 taken 44542 times.
✓ Branch 5 taken 35218 times.
✓ Branch 6 taken 44542 times.
✓ Branch 7 taken 35218 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
142121536 | { return fluidState_.pressure(phaseIdx); } |
384 | |||
385 | /*! | ||
386 | * \brief Returns temperature inside the sub-control volume. | ||
387 | * | ||
388 | * Note that we assume thermodynamic equilibrium, i.e. the | ||
389 | * temperature of the rock matrix and of all fluid phases are | ||
390 | * identical. | ||
391 | */ | ||
392 | Scalar temperature() const | ||
393 |
2/4✓ Branch 0 taken 53976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53976 times.
✗ Branch 3 not taken.
|
4656282 | { return fluidState_.temperature(/*phaseIdx=*/0); } |
394 | |||
395 | /*! | ||
396 | * \brief Returns the effective mobility of a given phase within | ||
397 | * the control volume. | ||
398 | * | ||
399 | * \param phaseIdx The phase index | ||
400 | */ | ||
401 | Scalar mobility(int phaseIdx) const | ||
402 | 104826148 | { return mobility_[phaseIdx]; } | |
403 | |||
404 | /*! | ||
405 | * \brief Returns the effective capillary pressure within the control volume | ||
406 | * in \f$[kg/(m*s^2)=N/m^2=Pa]\f$. | ||
407 | */ | ||
408 | ✗ | Scalar capillaryPressure() const | |
409 | ✗ | { return pc_; } | |
410 | |||
411 | /*! | ||
412 | * \brief Returns the average porosity within the control volume. | ||
413 | */ | ||
414 | Scalar porosity() const | ||
415 |
6/7✗ Branch 1 not taken.
✓ Branch 2 taken 41534151 times.
✓ Branch 3 taken 10359013 times.
✓ Branch 4 taken 1008 times.
✓ Branch 5 taken 2432428 times.
✓ Branch 6 taken 357 times.
✓ Branch 7 taken 595727 times.
|
476730062 | { return solidState_.porosity(); } |
416 | |||
417 | /*! | ||
418 | * \brief Returns the permeability within the control volume. | ||
419 | */ | ||
420 | const PermeabilityType& permeability() const | ||
421 | 1925436 | { return permeability_; } | |
422 | |||
423 | /*! | ||
424 | * \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$. | ||
425 | */ | ||
426 | ✗ | Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const | |
427 | { | ||
428 | typename FluidSystem::ParameterCache paramCache; | ||
429 | 52921044 | paramCache.updatePhase(fluidState_, phaseIdx); | |
430 |
4/7✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 2004852 times.
✓ Branch 3 taken 34792 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1008 times.
✓ Branch 7 taken 82312 times.
|
62100240 | return FluidSystem::binaryDiffusionCoefficient(fluidState_, paramCache, phaseIdx, compIIdx, compJIdx); |
431 | } | ||
432 | |||
433 | /*! | ||
434 | * \brief Returns the effective diffusion coefficients for a phase in \f$[m^2/s]\f$. | ||
435 | */ | ||
436 | Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const | ||
437 | 86105472 | { return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); } | |
438 | |||
439 | /*! | ||
440 | * \brief Returns the mass fraction of a component in the phase | ||
441 | * | ||
442 | * \param phaseIdx the index of the fluid phase | ||
443 | * \param compIdx the index of the component | ||
444 | */ | ||
445 | Scalar massFraction(int phaseIdx, int compIdx) const | ||
446 |
4/6✓ Branch 0 taken 25376400 times.
✓ Branch 1 taken 8458800 times.
✓ Branch 2 taken 14700 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2248 times.
✗ Branch 6 not taken.
|
174625480 | { return fluidState_.massFraction(phaseIdx, compIdx); } |
447 | |||
448 | /*! | ||
449 | * \brief Returns the mole fraction of a component in the phase | ||
450 | * | ||
451 | * \param phaseIdx the index of the fluid phase | ||
452 | * \param compIdx the index of the component | ||
453 | */ | ||
454 | Scalar moleFraction(int phaseIdx, int compIdx) const | ||
455 |
4/4✓ Branch 20 taken 1126645 times.
✓ Branch 21 taken 2933131 times.
✓ Branch 22 taken 1126645 times.
✓ Branch 23 taken 2933131 times.
|
845511600 | { return fluidState_.moleFraction(phaseIdx, compIdx); } |
456 | |||
457 | /*! | ||
458 | * \brief Returns the wetting phase index | ||
459 | */ | ||
460 | int wettingPhase() const | ||
461 | { return fluidState_.wettingPhase(); } | ||
462 | |||
463 | protected: | ||
464 | FluidState fluidState_; | ||
465 | SolidState solidState_; | ||
466 | |||
467 | private: | ||
468 | |||
469 | Scalar pc_; // The capillary pressure | ||
470 | Scalar porosity_; // Effective porosity within the control volume | ||
471 | PermeabilityType permeability_; // Effective permeability within the control volume | ||
472 | Scalar mobility_[ModelTraits::numFluidPhases()]; // Effective mobility within the control volume | ||
473 | DiffusionCoefficients effectiveDiffCoeff_; | ||
474 | |||
475 | }; | ||
476 | |||
477 | } // end namespace Dumux | ||
478 | |||
479 | #endif | ||
480 |