28 #ifndef OPM_FLUID_STATE_DENSITY_MODULES_HPP
29 #define OPM_FLUID_STATE_DENSITY_MODULES_HPP
42 template <
class Scalar,
49 { Valgrind::SetUndefined(density_); }
54 const Scalar&
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<Scalar>(fs.density(phaseIdx));
97 Valgrind::CheckDefined(density_);
101 const Implementation& asImp_()
const
102 {
return *
static_cast<const Implementation*
>(
this); }
104 Scalar density_[numPhases];
111 template <
class Scalar,
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>
Some templates to wrap the valgrind client request macros.
Module for the modular fluid state which stores the densities explicitly.
Definition: FluidStateDensityModules.hpp:46
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateDensityModules.hpp:95
Scalar molarDensity(unsigned phaseIdx) const
The molar density of a fluid phase [mol/m^3].
Definition: FluidStateDensityModules.hpp:60
Scalar molarVolume(unsigned phaseIdx) const
The molar volume of a fluid phase [m^3/mol].
Definition: FluidStateDensityModules.hpp:66
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateDensityModules.hpp:80
const Scalar & density(unsigned phaseIdx) const
The density of a fluid phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:54
void setDensity(unsigned phaseIdx, const Scalar &value)
Set the density of a phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:72
Module for the modular fluid state which does not the densities but throws std::logic_error instead.
Definition: FluidStateDensityModules.hpp:115
const Scalar & molarDensity(unsigned) const
The molar density of a fluid phase [mol/m^3].
Definition: FluidStateDensityModules.hpp:129
const Scalar & molarVolume(unsigned) const
The molar volume of a fluid phase [m^3/mol].
Definition: FluidStateDensityModules.hpp:135
void assign(const FluidState &)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateDensityModules.hpp:143
const Scalar & density(unsigned) const
The density of a fluid phase [kg/m^3].
Definition: FluidStateDensityModules.hpp:123
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateDensityModules.hpp:154