GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/2pnc/volumevariables.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 91 99 91.9%
Functions: 39 66 59.1%
Branches: 142 237 59.9%

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 14919110 void update(const ElemSol &elemSol,
119 const Problem &problem,
120 const Element &element,
121 const Scv& scv)
122 {
123 14919110 ParentType::update(elemSol, problem, element, scv);
124
125 14919110 completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_);
126
127 /////////////
128 // calculate the remaining quantities
129 /////////////
130
131 14919110 const auto& spatialParams = problem.spatialParams();
132 14919123 const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
133
134 14919110 const int wPhaseIdx = fluidState_.wettingPhase();
135 14919110 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.
33057594 mobility_[wPhaseIdx] = fluidMatrixInteraction.krw(saturation(wPhaseIdx))/fluidState_.viscosity(wPhaseIdx);
139
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
33057594 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.
14919110 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
143
144 14919110 auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
145 {
146 89944384 return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx);
147 };
148
149
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
14919110 effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient);
150
151 // calculate the remaining quantities
152
1/2
✓ Branch 1 taken 19234 times.
✗ Branch 2 not taken.
14919110 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
153
2/2
✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
24549661 permeability_ = spatialParams.permeability(element, scv, elemSol);
154
2/2
✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
14919110 EnergyVolVars::updateEffectiveThermalConductivity();
155 14919097 }
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 14919110 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 14919110 EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
178
179 14919110 const auto& priVars = elemSol[scv.localDofIndex()];
180 14919110 const auto phasePresence = priVars.state();
181
182
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5808208 times.
14919110 const auto& spatialParams = problem.spatialParams();
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5808208 times.
14960770 const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
184
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14916709 times.
14919110 const auto wPhaseIdx = spatialParams.template wettingPhase<FluidSystem>(element, scv, elemSol);
185
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14916709 times.
14919110 fluidState.setWettingPhase(wPhaseIdx);
186
187 // set the saturations
188
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14916709 times.
14919110 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 3554361 times.
✓ Branch 1 taken 11362348 times.
14916709 else if (phasePresence == firstPhaseOnly)
194 {
195 3554361 fluidState.setSaturation(phase0Idx, 1.0);
196 3554361 fluidState.setSaturation(phase1Idx, 0.0);
197 }
198
1/2
✓ Branch 0 taken 11362348 times.
✗ Branch 1 not taken.
11362348 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 4330590 fluidState.setSaturation(phase0Idx, priVars[switchIdx]);
208 4330590 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.
20768978 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 2165295 times.
✓ Branch 1 taken 561825 times.
✓ Branch 2 taken 2165295 times.
✓ Branch 3 taken 561825 times.
5454240 fluidState.setPressure(phase1Idx, priVars[pressureIdx]);
225
4/4
✓ Branch 0 taken 1863582 times.
✓ Branch 1 taken 561825 times.
✓ Branch 2 taken 1863582 times.
✓ Branch 3 taken 561825 times.
5454240 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 11362348 times.
✓ Branch 1 taken 3556762 times.
14919110 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 11320853 times.
✓ Branch 1 taken 11320853 times.
22683201 for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx)
244 22641706 fluidState.setMoleFraction(knownPhaseIdx, compIdx, priVars[compIdx]);
245
246
1/2
✓ Branch 1 taken 34443 times.
✗ Branch 2 not taken.
11362348 MiscibleMultiPhaseComposition::solve(fluidState,
247 paramCache,
248 knownPhaseIdx);
249 }
250
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 3554361 times.
3556762 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 3554361 times.
✗ Branch 1 not taken.
3554361 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 3157597 Dune::FieldVector<Scalar, ModelTraits::numFluidComponents()> moleFrac;
281
282 7108722 moleFrac[comp1Idx] = priVars[switchIdx];
283 3554361 Scalar sumMoleFracOtherComponents = moleFrac[comp1Idx];
284
2/2
✓ Branch 0 taken 18732229 times.
✓ Branch 1 taken 3157597 times.
22286590 for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx)
285 {
286 37464458 moleFrac[compIdx] = priVars[compIdx];
287
288 37464458 sumMoleFracOtherComponents += moleFrac[compIdx];
289 }
290
291 3554361 moleFrac[comp0Idx] = 1 - sumMoleFracOtherComponents;
292
293 // convert mass to mole fractions and set the fluid state
294
2/2
✓ Branch 0 taken 25840951 times.
✓ Branch 1 taken 3554361 times.
29395312 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.
52465798 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.
3554361 ComputeFromReferencePhase::solve(fluidState,
301 paramCache,
302 phase0Idx);
303 }
304 paramCache.updateAll(fluidState);
305
2/2
✓ Branch 0 taken 29838220 times.
✓ Branch 1 taken 14919110 times.
44757330 for (int phaseIdx = 0; phaseIdx < ModelTraits::numFluidPhases(); ++phaseIdx)
306 {
307
1/2
✓ Branch 1 taken 83320 times.
✗ Branch 2 not taken.
29838220 Scalar mu = FluidSystem::viscosity(fluidState, paramCache, phaseIdx);
308
1/2
✓ Branch 1 taken 38468 times.
✗ Branch 2 not taken.
29838220 Scalar h = EnergyVolVars::enthalpy(fluidState, paramCache, phaseIdx);
309 29838220 fluidState.setViscosity(phaseIdx, mu);
310 59676440 fluidState.setEnthalpy(phaseIdx, h);
311 }
312 14919110 }
313
314 /*!
315 * \brief Returns the phase state for the control-volume.
316 */
317 const FluidState &fluidState() const
318 5438500 { 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 2034018 times.
✓ Branch 3 taken 4258080 times.
✓ Branch 4 taken 2034018 times.
✓ Branch 5 taken 3398958 times.
✓ Branch 6 taken 444708 times.
✓ Branch 7 taken 518148 times.
✓ Branch 8 taken 444708 times.
✓ Branch 9 taken 518322 times.
✓ Branch 10 taken 442266 times.
✓ Branch 11 taken 2616 times.
✓ Branch 12 taken 442266 times.
✓ Branch 13 taken 625212 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1021770 times.
✓ Branch 16 taken 297 times.
✓ Branch 17 taken 488379 times.
✓ Branch 18 taken 351 times.
✓ Branch 19 taken 90685 times.
✓ Branch 20 taken 71 times.
✓ Branch 21 taken 2023 times.
✓ Branch 22 taken 17 times.
✓ Branch 23 taken 717 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 42181588 times.
✓ Branch 26 taken 1236 times.
✓ Branch 27 taken 52439596 times.
✓ Branch 28 taken 1251 times.
✓ Branch 29 taken 10604563 times.
✓ Branch 30 taken 18 times.
✓ Branch 31 taken 347269 times.
✓ Branch 32 taken 3 times.
✓ Branch 33 taken 714 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.
798084508 { 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 303259040 { 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 522943888 Scalar molarDensity(int phaseIdx) const
368 {
369
1/2
✓ Branch 0 taken 522943888 times.
✗ Branch 1 not taken.
522943888 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.
1078687540 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.
149596736 { 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 107619748 { 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 41534239 times.
✓ Branch 3 taken 11191829 times.
✓ Branch 4 taken 346272 times.
✓ Branch 5 taken 2087164 times.
✓ Branch 6 taken 357 times.
✓ Branch 7 taken 595727 times.
484203686 { 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 53753948 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.
63766048 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 87955072 { 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.
182023880 { 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.
857557804 { 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