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
30namespace Opm {
31
32class VFPInjTable;
33class VFPProdTable;
34
39template<typename Scalar, typename IndexTraits>
41public:
50 VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
51 const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
52 const WellState<Scalar, IndexTraits>& well_state)
53 : well_state_(well_state)
54 {
55 for (const auto& vfpinj : inj_tables)
56 this->m_inj.addTable( vfpinj );
57
58 for (const auto& vfpprod : prod_tables)
59 this->m_prod.addTable( vfpprod );
60 };
61
66 {
67 return &m_inj;
68 }
69
74 {
75 return &m_prod;
76 }
77
78 Scalar getExplicitWFR(const int table_id, const std::size_t well_index) const
79 {
80 const auto& pu = well_state_.phaseUsageInfo();
81 const bool has_water = pu.phaseIsActive(IndexTraits::waterPhaseIdx);
82 const bool has_oil = pu.phaseIsActive(IndexTraits::oilPhaseIdx);
83 const bool has_gas = pu.phaseIsActive(IndexTraits::gasPhaseIdx);
84 const auto& rates = well_state_.well(well_index).prev_surface_rates;
85 const auto& aqua = has_water ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::waterPhaseIdx)] : 0.0;
86 const auto& liquid = has_oil ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::oilPhaseIdx)] : 0.0;
87 const auto& vapour = has_gas ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::gasPhaseIdx)] : 0.0;
88 const VFPProdTable& table = this->m_prod.getTable(table_id);
89 return detail::getWFR(table, aqua, liquid, vapour);
90 }
91
92 Scalar getExplicitGFR(const int table_id, const std::size_t well_index) const
93 {
94 const auto& pu = well_state_.phaseUsageInfo();
95 const auto& rates = well_state_.well(well_index).prev_surface_rates;
96 const bool has_water = pu.phaseIsActive(IndexTraits::waterPhaseIdx);
97 const bool has_oil = pu.phaseIsActive(IndexTraits::oilPhaseIdx);
98 const bool has_gas = pu.phaseIsActive(IndexTraits::gasPhaseIdx);
99 const auto& aqua = has_water ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::waterPhaseIdx)] : 0.0;
100 const auto& liquid = has_oil ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::oilPhaseIdx)] : 0.0;
101 const auto& vapour = has_gas ? rates[pu.canonicalToActivePhaseIdx(IndexTraits::gasPhaseIdx)] : 0.0;
102 const VFPProdTable& table = this->m_prod.getTable(table_id);
103 return detail::getGFR(table, aqua, liquid, vapour);
104 }
105
106private:
109 const WellState<Scalar, IndexTraits>& well_state_;
110};
111
112} // namespace Opm
113
114#endif /* OPM_AUTODIFF_VFPPROPERTIES_HPP_ */
Definition: VFPInjProperties.hpp:34
Definition: VFPProdProperties.hpp:38
Definition: VFPProperties.hpp:40
Scalar getExplicitGFR(const int table_id, const std::size_t well_index) const
Definition: VFPProperties.hpp:92
const VFPInjProperties< Scalar > * getInj() const
Definition: VFPProperties.hpp:65
Scalar getExplicitWFR(const int table_id, const std::size_t well_index) const
Definition: VFPProperties.hpp:78
VFPProperties(const std::vector< std::reference_wrapper< const VFPInjTable > > &inj_tables, const std::vector< std::reference_wrapper< const VFPProdTable > > &prod_tables, const WellState< Scalar, IndexTraits > &well_state)
Definition: VFPProperties.hpp:50
const VFPProdProperties< Scalar > * getProd() const
Definition: VFPProperties.hpp:73
Definition: WellState.hpp:66
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: blackoilboundaryratevector.hh:39