00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OPM_BLACKOILMULTISEGMENTMODEL_HEADER_INCLUDED
00021 #define OPM_BLACKOILMULTISEGMENTMODEL_HEADER_INCLUDED
00022
00023 #include <opm/core/simulator/BlackoilState.hpp>
00024 #include <opm/autodiff/BlackoilModelBase.hpp>
00025 #include <opm/autodiff/BlackoilModelParameters.hpp>
00026 #include <opm/autodiff/WellStateMultiSegment.hpp>
00027 #include <opm/autodiff/WellMultiSegment.hpp>
00028 #include <opm/autodiff/StandardWells.hpp>
00029 #include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
00030
00031 #include <opm/autodiff/MultisegmentWells.hpp>
00032
00033 namespace Opm {
00034
00035 struct BlackoilMultiSegmentSolutionState : public DefaultBlackoilSolutionState
00036 {
00037 explicit BlackoilMultiSegmentSolutionState(const int np)
00038 : DefaultBlackoilSolutionState(np)
00039 , segp ( ADB::null())
00040 , segqs ( ADB::null())
00041 {
00042 }
00043 ADB segp;
00044 ADB segqs;
00045 };
00046
00054 template<class Grid>
00055 class BlackoilMultiSegmentModel : public BlackoilModelBase<Grid, MultisegmentWells, BlackoilMultiSegmentModel<Grid> >
00056 {
00057 public:
00058
00059 typedef BlackoilModelBase<Grid, MultisegmentWells, BlackoilMultiSegmentModel<Grid> > Base;
00060 typedef typename Base::ReservoirState ReservoirState;
00061 typedef typename Base::WellState WellState;
00062 typedef BlackoilMultiSegmentSolutionState SolutionState;
00063
00064 friend Base;
00065
00066
00067
00084 BlackoilMultiSegmentModel(const typename Base::ModelParameters& param,
00085 const Grid& grid ,
00086 const BlackoilPropsAdFromDeck& fluid,
00087 const DerivedGeology& geo ,
00088 const RockCompressibility* rock_comp_props,
00089 const MultisegmentWells& well_model,
00090 const NewtonIterationBlackoilInterface& linsolver,
00091 std::shared_ptr< const EclipseState > eclState,
00092 const bool has_disgas,
00093 const bool has_vapoil,
00094 const bool terminal_output);
00095
00100 void prepareStep(const SimulatorTimerInterface& timer,
00101 const ReservoirState& reservoir_state,
00102 const WellState& well_state);
00103
00104
00109 SimulatorReport
00110 assemble(const ReservoirState& reservoir_state,
00111 WellState& well_state,
00112 const bool initial_assembly);
00113
00114 using Base::numPhases;
00115 using Base::numMaterials;
00116 using Base::materialName;
00117
00118 protected:
00119
00120
00121
00122
00123 using Base::pvdt_;
00124 using Base::geo_;
00125 using Base::active_;
00126 using Base::sd_;
00127 using Base::fluid_;
00128 using Base::terminal_output_;
00129 using Base::grid_;
00130 using Base::canph_;
00131 using Base::residual_;
00132 using Base::isSg_;
00133 using Base::isRs_;
00134 using Base::isRv_;
00135 using Base::has_disgas_;
00136 using Base::has_vapoil_;
00137 using Base::cells_;
00138 using Base::param_;
00139 using Base::linsolver_;
00140 using Base::phaseCondition_;
00141 using Base::vfp_properties_;
00142 using Base::well_model_;
00143
00144 using Base::wellModel;
00145
00146 using Base::wellsActive;
00147 using Base::updatePrimalVariableFromState;
00148 using Base::phaseCondition;
00149 using Base::fluidRvSat;
00150 using Base::fluidRsSat;
00151 using Base::fluidDensity;
00152 using Base::updatePhaseCondFromPrimalVariable;
00153 using Base::computeGasPressure;
00154 using Base::dpMaxRel;
00155 using Base::dsMax;
00156 using Base::drMaxRel;
00157 using Base::convergenceReduction;
00158 using Base::maxResidualAllowed;
00159 using Base::variableState;
00160
00161 using Base::asImpl;
00162 using Base::variableReservoirStateInitials;
00163
00164
00165 const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return well_model_.msWells(); }
00166
00167 const MultisegmentWells::MultisegmentWellOps& msWellOps() const { return well_model_.wellOps(); }
00168
00169 SimulatorReport
00170 solveWellEq(const std::vector<ADB>& mob_perfcells,
00171 const std::vector<ADB>& b_perfcells,
00172 const ReservoirState& reservoir_state,
00173 SolutionState& state,
00174 WellState& well_state);
00175
00176 void
00177 makeConstantState(SolutionState& state) const;
00178
00179
00180
00181 void
00182 computeWellConnectionPressures(const SolutionState& state,
00183 const WellState& well_state);
00184
00185 };
00186
00188 template <class GridT>
00189 struct ModelTraits< BlackoilMultiSegmentModel<GridT> >
00190 {
00191 typedef BlackoilState ReservoirState;
00192 typedef WellStateMultiSegment WellState;
00193 typedef BlackoilModelParameters ModelParameters;
00194 typedef BlackoilMultiSegmentSolutionState SolutionState;
00195 };
00196
00197
00198
00199
00200 }
00201
00202 #include "BlackoilMultiSegmentModel_impl.hpp"
00203
00204 #endif // OPM_BLACKOILMULTISEGMENTMODEL_HEADER_INCLUDED