VFPProperties.hpp
Go to the documentation of this file.
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
27
28#include <cstddef>
29#include <map>
30
31namespace Opm {
32
33class VFPInjTable;
34class VFPProdTable;
35
41public:
49 VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
50 const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
51 const WellState<double>& well_state)
52 :well_state_(well_state)
53 {
54 for (const auto& vfpinj : inj_tables)
55 this->m_inj.addTable( vfpinj );
56
57 for (const auto& vfpprod : prod_tables)
58 this->m_prod.addTable( vfpprod );
59 };
60
64 const VFPInjProperties* getInj() const {
65 return &m_inj;
66 }
67
71 const VFPProdProperties* getProd() const {
72 return &m_prod;
73 }
74
75 double getExplicitWFR(const int table_id, const std::size_t well_index) const {
76 const auto& rates = well_state_.well(well_index).prev_surface_rates;
77 const auto& pu = well_state_.phaseUsage();
78 const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
79 const auto& liquid = pu.phase_used[BlackoilPhases::Liquid]? rates[pu.phase_pos[BlackoilPhases::Liquid]]:0.0;
80 const auto& vapour = pu.phase_used[BlackoilPhases::Vapour]? rates[pu.phase_pos[BlackoilPhases::Vapour]]:0.0;
81 const VFPProdTable& table = this->m_prod.getTable(table_id);
82 return detail::getWFR(table, aqua, liquid, vapour);
83 }
84
85 double getExplicitGFR(const int table_id, const std::size_t well_index) const {
86 const auto& rates = well_state_.well(well_index).prev_surface_rates;
87 const auto& pu = well_state_.phaseUsage();
88 const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
89 const auto& liquid = pu.phase_used[BlackoilPhases::Liquid]? rates[pu.phase_pos[BlackoilPhases::Liquid]]:0.0;
90 const auto& vapour = pu.phase_used[BlackoilPhases::Vapour]? rates[pu.phase_pos[BlackoilPhases::Vapour]]:0.0;
91 const VFPProdTable& table = this->m_prod.getTable(table_id);
92 return detail::getGFR(table, aqua, liquid, vapour);
93 }
94
95private:
96 VFPInjProperties m_inj;
97 VFPProdProperties m_prod;
98 const WellState<double>& well_state_;
99
100};
101
102
103} //Namespace
104
105#endif /* OPM_AUTODIFF_VFPPROPERTIES_HPP_ */
@ Liquid
Definition: BlackoilPhases.hpp:42
@ Aqua
Definition: BlackoilPhases.hpp:42
@ Vapour
Definition: BlackoilPhases.hpp:42
std::vector< Scalar > prev_surface_rates
Definition: SingleWellState.hpp:108
Definition: VFPInjProperties.hpp:33
void addTable(const VFPInjTable &new_table)
Definition: VFPProdProperties.hpp:37
const VFPProdTable & getTable(const int table_id) const
void addTable(const VFPProdTable &new_table)
Definition: VFPProperties.hpp:40
double getExplicitWFR(const int table_id, const std::size_t well_index) const
Definition: VFPProperties.hpp:75
const VFPProdProperties * getProd() const
Definition: VFPProperties.hpp:71
double getExplicitGFR(const int table_id, const std::size_t well_index) const
Definition: VFPProperties.hpp:85
const VFPInjProperties * getInj() const
Definition: VFPProperties.hpp:64
VFPProperties(const std::vector< std::reference_wrapper< const VFPInjTable > > &inj_tables, const std::vector< std::reference_wrapper< const VFPProdTable > > &prod_tables, const WellState< double > &well_state)
Definition: VFPProperties.hpp:49
const SingleWellState< Scalar > & well(std::size_t well_index) const
Definition: WellState.hpp:300
const PhaseUsage & phaseUsage() const
Definition: WellState.hpp:259
T getWFR(const VFPProdTable &table, const T &aqua, const T &liquid, const T &vapour)
T getGFR(const VFPProdTable &table, const T &aqua, const T &liquid, const T &vapour)
Definition: BlackoilPhases.hpp:27
std::array< int, MaxNumPhases+NumCryptoPhases > phase_used
Definition: BlackoilPhases.hpp:51