FIX swatinit test in test_equil

The capillarySwatinit.DATA is updated to make it possible to run in Ecl.
Referance solutions is updated accordingly.
This commit is contained in:
Tor Harald Sandve 2017-03-22 10:07:56 +01:00
parent 0b1d5745a6
commit 77b9311f2c
2 changed files with 57 additions and 33 deletions

View File

@ -11,15 +11,17 @@ OIL
GAS GAS
DIMENS DIMENS
40 40 40 / 1 1 20 /
TABDIMS TABDIMS
1 1 40 20 1 20 / 1 1 40 20 1 20 /
EQLDIMS EQLDIMS
-- NTEQUL -- NTEQUL
1 / 1 /
START
1 'JAN' 2015 /
------------------------------------- -------------------------------------
GRID GRID
@ -27,20 +29,31 @@ GRID
-- specify a fake one... -- specify a fake one...
DXV DXV
40*1 / 1 /
DYV DYV
40*1 / 1 /
DZV DZ
40*1 / 20*5 /
DEPTHZ TOPS
1681*123.456 / 0 /
PORO
20*0.3 /
PERMX
20*500 /
PERMZ
20*500 /
------------------------------------- -------------------------------------
PROPS PROPS
ROCK
14.7 3E-6 /
PVDO PVDO
100 1.0 1.0 100 1.0 1.0
200 0.9 1.0 200 0.9 1.0
@ -72,7 +85,7 @@ DENSITY
SWATINIT SWATINIT
5*0 5*0
10*0.5 10*0.5
5*1 / 5*1 /
------------------------------------- -------------------------------------
SOLUTION SOLUTION
@ -81,6 +94,9 @@ EQUIL
50 150 50 0.25 20 0.35 1* 1* 0 50 150 50 0.25 20 0.35 1* 1* 0
/ /
RPTSOL
SWATINIT SWAT SGAS SOIL PCOG PCOW
/
------------------------------------- -------------------------------------
SCHEDULE SCHEDULE
-- empty section -- empty section

View File

