28#ifndef OPM_FLUID_STATE_DENSITY_MODULES_HPP
29#define OPM_FLUID_STATE_DENSITY_MODULES_HPP
42template <
class ValueType,
45class FluidStateExplicitDensityModule
48 FluidStateExplicitDensityModule()
54 const ValueType&
density(
unsigned phaseIdx)
const
55 {
return density_[phaseIdx]; }
61 {
return density_[phaseIdx]/asImp_().averageMolarMass(phaseIdx); }
72 void setDensity(
unsigned phaseIdx,
const ValueType& value)
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));
101 const Implementation& asImp_()
const
102 {
return *
static_cast<const Implementation*
>(
this); }
104 std::array<ValueType, numPhases> density_{};
111template <
class ValueT,
113 class Implementation>
114class FluidStateNullDensityModule
117 FluidStateNullDensityModule()
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.
OPM_HOST_DEVICE void SetUndefined(const T &value)
Make the memory on which an object resides undefined in valgrind runs.
Definition Valgrind.hpp:174
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
ValueType molarDensity(unsigned phaseIdx) const
The molar density of a fluid phase [mol/m^3].
Definition FluidStateDensityModules.hpp:60
void setDensity(unsigned phaseIdx, const ValueType &value)
Set the density of a phase [kg/m^3].
Definition FluidStateDensityModules.hpp:72
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStateDensityModules.hpp:80
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
ValueType molarVolume(unsigned phaseIdx) const
The molar volume of a fluid phase [m^3/mol].
Definition FluidStateDensityModules.hpp:66
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
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
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