SimulatorFullyImplicitBlackoilPolymer.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2013 SINTEF ICT, Applied Mathematics.
3  Copyright 2014 STATOIL ASA.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED
22 #define OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED
23 
24 #include <opm/autodiff/SimulatorBase.hpp>
25 #include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
30 
31 #include <opm/core/utility/parameters/ParameterGroup.hpp>
32 #include <opm/common/ErrorMacros.hpp>
33 
34 #include <opm/autodiff/GeoProps.hpp>
35 #include <opm/autodiff/BlackoilPropsAdInterface.hpp>
36 #include <opm/autodiff/RateConverter.hpp>
37 #include <opm/autodiff/NewtonSolver.hpp>
38 
39 #include <opm/core/grid.h>
40 #include <opm/core/wells.h>
41 #include <opm/core/well_controls.h>
42 #include <opm/core/pressure/flow_bc.h>
43 
44 #include <opm/core/simulator/SimulatorReport.hpp>
45 #include <opm/core/simulator/SimulatorTimer.hpp>
46 //#include <opm/core/simulator/AdaptiveSimulatorTimer.hpp>
47 #include <opm/core/utility/StopWatch.hpp>
48 #include <opm/core/io/vtk/writeVtkData.hpp>
49 #include <opm/core/utility/miscUtilities.hpp>
50 #include <opm/core/utility/miscUtilitiesBlackoil.hpp>
51 
52 #include <opm/core/props/rock/RockCompressibility.hpp>
53 
54 //#include <opm/core/simulator/AdaptiveTimeStepping.hpp>
55 #include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
56 
57 #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
58 #include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
59 #include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
60 #include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
61 #include <opm/parser/eclipse/Deck/Deck.hpp>
62 
63 #include <boost/filesystem.hpp>
64 #include <boost/lexical_cast.hpp>
65 
66 #include <algorithm>
67 #include <cstddef>
68 #include <cassert>
69 #include <functional>
70 #include <memory>
71 #include <numeric>
72 #include <fstream>
73 #include <iostream>
74 #include <string>
75 #include <unordered_map>
76 #include <utility>
77 #include <vector>
78 
79 namespace Opm
80 {
81  template <class GridT>
83 
84  template<class GridT>
85  struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
86  {
89  typedef BlackoilOutputWriter OutputWriter;
90  typedef GridT Grid;
92  typedef NewtonSolver<Model> Solver;
93  };
94 
97  template <class GridT>
99  : public SimulatorBase<SimulatorFullyImplicitBlackoilPolymer<GridT> >
100  {
102  typedef SimulatorBase<ThisType> BaseType;
103 
104  typedef SimulatorTraits<ThisType> Traits;
105  typedef typename Traits::Solver Solver;
106 
107  public:
108  SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
109  const GridT& grid,
110  const DerivedGeology& geo,
111  BlackoilPropsAdInterface& props,
112  const PolymerPropsAd& polymer_props,
113  const RockCompressibility* rock_comp_props,
114  NewtonIterationBlackoilInterface& linsolver,
115  const double* gravity,
116  const bool disgas,
117  const bool vapoil,
118  const bool polymer,
119  const bool plyshlog,
120  const bool shrate,
121  std::shared_ptr<EclipseState> eclipse_state,
122  BlackoilOutputWriter& output_writer,
123  Opm::DeckConstPtr& deck,
124  const std::vector<double>& threshold_pressures_by_face);
125 
126  std::unique_ptr<Solver> createSolver(const Wells* wells);
127 
128 
129  void handleAdditionalWellInflow(SimulatorTimer& timer,
130  WellsManager& wells_manager,
131  typename BaseType::WellState& well_state,
132  const Wells* wells);
133 
134 
135  private:
136  const PolymerPropsAd& polymer_props_;
137  bool has_polymer_;
138  // flag for PLYSHLOG keyword
139  bool has_plyshlog_;
140  // flag for SHRATE keyword
141  bool has_shrate_;
142  DeckConstPtr deck_;
143 
144  std::vector<double> wells_rep_radius_;
145  std::vector<double> wells_perf_length_;
146  std::vector<double> wells_bore_diameter_;
147 
148  // generate the mapping from Cartesian grid cells to global compressed cells,
149  // copied from opm-core, to be used in function computeRepRadiusPerfLength()
150  static void
151  setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed);
152 
153  // calculate the representative radius and length for for well peforations
154  // and store the wellbore diameters
155  // it will be used in the shear-thinning calcluation only.
156  void
157  computeRepRadiusPerfLength(const Opm::EclipseStateConstPtr eclipseState,
158  const size_t timeStep,
159  const GridT& grid,
160  std::vector<double>& wells_rep_radius,
161  std::vector<double>& wells_perf_length,
162  std::vector<double>& wells_bore_diameter);
163 
164  };
165 
166 } // namespace Opm
167 
169 
170 #endif // OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:82
std::unique_ptr< Solver > createSolver(const Wells *wells)
Definition: SimulatorFullyImplicitBlackoilPolymer_impl.hpp:65
Definition: CompressibleTpfaPolymer.hpp:32
GridT Grid
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:90
void handleAdditionalWellInflow(SimulatorTimer &timer, WellsManager &wells_manager, typename BaseType::WellState &well_state, const Wells *wells)
Definition: SimulatorFullyImplicitBlackoilPolymer_impl.hpp:102
WellStateFullyImplicitBlackoilPolymer WellState
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:87
PolymerBlackoilState ReservoirState
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:88
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup &param, const GridT &grid, const DerivedGeology &geo, BlackoilPropsAdInterface &props, const PolymerPropsAd &polymer_props, const RockCompressibility *rock_comp_props, NewtonIterationBlackoilInterface &linsolver, const double *gravity, const bool disgas, const bool vapoil, const bool polymer, const bool plyshlog, const bool shrate, std::shared_ptr< EclipseState > eclipse_state, BlackoilOutputWriter &output_writer, Opm::DeckConstPtr &deck, const std::vector< double > &threshold_pressures_by_face)
Definition: SimulatorFullyImplicitBlackoilPolymer_impl.hpp:26
Definition: WellStateFullyImplicitBlackoilPolymer.hpp:28
Definition: PolymerBlackoilState.hpp:33
Definition: PolymerPropsAd.hpp:32
BlackoilPolymerModel< Grid > Model
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:91
Definition: BlackoilPolymerModel.hpp:43
NewtonSolver< Model > Solver
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:92
BlackoilOutputWriter OutputWriter
Definition: SimulatorFullyImplicitBlackoilPolymer.hpp:89