00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED
00022 #define OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED
00023
00024 #include <opm/autodiff/SimulatorBase.hpp>
00025 #include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
00026 #include <opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp>
00027 #include <opm/polymer/fullyimplicit/WellStateFullyImplicitBlackoilPolymer.hpp>
00028 #include <opm/polymer/PolymerBlackoilState.hpp>
00029 #include <opm/polymer/PolymerInflow.hpp>
00030
00031 #include <opm/core/utility/parameters/ParameterGroup.hpp>
00032 #include <opm/common/ErrorMacros.hpp>
00033
00034 #include <opm/autodiff/GeoProps.hpp>
00035 #include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
00036 #include <opm/autodiff/RateConverter.hpp>
00037 #include <opm/autodiff/NonlinearSolver.hpp>
00038
00039 #include <opm/core/grid.h>
00040 #include <opm/core/wells.h>
00041 #include <opm/core/well_controls.h>
00042 #include <opm/core/pressure/flow_bc.h>
00043
00044 #include <opm/core/simulator/SimulatorReport.hpp>
00045 #include <opm/simulators/timestepping/SimulatorTimer.hpp>
00046
00047 #include <opm/core/utility/StopWatch.hpp>
00048 #include <opm/core/utility/miscUtilities.hpp>
00049 #include <opm/core/utility/miscUtilitiesBlackoil.hpp>
00050
00051 #include <opm/core/props/rock/RockCompressibility.hpp>
00052
00053
00054 #include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
00055
00056 #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
00057 #include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
00058 #include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
00059 #include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
00060 #include <opm/parser/eclipse/Deck/Deck.hpp>
00061
00062 #include <boost/filesystem.hpp>
00063 #include <boost/lexical_cast.hpp>
00064
00065 #include <algorithm>
00066 #include <cstddef>
00067 #include <cassert>
00068 #include <functional>
00069 #include <memory>
00070 #include <numeric>
00071 #include <fstream>
00072 #include <iostream>
00073 #include <string>
00074 #include <unordered_map>
00075 #include <utility>
00076 #include <vector>
00077
00078 namespace Opm
00079 {
00080 template <class GridT>
00081 class SimulatorFullyImplicitBlackoilPolymer;
00082
00083 class StandardWells;
00084
00085 template<class GridT>
00086 struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
00087 {
00088 typedef WellStateFullyImplicitBlackoilPolymer WellState;
00089 typedef PolymerBlackoilState ReservoirState;
00090 typedef BlackoilOutputWriter OutputWriter;
00091 typedef GridT Grid;
00092 typedef BlackoilPolymerModel<Grid> Model;
00093 typedef NonlinearSolver<Model> Solver;
00094 typedef StandardWells WellModel;
00095 };
00096
00099 template <class GridT>
00100 class SimulatorFullyImplicitBlackoilPolymer
00101 : public SimulatorBase<SimulatorFullyImplicitBlackoilPolymer<GridT> >
00102 {
00103 typedef SimulatorFullyImplicitBlackoilPolymer<GridT> ThisType;
00104 typedef SimulatorBase<ThisType> BaseType;
00105
00106 typedef SimulatorTraits<ThisType> Traits;
00107 typedef typename Traits::Solver Solver;
00108 typedef typename Traits::WellModel WellModel;
00109
00110 public:
00111 SimulatorFullyImplicitBlackoilPolymer(const ParameterGroup& param,
00112 const GridT& grid,
00113 DerivedGeology& geo,
00114 BlackoilPropsAdFromDeck& props,
00115 const PolymerPropsAd& polymer_props,
00116 const RockCompressibility* rock_comp_props,
00117 NewtonIterationBlackoilInterface& linsolver,
00118 const double* gravity,
00119 const bool disgas,
00120 const bool vapoil,
00121 const bool polymer,
00122 const bool plyshlog,
00123 const bool shrate,
00124 std::shared_ptr<EclipseState> eclipse_state,
00125 BlackoilOutputWriter& output_writer,
00126 std::shared_ptr< Deck > deck,
00127 const std::vector<double>& threshold_pressures_by_face);
00128
00129 std::unique_ptr<Solver> createSolver(const WellModel& well_model);
00130
00131
00132 void handleAdditionalWellInflow(SimulatorTimer& timer,
00133 WellsManager& wells_manager,
00134 typename BaseType::WellState& well_state,
00135 const Wells* wells);
00136
00137
00138 private:
00139 const PolymerPropsAd& polymer_props_;
00140 bool has_polymer_;
00141
00142 bool has_plyshlog_;
00143
00144 bool has_shrate_;
00145 std::shared_ptr< Deck > deck_;
00146
00147 std::vector<double> wells_rep_radius_;
00148 std::vector<double> wells_perf_length_;
00149 std::vector<double> wells_bore_diameter_;
00150
00151
00152
00153 static void
00154 setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed);
00155
00156
00157
00158
00159 void
00160 computeRepRadiusPerfLength(const EclipseState& eclipseState,
00161 const size_t timeStep,
00162 const GridT& grid,
00163 std::vector<double>& wells_rep_radius,
00164 std::vector<double>& wells_perf_length,
00165 std::vector<double>& wells_bore_diameter);
00166
00167 };
00168
00169 }
00170
00171 #include "SimulatorFullyImplicitBlackoilPolymer_impl.hpp"
00172
00173 #endif // OPM_SIMULATORFULLYIMPLICITBLACKOILPOLYMER_HEADER_INCLUDED