28#ifndef OPM_FLUID_STATE_FUGACITY_MODULES_HPP
29#define OPM_FLUID_STATE_FUGACITY_MODULES_HPP
43template <
class Scalar,
45 unsigned numComponents,
52 Valgrind::SetUndefined(fugacityCoefficient_);
59 {
return fugacityCoefficient_[phaseIdx][compIdx]; }
64 Scalar
fugacity(
unsigned phaseIdx,
unsigned compIdx)
const
65 {
return asImp_().pressure(phaseIdx)*fugacityCoefficient_[phaseIdx][compIdx]*asImp_().moleFraction(phaseIdx, compIdx); }
71 { fugacityCoefficient_[phaseIdx][compIdx] = value; }
77 template <
class Flu
idState>
80 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
81 for (
unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
82 fugacityCoefficient_[phaseIdx][compIdx] = fs.fugacityCoefficient(phaseIdx, compIdx);
97 Valgrind::CheckDefined(fugacityCoefficient_);
101 const Implementation& asImp_()
const
102 {
return *
static_cast<const Implementation*
>(
this); }
104 Scalar fugacityCoefficient_[numPhases][numComponents];
111template <
class Scalar,
113 unsigned numComponents,
114 class Implementation>
117 static_assert(numPhases == numComponents,
118 "The number of phases must be the same as the number of (pseudo-) components if you assume immiscibility");
122 { Valgrind::SetUndefined(fugacityCoefficient_); }
128 {
return (phaseIdx == compIdx)?fugacityCoefficient_[phaseIdx]:std::numeric_limits<Scalar>::infinity(); }
133 Scalar
fugacity(
unsigned phaseIdx,
unsigned compIdx)
const
134 {
return asImp_().pressure(phaseIdx)*
fugacityCoefficient(phaseIdx, compIdx)*asImp_().moleFraction(phaseIdx, compIdx); }
140 { fugacityCoefficient_[phaseIdx] = value; }
146 template <
class Flu
idState>
149 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
150 fugacityCoefficient_[phaseIdx] = fs.fugacityCoefficient(phaseIdx, phaseIdx);
164 Valgrind::CheckDefined(fugacityCoefficient_);
168 const Implementation& asImp_()
const
169 {
return *
static_cast<const Implementation*
>(
this); }
171 Scalar fugacityCoefficient_[numPhases];
178template <
class Scalar>
189 {
throw std::logic_error(
"Fugacity coefficients are not provided by this fluid state"); }
195 {
throw std::logic_error(
"Fugacities coefficients are not provided by this fluid state"); }
Some templates to wrap the valgrind client request macros.
Module for the modular fluid state which stores the phase fugacity coefficients explicitly.
Definition FluidStateFugacityModules.hpp:48
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStateFugacityModules.hpp:78
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStateFugacityModules.hpp:95
void setFugacityCoefficient(unsigned phaseIdx, unsigned compIdx, const Scalar &value)
Set the fugacity of a component in a phase [].
Definition FluidStateFugacityModules.hpp:70
Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
The fugacity of a component in a phase [Pa].
Definition FluidStateFugacityModules.hpp:64
const Scalar & fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
The fugacity coefficient of a component in a phase [].
Definition FluidStateFugacityModules.hpp:58
Module for the modular fluid state which stores the phase fugacity coefficients explicitly assuming i...
Definition FluidStateFugacityModules.hpp:116
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStateFugacityModules.hpp:147
Scalar fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
The fugacity coefficient of a component in a phase [].
Definition FluidStateFugacityModules.hpp:127
void setFugacityCoefficient(unsigned phaseIdx, const Scalar &value)
Set the fugacity of a component in a phase [].
Definition FluidStateFugacityModules.hpp:139
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStateFugacityModules.hpp:162
Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
The fugacity of a component in a phase [Pa].
Definition FluidStateFugacityModules.hpp:133
Module for the modular fluid state which does not store the fugacities but throws std::logic_error in...
Definition FluidStateFugacityModules.hpp:180
const Scalar & fugacity(unsigned, unsigned) const
The fugacity of a component in a phase [Pa].
Definition FluidStateFugacityModules.hpp:194
const Scalar & fugacityCoefficient(unsigned, unsigned) const
The fugacity coefficient of a component in a phase [].
Definition FluidStateFugacityModules.hpp:188
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStateFugacityModules.hpp:205
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30