00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef OPM_BLACKOILPROPSADFROMDECK_HEADER_INCLUDED
00023 #define OPM_BLACKOILPROPSADFROMDECK_HEADER_INCLUDED
00024
00025 #include <opm/autodiff/AutoDiffBlock.hpp>
00026 #include <opm/autodiff/BlackoilModelEnums.hpp>
00027
00028 #include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
00029 #include <opm/core/props/rock/RockFromDeck.hpp>
00030
00031 #include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
00032 #include <opm/material/densead/Math.hpp>
00033 #include <opm/material/densead/Evaluation.hpp>
00034
00035 #include <opm/parser/eclipse/Deck/Deck.hpp>
00036 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
00037
00038 #include <memory>
00039 #include <array>
00040 #include <vector>
00041
00042 #ifdef HAVE_OPM_GRID
00043 #include <opm/common/utility/platform_dependent/disable_warnings.h>
00044 #include <dune/grid/CpGrid.hpp>
00045 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
00046 #endif
00047
00048 namespace Opm
00049 {
00050 class PvtInterface;
00051
00061 class BlackoilPropsAdFromDeck
00062 {
00063 friend class BlackoilPropsDataHandle;
00064 public:
00065 typedef FluidSystems::BlackOil<double> FluidSystem;
00066 typedef Opm::GasPvtMultiplexer<double> GasPvt;
00067 typedef Opm::OilPvtMultiplexer<double> OilPvt;
00068 typedef Opm::WaterPvtMultiplexer<double> WaterPvt;
00069
00070 typedef typename SaturationPropsFromDeck::MaterialLawManager MaterialLawManager;
00071
00086 BlackoilPropsAdFromDeck(const Opm::Deck& deck,
00087 const Opm::EclipseState& eclState,
00088 std::shared_ptr<MaterialLawManager> materialLawManager,
00089 const UnstructuredGrid& grid,
00090 const bool init_rock = true );
00091
00092 #ifdef HAVE_OPM_GRID
00107 BlackoilPropsAdFromDeck(const Opm::Deck& deck,
00108 const Opm::EclipseState& eclState,
00109 std::shared_ptr<MaterialLawManager> materialLawManager,
00110 const Dune::CpGrid& grid,
00111 const bool init_rock = true );
00112 #endif
00113
00121 BlackoilPropsAdFromDeck(const Opm::Deck& deck,
00122 const Opm::EclipseState& eclState,
00123 const UnstructuredGrid& grid,
00124 const bool init_rock = true );
00125
00126 #ifdef HAVE_OPM_GRID
00134 BlackoilPropsAdFromDeck(const Opm::Deck& deck,
00135 const Opm::EclipseState& eclState,
00136 const Dune::CpGrid& grid,
00137 const bool init_rock = true );
00138 #endif
00139
00152 BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& props,
00153 std::shared_ptr<MaterialLawManager> materialLawManager,
00154 const int number_of_cells);
00155
00156
00158
00160
00162 int numDimensions() const;
00163
00165 int numCells() const;
00166
00169 virtual const int* cellPvtRegionIndex() const
00170 { return &cellPvtRegionIdx_[0]; }
00171
00173 const double* porosity() const;
00174
00178 const double* permeability() const;
00179
00180
00182
00184
00185 typedef AutoDiffBlock<double> ADB;
00186 typedef ADB::V V;
00187 typedef std::vector<int> Cells;
00188
00190 int numPhases() const;
00191
00193 PhaseUsage phaseUsage() const;
00194
00195
00196
00201 V surfaceDensity(const int phaseIdx , const Cells& cells) const;
00202
00203
00204
00205
00211 ADB muWat(const ADB& pw,
00212 const ADB& T,
00213 const Cells& cells) const;
00214
00222 ADB muOil(const ADB& po,
00223 const ADB& T,
00224 const ADB& rs,
00225 const std::vector<PhasePresence>& cond,
00226 const Cells& cells) const;
00227
00235 ADB muGas(const ADB& pg,
00236 const ADB& T,
00237 const ADB& rv,
00238 const std::vector<PhasePresence>& cond,
00239 const Cells& cells) const;
00240
00241
00242
00248 ADB bWat(const ADB& pw,
00249 const ADB& T,
00250 const Cells& cells) const;
00251
00259 ADB bOil(const ADB& po,
00260 const ADB& T,
00261 const ADB& rs,
00262 const std::vector<PhasePresence>& cond,
00263 const Cells& cells) const;
00264
00272 ADB bGas(const ADB& pg,
00273 const ADB& T,
00274 const ADB& rv,
00275 const std::vector<PhasePresence>& cond,
00276 const Cells& cells) const;
00277
00278
00279
00284 V rsSat(const V& po,
00285 const Cells& cells) const;
00286
00292 V rsSat(const V& po,
00293 const V& so,
00294 const Cells& cells) const;
00295
00300 ADB rsSat(const ADB& po,
00301 const Cells& cells) const;
00302
00308 ADB rsSat(const ADB& po,
00309 const ADB& so,
00310 const Cells& cells) const;
00311
00312
00313
00318 ADB rvSat(const ADB& po,
00319 const Cells& cells) const;
00320
00326 ADB rvSat(const ADB& po,
00327 const ADB& so,
00328 const Cells& cells) const;
00329
00330
00331
00339 std::vector<ADB> relperm(const ADB& sw,
00340 const ADB& so,
00341 const ADB& sg,
00342 const Cells& cells) const;
00343
00352 std::vector<ADB> capPress(const ADB& sw,
00353 const ADB& so,
00354 const ADB& sg,
00355 const Cells& cells) const;
00356
00359 void updateSatHyst(const std::vector<double>& saturation,
00360 const std::vector<int>& cells);
00361
00365 void setGasOilHystParams(const std::vector<double>& pcswmdc,
00366 const std::vector<double>& krnswdc,
00367 const std::vector<int>& cells);
00368
00372 void getGasOilHystParams(std::vector<double>& pcswmdc,
00373 std::vector<double>& krnswdc,
00374 const std::vector<int>& cells) const;
00375
00379 void setOilWaterHystParams(const std::vector<double>& pcswmdc,
00380 const std::vector<double>& krnswdc,
00381 const std::vector<int>& cells);
00382
00386 void getOilWaterHystParams(std::vector<double>& pcswmdc,
00387 std::vector<double>& krnswdc,
00388 const std::vector<int>& cells) const;
00389
00392 void updateSatOilMax(const std::vector<double>& saturation);
00393
00395 const std::vector<double>& satOilMax() const;
00396
00402 void setSatOilMax(const std::vector<double>& max_sat);
00403
00405 std::vector<double> bubblePointPressure(const Cells& cells,
00406 const V& T,
00407 const V& rs) const;
00408
00410 std::vector<double> dewPointPressure(const Cells& cells,
00411 const V& T,
00412 const V& rv) const;
00413
00417 void setSwatInitScaling(const std::vector<double>& saturation,
00418 const std::vector<double>& pc);
00419
00423 V scaledCriticalOilinGasSaturations(const Cells& cells) const;
00424
00428 V scaledCriticalGasSaturations(const Cells& cells) const;
00429
00431 const WaterPvt& waterProps() const
00432 {
00433 return FluidSystem::waterPvt();
00434 }
00435
00437 const OilPvt& oilProps() const
00438 {
00439 return FluidSystem::oilPvt();
00440 }
00441
00443 const GasPvt& gasProps() const
00444 {
00445 return FluidSystem::gasPvt();
00446 }
00447
00449 const MaterialLawManager& materialLaws() const
00450 {
00451 return *materialLawManager_;
00452 }
00453
00454
00455 const std::vector<int>& pvtRegions() const
00456 {
00457 return cellPvtRegionIdx_;
00458 }
00459
00460
00461 private:
00463 void init(const Opm::Deck& deck,
00464 const Opm::EclipseState& eclState,
00465 std::shared_ptr<MaterialLawManager> materialLawManager,
00466 int number_of_cells,
00467 const int* global_cell,
00468 const int* cart_dims,
00469 const bool init_rock);
00470
00472 void applyVap(V& r,
00473 const V& so,
00474 const std::vector<int>& cells,
00475 const double vap) const;
00476
00477 void applyVap(ADB& r,
00478 const ADB& so,
00479 const std::vector<int>& cells,
00480 const double vap) const;
00481
00482 RockFromDeck rock_;
00483
00484
00485
00486 std::shared_ptr<MaterialLawManager> materialLawManager_;
00487 std::shared_ptr<SaturationPropsFromDeck> satprops_;
00488
00489 PhaseUsage phase_usage_;
00490
00491
00492
00493
00494 std::vector<int> cellPvtRegionIdx_;
00495
00496
00497 double vap1_;
00498 double vap2_;
00499 std::vector<double> satOilMax_;
00500 double vap_satmax_guard_;
00501 };
00502 }
00503
00504 #endif // OPM_BLACKOILPROPSADFROMDECK_HEADER_INCLUDED