diff --git a/opm/core/simulator/BlackoilState.cpp b/opm/core/simulator/BlackoilState.cpp index c8c3afa83..0b864a17d 100644 --- a/opm/core/simulator/BlackoilState.cpp +++ b/opm/core/simulator/BlackoilState.cpp @@ -7,6 +7,7 @@ void BlackoilState::init(const UnstructuredGrid& g, int num_phases) { SimulatorState::init(g, num_phases); gor_.resize(g.number_of_cells, 0.) ; + rv_.resize(g.number_of_cells,0.); // surfvol_ intentionally empty, left to initBlackoilSurfvol } diff --git a/opm/core/simulator/BlackoilState.hpp b/opm/core/simulator/BlackoilState.hpp index 5cf8156ed..c6fb7779e 100644 --- a/opm/core/simulator/BlackoilState.hpp +++ b/opm/core/simulator/BlackoilState.hpp @@ -47,13 +47,16 @@ namespace Opm std::vector& surfacevol () { return surfvol_; } std::vector& gasoilratio () { return gor_ ; } + std::vector& rv () {return rv_ ; } const std::vector& surfacevol () const { return surfvol_; } const std::vector& gasoilratio () const { return gor_ ; } + const std::vector& rv () const {return rv_ ; } private: std::vector surfvol_; std::vector gor_ ; + std::vector rv_ ; }; } // namespace Opm diff --git a/opm/core/simulator/initState_impl.hpp b/opm/core/simulator/initState_impl.hpp index 13d7728be..12dbe7b52 100644 --- a/opm/core/simulator/initState_impl.hpp +++ b/opm/core/simulator/initState_impl.hpp @@ -609,26 +609,26 @@ namespace Opm } } /// Initialize surface volume from pressure and saturation by z = As. - /// Here the gas/oil ratio is used to compute an intial z for the - /// computation of A. + /// Here the solution gas/oil ratio or vapor oil/gas ratio is used to + /// compute an intial z for the computation of A. template - void initBlackoilSurfvolUsingRS(const UnstructuredGrid& grid, + void initBlackoilSurfvolUsingRSorRV(const UnstructuredGrid& grid, const Props& props, State& state) { if (props.numPhases() != 3) { OPM_THROW(std::runtime_error, "initBlackoilSurfvol() is only supported in three-phase simulations."); } - const std::vector& rs = state.gasoilratio(); + const std::vector& rv = state.rv(); //make input for computation of the A matrix state.surfacevol() = state.saturation(); - //const PhaseUsage pu = phaseUsageFromDeck(deck); const PhaseUsage pu = props.phaseUsage(); const int np = props.numPhases(); const int nc = grid.number_of_cells; + std::vector allA_a(nc*np*np); std::vector allA_l(nc*np*np); std::vector allA_v(nc*np*np); @@ -641,6 +641,17 @@ namespace Opm allcells[c] = c; } + std::vector capPressures(nc*np); + props.capPress(nc,&state.saturation()[0],&allcells[0],&capPressures[0],NULL); + + std::vector Pw(nc); + std::vector Pg(nc); + + for (int c = 0; c < nc; ++c){ + Pw[c] = state.pressure()[c] + capPressures[c*np + BlackoilPhases::Aqua]; + Pg[c] = state.pressure()[c] + capPressures[c*np + BlackoilPhases::Vapour]; + } + double z_tmp; @@ -687,7 +698,7 @@ namespace Opm if(state.saturation()[np*c + p] > 0) z_tmp = 1e10; else - z_tmp = rs[c]; + z_tmp = rv[c]; } else if(p == BlackoilPhases::Vapour) z_tmp = 1; @@ -717,7 +728,9 @@ namespace Opm z[2] += A_v[2 + np*col]*s[col]; } + double ztmp = z[2]; z[2] += z[1]*rs[c]; + z[1] += ztmp*rv[c]; } } @@ -739,10 +752,21 @@ namespace Opm int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c]; state.gasoilratio()[c] = rs_deck[c_deck]; } - initBlackoilSurfvolUsingRS(grid, props, state); + initBlackoilSurfvolUsingRSorRV(grid, props, state); computeSaturation(props,state); - } else { - OPM_THROW(std::runtime_error, "Temporarily, we require the RS field."); + } else if (deck.hasField("RV")){ + const std::vector& rv_deck = deck.getFloatingPointValue("RV"); + const int num_cells = grid.number_of_cells; + for (int c = 0; c < num_cells; ++c) { + int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c]; + state.rv()[c] = rv_deck[c_deck]; + } + initBlackoilSurfvolUsingRSorRV(grid, props, state); + computeSaturation(props,state); + } + + else { + OPM_THROW(std::runtime_error, "Temporarily, we require the RS or the RV field."); } } diff --git a/tests/liveoil.DATA b/tests/liveoil.DATA new file mode 100644 index 000000000..c6a04b406 --- /dev/null +++ b/tests/liveoil.DATA @@ -0,0 +1,36 @@ +OIL +GAS +WATER + +FIELD + +PVTO +-- Rs Pbub Bo Vo + .0 14.7 1.0000 1.20 / + .165 400. 1.0120 1.17 / + .335 800. 1.0255 1.14 / + .500 1200. 1.0380 1.11 / + .665 1600. 1.0510 1.08 / + .828 2000. 1.0630 1.06 / + .985 2400. 1.0750 1.03 / + 1.130 2800. 1.0870 1.00 / + 1.270 3200. 1.0985 .98 / + 1.390 3600. 1.1100 .95 / + 1.500 4000. 1.1200 .94 + 5000. 1.1189 .94 / + / + +PVDG +-- Pg Bg Vg + 14.7 178.08 .0125 + 400. 5.4777 .0130 + 800. 2.7392 .0135 + 1200. 1.8198 .0140 + 1600. 1.3648 .0145 + 2000. 1.0957 .0150 + 2400. 0.9099 .0155 + 2800. 0.7799 .0160 + 3200. 0.6871 .0165 + 3600. 0.6035 .0170 + 4000. 0.5432 .0175 / + diff --git a/tests/wetgas.DATA b/tests/wetgas.DATA new file mode 100644 index 000000000..4fad316e5 --- /dev/null +++ b/tests/wetgas.DATA @@ -0,0 +1,71 @@ +WATER +OIL +GAS + +FIELD + +-- PVT PROPERTIES OF DRY GAS (NO VAPOURISED OIL) +-- FROM SPE3 Blackoil Kleppe +-- +-- 'Pressure' 'Oil FVF' 'Oil Visc' +PVDO + 1214.7000 1.0632 0.3668 + 1814.7000 1.0518 0.4241 + 2414.7000 1.0418 0.5018 + 3014.7000 1.0332 0.6068 + 3214.7000 1.0308 0.6461 + 3364.7000 1.0291 0.6753 + 3414.7000 1.0285 0.6852 + 3443.8831 1.0282 0.6912 +/ + +-- Wet Gas PVT Properties (Vapourised Oil) +-- Column Properties are: +-- 'Gas Pressure' 'Gas OGR' 'Gas FVF' 'Gas Visc' +-- Units: psia stb /Mscf rb /Mscf cp +PVTG + 1214.7000 0.0013130 2.2799 0.0149 + 0 2.2815 0.01488/ + 1814.7000 0.00353 1.4401 0.01791 + 0.001313 1.4429 0.01782 + 0 1.4445 0.01735 / + 2414.7000 0.01102 1.0438 0.02328 + 0.00353 1.0495 0.02267 + 0.001313 1.0512 0.0225 + 0 1.0522 0.02240 / + 3014.7000 0.0331 0.8456 0.0318 + 0.01102 0.8489 0.02924 + 0.00353 0.8500 0.02844 + 0.001313 0.8503 0.02820 + 0 0.8505 0.02807 / + 3214.7000 0.0454 0.8082 0.03539 + 0.0331 0.8080 0.03371 + 0.01102 0.8075 0.03113 + 0.00353 0.8073 0.03029 + 0.001313 0.8073 0.03004 + 0 0.8073 0.02989 / + 3364.7000 0.05670 0.7875 0.0384 + 0.04540 0.7860 0.03667 + 0.03310 0.7843 0.03515 + 0.01102 0.7814 0.03429 + 0.00353 0.7804 0.03162 + 0.001313 0.7801 0.03136 + 0 0.7799 0.03121 / + 3416.7575 0.0612 0.7816 0.03955 + 0.0567 0.7809 0.0386 + 0.0454 0.7789 0.03717 + 0.0331 0.7768 0.03564 + 0.01102 0.7731 0.03296 + 0.00353 0.7718 0.03207 + 0.001313 0.7714 0.03181 + 0 0.7712 0.03166 / + 3449.3322 0.0642 0.7783 0.0403 + 0.0612 0.7777 0.0395 + 0.0567 0.7769 0.03892 + 0.0454 0.7747 0.03748 + 0.0331 0.7723 0.03594 + 0.01102 0.7681 0.03325 + 0.00353 0.7666 0.03236 + 0.001313 0.7662 0.0321 + 0 0.7660 0.03194 / +/