28 #ifndef OPM_FLUID_STATE_DENSITY_MODULES_HPP 29 #define OPM_FLUID_STATE_DENSITY_MODULES_HPP 42 template <
class ValueType,
49 { Valgrind::SetUndefined(density_); }
54 const ValueType&
density(
unsigned phaseIdx)
const 55 {
return density_[phaseIdx]; }
61 {
return density_[phaseIdx]/asImp_().averageMolarMass(phaseIdx); }
73 { density_[phaseIdx] =
value; }
79 template <
class Flu
idState>
82 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
83 density_[phaseIdx] = decay<ValueType>(fs.density(phaseIdx));
97 Valgrind::CheckDefined(density_);
101 const Implementation& asImp_()
const 102 {
return *
static_cast<const Implementation*
>(
this); }
104 std::array<ValueType, numPhases> density_{};
111 template <
class ValueT,
113 class Implementation>
124 {
throw std::logic_error(
"Density is not provided by this fluid state"); }
130 {
throw std::logic_error(
"Molar density is not provided by this fluid state"); }
136 {
throw std::logic_error(
"Molar volume is not provided by this fluid state"); }
142 template <
class Flu
idState>
const ValueType & density(unsigned phaseIdx) const
The density of a fluid phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:54
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateDensityModules.hpp:95
const ValueT & molarVolume(unsigned) const
The molar volume of a fluid phase [m^3/mol].
Definition: FluidStateDensityModules.hpp:135
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
void assign(const FluidState &)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateDensityModules.hpp:143
const ValueT & molarDensity(unsigned) const
The molar density of a fluid phase [mol/m^3].
Definition: FluidStateDensityModules.hpp:129
ValueType molarVolume(unsigned phaseIdx) const
The molar volume of a fluid phase [m^3/mol].
Definition: FluidStateDensityModules.hpp:66
void setDensity(unsigned phaseIdx, const ValueType &value)
Set the density of a phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:72
Module for the modular fluid state which stores the densities explicitly.
Definition: FluidStateDensityModules.hpp:45
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateDensityModules.hpp:154
const ValueT & density(unsigned) const
The density of a fluid phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:123
Some templates to wrap the valgrind client request macros.
Module for the modular fluid state which does not the densities but throws std::logic_error instead...
Definition: FluidStateDensityModules.hpp:114
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateDensityModules.hpp:80
ValueType molarDensity(unsigned phaseIdx) const
The molar density of a fluid phase [mol/m^3].
Definition: FluidStateDensityModules.hpp:60