opm-common
Loading...
Searching...
No Matches
BlackOilFluidState.hpp
Go to the documentation of this file.
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 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef OPM_BLACK_OIL_FLUID_STATE_HH
29#define OPM_BLACK_OIL_FLUID_STATE_HH
30
31#include <type_traits>
32
33#include <opm/common/utility/gpuDecorators.hpp>
34#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
36
39
40namespace Opm {
41
42OPM_GENERATE_HAS_MEMBER(pvtRegionIndex, ) // Creates 'HasMember_pvtRegionIndex<T>'.
43
44template <class FluidState>
45OPM_HOST_DEVICE unsigned getPvtRegionIndex_(typename std::enable_if<HasMember_pvtRegionIndex<FluidState>::value,
46 const FluidState&>::type fluidState)
47{ return fluidState.pvtRegionIndex(); }
48
49template <class FluidState>
50OPM_HOST_DEVICE unsigned getPvtRegionIndex_(typename std::enable_if<!HasMember_pvtRegionIndex<FluidState>::value,
51 const FluidState&>::type)
52{ return 0; }
53
54OPM_GENERATE_HAS_MEMBER(invB, /*phaseIdx=*/0) // Creates 'HasMember_invB<T>'.
55
56template <class FluidSystem, class FluidState, class LhsEval>
57OPM_HOST_DEVICE
58auto getInvB_(typename std::enable_if<HasMember_invB<FluidState>::value,
59 const FluidState&>::type fluidState,
60 unsigned phaseIdx,
61 unsigned,
62 [[maybe_unused]] const FluidSystem& fluidSystem = FluidSystem{})
63 -> decltype(decay<LhsEval>(fluidState.invB(phaseIdx)))
64{ return decay<LhsEval>(fluidState.invB(phaseIdx)); }
65
66template <class FluidSystem, class FluidState, class LhsEval>
67OPM_HOST_DEVICE
68LhsEval getInvB_(typename std::enable_if<!HasMember_invB<FluidState>::value,
69 const FluidState&>::type fluidState,
70 unsigned phaseIdx,
71 unsigned pvtRegionIdx,
72 const FluidSystem& fluidSystem = FluidSystem{})
73{
74 const auto& rho = fluidState.density(phaseIdx);
75 const auto& Xsolvent =
76 fluidState.massFraction(phaseIdx, fluidSystem.solventComponentIndex(phaseIdx));
77
78 return
79 decay<LhsEval>(rho)
80 *decay<LhsEval>(Xsolvent)
81 /fluidSystem.referenceDensity(phaseIdx, pvtRegionIdx);
82}
83
84OPM_GENERATE_HAS_MEMBER(saltConcentration, ) // Creates 'HasMember_saltConcentration<T>'.
85
86template <class FluidState>
87OPM_HOST_DEVICE auto getSaltConcentration_(typename std::enable_if<HasMember_saltConcentration<FluidState>::value,
88 const FluidState&>::type fluidState)
89{ return fluidState.saltConcentration(); }
90
91template <class FluidState>
92OPM_HOST_DEVICE auto getSaltConcentration_(typename std::enable_if<!HasMember_saltConcentration<FluidState>::value,
93 const FluidState&>::type)
94{ return 0.0; }
95
96OPM_GENERATE_HAS_MEMBER(saltSaturation, ) // Creates 'HasMember_saltSaturation<T>'.
97
98template <class FluidState>
99OPM_HOST_DEVICE auto getSaltSaturation_(typename std::enable_if<HasMember_saltSaturation<FluidState>::value,
100 const FluidState&>::type fluidState)
101{ return fluidState.saltSaturation(); }
102
103
104template <class FluidState>
105OPM_HOST_DEVICE auto getSaltSaturation_(typename std::enable_if<!HasMember_saltSaturation<FluidState>::value,
106 const FluidState&>::type)
107{ return 0.0; }
108
116template <class ScalarT,
117 class FluidSystemT,
118 bool enableTemperature = false,
119 bool enableEnergy = false,
120 bool enableDissolution = true,
121 bool enableVapwat = false,
122 bool enableBrine = false,
123 bool enableSaltPrecipitation = false,
124 bool enableDissolutionInWater = false,
125 unsigned numStoragePhases = FluidSystemT::numPhases>
127{
128public:
129 using FluidSystem = FluidSystemT;
130 using Scalar = ScalarT;
131
132 static constexpr int waterPhaseIdx = FluidSystem::waterPhaseIdx;
133 static constexpr int gasPhaseIdx = FluidSystem::gasPhaseIdx;
134 static constexpr int oilPhaseIdx = FluidSystem::oilPhaseIdx;
135
136 static constexpr int waterCompIdx = FluidSystem::waterCompIdx;
137 static constexpr int gasCompIdx = FluidSystem::gasCompIdx;
138 static constexpr int oilCompIdx = FluidSystem::oilCompIdx;
139
140 static constexpr int numPhases = FluidSystem::numPhases;
141 static constexpr int numComponents = FluidSystem::numComponents;
142
143 static constexpr bool fluidSystemIsStatic = std::is_empty_v<FluidSystem>;
144
150 explicit OPM_HOST_DEVICE BlackOilFluidState(const FluidSystem& fluidSystem)
151 {
152 if constexpr (fluidSystemIsStatic) {
153 fluidSystemPtr_ = &fluidSystem;
154 }
155 }
156
162 OPM_HOST_DEVICE BlackOilFluidState()
163 {
164 static_assert(fluidSystemIsStatic);
165 }
166
175 void checkDefined() const
176 {
177#ifndef NDEBUG
178 Valgrind::CheckDefined(pvtRegionIdx_);
179
180 for (unsigned storagePhaseIdx = 0; storagePhaseIdx < numStoragePhases; ++ storagePhaseIdx) {
181 Valgrind::CheckDefined(saturation_[storagePhaseIdx]);
182 Valgrind::CheckDefined(pressure_[storagePhaseIdx]);
183 Valgrind::CheckDefined(density_[storagePhaseIdx]);
184 Valgrind::CheckDefined(invB_[storagePhaseIdx]);
185
186 if constexpr (enableEnergy)
187 Valgrind::CheckDefined((*enthalpy_)[storagePhaseIdx]);
188 }
189
190 if constexpr (enableDissolution) {
193 }
194
195 if constexpr (enableVapwat) {
197 }
198
199 if constexpr (enableDissolutionInWater) {
201 }
202
203 if constexpr (enableBrine) {
204 Valgrind::CheckDefined(*saltConcentration_);
205 }
206
207 if constexpr (enableSaltPrecipitation) {
208 Valgrind::CheckDefined(*saltSaturation_);
209 }
210
211 if constexpr (enableTemperature || enableEnergy)
212 Valgrind::CheckDefined(*temperature_);
213#endif // NDEBUG
214 }
215
220 template <class FluidState>
221 OPM_HOST_DEVICE void assign(const FluidState& fs)
222 {
223 if constexpr (enableTemperature || enableEnergy)
224 setTemperature(fs.temperature(/*phaseIdx=*/0));
225
226 unsigned pvtRegionIdx = getPvtRegionIndex_<FluidState>(fs);
227 setPvtRegionIndex(pvtRegionIdx);
228
229 if constexpr (enableDissolution) {
230 setRs(BlackOil::getRs_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
231 setRv(BlackOil::getRv_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
232 }
233 if constexpr (enableVapwat) {
234 setRvw(BlackOil::getRvw_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
235 }
236 if constexpr (enableDissolutionInWater) {
237 setRsw(BlackOil::getRsw_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
238 }
239 if constexpr (enableBrine){
240 setSaltConcentration(BlackOil::getSaltConcentration_<FluidState, Scalar>(fs, pvtRegionIdx));
241 }
242 if constexpr (enableSaltPrecipitation){
243 setSaltSaturation(BlackOil::getSaltSaturation_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
244 }
245 for (unsigned storagePhaseIdx = 0; storagePhaseIdx < numStoragePhases; ++storagePhaseIdx) {
246 unsigned phaseIdx = storageToCanonicalPhaseIndex_(storagePhaseIdx, fluidSystem());
247 setSaturation(phaseIdx, fs.saturation(phaseIdx));
248 setPressure(phaseIdx, fs.pressure(phaseIdx));
249 setDensity(phaseIdx, fs.density(phaseIdx));
250
251 if constexpr (enableEnergy)
252 setEnthalpy(phaseIdx, fs.enthalpy(phaseIdx));
253
254 setInvB(phaseIdx, getInvB_<FluidSystem, FluidState, Scalar>(fs, phaseIdx, pvtRegionIdx, fluidSystem()));
255 }
256 }
257
264 OPM_HOST_DEVICE void setPvtRegionIndex(unsigned newPvtRegionIdx)
265 { pvtRegionIdx_ = static_cast<unsigned short>(newPvtRegionIdx); }
266
270 OPM_HOST_DEVICE void setPressure(unsigned phaseIdx, const Scalar& p)
271 { pressure_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())] = p; }
272
276 OPM_HOST_DEVICE void setSaturation(unsigned phaseIdx, const Scalar& S)
277 { saturation_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())] = S; }
278
282 OPM_HOST_DEVICE void setTotalSaturation(const Scalar& value)
283 {
284 totalSaturation_ = value;
285 }
286
293 OPM_HOST_DEVICE void setTemperature(const Scalar& value)
294 {
295 assert(enableTemperature || enableEnergy);
296
297 (*temperature_) = value;
298 }
299
306 OPM_HOST_DEVICE void setEnthalpy(unsigned phaseIdx, const Scalar& value)
307 {
308 assert(enableTemperature || enableEnergy);
309
310 (*enthalpy_)[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())] = value;
311 }
312
316 OPM_HOST_DEVICE void setInvB(unsigned phaseIdx, const Scalar& b)
317 { invB_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())] = b; }
318
322 OPM_HOST_DEVICE void setDensity(unsigned phaseIdx, const Scalar& rho)
323 { density_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())] = rho; }
324
330 OPM_HOST_DEVICE void setRs(const Scalar& newRs)
331 { *Rs_ = newRs; }
332
338 OPM_HOST_DEVICE void setRv(const Scalar& newRv)
339 { *Rv_ = newRv; }
340
346 OPM_HOST_DEVICE void setRvw(const Scalar& newRvw)
347 { *Rvw_ = newRvw; }
348
354 OPM_HOST_DEVICE void setRsw(const Scalar& newRsw)
355 { *Rsw_ = newRsw; }
356
360 OPM_HOST_DEVICE void setSaltConcentration(const Scalar& newSaltConcentration)
361 { *saltConcentration_ = newSaltConcentration; }
362
366 OPM_HOST_DEVICE void setSaltSaturation(const Scalar& newSaltSaturation)
367 { *saltSaturation_ = newSaltSaturation; }
368
372 OPM_HOST_DEVICE const Scalar& pressure(unsigned phaseIdx) const
373 { return pressure_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())]; }
374
378 OPM_HOST_DEVICE const Scalar& saturation(unsigned phaseIdx) const
379 { return saturation_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())]; }
380
384 OPM_HOST_DEVICE const Scalar& totalSaturation() const
385 {
386 return totalSaturation_;
387 }
388
392 OPM_HOST_DEVICE Scalar temperature(unsigned) const
393 {
394 if constexpr (enableTemperature || enableEnergy) {
395 return *temperature_;
396 } else {
397 return fluidSystem().reservoirTemperature(pvtRegionIdx_);
398 }
399 }
400
407 OPM_HOST_DEVICE const Scalar& invB(unsigned phaseIdx) const
408 { return invB_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())]; }
409
417 OPM_HOST_DEVICE Scalar Rs() const
418 {
419 if constexpr (enableDissolution) {
420 return *Rs_;
421 } else {
422 return Scalar(0.0);
423 }
424 }
425
433 OPM_HOST_DEVICE Scalar Rv() const
434 {
435 if constexpr (!enableDissolution) {
436 return Scalar(0.0);
437 } else {
438 return *Rv_;
439 }
440 }
441
449 OPM_HOST_DEVICE Scalar Rvw() const
450 {
451 if constexpr (enableVapwat) {
452 return *Rvw_;
453 } else {
454 return Scalar(0.0);
455 }
456 }
457
465 OPM_HOST_DEVICE Scalar Rsw() const
466 {
467 if constexpr (enableDissolutionInWater) {
468 return *Rsw_;
469 } else {
470 return Scalar(0.0);
471 }
472 }
473
477 OPM_HOST_DEVICE Scalar saltConcentration() const
478 {
479 if constexpr (enableBrine) {
480 return *saltConcentration_;
481 } else {
482 return Scalar(0.0);
483 }
484 }
485
489 OPM_HOST_DEVICE Scalar saltSaturation() const
490 {
491 if constexpr (enableSaltPrecipitation) {
492 return *saltSaturation_;
493 } else {
494 return Scalar(0.0);
495 }
496 }
497
502 OPM_HOST_DEVICE unsigned short pvtRegionIndex() const
503 { return pvtRegionIdx_; }
504
508 OPM_HOST_DEVICE Scalar density(unsigned phaseIdx) const
509 { return density_[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())]; }
510
517 OPM_HOST_DEVICE const Scalar& enthalpy(unsigned phaseIdx) const
518 { return (*enthalpy_)[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())]; }
519
526 OPM_HOST_DEVICE Scalar internalEnergy(unsigned phaseIdx) const
527 { auto energy = (*enthalpy_)[canonicalToStoragePhaseIndex_(phaseIdx, fluidSystem())];
528 if(!fluidSystem().enthalpyEqualEnergy()){
529 energy -= pressure(phaseIdx)/density(phaseIdx);
530 }
531 return energy;
532 }
533
535 // slow methods
537
541 OPM_HOST_DEVICE Scalar molarDensity(unsigned phaseIdx) const
542 {
543 const auto& rho = density(phaseIdx);
544
545 if (phaseIdx == waterPhaseIdx)
546 return rho/fluidSystem().molarMass(waterCompIdx, pvtRegionIdx_);
547
548 return
549 rho*(moleFraction(phaseIdx, gasCompIdx)/fluidSystem().molarMass(gasCompIdx, pvtRegionIdx_)
550 + moleFraction(phaseIdx, oilCompIdx)/fluidSystem().molarMass(oilCompIdx, pvtRegionIdx_));
551
552 }
553
559 OPM_HOST_DEVICE Scalar molarVolume(unsigned phaseIdx) const
560 { return 1.0/molarDensity(phaseIdx); }
561
565 OPM_HOST_DEVICE Scalar viscosity(unsigned phaseIdx) const
566 { return fluidSystem().viscosity(*this, phaseIdx, pvtRegionIdx_); }
567
571 OPM_HOST_DEVICE Scalar massFraction(unsigned phaseIdx, unsigned compIdx) const
572 {
573 switch (phaseIdx) {
574 case waterPhaseIdx:
575 if (compIdx == waterCompIdx)
576 return 1.0;
577 return 0.0;
578
579 case oilPhaseIdx:
580 if (compIdx == waterCompIdx)
581 return 0.0;
582 else if (compIdx == oilCompIdx)
583 return 1.0 - fluidSystem().convertRsToXoG(Rs(), pvtRegionIdx_);
584 else {
585 assert(compIdx == gasCompIdx);
586 return fluidSystem().convertRsToXoG(Rs(), pvtRegionIdx_);
587 }
588 break;
589
590 case gasPhaseIdx:
591 if (compIdx == waterCompIdx)
592 return 0.0;
593 else if (compIdx == oilCompIdx)
594 return fluidSystem().convertRvToXgO(Rv(), pvtRegionIdx_);
595 else {
596 assert(compIdx == gasCompIdx);
597 return 1.0 - fluidSystem().convertRvToXgO(Rv(), pvtRegionIdx_);
598 }
599 break;
600 }
601
602 OPM_THROW(std::logic_error, "Invalid phase or component index!");
603 }
604
608 OPM_HOST_DEVICE Scalar moleFraction(unsigned phaseIdx, unsigned compIdx) const
609 {
610 switch (phaseIdx) {
611 case waterPhaseIdx:
612 if (compIdx == waterCompIdx)
613 return 1.0;
614 return 0.0;
615
616 case oilPhaseIdx:
617 if (compIdx == waterCompIdx)
618 return 0.0;
619 else if (compIdx == oilCompIdx)
620 return 1.0 - fluidSystem().convertXoGToxoG(fluidSystem().convertRsToXoG(Rs(), pvtRegionIdx_),
621 pvtRegionIdx_);
622 else {
623 assert(compIdx == gasCompIdx);
624 return fluidSystem().convertXoGToxoG(fluidSystem().convertRsToXoG(Rs(), pvtRegionIdx_),
625 pvtRegionIdx_);
626 }
627 break;
628
629 case gasPhaseIdx:
630 if (compIdx == waterCompIdx)
631 return 0.0;
632 else if (compIdx == oilCompIdx)
633 return fluidSystem().convertXgOToxgO(fluidSystem().convertRvToXgO(Rv(), pvtRegionIdx_),
634 pvtRegionIdx_);
635 else {
636 assert(compIdx == gasCompIdx);
637 return 1.0 - fluidSystem().convertXgOToxgO(fluidSystem().convertRvToXgO(Rv(), pvtRegionIdx_),
638 pvtRegionIdx_);
639 }
640 break;
641 }
642
643 OPM_THROW(std::logic_error, "Invalid phase or component index!");
644 }
645
649 OPM_HOST_DEVICE Scalar molarity(unsigned phaseIdx, unsigned compIdx) const
650 { return moleFraction(phaseIdx, compIdx)*molarDensity(phaseIdx); }
651
655 OPM_HOST_DEVICE Scalar averageMolarMass(unsigned phaseIdx) const
656 {
657 Scalar result(0.0);
658 for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx)
659 result += fluidSystem().molarMass(compIdx, pvtRegionIdx_)*moleFraction(phaseIdx, compIdx);
660 return result;
661 }
662
666 OPM_HOST_DEVICE Scalar fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
667 { return fluidSystem().fugacityCoefficient(*this, phaseIdx, compIdx, pvtRegionIdx_); }
668
672 OPM_HOST_DEVICE Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
673 {
674 return
675 fugacityCoefficient(phaseIdx, compIdx)
676 *moleFraction(phaseIdx, compIdx)
677 *pressure(phaseIdx);
678 }
679
687 bool phaseIsActive(int phaseIdx) const
688 {
689 return fluidSystem().phaseIsActive(phaseIdx);
690 }
691
699 OPM_HOST_DEVICE const FluidSystem& fluidSystem() const
700 {
701 if constexpr (fluidSystemIsStatic) {
702 static FluidSystem instance;
703 return instance;
704 } else {
705 return **fluidSystemPtr_;
706 }
707 }
708
709private:
710 OPM_HOST_DEVICE static unsigned storageToCanonicalPhaseIndex_(unsigned storagePhaseIdx, const FluidSystem& fluidSystem)
711 {
712 if constexpr (numStoragePhases == 3)
713 return storagePhaseIdx;
714 else
715 return fluidSystem.activeToCanonicalPhaseIdx(storagePhaseIdx);
716 }
717
718 OPM_HOST_DEVICE static unsigned canonicalToStoragePhaseIndex_(unsigned canonicalPhaseIdx, const FluidSystem& fluidSystem)
719 {
720 if constexpr (numStoragePhases == 3)
721 return canonicalPhaseIdx;
722 else
723 return fluidSystem.canonicalToActivePhaseIdx(canonicalPhaseIdx);
724 }
725
726 ConditionalStorage<enableTemperature || enableEnergy, Scalar> temperature_{};
727 ConditionalStorage<enableEnergy, std::array<Scalar, numStoragePhases> > enthalpy_{};
728 Scalar totalSaturation_{};
729 std::array<Scalar, numStoragePhases> pressure_{};
730 std::array<Scalar, numStoragePhases> saturation_{};
731 std::array<Scalar, numStoragePhases> invB_{};
732 std::array<Scalar, numStoragePhases> density_{};
733 ConditionalStorage<enableDissolution,Scalar> Rs_{};
734 ConditionalStorage<enableDissolution, Scalar> Rv_{};
735 ConditionalStorage<enableVapwat,Scalar> Rvw_{};
736 ConditionalStorage<enableDissolutionInWater,Scalar> Rsw_{};
737 ConditionalStorage<enableBrine, Scalar> saltConcentration_{};
738 ConditionalStorage<enableSaltPrecipitation, Scalar> saltSaturation_{};
739
740 unsigned short pvtRegionIdx_{};
741
742 // If we have a non-static fluid system, we need to store a pointer
743 // to it. Otherwise, we do not need to store anything.
744 ConditionalStorage<!fluidSystemIsStatic, FluidSystem const*> fluidSystemPtr_;
745};
746
747} // namespace Opm
748
749#endif
A simple class which only stores a given member attribute if a boolean condition is true.
This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.
#define OPM_GENERATE_HAS_MEMBER(MEMBER_NAME,...)
This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.
Definition HasMemberGeneratorMacros.hpp:49
Some templates to wrap the valgrind client request macros.
OPM_HOST_DEVICE bool CheckDefined(const T &value)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition Valgrind.hpp:76
OPM_HOST_DEVICE void setRvw(const Scalar &newRvw)
Set the water vaporization factor [m^3/m^3] of the gas phase.
Definition BlackOilFluidState.hpp:346
OPM_HOST_DEVICE void setSaltSaturation(const Scalar &newSaltSaturation)
Set the solid salt saturation.
Definition BlackOilFluidState.hpp:366
OPM_HOST_DEVICE const Scalar & invB(unsigned phaseIdx) const
Return the inverse formation volume factor of a fluid phase [-].
Definition BlackOilFluidState.hpp:407
OPM_HOST_DEVICE void setRs(const Scalar &newRs)
Set the gas dissolution factor [m^3/m^3] of the oil phase.
Definition BlackOilFluidState.hpp:330
OPM_HOST_DEVICE Scalar molarity(unsigned phaseIdx, unsigned compIdx) const
Return the partial molar density of a component in a fluid phase [mol / m^3].
Definition BlackOilFluidState.hpp:649
OPM_HOST_DEVICE BlackOilFluidState()
Construct a fluid state object.
Definition BlackOilFluidState.hpp:162
OPM_HOST_DEVICE void setSaltConcentration(const Scalar &newSaltConcentration)
Set the salt concentration.
Definition BlackOilFluidState.hpp:360
OPM_HOST_DEVICE Scalar fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
Return the fugacity coefficient of a component in a fluid phase [-].
Definition BlackOilFluidState.hpp:666
OPM_HOST_DEVICE Scalar Rv() const
Return the oil vaporization factor of gas [m^3/m^3].
Definition BlackOilFluidState.hpp:433
OPM_HOST_DEVICE Scalar density(unsigned phaseIdx) const
Return the density [kg/m^3] of a given fluid phase.
Definition BlackOilFluidState.hpp:508
OPM_HOST_DEVICE void setInvB(unsigned phaseIdx, const Scalar &b)
\ brief Set the inverse formation volume factor of a fluid phase
Definition BlackOilFluidState.hpp:316
OPM_HOST_DEVICE const Scalar & enthalpy(unsigned phaseIdx) const
Return the specific enthalpy [J/kg] of a given fluid phase.
Definition BlackOilFluidState.hpp:517
OPM_HOST_DEVICE void setSaturation(unsigned phaseIdx, const Scalar &S)
Set the saturation of a fluid phase [-].
Definition BlackOilFluidState.hpp:276
OPM_HOST_DEVICE void setTotalSaturation(const Scalar &value)
Set the total saturation used for sequential methods.
Definition BlackOilFluidState.hpp:282
OPM_HOST_DEVICE Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
Return the fugacity of a component in a fluid phase [Pa].
Definition BlackOilFluidState.hpp:672
OPM_HOST_DEVICE const Scalar & totalSaturation() const
Return the total saturation needed for sequential.
Definition BlackOilFluidState.hpp:384
OPM_HOST_DEVICE Scalar averageMolarMass(unsigned phaseIdx) const
Return the partial molar density of a fluid phase [kg / mol].
Definition BlackOilFluidState.hpp:655
OPM_HOST_DEVICE void setDensity(unsigned phaseIdx, const Scalar &rho)
\ brief Set the density of a fluid phase
Definition BlackOilFluidState.hpp:322
void checkDefined() const
Make sure that all attributes are defined.
Definition BlackOilFluidState.hpp:175
OPM_HOST_DEVICE Scalar Rs() const
Return the gas dissolution factor of oil [m^3/m^3].
Definition BlackOilFluidState.hpp:417
OPM_HOST_DEVICE Scalar temperature(unsigned) const
Return the temperature [K].
Definition BlackOilFluidState.hpp:392
OPM_HOST_DEVICE BlackOilFluidState(const FluidSystem &fluidSystem)
Construct a fluid state object.
Definition BlackOilFluidState.hpp:150
OPM_HOST_DEVICE void setRv(const Scalar &newRv)
Set the oil vaporization factor [m^3/m^3] of the gas phase.
Definition BlackOilFluidState.hpp:338
OPM_HOST_DEVICE Scalar molarDensity(unsigned phaseIdx) const
Return the molar density of a fluid phase [mol/m^3].
Definition BlackOilFluidState.hpp:541
OPM_HOST_DEVICE void setPvtRegionIndex(unsigned newPvtRegionIdx)
Set the index of the fluid region.
Definition BlackOilFluidState.hpp:264
OPM_HOST_DEVICE void setPressure(unsigned phaseIdx, const Scalar &p)
Set the pressure of a fluid phase [-].
Definition BlackOilFluidState.hpp:270
OPM_HOST_DEVICE const Scalar & pressure(unsigned phaseIdx) const
Return the pressure of a fluid phase [Pa].
Definition BlackOilFluidState.hpp:372
OPM_HOST_DEVICE void setRsw(const Scalar &newRsw)
Set the gas dissolution factor [m^3/m^3] of the water phase.
Definition BlackOilFluidState.hpp:354
OPM_HOST_DEVICE void setTemperature(const Scalar &value)
Set the temperature [K].
Definition BlackOilFluidState.hpp:293
OPM_HOST_DEVICE Scalar saltSaturation() const
Return the saturation of solid salt.
Definition BlackOilFluidState.hpp:489
OPM_HOST_DEVICE Scalar internalEnergy(unsigned phaseIdx) const
Return the specific internal energy [J/kg] of a given fluid phase.
Definition BlackOilFluidState.hpp:526
OPM_HOST_DEVICE Scalar Rsw() const
Return the gas dissolution factor of water [m^3/m^3].
Definition BlackOilFluidState.hpp:465
OPM_HOST_DEVICE void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition BlackOilFluidState.hpp:221
OPM_HOST_DEVICE Scalar Rvw() const
Return the water vaporization factor of gas [m^3/m^3].
Definition BlackOilFluidState.hpp:449
OPM_HOST_DEVICE const FluidSystem & fluidSystem() const
Return the fluid system used by this fluid state.
Definition BlackOilFluidState.hpp:699
bool phaseIsActive(int phaseIdx) const
Return if a phase is active (via the FluidSystem).
Definition BlackOilFluidState.hpp:687
OPM_HOST_DEVICE void setEnthalpy(unsigned phaseIdx, const Scalar &value)
Set the specific enthalpy [J/kg] of a given fluid phase.
Definition BlackOilFluidState.hpp:306
OPM_HOST_DEVICE const Scalar & saturation(unsigned phaseIdx) const
Return the saturation of a fluid phase [-].
Definition BlackOilFluidState.hpp:378
OPM_HOST_DEVICE Scalar saltConcentration() const
Return the concentration of salt in water.
Definition BlackOilFluidState.hpp:477
OPM_HOST_DEVICE Scalar molarVolume(unsigned phaseIdx) const
Return the molar volume of a fluid phase [m^3/mol].
Definition BlackOilFluidState.hpp:559
OPM_HOST_DEVICE unsigned short pvtRegionIndex() const
Return the PVT region where the current fluid state is assumed to be part of.
Definition BlackOilFluidState.hpp:502
OPM_HOST_DEVICE Scalar massFraction(unsigned phaseIdx, unsigned compIdx) const
Return the mass fraction of a component in a fluid phase [-].
Definition BlackOilFluidState.hpp:571
OPM_HOST_DEVICE Scalar moleFraction(unsigned phaseIdx, unsigned compIdx) const
Return the mole fraction of a component in a fluid phase [-].
Definition BlackOilFluidState.hpp:608
OPM_HOST_DEVICE Scalar viscosity(unsigned phaseIdx) const
Return the dynamic viscosity of a fluid phase [Pa s].
Definition BlackOilFluidState.hpp:565
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30