My Project
VFPProperties.hpp
1 /*
2  Copyright 2015 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_AUTODIFF_VFPPROPERTIES_HPP_
21 #define OPM_AUTODIFF_VFPPROPERTIES_HPP_
22 
23 #include <opm/simulators/wells/VFPInjProperties.hpp>
24 #include <opm/simulators/wells/VFPProdProperties.hpp>
25 #include <opm/simulators/wells/WellState.hpp>
26 #include <opm/simulators/wells/VFPHelpers.hpp>
27 
28 #include <map>
29 
30 namespace Opm {
31 
32 class VFPInjTable;
33 class VFPProdTable;
34 
40 public:
48  VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
49  const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
50  const WellState& well_state)
51  :well_state_(well_state)
52  {
53  for (const auto& vfpinj : inj_tables)
54  this->m_inj.addTable( vfpinj );
55 
56  for (const auto& vfpprod : prod_tables)
57  this->m_prod.addTable( vfpprod );
58  };
59 
63  const VFPInjProperties* getInj() const {
64  return &m_inj;
65  }
66 
70  const VFPProdProperties* getProd() const {
71  return &m_prod;
72  }
73 
74  double getExplicitWFR(const int table_id, const size_t well_index) const {
75  const auto& rates = well_state_.well(well_index).surface_rates;
76  const auto& pu = well_state_.phaseUsage();
77  const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
78  const auto& liquid = pu.phase_used[BlackoilPhases::Liquid]? rates[pu.phase_pos[BlackoilPhases::Liquid]]:0.0;
79  const auto& vapour = pu.phase_used[BlackoilPhases::Vapour]? rates[pu.phase_pos[BlackoilPhases::Vapour]]:0.0;
80  const VFPProdTable& table = this->m_prod.getTable(table_id);
81  return detail::getWFR(table, aqua, liquid, vapour);
82  }
83 
84  double getExplicitGFR(const int table_id, const size_t well_index) const {
85  const auto& rates = well_state_.well(well_index).surface_rates;
86  const auto& pu = well_state_.phaseUsage();
87  const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
88  const auto& liquid = pu.phase_used[BlackoilPhases::Liquid]? rates[pu.phase_pos[BlackoilPhases::Liquid]]:0.0;
89  const auto& vapour = pu.phase_used[BlackoilPhases::Vapour]? rates[pu.phase_pos[BlackoilPhases::Vapour]]:0.0;
90  const VFPProdTable& table = this->m_prod.getTable(table_id);
91  return detail::getGFR(table, aqua, liquid, vapour);
92  }
93 
94 private:
95  VFPInjProperties m_inj;
96  VFPProdProperties m_prod;
97  const WellState& well_state_;
98 
99 };
100 
101 
102 } //Namespace
103 
104 #endif /* OPM_AUTODIFF_VFPPROPERTIES_HPP_ */
Definition: VFPInjProperties.hpp:33
void addTable(const VFPInjTable &new_table)
Takes no ownership of data.
Definition: VFPInjProperties.cpp:89
Class which linearly interpolates BHP as a function of rate, tubing head pressure,...
Definition: VFPProdProperties.hpp:37
const VFPProdTable & getTable(const int table_id) const
Returns the table associated with the ID, or throws an exception if the table does not exist.
Definition: VFPProdProperties.cpp:101
void addTable(const VFPProdTable &new_table)
Takes no ownership of data.
Definition: VFPProdProperties.cpp:141
A thin wrapper class that holds one VFPProdProperties and one VFPInjProperties object.
Definition: VFPProperties.hpp:39
const VFPInjProperties * getInj() const
Returns the VFP properties for injection wells.
Definition: VFPProperties.hpp:63
VFPProperties(const std::vector< std::reference_wrapper< const VFPInjTable >> &inj_tables, const std::vector< std::reference_wrapper< const VFPProdTable >> &prod_tables, const WellState &well_state)
Constructor Takes no ownership of data.
Definition: VFPProperties.hpp:48
const VFPProdProperties * getProd() const
Returns the VFP properties for production wells.
Definition: VFPProperties.hpp:70
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:56
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27