opm-simulators
SingleCompWellState.hpp
1 /*
2  Copyright 2024, SINTEF Digital
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_SINGLE_COMP_WELL_STATE_HPP
21 #define OPM_SINGLE_COMP_WELL_STATE_HPP
22 
23 #include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
24 #include <opm/simulators/wells/PerforationData.hpp>
25 
26 #include <string>
27 #include <vector>
28 
29 
30 namespace Opm {
31 
32 template <typename Scalar>
34 {
35 public:
36  CompConnectionData() = default;
37  CompConnectionData(std::size_t num_connection,
38  std::size_t num_phases,
39  std::size_t num_components);
40 
41  CompConnectionData(const std::vector<PerforationData<Scalar>>& connections,
42  const std::size_t num_phases,
43  const CompositionalConfig& comp_config);
44 
45  std::vector<Scalar> pressure {};
46  std::vector<Scalar> surface_phase_rates {}; // surface phase rates
47  std::vector<Scalar> reservoir_phase_rates {}; // phase rates
48  std::vector<Scalar> total_molar_fractions {};
49 
50  // connection_transmissibility_factor
51  std::vector<Scalar> transmissibility_factor {};
52  std::vector<int> satnum_id {};
53  std::vector<std::size_t> ecl_index {};
54 };
55 
56 template <typename FluidSystem>
58 {
59 public:
60  using Scalar = typename FluidSystem::Scalar;
61 
62  SingleCompWellState(const std::string& name,
63  const CompositionalConfig& comp_config,
64  const Scalar temperature,
65  const std::vector<PerforationData<Scalar>>& connections,
66  bool is_producer);
67 
68  std::string name;
69  bool producer;
70 
71  WellStatus status{WellStatus::OPEN};
72  Scalar bhp{0};
73  Scalar temperature{0};
74 
75  std::vector<Scalar> surface_phase_rates;
76  std::vector<Scalar> phase_fractions; // V or L
77  std::vector<Scalar> reservoir_phase_rates;
78  // WZMF
79  std::vector<Scalar> total_molar_fractions;
80  // WXMF WYMF and WAMF
81  std::vector<std::vector<Scalar> > phase_molar_fractions;
82 
83  CompConnectionData<Scalar> connection_data;
84 
85  WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
86  WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
87 
88  // TODO: the function can be reorganized so that we do not need to have initSingleInjector
89  // and initSingleProducer, but we split when update the targets
90  // so we have a function update_targets() to split between injector and producer
91  void update_producer_targets(const Well& well,
92  const std::vector<std::vector<Scalar>>& cell_mole_fractions,
93  const SummaryState& st);
94 
95  void update_injector_targets(const Well& well, const SummaryState& st);
96 
97  void copyRuntimeStateFrom(const SingleCompWellState& other);
98 
99  Scalar get_total_surface_rate() const;
100 };
101 
102 } // namespace Opm
103 
104 #include "SingleCompWellState_impl.hpp"
105 
106 #endif // OPM_SINGLE_COMP_WELL_STATE_HPP
Definition: CompWellPrimaryVariables.hpp:32
Definition: SingleCompWellState.hpp:33
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
Static data associated with a well perforation.
Definition: BlackoilWellModelRestart.hpp:41