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 CO2Model | ||
10 | * \brief Contains the quantities which are constant within a | ||
11 | * finite volume in the CO2 model. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_CO2_VOLUME_VARIABLES_HH | ||
15 | #define DUMUX_CO2_VOLUME_VARIABLES_HH | ||
16 | |||
17 | #include <array> | ||
18 | |||
19 | #include <dune/common/exceptions.hh> | ||
20 | |||
21 | #include <dumux/porousmediumflow/volumevariables.hh> | ||
22 | #include <dumux/porousmediumflow/2p/formulation.hh> | ||
23 | #include <dumux/porousmediumflow/nonisothermal/volumevariables.hh> | ||
24 | #include <dumux/material/solidstates/updatesolidvolumefractions.hh> | ||
25 | |||
26 | #include "primaryvariableswitch.hh" | ||
27 | |||
28 | namespace Dumux { | ||
29 | |||
30 | /*! | ||
31 | * \ingroup CO2Model | ||
32 | * \brief Contains the quantities which are are constant within a | ||
33 | * finite volume in the CO2 model. | ||
34 | */ | ||
35 | template <class Traits> | ||
36 |
3/6✓ Branch 1 taken 90250 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 90250 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 90250 times.
✗ Branch 8 not taken.
|
57797631 | class TwoPTwoCCO2VolumeVariables |
37 | : public PorousMediumFlowVolumeVariables<Traits> | ||
38 | , public EnergyVolumeVariables<Traits, TwoPTwoCCO2VolumeVariables<Traits> > | ||
39 | { | ||
40 | using ParentType = PorousMediumFlowVolumeVariables< Traits>; | ||
41 | using EnergyVolVars = EnergyVolumeVariables<Traits, TwoPTwoCCO2VolumeVariables<Traits> >; | ||
42 | |||
43 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
44 | using ModelTraits = typename Traits::ModelTraits; | ||
45 | static constexpr int numFluidComps = ParentType::numFluidComponents(); | ||
46 | |||
47 | // component indices | ||
48 | enum | ||
49 | { | ||
50 | comp0Idx = Traits::FluidSystem::comp0Idx, | ||
51 | comp1Idx = Traits::FluidSystem::comp1Idx, | ||
52 | phase0Idx = Traits::FluidSystem::phase0Idx, | ||
53 | phase1Idx = Traits::FluidSystem::phase1Idx | ||
54 | }; | ||
55 | |||
56 | // phase presence indices | ||
57 | enum | ||
58 | { | ||
59 | firstPhaseOnly = ModelTraits::Indices::firstPhaseOnly, | ||
60 | secondPhaseOnly = ModelTraits::Indices::secondPhaseOnly, | ||
61 | bothPhases = ModelTraits::Indices::bothPhases | ||
62 | }; | ||
63 | |||
64 | // primary variable indices | ||
65 | enum | ||
66 | { | ||
67 | switchIdx = ModelTraits::Indices::switchIdx, | ||
68 | pressureIdx = ModelTraits::Indices::pressureIdx | ||
69 | }; | ||
70 | |||
71 | // formulation | ||
72 | static constexpr auto formulation = ModelTraits::priVarFormulation(); | ||
73 | |||
74 | // type used for the permeability | ||
75 | using PermeabilityType = typename Traits::PermeabilityType; | ||
76 | |||
77 | // type used for the diffusion coefficients | ||
78 | using EffDiffModel = typename Traits::EffectiveDiffusivityModel; | ||
79 | using DiffusionCoefficients = typename Traits::DiffusionType::DiffusionCoefficientsContainer; | ||
80 | |||
81 | public: | ||
82 | //! The type of the object returned by the fluidState() method | ||
83 | using FluidState = typename Traits::FluidState; | ||
84 | //! The fluid system used here | ||
85 | using FluidSystem = typename Traits::FluidSystem; | ||
86 | //! Export the indices | ||
87 | using Indices = typename ModelTraits::Indices; | ||
88 | //! Export type of solid state | ||
89 | using SolidState = typename Traits::SolidState; | ||
90 | //! Export type of solid system | ||
91 | using SolidSystem = typename Traits::SolidSystem; | ||
92 | //! Export the type of the primary variable switch | ||
93 | using PrimaryVariableSwitch = TwoPTwoCCO2PrimaryVariableSwitch; | ||
94 | |||
95 | |||
96 | //! Return whether moles or masses are balanced | ||
97 | static constexpr bool useMoles() { return ModelTraits::useMoles(); } | ||
98 | //! Return the two-phase formulation used here | ||
99 | static constexpr TwoPFormulation priVarFormulation() { return formulation; } | ||
100 | |||
101 | // check for permissive combinations | ||
102 | static_assert(ModelTraits::numFluidPhases() == 2, "NumPhases set in the model is not two!"); | ||
103 | static_assert(ModelTraits::numFluidComponents() == 2, "NumComponents set in the model is not two!"); | ||
104 | static_assert((formulation == TwoPFormulation::p0s1 || formulation == TwoPFormulation::p1s0), "Chosen TwoPFormulation not supported!"); | ||
105 | |||
106 | /*! | ||
107 | * \brief Updates all quantities for a given control volume. | ||
108 | * | ||
109 | * \param elemSol A vector containing all primary variables connected to the element | ||
110 | * \param problem The object specifying the problem which ought to | ||
111 | * be simulated | ||
112 | * \param element An element which contains part of the control volume | ||
113 | * \param scv The sub control volume | ||
114 | */ | ||
115 | template<class ElemSol, class Problem, class Element, class Scv> | ||
116 | 71188461 | void update(const ElemSol& elemSol, const Problem& problem, const Element& element, const Scv& scv) | |
117 | { | ||
118 | 71188461 | ParentType::update(elemSol, problem, element, scv); | |
119 | 71188461 | completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_); | |
120 | |||
121 | // Second instance of a parameter cache. Could be avoided if | ||
122 | // diffusion coefficients also became part of the fluid state. | ||
123 | typename FluidSystem::ParameterCache paramCache; | ||
124 | 71188461 | paramCache.updateAll(fluidState_); | |
125 | |||
126 | 71188461 | const auto& spatialParams = problem.spatialParams(); | |
127 | 71188461 | const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol); | |
128 | |||
129 | 71188461 | const int wPhaseIdx = fluidState_.wettingPhase(); | |
130 | 71188461 | const int nPhaseIdx = 1 - wPhaseIdx; | |
131 | |||
132 | // relative permeabilities -> require wetting phase saturation as parameter! | ||
133 | 71188461 | relativePermeability_[wPhaseIdx] = fluidMatrixInteraction.krw(saturation(wPhaseIdx)); | |
134 | 71188461 | relativePermeability_[nPhaseIdx] = fluidMatrixInteraction.krn(saturation(wPhaseIdx)); | |
135 | |||
136 | // porosity & permeabilty | ||
137 | 71188461 | updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps); | |
138 | 71188461 | EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_); | |
139 | 71188461 | permeability_ = spatialParams.permeability(element, scv, elemSol); | |
140 | |||
141 | 71188461 | auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx) | |
142 | { | ||
143 | 142376922 | return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx); | |
144 | }; | ||
145 | |||
146 | 71188461 | effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient); | |
147 | |||
148 | 71188461 | EnergyVolVars::updateEffectiveThermalConductivity(); | |
149 | 71188461 | } | |
150 | |||
151 | /*! | ||
152 | * \brief Completes the fluid state. | ||
153 | * | ||
154 | * \note TODO: This is a lot of copy paste from the 2p2c: factor out code! | ||
155 | * | ||
156 | * \param elemSol A vector containing all primary variables connected to the element | ||
157 | * \param problem The object specifying the problem which ought to be simulated | ||
158 | * \param element An element which contains part of the control volume | ||
159 | * \param scv The sub-control volume | ||
160 | * \param fluidState A container with the current (physical) state of the fluid | ||
161 | * \param solidState A container with the current (physical) state of the solid | ||
162 | * | ||
163 | * Set temperature, saturations, capillary pressures, viscosities, densities and enthalpies. | ||
164 | */ | ||
165 | template<class ElemSol, class Problem, class Element, class Scv> | ||
166 | 71188461 | void completeFluidState(const ElemSol& elemSol, | |
167 | const Problem& problem, | ||
168 | const Element& element, | ||
169 | const Scv& scv, | ||
170 | FluidState& fluidState, | ||
171 | SolidState& solidState) | ||
172 | { | ||
173 | 71188461 | EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState); | |
174 | |||
175 | 71188461 | const auto& priVars = elemSol[scv.localDofIndex()]; | |
176 | 71188461 | const auto phasePresence = priVars.state(); | |
177 | |||
178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71188461 times.
|
71188461 | const auto& spatialParams = problem.spatialParams(); |
179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71188461 times.
|
71188461 | const auto wPhaseIdx = spatialParams.template wettingPhase<FluidSystem>(element, scv, elemSol); |
180 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71188461 times.
|
71188461 | fluidState.setWettingPhase(wPhaseIdx); |
181 | |||
182 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71188461 times.
|
71188461 | const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol); |
183 | |||
184 | // set the saturations | ||
185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71188461 times.
|
71188461 | if (phasePresence == secondPhaseOnly) |
186 | { | ||
187 | ✗ | fluidState.setSaturation(phase0Idx, 0.0); | |
188 | ✗ | fluidState.setSaturation(phase1Idx, 1.0); | |
189 | } | ||
190 |
2/2✓ Branch 0 taken 67861748 times.
✓ Branch 1 taken 3326713 times.
|
71188461 | else if (phasePresence == firstPhaseOnly) |
191 | { | ||
192 | 67861748 | fluidState.setSaturation(phase0Idx, 1.0); | |
193 | 67861748 | fluidState.setSaturation(phase1Idx, 0.0); | |
194 | } | ||
195 |
1/2✓ Branch 0 taken 3326713 times.
✗ Branch 1 not taken.
|
3326713 | else if (phasePresence == bothPhases) |
196 | { | ||
197 | if (formulation == TwoPFormulation::p0s1) | ||
198 | { | ||
199 | 6653426 | fluidState.setSaturation(phase1Idx, priVars[switchIdx]); | |
200 | 6653426 | fluidState.setSaturation(phase0Idx, 1 - priVars[switchIdx]); | |
201 | } | ||
202 | else | ||
203 | { | ||
204 | fluidState.setSaturation(phase0Idx, priVars[switchIdx]); | ||
205 | fluidState.setSaturation(phase1Idx, 1 - priVars[switchIdx]); | ||
206 | } | ||
207 | } | ||
208 | else | ||
209 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Invalid phase presence."); | |
210 | |||
211 | // set pressures of the fluid phases | ||
212 | 142376922 | pc_ = fluidMatrixInteraction.pc(fluidState.saturation(wPhaseIdx)); | |
213 | if (formulation == TwoPFormulation::p0s1) | ||
214 | { | ||
215 |
4/4✓ Branch 0 taken 3326713 times.
✓ Branch 1 taken 67861748 times.
✓ Branch 2 taken 3326713 times.
✓ Branch 3 taken 67861748 times.
|
142376922 | fluidState.setPressure(phase0Idx, priVars[pressureIdx]); |
216 |
4/4✓ Branch 0 taken 3326713 times.
✓ Branch 1 taken 67861748 times.
✓ Branch 2 taken 3326713 times.
✓ Branch 3 taken 67861748 times.
|
142376922 | fluidState.setPressure(phase1Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] + pc_ |
217 | : priVars[pressureIdx] - pc_); | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | fluidState.setPressure(phase1Idx, priVars[pressureIdx]); | ||
222 | fluidState.setPressure(phase0Idx, (wPhaseIdx == phase0Idx) ? priVars[pressureIdx] - pc_ | ||
223 | : priVars[pressureIdx] + pc_); | ||
224 | } | ||
225 | |||
226 | // calculate the phase compositions | ||
227 | typename FluidSystem::ParameterCache paramCache; | ||
228 | // both phases are present | ||
229 |
2/2✓ Branch 0 taken 3326713 times.
✓ Branch 1 taken 67861748 times.
|
71188461 | if (phasePresence == bothPhases) |
230 | { | ||
231 | //Get the equilibrium mole fractions from the FluidSystem and set them in the fluidState | ||
232 | //xCO2 = equilibrium mole fraction of CO2 in the liquid phase | ||
233 | //yH2O = equilibrium mole fraction of H2O in the gas phase | ||
234 | 3326713 | const auto xwCO2 = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase0Idx); | |
235 | 3326713 | const auto xgH2O = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase1Idx); | |
236 | 3326713 | const auto xwH2O = 1 - xwCO2; | |
237 | 3326713 | const auto xgCO2 = 1 - xgH2O; | |
238 | 3326713 | fluidState.setMoleFraction(phase0Idx, comp0Idx, xwH2O); | |
239 | 3326713 | fluidState.setMoleFraction(phase0Idx, comp1Idx, xwCO2); | |
240 | 3326713 | fluidState.setMoleFraction(phase1Idx, comp0Idx, xgH2O); | |
241 | 3326713 | fluidState.setMoleFraction(phase1Idx, comp1Idx, xgCO2); | |
242 | } | ||
243 | |||
244 | // only the nonwetting phase is present, i.e. nonwetting phase | ||
245 | // composition is stored explicitly. | ||
246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67861748 times.
|
67861748 | else if (phasePresence == secondPhaseOnly) |
247 | { | ||
248 | if( useMoles() ) // mole-fraction formulation | ||
249 | { | ||
250 | // set the fluid state | ||
251 | fluidState.setMoleFraction(phase1Idx, comp0Idx, priVars[switchIdx]); | ||
252 | fluidState.setMoleFraction(phase1Idx, comp1Idx, 1-priVars[switchIdx]); | ||
253 | // TODO give values for non-existing wetting phase | ||
254 | const auto xwCO2 = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase0Idx); | ||
255 | const auto xwH2O = 1 - xwCO2; | ||
256 | fluidState.setMoleFraction(phase0Idx, comp1Idx, xwCO2); | ||
257 | fluidState.setMoleFraction(phase0Idx, comp0Idx, xwH2O); | ||
258 | } | ||
259 | else // mass-fraction formulation | ||
260 | { | ||
261 | // setMassFraction() has only to be called 1-numComponents times | ||
262 | ✗ | fluidState.setMassFraction(phase1Idx, comp0Idx, priVars[switchIdx]); | |
263 | // TODO give values for non-existing wetting phase | ||
264 | ✗ | const auto xwCO2 = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase0Idx); | |
265 | ✗ | const auto xwH2O = 1 - xwCO2; | |
266 | ✗ | fluidState.setMoleFraction(phase0Idx, comp1Idx, xwCO2); | |
267 | ✗ | fluidState.setMoleFraction(phase0Idx, comp0Idx, xwH2O); | |
268 | } | ||
269 | } | ||
270 | |||
271 | // only the wetting phase is present, i.e. wetting phase | ||
272 | // composition is stored explicitly. | ||
273 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67861748 times.
|
67861748 | else if (phasePresence == firstPhaseOnly) |
274 | { | ||
275 | if( useMoles() ) // mole-fraction formulation | ||
276 | { | ||
277 | // convert mass to mole fractions and set the fluid state | ||
278 | fluidState.setMoleFraction(phase0Idx, comp0Idx, 1-priVars[switchIdx]); | ||
279 | fluidState.setMoleFraction(phase0Idx, comp1Idx, priVars[switchIdx]); | ||
280 | // TODO give values for non-existing nonwetting phase | ||
281 | Scalar xnH2O = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase1Idx); | ||
282 | Scalar xnCO2 = 1 - xnH2O; | ||
283 | fluidState.setMoleFraction(phase1Idx, comp1Idx, xnCO2); | ||
284 | fluidState.setMoleFraction(phase1Idx, comp0Idx, xnH2O); | ||
285 | } | ||
286 | else // mass-fraction formulation | ||
287 | { | ||
288 | // setMassFraction() has only to be called 1-numComponents times | ||
289 | 135723496 | fluidState.setMassFraction(phase0Idx, comp1Idx, priVars[switchIdx]); | |
290 | // TODO give values for non-existing nonwetting phase | ||
291 | 67861748 | Scalar xnH2O = FluidSystem::equilibriumMoleFraction(fluidState, paramCache, phase1Idx); | |
292 | 67861748 | Scalar xnCO2 = 1 - xnH2O; | |
293 | 67861748 | fluidState.setMoleFraction(phase1Idx, comp1Idx, xnCO2); | |
294 | 67861748 | fluidState.setMoleFraction(phase1Idx, comp0Idx, xnH2O); | |
295 | } | ||
296 | } | ||
297 | |||
298 |
2/2✓ Branch 0 taken 142376922 times.
✓ Branch 1 taken 71188461 times.
|
213565383 | for (int phaseIdx = 0; phaseIdx < ModelTraits::numFluidPhases(); ++phaseIdx) |
299 | { | ||
300 | // set the viscosity and desity here if constraintsolver is not used | ||
301 | 142376922 | paramCache.updateComposition(fluidState, phaseIdx); | |
302 | 142376922 | const Scalar rho = FluidSystem::density(fluidState, paramCache, phaseIdx); | |
303 | 142376922 | fluidState.setDensity(phaseIdx, rho); | |
304 | 142376922 | const Scalar rhoMolar = FluidSystem::molarDensity(fluidState, phaseIdx); | |
305 | 142376922 | fluidState.setMolarDensity(phaseIdx, rhoMolar); | |
306 | 142376922 | const Scalar mu = FluidSystem::viscosity(fluidState, paramCache, phaseIdx); | |
307 | 142376922 | fluidState.setViscosity(phaseIdx,mu); | |
308 | |||
309 | // compute and set the enthalpy | ||
310 | 142376922 | Scalar h = EnergyVolVars::enthalpy(fluidState, paramCache, phaseIdx); | |
311 | 284753844 | fluidState.setEnthalpy(phaseIdx, h); | |
312 | } | ||
313 | 71188461 | } | |
314 | |||
315 | /*! | ||
316 | * \brief Returns the phase state within the control volume. | ||
317 | */ | ||
318 | const FluidState &fluidState() const | ||
319 | 742787357 | { return fluidState_; } | |
320 | |||
321 | /*! | ||
322 | * \brief Returns the phase state for the control volume. | ||
323 | */ | ||
324 | const SolidState &solidState() const | ||
325 | 46343514 | { return solidState_; } | |
326 | |||
327 | /*! | ||
328 | * \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$ of the fluid phase. | ||
329 | * | ||
330 | * \param phaseIdx The phase index | ||
331 | */ | ||
332 | Scalar averageMolarMass(int phaseIdx) const | ||
333 | { return fluidState_.averageMolarMass(phaseIdx); } | ||
334 | |||
335 | /*! | ||
336 | * \brief Returns the saturation of a given phase within | ||
337 | * the control volume in \f$[-]\f$. | ||
338 | * | ||
339 | * \param phaseIdx The phase index | ||
340 | */ | ||
341 | Scalar saturation(const int phaseIdx) const | ||
342 |
18/26✓ Branch 2 taken 18 times.
✓ Branch 3 taken 169863 times.
✓ Branch 4 taken 74 times.
✓ Branch 5 taken 92856835 times.
✓ Branch 6 taken 56 times.
✓ Branch 7 taken 92686972 times.
✓ Branch 8 taken 10 times.
✓ Branch 9 taken 124764 times.
✓ Branch 10 taken 10 times.
✓ Branch 11 taken 124764 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 169863 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 169863 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 124764 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 124764 times.
✓ Branch 22 taken 138 times.
✓ Branch 23 taken 49689756 times.
✓ Branch 24 taken 138 times.
✓ Branch 25 taken 49689756 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
|
2964213248 | { return fluidState_.saturation(phaseIdx); } |
343 | |||
344 | /*! | ||
345 | * \brief Returns the mass fraction of a given component in a | ||
346 | * given phase within the control volume in \f$[-]\f$. | ||
347 | * | ||
348 | * \param phaseIdx The phase index | ||
349 | * \param compIdx The component index | ||
350 | */ | ||
351 | Scalar massFraction(const int phaseIdx, const int compIdx) const | ||
352 | 4302283120 | { return fluidState_.massFraction(phaseIdx, compIdx); } | |
353 | |||
354 | /*! | ||
355 | * \brief Returns the mole fraction of a given component in a | ||
356 | * given phase within the control volume in \f$[-]\f$. | ||
357 | * | ||
358 | * \param phaseIdx The phase index | ||
359 | * \param compIdx The component index | ||
360 | */ | ||
361 | Scalar moleFraction(const int phaseIdx, const int compIdx) const | ||
362 | 11882086 | { return fluidState_.moleFraction(phaseIdx, compIdx); } | |
363 | |||
364 | /*! | ||
365 | * \brief Returns the mass density of a given phase within the | ||
366 | * control volume in \f$[kg/m^3]\f$. | ||
367 | * | ||
368 | * \param phaseIdx The phase index | ||
369 | */ | ||
370 | Scalar density(const int phaseIdx) const | ||
371 |
6/6✓ Branch 4 taken 54595320 times.
✓ Branch 5 taken 835188 times.
✓ Branch 6 taken 113697364 times.
✓ Branch 7 taken 1670376 times.
✓ Branch 8 taken 59102044 times.
✓ Branch 9 taken 835188 times.
|
13561004512 | { return fluidState_.density(phaseIdx); } |
372 | |||
373 | /*! | ||
374 | * \brief Returns the dynamic viscosity of the fluid within the | ||
375 | * control volume in \f$\mathrm{[Pa s]}\f$. | ||
376 | * | ||
377 | * \param phaseIdx The phase index | ||
378 | */ | ||
379 | Scalar viscosity(const int phaseIdx) const | ||
380 | { return fluidState_.viscosity(phaseIdx); } | ||
381 | |||
382 | /*! | ||
383 | * \brief Returns the mass density of a given phase within the | ||
384 | * control volume in \f$[mol/m^3]\f$. | ||
385 | * | ||
386 | * \param phaseIdx The phase index | ||
387 | */ | ||
388 | Scalar molarDensity(const int phaseIdx) const | ||
389 | 9358184 | { return fluidState_.molarDensity(phaseIdx) ; } | |
390 | |||
391 | /*! | ||
392 | * \brief Returns the effective pressure of a given phase within | ||
393 | * the control volume in \f$[kg/(m*s^2)=N/m^2=Pa]\f$. | ||
394 | * | ||
395 | * \param phaseIdx The phase index | ||
396 | */ | ||
397 | Scalar pressure(const int phaseIdx) const | ||
398 | 2456955800 | { return fluidState_.pressure(phaseIdx); } | |
399 | |||
400 | /*! | ||
401 | * \brief Returns temperature within the control volume in \f$[K]\f$. | ||
402 | * | ||
403 | * Note that we assume thermodynamic equilibrium, i.e. the | ||
404 | * temperature of the rock matrix and of all fluid phases are | ||
405 | * identical. | ||
406 | */ | ||
407 | Scalar temperature() const | ||
408 |
2/4✓ Branch 0 taken 38457504 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38457504 times.
✗ Branch 3 not taken.
|
670965024 | { return fluidState_.temperature(/*phaseIdx=*/0); } |
409 | |||
410 | /*! | ||
411 | * \brief Returns the relative permeability of a given phase within | ||
412 | * the control volume in \f$[-]\f$. | ||
413 | * | ||
414 | * \param phaseIdx The phase index | ||
415 | */ | ||
416 | Scalar relativePermeability(const int phaseIdx) const | ||
417 | { return relativePermeability_[phaseIdx]; } | ||
418 | |||
419 | /*! | ||
420 | * \brief Returns the effective mobility of a given phase within | ||
421 | * the control volume in \f$[s*m/kg]\f$. | ||
422 | * | ||
423 | * \param phaseIdx The phase index | ||
424 | */ | ||
425 | Scalar mobility(const int phaseIdx) const | ||
426 | 1237192560 | { return relativePermeability_[phaseIdx]/fluidState_.viscosity(phaseIdx); } | |
427 | |||
428 | /*! | ||
429 | * \brief Returns the effective capillary pressure within the control volume | ||
430 | * in \f$[kg/(m*s^2)=N/m^2=Pa]\f$. | ||
431 | */ | ||
432 | Scalar capillaryPressure() const | ||
433 | 7018638 | { return fluidState_.pressure(phase1Idx) - fluidState_.pressure(phase0Idx); } | |
434 | |||
435 | /*! | ||
436 | * \brief Returns the average porosity within the control volume in \f$[-]\f$. | ||
437 | */ | ||
438 | Scalar porosity() const | ||
439 |
6/6✓ Branch 2 taken 138 times.
✓ Branch 3 taken 49689756 times.
✓ Branch 4 taken 194 times.
✓ Branch 5 taken 142376728 times.
✓ Branch 6 taken 56 times.
✓ Branch 7 taken 92686972 times.
|
2821247016 | { return solidState_.porosity(); } |
440 | |||
441 | /*! | ||
442 | * \brief Returns the average permeability within the control volume in \f$[m^2]\f$. | ||
443 | */ | ||
444 | const PermeabilityType& permeability() const | ||
445 | ✗ | { return permeability_; } | |
446 | |||
447 | /*! | ||
448 | * \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$. | ||
449 | */ | ||
450 | Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const | ||
451 | { | ||
452 | typename FluidSystem::ParameterCache paramCache; | ||
453 | 142376922 | paramCache.updatePhase(fluidState_, phaseIdx); | |
454 |
2/2✓ Branch 1 taken 194 times.
✓ Branch 2 taken 142376728 times.
|
142376922 | return FluidSystem::binaryDiffusionCoefficient(fluidState_, paramCache, phaseIdx, compIIdx, compJIdx); |
455 | } | ||
456 | |||
457 | /*! | ||
458 | * \brief Returns the effective diffusion coefficients for a phase in \f$[m^2/s]\f$. | ||
459 | */ | ||
460 | Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const | ||
461 | 708889568 | { return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); } | |
462 | |||
463 | |||
464 | /*! | ||
465 | * \brief Returns the wetting phase index | ||
466 | */ | ||
467 | int wettingPhase() const | ||
468 | { return fluidState_.wettingPhase(); } | ||
469 | |||
470 | private: | ||
471 | FluidState fluidState_; | ||
472 | SolidState solidState_; | ||
473 | Scalar pc_; // The capillary pressure | ||
474 | PermeabilityType permeability_; // Effective permeability within the control volume | ||
475 | |||
476 | // Relative permeability within the control volume | ||
477 | std::array<Scalar, ModelTraits::numFluidPhases()> relativePermeability_; | ||
478 | |||
479 | // Effective diffusion coefficients for the phases | ||
480 | DiffusionCoefficients effectiveDiffCoeff_; | ||
481 | }; | ||
482 | |||
483 | } // end namespace Dumux | ||
484 | |||
485 | #endif | ||
486 |