BlackoilStateToFluidState.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2015 Andreas Lauser
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_BLACKOIL_STATE_TO_FLUID_STATE_HEADER_INCLUDED
21 #define OPM_BLACKOIL_STATE_TO_FLUID_STATE_HEADER_INCLUDED
22 
24 
25 namespace Opm
26 {
27 
39 {
40 public:
41  typedef double Scalar;
42 
43  enum { numPhases = 3 };
44  enum { numComponents = 3 };
45 
53  : blackoilState_(blackoilState)
54  {
55  if (blackoilState_.numPhases() != numPhases) {
56  OPM_THROW(std::runtime_error,
57  "Only " << numPhases << " are supported, but the deck specifies " << blackoilState_.numPhases());
58  }
59  }
60 
67  void setCurrentCellIndex(unsigned cellIdx)
68  { cellIdx_ = cellIdx; }
69 
73  Scalar saturation(int phaseIdx) const
74  { return blackoilState_.saturation()[numPhases*cellIdx_ + phaseIdx]; }
75 
79  Scalar temperature(int phaseIdx) const
80  { return blackoilState_.temperature()[cellIdx_]; }
81 
82  // TODO (?) pressure, composition, etc
83 
84 private:
85  size_t numCells() const
86  { return blackoilState_.pressure().size(); }
87 
88  const BlackoilState& blackoilState_;
89  unsigned cellIdx_;
90 }
91 
92 } // namespace Opm
93 
94 #endif // OPM_SIMULATORTIMER_HEADER_INCLUDED
Definition: BlackoilStateToFluidState.hpp:44
Definition: AnisotropicEikonal.hpp:43
Definition: BlackoilStateToFluidState.hpp:43
Scalar saturation(int phaseIdx) const
Returns the saturation of a phase for the current cell index.
Definition: BlackoilStateToFluidState.hpp:73
std::vector< double > & saturation()
Definition: SimulatorState.hpp:60
BlackoilStateToFluidState(const BlackoilState &blackoilState)
Create a BlackoilState to Fluid state wrapper object.
Definition: BlackoilStateToFluidState.hpp:52
This is an light weight "impedance adaption" class with a well defined API for saturation and PVT fun...
Definition: BlackoilStateToFluidState.hpp:38
int numPhases() const
Definition: SimulatorState.hpp:52
double Scalar
Definition: BlackoilStateToFluidState.hpp:41
Simulator state for a blackoil simulator.
Definition: BlackoilState.hpp:33
std::vector< double > & temperature()
Definition: SimulatorState.hpp:57
Scalar temperature(int phaseIdx) const
Returns the temperature [K] of a phase for the current cell index.
Definition: BlackoilStateToFluidState.hpp:79
void setCurrentCellIndex(unsigned cellIdx)
Sets the index of the currently used cell.
Definition: BlackoilStateToFluidState.hpp:67
std::vector< double > & pressure()
Definition: SimulatorState.hpp:56