WellStateFullyImplicitBlackoilSolvent.hpp
1 /*
2  Copyright 2015 IRIS AS
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_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED
21 #define OPM_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED
22 
23 #include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
24 
25 namespace Opm
26 {
27 
29  {
30  typedef WellStateFullyImplicitBlackoil BaseType;
31  public:
32 
34  std::vector<double>& solventFraction() { return solvent_fraction_; }
35  const std::vector<double>& solventFraction() const { return solvent_fraction_; }
36 
37  data::Wells report(const PhaseUsage &pu) const override {
38  data::Wells res = WellStateFullyImplicitBlackoil::report(pu);
39 
40  const int nw = WellState::numWells();
41 
42  // If there are now wells numPhases throws a floating point
43  // exception.
44  if (nw == 0) {
45  return res;
46  }
47 
48  const int np = BaseType::numPhases();
49 
50  assert( np == 3 ); // the solvent model assumes 3 phases in the base model
51 
52  // completions aren't supported yet
53  for( auto w = 0; w < nw; ++w ) {
54  using rt = data::Rates::opt;
55  double solvent_well_rate = 0.0;
56  for (int perf = wells_->well_connpos[w]; perf < wells_->well_connpos[w+1]; ++perf ) {
57  auto solvent_rate_this = BaseType::perfPhaseRates()[np*perf + pu.phase_pos[BlackoilPhases::Vapour]] * solventFraction()[perf];
58  solvent_well_rate += solvent_rate_this;
59  }
60 
61  res.at( wells_->name[ w ]).rates.set( rt::solvent, solvent_well_rate );
62 
63  }
64 
65  return res;
66  }
67  private:
68  std::vector<double> solvent_fraction_;
69  };
70 
71 } // namespace Opm
72 
73 #endif // OPM_WELLSTATEFULLYIMPLICITBLACKOILSOLVENT_HEADER_INCLUDED
Definition: WellStateFullyImplicitBlackoilSolvent.hpp:28
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: AdditionalObjectDeleter.hpp:22
std::vector< double > & perfPhaseRates()
One rate per phase and well connection.
Definition: WellStateFullyImplicitBlackoil.hpp:230
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellStateFullyImplicitBlackoil.hpp:44
std::vector< double > & solventFraction()
One solvent fraction per well connection.
Definition: WellStateFullyImplicitBlackoilSolvent.hpp:34