GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/porousmediumflow/2pnc/volumevariables.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 106 110 96.4%
Functions: 39 39 100.0%
Branches: 101 182 55.5%

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 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 406336 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 14918762 void update(const ElemSol &elemSol,
119 const Problem &problem,
120 const Element &element,
121 const Scv& scv)
122 {
123 14918762 ParentType::update(elemSol, problem, element, scv);
124
125 14918762 completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_);
126
127 /////////////
128 // calculate the remaining quantities
129 /////////////
130
131 14918762 const auto& spatialParams = problem.spatialParams();
132 14918762 const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
133
134
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
14918762 const int wPhaseIdx = fluidState_.wettingPhase();
135 14918762 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.
14918762 mobility_[wPhaseIdx] = fluidMatrixInteraction.krw(saturation(wPhaseIdx))/fluidState_.viscosity(wPhaseIdx);
139
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
14918762 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.
14918762 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
143
144 104861754 auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
145 {
146 89942992 return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx);
147 };
148
149
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
14918762 effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient);
150
151 // calculate the remaining quantities
152
1/2
✓ Branch 1 taken 19234 times.
✗ Branch 2 not taken.
9313848 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
153
2/2
✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
14918762 permeability_ = spatialParams.permeability(element, scv, elemSol);
154
2/2
✓ Branch 1 taken 19221 times.
✓ Branch 2 taken 13 times.
267032 EnergyVolVars::updateEffectiveThermalConductivity();
155 14918749 }
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 14918762 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 14918762 EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
178
179 14918762 const auto& priVars = elemSol[scv.localDofIndex()];
180 14918762 const auto phasePresence = priVars.state();
181
182
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5807860 times.
14918762 const auto& spatialParams = problem.spatialParams();
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5807860 times.
14918762 const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
184
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14916361 times.
14918762 const auto wPhaseIdx = spatialParams.template wettingPhase<FluidSystem>(element, scv, elemSol);
185 14918762 fluidState.setWettingPhase(wPhaseIdx);
186
187 // set the saturations
188
2/2
✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 14916361 times.
14918762 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 11362000 times.
14916361 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 11362000 times.
✗ Branch 1 not taken.
11362000 else if (phasePresence == bothPhases)
199 {
200 if (formulation == TwoPFormulation::p0s1)
201 {
202 9196705 fluidState.setSaturation(phase1Idx, priVars[switchIdx]);
203 9196705 fluidState.setSaturation(phase0Idx, 1 - priVars[switchIdx]);
204 }
205 else
206 {
207 2165295 fluidState.setSaturation(phase0Idx, priVars[switchIdx]);
208 2165295 fluidState.setSaturation(phase1Idx, 1 - priVars[switchIdx]);
209 }
210 }
211 else
212
2/27
✗ 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.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✓ Branch 40 taken 41660 times.
✗ Branch 41 not taken.
✓ Branch 39 taken 9069242 times.
14918762 DUNE_THROW(Dune::InvalidStateException, "phasePresence: " << phasePresence << " is invalid.");
213
214 // set pressures of the fluid phases
215
1/2
✓ Branch 1 taken 41660 times.
✗ Branch 2 not taken.
14918762 pc_ = fluidMatrixInteraction.pc(fluidState.saturation(wPhaseIdx));
216 if (formulation == TwoPFormulation::p0s1)
217 {
218
2/2
✓ Branch 0 taken 9196705 times.
✓ Branch 1 taken 2994937 times.
12191642 fluidState.setPressure(phase0Idx, priVars[pressureIdx]);
219 12191642 fluidState.setPressure(phase1Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] + pc_
220 : priVars[pressureIdx] - pc_);
221 }
222 else
223 {
224
2/2
✓ Branch 0 taken 2165295 times.
✓ Branch 1 taken 561825 times.
2727120 fluidState.setPressure(phase1Idx, priVars[pressureIdx]);
225 2727120 fluidState.setPressure(phase0Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] - pc_
226 301713 : 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 11362000 times.
✓ Branch 1 taken 3556762 times.
14918762 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/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1949550 times.
✓ Branch 2 taken 1949550 times.
22682505 for (int compIdx = numMajorComponents; compIdx < ModelTraits::numFluidComponents(); ++compIdx)
244
2/2
✓ Branch 0 taken 9370955 times.
✓ Branch 1 taken 9370955 times.
20691460 fluidState.setMoleFraction(knownPhaseIdx, compIdx, priVars[compIdx]);
245
246
1/2
✓ Branch 1 taken 34443 times.
✗ Branch 2 not taken.
11362000 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 2401 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
1/2
✓ Branch 1 taken 4802 times.
✗ Branch 2 not taken.
4802 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 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 3554361 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 18732229 moleFrac[compIdx] = priVars[compIdx];
287
288 18732229 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
1/2
✓ Branch 1 taken 9632 times.
✗ Branch 2 not taken.
26624847 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 29837524 times.
✓ Branch 1 taken 14918762 times.
44756286 for (int phaseIdx = 0; phaseIdx < ModelTraits::numFluidPhases(); ++phaseIdx)
306 {
307
1/2
✓ Branch 1 taken 38468 times.
✗ Branch 2 not taken.
29837524 Scalar mu = FluidSystem::viscosity(fluidState, paramCache, phaseIdx);
308 29837524 Scalar h = EnergyVolVars::enthalpy(fluidState, paramCache, phaseIdx);
309 29837524 fluidState.setViscosity(phaseIdx, mu);
310 29837524 fluidState.setEnthalpy(phaseIdx, h);
311 }
312 14918762 }
313
314 /*!
315 * \brief Returns the phase state for the control-volume.
316 */
317 299234 const FluidState &fluidState() const
318 2219721 { return fluidState_; }
319
320 /*!
321 * \brief Returns the phase state for the control-volume.
322 */
323 const SolidState &solidState() const
324 561205 { 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 859122 Scalar averageMolarMass(int phaseIdx) const
332 859122 { 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 432998518 Scalar saturation(int phaseIdx) const
341
19/21
✗ Branch 0 not taken.
✓ Branch 1 taken 2738361 times.
✓ Branch 2 taken 3550977 times.
✓ Branch 3 taken 447462 times.
✓ Branch 5 taken 445470 times.
✓ Branch 6 taken 5080 times.
✓ Branch 8 taken 399297 times.
✓ Branch 9 taken 84499 times.
✓ Branch 10 taken 3550 times.
✓ Branch 11 taken 2609 times.
✓ Branch 13 taken 42182824 times.
✓ Branch 14 taken 10258008 times.
✓ Branch 15 taken 1036 times.
✓ Branch 16 taken 301638 times.
✓ Branch 18 taken 22426 times.
✓ Branch 19 taken 19234 times.
✓ Branch 7 taken 623313 times.
✓ Branch 12 taken 36277682 times.
✓ Branch 17 taken 124903 times.
✗ Branch 20 not taken.
✓ Branch 4 taken 513268 times.
424374396 { 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 137395328 Scalar density(int phaseIdx) const
350 135336036 { 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 539230838 Scalar molarDensity(int phaseIdx) const
368 {
369
1/2
✓ Branch 0 taken 522932528 times.
✗ Branch 1 not taken.
522932528 if (phaseIdx < ModelTraits::numFluidPhases())
370
6/6
✓ Branch 1 taken 4025170 times.
✓ Branch 2 taken 34606 times.
✓ Branch 3 taken 3936839 times.
✓ Branch 4 taken 122937 times.
✓ Branch 5 taken 1126645 times.
✓ Branch 6 taken 2933131 times.
539196232 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 69209434 Scalar pressure(int phaseIdx) const
383
3/6
✓ Branch 0 taken 59206 times.
✓ Branch 1 taken 77512 times.
✓ Branch 2 taken 44506 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
68980926 { 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 2919447 Scalar temperature() const
393
1/2
✓ Branch 0 taken 53040 times.
✗ Branch 1 not taken.
2308121 { 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 211943366 Scalar mobility(int phaseIdx) const
402 13290362 { 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 137722 Scalar capillaryPressure() const
409
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1691 times.
✓ Branch 3 taken 18857 times.
137490 { return pc_; }
410
411 /*!
412 * \brief Returns the average porosity within the control volume.
413 */
414 209659746 Scalar porosity() const
415
5/6
✗ Branch 0 not taken.
✓ Branch 1 taken 41533003 times.
✓ Branch 2 taken 37769998 times.
✓ Branch 3 taken 10296119 times.
✓ Branch 4 taken 257080 times.
✓ Branch 5 taken 86792 times.
267890755 { return solidState_.porosity(); }
416
417 /*!
418 * \brief Returns the permeability within the control volume.
419 */
420 1925436 const PermeabilityType& permeability() const
421
2/4
✓ Branch 0 taken 57516 times.
✓ Branch 1 taken 933960 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1925436 { return permeability_; }
422
423 /*!
424 * \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$.
425 */
426 53754732 Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
427 {
428 typename FluidSystem::ParameterCache paramCache;
429 89913588 paramCache.updatePhase(fluidState_, phaseIdx);
430
5/7
✓ Branch 2 taken 2039644 times.
✓ Branch 3 taken 2212 times.
✓ Branch 5 taken 1008 times.
✓ Branch 6 taken 82312 times.
✓ Branch 1 taken 36276968 times.
✗ Branch 0 not taken.
✗ Branch 4 not taken.
89996908 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 155921808 Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
437 87946576 { 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 183346956 Scalar massFraction(int phaseIdx, int compIdx) const
446
3/4
✓ Branch 0 taken 8458800 times.
✓ Branch 1 taken 25376400 times.
✓ Branch 2 taken 16912 times.
✗ Branch 3 not taken.
182020100 { 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 509588798 Scalar moleFraction(int phaseIdx, int compIdx) const
455
6/6
✓ Branch 2 taken 4025170 times.
✓ Branch 3 taken 34606 times.
✓ Branch 4 taken 3936839 times.
✓ Branch 5 taken 122937 times.
✓ Branch 7 taken 1126645 times.
✓ Branch 8 taken 2933131 times.
322378243 { 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