Add test for swatinit

This commit is contained in:
Tor Harald Sandve 2017-01-04 11:30:43 +01:00
parent edd857ec3e
commit e72cf77bc8
2 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,86 @@
-- Most of the following sections are not actually needed by the test,
-- but it is required by the Eclipse reference manual that they are
-- present. Also, the higher level opm-parser classes
-- (i.e. Opm::EclipseState et al.) assume that they are present.
-------------------------------------
RUNSPEC
WATER
OIL
GAS
DIMENS
40 40 40 /
TABDIMS
1 1 40 20 1 20 /
EQLDIMS
-- NTEQUL
1 /
-------------------------------------
GRID
-- Opm::EclipseState assumes that _some_ grid gets defined, so let's
-- specify a fake one...
DXV
40*1 /
DYV
40*1 /
DZV
40*1 /
DEPTHZ
1681*123.456 /
-------------------------------------
PROPS
PVDO
100 1.0 1.0
200 0.9 1.0
/
PVDG
100 0.010 0.1
200 0.005 0.2
/
PVTW
1.0 1.0 4.0E-5 0.96 0.0
/
SWOF
0.2 0 1 0.4
1 1 0 0.1
/
SGOF
0 0 1 0.2
0.8 1 0 0.5
/
DENSITY
700 1000 1
/
SWATINIT
5*0
10*0.5
5*1 /
-------------------------------------
SOLUTION
EQUIL
50 150 50 0.25 20 0.35 1* 1* 0
/
-------------------------------------
SCHEDULE
-- empty section

View File

@ -809,4 +809,88 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
}
}
BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::Deck deck = parser.parseFile("capillarySwatinit.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::BlackoilState state( Opm::UgGridHelpers::numCells( grid ) , Opm::UgGridHelpers::numFaces( grid ) , 3);
// reference saturations
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, 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.8, 0.8, 0.8, 0.79264, 0.007253333333, 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.
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, 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.8, 0.8, 0.8, 0.79264, 0.007253333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
std::vector<double> sats = state.saturation();
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
sats[3*i + phase] = s[phase][i];
}
}
// reference pcs
const int numCells = Opm::UgGridHelpers::numCells(grid);
std::vector<int> cells(numCells);
for (int c = 0; c < numCells; ++c) { cells[c] = c; }
std::vector<double> pc_original = state.saturation();
props.capPress(numCells, sats.data(), cells.data(), pc_original.data(), nullptr);
std::vector<double> pc_scaled_truth = pc_original;
// only modify pcow
// sw = 0.2
for (size_t i = 0; i < 5; ++i) {
pc_scaled_truth[3*i + 0] = 40000;
}
// sw = 0.5
for (size_t i = 5; i < 12; ++i) {
pc_scaled_truth[3*i + 0] = 28750;
}
// sw = 1
for (size_t i = 12; i < 20; ++i) {
pc_scaled_truth[3*i + 0] = 10000;
}
// compute the initial state
// apply swatinit
Opm::BlackoilState state_scaled = state;
initStateEquil(grid, props, deck, eclipseState, 10.0, state_scaled, true);
// don't apply swatinit
Opm::BlackoilState state_unscaled = state;
initStateEquil(grid, props, deck, eclipseState, 10.0, state_unscaled, false);
// compute pc
std::vector<double> pc_scaled= state.saturation();
props.capPress(numCells, state_scaled.saturation().data(), cells.data(), pc_scaled.data(), nullptr);
std::vector<double> pc_unscaled= state.saturation();
props.capPress(numCells, state_unscaled.saturation().data(), cells.data(), pc_unscaled.data(), nullptr);
// test
const double reltol = 1.0e-6;
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
CHECK( pc_original[3*i + phase ], pc_unscaled[3*i + phase ], reltol);
CHECK( pc_scaled_truth[3*i + phase], pc_scaled[3*i + phase ], reltol);
}
}
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
CHECK(state_unscaled.saturation()[3*i + phase], s[phase][i], reltol);
CHECK(state_scaled.saturation()[3*i + phase], swatinit[phase][i], reltol);
}
}
}
BOOST_AUTO_TEST_SUITE_END()