@ -815,26 +815,29 @@ Test disabled by Joakim 21.03.2017 to recover green test chain.
BOOST_AUTO_TEST_CASE (DeckWithSwatinit) BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
{ {
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0); //Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::Parser parser; Opm::Parser parser;
Opm::ParseContext parseContext; Opm::ParseContext parseContext;
Opm::Deck deck = parser.parseFile("capillarySwatinit.DATA" , parseContext); Opm::Deck deck = parser.parseFile("capillarySwatinit.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext); Opm::EclipseState eclipseState(deck , parseContext);
Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::BlackoilPropertiesFromDeck propsScaled(deck, eclipseState, grid, false);
Opm::BlackoilState state( Opm::UgGridHelpers::numCells( grid ) , Opm::UgGridHelpers::numFaces( grid ) , 3); Opm::BlackoilState state( Opm::UgGridHelpers::numCells( grid ) , Opm::UgGridHelpers::numFaces( grid ) , 3);
// reference saturations // reference saturations
const std::vector<double> s[3]{ const std::vector<double> s[3]{
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.42192000000000002, 0.77802666666666664, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.425307, 0.77464, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0.00736, 0.792746666666, 0.8, 0.8, 0.8, 0.8, 0.57807999999999993, 0.22197333333333336, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0.0148267, 0.78528, 0.8, 0.8, 0.8, 0.8, 0.574693, 0.22536, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.79264, 0.007253333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } { 0.8, 0.8, 0.8, 0.785173, 0.01472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}; };
// sw in cell 13 and 14 is forced to be swu=1 since P_oil - P_wat < 0. // sw in cell 13 and 14 is forced to be swu=1 since P_oil - P_wat < 0.
const std::vector<double> swatinit[3]{ const std::vector<double> swatinit[3]{
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0.2, 0.2, 0.2, 0.2, 0.2, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0.00736, 0.792746666666, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0.0148267, 0.78528, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.79264, 0.007253333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } { 0.8, 0.8, 0.8, 0.785173, 0.01472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}; };
std::vector<double> sats = state.saturation(); std::vector<double> sats = state.saturation();
for (int phase = 0; phase < 3; ++phase) { for (int phase = 0; phase < 3; ++phase) {
@ -842,6 +845,13 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
sats[3*i + phase] = s[phase][i]; sats[3*i + phase] = s[phase][i];
} }
} }
std::vector<double> sats_swatinit = state.saturation();
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
sats_swatinit[3*i + phase] = swatinit[phase][i];
}
}
// reference pcs // reference pcs
const int numCells = Opm::UgGridHelpers::numCells(grid); const int numCells = Opm::UgGridHelpers::numCells(grid);
std::vector<int> cells(numCells); std::vector<int> cells(numCells);
@ -850,38 +860,36 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
props.capPress(numCells, sats.data(), cells.data(), pc_original.data(), nullptr); props.capPress(numCells, sats.data(), cells.data(), pc_original.data(), nullptr);
std::vector<double> pc_scaled_truth = pc_original; std::vector<double> pc_scaled_truth = pc_original;
// only modify pcow
// sw = 0.2 // modify pcow for cell 5 - 11 (where sw is changed due to swatinit)
for (size_t i = 0; i < 5; ++i) { // for the reference scaled pc.
pc_scaled_truth[3*i + 0] = 40000; pc_scaled_truth[3*5 + 0] = 84081;
} pc_scaled_truth[3*6 + 0] = 70929;
// sw = 0.5 pc_scaled_truth[3*7 + 0] = 57791;
for (size_t i = 5; i < 12; ++i) { pc_scaled_truth[3*8 + 0] = 44665;
pc_scaled_truth[3*i + 0] = 28750; pc_scaled_truth[3*9 + 0] = 31552;
} pc_scaled_truth[3*10 + 0] = 18451.5;
// sw = 1 pc_scaled_truth[3*11 + 0] = 5364.1;
for (size_t i = 12; i < 20; ++i) {
pc_scaled_truth[3*i + 0] = 10000;
}
// compute the initial state // compute the initial state
// apply swatinit // apply swatinit
Opm::BlackoilState state_scaled = state; Opm::BlackoilState state_scaled = state;
initStateEquil(grid, props, deck, eclipseState, 10.0, state_scaled, true); initStateEquil(grid, propsScaled, deck, eclipseState, 9.81, state_scaled, true);
// don't apply swatinit // don't apply swatinit
Opm::BlackoilState state_unscaled = state; Opm::BlackoilState state_unscaled = state;
initStateEquil(grid, props, deck, eclipseState, 10.0, state_unscaled, false); initStateEquil(grid, props, deck, eclipseState, 9.81, state_unscaled, false);
// compute pc // compute pc
std::vector<double> pc_scaled= state.saturation(); std::vector<double> pc_scaled= state.saturation();
props.capPress(numCells, state_scaled.saturation().data(), cells.data(), pc_scaled.data(), nullptr); propsScaled.capPress(numCells, state_scaled.saturation().data(), cells.data(), pc_scaled.data(), nullptr);
std::vector<double> pc_unscaled= state.saturation(); std::vector<double> pc_unscaled= state.saturation();
props.capPress(numCells, state_unscaled.saturation().data(), cells.data(), pc_unscaled.data(), nullptr); props.capPress(numCells, state_unscaled.saturation().data(), cells.data(), pc_unscaled.data(), nullptr);
// test // test
const double reltol = 1.0e-6; const double reltol = 1.0e-3;
for (int phase = 0; phase < 3; ++phase) { for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) { for (size_t i = 0; i < 20; ++i) {
CHECK( pc_original[3*i + phase ], pc_unscaled[3*i + phase ], reltol); CHECK( pc_original[3*i + phase ], pc_unscaled[3*i + phase ], reltol);