opm-simulators
CompWellInterface_impl.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 #include <string>
21 
22 namespace Opm {
23 template <typename TypeTag>
24 CompWellInterface<TypeTag>::
25 CompWellInterface(const Well& well,
26  const int index_of_well,
27  const std::vector<CompConnectionData>& well_connection_data)
28  : well_ecl_(well)
29  , index_of_well_(index_of_well)
30  , number_of_connection_(well_connection_data.size())
31  , reference_depth_(well.getRefDepth())
32  , connectionRates_(number_of_connection_)
33 {
34  if (FluidSystem::waterEnabled) {
35  throw std::runtime_error("the well model does not support water phase yet");
36  }
37 
38  {
39  well_cells_.resize(number_of_connection_);
40  well_index_.resize(number_of_connection_);
41  saturation_table_number_.resize(number_of_connection_, 0);
42  int connection_idx = 0;
43  for (const auto& connection_data : well_connection_data) {
44  well_cells_[connection_idx] = connection_data.cell_index;
45  well_index_[connection_idx] = connection_data.connection_transmissibility_factor;
46  saturation_table_number_[connection_idx] = connection_data.satnum_id;
47  ++connection_idx;
48  }
49  // TODO: saturation_table_number
50  }
51 
52 }
53 
54 template <typename TypeTag>
55 void
56 CompWellInterface<TypeTag>::
57 init()
58 {
59  // more things to add here
60 }
61 
62 template <typename TypeTag>
63 const std::string&
64 CompWellInterface<TypeTag>::
65 name() const
66 {
67  return this->well_ecl_.name();
68 }
69 
70 template <typename TypeTag>
71 void
72 CompWellInterface<TypeTag>::
73 addCellRates(RateVector& rates, unsigned cellIdx) const
74 {
75  for (int con = 0; con < this->number_of_connection_; ++con) {
76  if (this->well_cells_[con] == cellIdx) {
77  for (int i = 0; i < RateVector::dimension; ++i) {
78  rates[i] += connectionRates_[con][i];
79  }
80  }
81  }
82 }
83 
84 
85 } // end of namespace Opm
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45