TemperatureOverlayFluidState.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  Copyright (C) 2011-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_TEMPERATURE_OVERLAY_FLUID_STATE_HPP
26 #define OPM_TEMPERATURE_OVERLAY_FLUID_STATE_HPP
27 
29 
30 namespace Opm {
31 
37 template <class FluidState>
39 {
40 public:
41  typedef typename FluidState::Scalar Scalar;
42 
43  enum { numPhases = FluidState::numPhases };
44  enum { numComponents = FluidState::numComponents };
45 
54  TemperatureOverlayFluidState(const FluidState &fs)
55  : fs_(&fs)
56  {
57  temperature_ = fs.temperature(/*phaseIdx=*/0);
58  }
59 
60  TemperatureOverlayFluidState(Scalar T, const FluidState &fs)
61  : temperature_(T), fs_(&fs)
62  { }
63 
64  // copy constructor
66  : fs_(fs.fs_)
68  {}
69 
70  // assignment operator
72  {
73  fs_ = fs.fs_;
75  return *this;
76  }
77 
78  /*****************************************************
79  * Generic access to fluid properties (No assumptions
80  * on thermodynamic equilibrium required)
81  *****************************************************/
85  Scalar saturation(unsigned phaseIdx) const
86  { return fs_->saturation(phaseIdx); }
87 
91  Scalar moleFraction(unsigned phaseIdx, unsigned compIdx) const
92  { return fs_->moleFraction(phaseIdx, compIdx); }
93 
97  Scalar massFraction(unsigned phaseIdx, unsigned compIdx) const
98  { return fs_->massFraction(phaseIdx, compIdx); }
99 
108  Scalar averageMolarMass(unsigned phaseIdx) const
109  { return fs_->averageMolarMass(phaseIdx); }
110 
120  Scalar molarity(unsigned phaseIdx, unsigned compIdx) const
121  { return fs_->molarity(phaseIdx, compIdx); }
122 
126  Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
127  { return fs_->fugacity(phaseIdx, compIdx); }
128 
132  Scalar fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
133  { return fs_->fugacityCoefficient(phaseIdx, compIdx); }
134 
138  Scalar molarVolume(unsigned phaseIdx) const
139  { return fs_->molarVolume(phaseIdx); }
140 
144  Scalar density(unsigned phaseIdx) const
145  { return fs_->density(phaseIdx); }
146 
150  Scalar molarDensity(unsigned phaseIdx) const
151  { return fs_->molarDensity(phaseIdx); }
152 
156  Scalar temperature(int /*phaseIdx*/) const
157  { return temperature_; }
158 
162  Scalar pressure(unsigned phaseIdx) const
163  { return fs_->pressure(phaseIdx); }
164 
168  Scalar enthalpy(unsigned phaseIdx) const
169  { return fs_->enthalpy(phaseIdx); }
170 
174  Scalar internalEnergy(unsigned phaseIdx) const
175  { return fs_->internalEnergy(phaseIdx); }
176 
180  Scalar viscosity(unsigned phaseIdx) const
181  { return fs_->viscosity(phaseIdx); }
182 
183 
184  /*****************************************************
185  * Setter methods. Note that these are not part of the
186  * generic FluidState interface but specific for each
187  * implementation...
188  *****************************************************/
192  void setTemperature(Scalar value)
193  { temperature_ = value; }
194 
203  void checkDefined() const
204  {
206  }
207 
208 protected:
209  const FluidState *fs_;
210  Scalar temperature_;
211 };
212 
213 } // namespace Opm
214 
215 #endif
Scalar enthalpy(unsigned phaseIdx) const
The specific enthalpy of a fluid phase [J/kg].
Definition: TemperatureOverlayFluidState.hpp:168
bool CheckDefined(const T &value OPM_UNUSED)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition: Valgrind.hpp:74
Scalar pressure(unsigned phaseIdx) const
The pressure of a fluid phase [Pa].
Definition: TemperatureOverlayFluidState.hpp:162
Definition: TemperatureOverlayFluidState.hpp:44
Definition: Air_Mesitylene.hpp:31
This is a fluid state which allows to set the fluid temperatures and takes all other quantities from ...
Definition: TemperatureOverlayFluidState.hpp:38
Scalar moleFraction(unsigned phaseIdx, unsigned compIdx) const
The mole fraction of a component in a phase [].
Definition: TemperatureOverlayFluidState.hpp:91
TemperatureOverlayFluidState & operator=(const TemperatureOverlayFluidState &fs)
Definition: TemperatureOverlayFluidState.hpp:71
Some templates to wrap the valgrind client request macros.
void setTemperature(Scalar value)
Set the temperature [K] of a fluid phase.
Definition: TemperatureOverlayFluidState.hpp:192
TemperatureOverlayFluidState(const TemperatureOverlayFluidState &fs)
Definition: TemperatureOverlayFluidState.hpp:65
Scalar massFraction(unsigned phaseIdx, unsigned compIdx) const
The mass fraction of a component in a phase [].
Definition: TemperatureOverlayFluidState.hpp:97
Scalar molarVolume(unsigned phaseIdx) const
The molar volume of a fluid phase [m^3/mol].
Definition: TemperatureOverlayFluidState.hpp:138
Scalar internalEnergy(unsigned phaseIdx) const
The specific internal energy of a fluid phase [J/kg].
Definition: TemperatureOverlayFluidState.hpp:174
TemperatureOverlayFluidState(Scalar T, const FluidState &fs)
Definition: TemperatureOverlayFluidState.hpp:60
Scalar viscosity(unsigned phaseIdx) const
The dynamic viscosity of a fluid phase [Pa s].
Definition: TemperatureOverlayFluidState.hpp:180
Scalar temperature_
Definition: TemperatureOverlayFluidState.hpp:210
Scalar averageMolarMass(unsigned phaseIdx) const
The average molar mass of a fluid phase [kg/mol].
Definition: TemperatureOverlayFluidState.hpp:108
Definition: TemperatureOverlayFluidState.hpp:43
Scalar fugacity(unsigned phaseIdx, unsigned compIdx) const
The fugacity of a component in a phase [Pa].
Definition: TemperatureOverlayFluidState.hpp:126
Scalar density(unsigned phaseIdx) const
The mass density of a fluid phase [kg/m^3].
Definition: TemperatureOverlayFluidState.hpp:144
Scalar molarDensity(unsigned phaseIdx) const
The molar density of a fluid phase [mol/m^3].
Definition: TemperatureOverlayFluidState.hpp:150
Scalar saturation(unsigned phaseIdx) const
Returns the saturation of a phase [].
Definition: TemperatureOverlayFluidState.hpp:85
void checkDefined() const
Make sure that all attributes are defined.
Definition: TemperatureOverlayFluidState.hpp:203
const FluidState * fs_
Definition: TemperatureOverlayFluidState.hpp:209
TemperatureOverlayFluidState(const FluidState &fs)
Constructor.
Definition: TemperatureOverlayFluidState.hpp:54
FluidState::Scalar Scalar
Definition: TemperatureOverlayFluidState.hpp:41
Scalar molarity(unsigned phaseIdx, unsigned compIdx) const
The molar concentration of a component in a phase [mol/m^3].
Definition: TemperatureOverlayFluidState.hpp:120
Scalar fugacityCoefficient(unsigned phaseIdx, unsigned compIdx) const
The fugacity coefficient of a component in a phase [].
Definition: TemperatureOverlayFluidState.hpp:132
Scalar temperature(int) const
The temperature of a fluid phase [K].
Definition: TemperatureOverlayFluidState.hpp:156