PolymerState.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2012 SINTEF ICT, Applied Mathematics.
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_POLYMERSTATE_HEADER_INCLUDED
21 #define OPM_POLYMERSTATE_HEADER_INCLUDED
22 
23 
24 #include <opm/core/simulator/TwophaseState.hpp>
25 #include <opm/core/grid.h>
26 #include <vector>
27 
28 namespace Opm
29 {
30 
33  {
34  public:
35  void init(const UnstructuredGrid& g, int num_phases)
36  {
37  this->init(g.number_of_cells, g.number_of_faces, num_phases);
38  }
39 
40  void init(int number_of_cells, int number_of_faces, int num_phases)
41  {
42  state2p_.init(number_of_cells, number_of_faces, num_phases);
43  concentration_.resize(number_of_cells, 0.0);
44  cmax_.resize(number_of_cells, 0.0);
45  }
46 
47  enum ExtremalSat { MinSat = TwophaseState::MinSat, MaxSat = TwophaseState::MaxSat };
48 
49  void setFirstSat(const std::vector<int>& cells,
50  const Opm::IncompPropertiesInterface& props,
51  ExtremalSat es)
52  {
53  // A better solution for embedding TwophaseState::ExtremalSat could perhaps
54  // be found, to avoid the cast.
55  state2p_.setFirstSat(cells, props, static_cast<TwophaseState::ExtremalSat>(es));
56  }
57 
58  inline int numPhases() const
59  {
60  return state2p_.numPhases();
61  }
62  std::vector<double>& pressure () { return state2p_.pressure(); }
63  std::vector<double>& facepressure() { return state2p_.facepressure(); }
64  std::vector<double>& faceflux () { return state2p_.faceflux(); }
65  std::vector<double>& saturation () { return state2p_.saturation(); }
66  std::vector<double>& concentration() { return concentration_; }
67  std::vector<double>& maxconcentration() { return cmax_; }
68 
69  const std::vector<double>& pressure () const { return state2p_.pressure(); }
70  const std::vector<double>& facepressure() const { return state2p_.facepressure(); }
71  const std::vector<double>& faceflux () const { return state2p_.faceflux(); }
72  const std::vector<double>& saturation () const { return state2p_.saturation(); }
73  const std::vector<double>& concentration() const { return concentration_; }
74  const std::vector<double>& maxconcentration() const { return cmax_; }
75 
76  TwophaseState& twophaseState() { return state2p_; }
77  const TwophaseState& twophaseState() const { return state2p_; }
78 
79  private:
80  TwophaseState state2p_;
81  std::vector<double> concentration_;
82  std::vector<double> cmax_;
83  };
84 
85 } // namespace Opm
86 
87 
88 
89 
90 #endif // OPM_POLYMERSTATE_HEADER_INCLUDED
ExtremalSat
Definition: PolymerState.hpp:47
Definition: CompressibleTpfaPolymer.hpp:32
std::vector< double > & saturation()
Definition: PolymerState.hpp:65
Simulator state for a two-phase simulator with polymer.
Definition: PolymerState.hpp:32
std::vector< double > & pressure()
Definition: PolymerState.hpp:62
std::vector< double > & maxconcentration()
Definition: PolymerState.hpp:67
const std::vector< double > & facepressure() const
Definition: PolymerState.hpp:70
TwophaseState & twophaseState()
Definition: PolymerState.hpp:76
std::vector< double > & facepressure()
Definition: PolymerState.hpp:63
const std::vector< double > & maxconcentration() const
Definition: PolymerState.hpp:74
const std::vector< double > & faceflux() const
Definition: PolymerState.hpp:71
const std::vector< double > & saturation() const
Definition: PolymerState.hpp:72
const std::vector< double > & pressure() const
Definition: PolymerState.hpp:69
void setFirstSat(const std::vector< int > &cells, const Opm::IncompPropertiesInterface &props, ExtremalSat es)
Definition: PolymerState.hpp:49
void init(int number_of_cells, int number_of_faces, int num_phases)
Definition: PolymerState.hpp:40
std::vector< double > & concentration()
Definition: PolymerState.hpp:66
int numPhases() const
Definition: PolymerState.hpp:58
std::vector< double > & faceflux()
Definition: PolymerState.hpp:64
void init(const UnstructuredGrid &g, int num_phases)
Definition: PolymerState.hpp:35
Definition: PolymerState.hpp:47
Definition: PolymerState.hpp:47
const TwophaseState & twophaseState() const
Definition: PolymerState.hpp:77
const std::vector< double > & concentration() const
Definition: PolymerState.hpp:73