Added test_wellmanager which loads wellmanager from deck and tests many values.

This commit is contained in:
Joakim Hove 2014-01-03 15:02:11 +01:00
parent e4a7a33598
commit 487ff810fd
2 changed files with 171 additions and 12 deletions

View File

@ -31,10 +31,156 @@
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/grid/GridManager.hpp> #include <opm/core/grid/GridManager.hpp>
BOOST_AUTO_TEST_CASE(Constructor_Old_Works) {
Opm::EclipseGridParser oldParser("wells_manager_data.data"); void wells_static_check(const Wells* wells) {
Opm::GridManager gridManager(oldParser); BOOST_CHECK_EQUAL(2 , wells->number_of_wells);
Opm::WellsManager wellsManager(oldParser, *gridManager.c_grid(), NULL); BOOST_CHECK_EQUAL(3 , wells->number_of_phases);
const Wells* oldWells = wellsManager.c_wells();
BOOST_CHECK_EQUAL(oldWells->number_of_wells, 2); BOOST_CHECK_EQUAL("INJ1" , wells->name[0]);
BOOST_CHECK_EQUAL("PROD1" , wells->name[1]);
/* The mapping from well number into the wells->WI and wells->well_cells arrays. */
BOOST_CHECK_EQUAL(0 , wells->well_connpos[0]);
BOOST_CHECK_EQUAL(1 , wells->well_connpos[1]);
BOOST_CHECK_EQUAL(2 , wells->well_connpos[2]);
/* Connection factor */
BOOST_CHECK_CLOSE(1.2279166666666664e-12 , wells->WI[0] , 0.001);
BOOST_CHECK_CLOSE(1.2279166666666664e-12 , wells->WI[1] , 0.001);
/* Completed cells */
BOOST_CHECK_EQUAL(0 , wells->well_cells[0]);
BOOST_CHECK_EQUAL(9 + 2*10 + 2*10*10 , wells->well_cells[1]);
} }
/*
The number of controls is determined by looking at which elements
have been given explicit - non-default - values in the WCONxxxx
keyword. Is that at all interesting?
*/
void check_controls_epoch0( struct WellControls ** ctrls) {
// The injector
{
const struct WellControls * ctrls0 = ctrls[0];
BOOST_CHECK_EQUAL( 3 , ctrls0->num); // The number of controls for the injector == 3??
BOOST_CHECK_EQUAL( SURFACE_RATE , ctrls0->type[0] );
BOOST_CHECK_EQUAL( RESERVOIR_RATE , ctrls0->type[1] );
BOOST_CHECK_EQUAL( BHP , ctrls0->type[2] );
// The different targets
BOOST_CHECK_EQUAL( 100.0 / 86400 , ctrls0->target[0]);
BOOST_CHECK_EQUAL( 200.0 / 86400 , ctrls0->target[1]);
BOOST_CHECK_EQUAL( 400 * 100000 , ctrls0->target[2]);
// Which control is active
BOOST_CHECK_EQUAL( 0 , ctrls0->current );
// The phase distribution in the active target
BOOST_CHECK_EQUAL( 0 , ctrls0->distr[0] ); // Water
BOOST_CHECK_EQUAL( 0 , ctrls0->distr[1] ); // Oil
BOOST_CHECK_EQUAL( 1 , ctrls0->distr[2] ); // Gas
}
// The producer
{
const struct WellControls * ctrls1 = ctrls[1];
BOOST_CHECK_EQUAL( 2 , ctrls1->num); // The number of controls for the producer == 2??
BOOST_CHECK_EQUAL( SURFACE_RATE , ctrls1->type[0] );
BOOST_CHECK_EQUAL( BHP , ctrls1->type[1] );
// The different targets
BOOST_CHECK_EQUAL( -20000.0 / 86400 , ctrls1->target[0]);
BOOST_CHECK_EQUAL( 1000 * 100000 , ctrls1->target[1]);
// Which control is active
BOOST_CHECK_EQUAL( 0 , ctrls1->current );
// The phase distribution in the active target
BOOST_CHECK_EQUAL( 0 , ctrls1->distr[0] ); // Water
BOOST_CHECK_EQUAL( 1 , ctrls1->distr[1] ); // Oil
BOOST_CHECK_EQUAL( 0 , ctrls1->distr[2] ); // Gas
}
}
void check_controls_epoch1( struct WellControls ** ctrls) {
// The injector
{
const struct WellControls * ctrls0 = ctrls[0];
BOOST_CHECK_EQUAL( 3 , ctrls0->num); // The number of controls for the injector == 3??
BOOST_CHECK_EQUAL( SURFACE_RATE , ctrls0->type[0] );
BOOST_CHECK_EQUAL( RESERVOIR_RATE , ctrls0->type[1] );
BOOST_CHECK_EQUAL( BHP , ctrls0->type[2] );
// The different targets
BOOST_CHECK_CLOSE( 10.0 / 86400 , ctrls0->target[0] , 0.001);
BOOST_CHECK_CLOSE( 20.0 / 86400 , ctrls0->target[1] , 0.001);
BOOST_CHECK_CLOSE( 40 * 100000 , ctrls0->target[2] , 0.001);
// Which control is active
BOOST_CHECK_EQUAL( 1 , ctrls0->current );
// The phase distribution in the active target
BOOST_CHECK_EQUAL( 1 , ctrls0->distr[3] ); // Water
BOOST_CHECK_EQUAL( 0 , ctrls0->distr[4] ); // Oil
BOOST_CHECK_EQUAL( 0 , ctrls0->distr[5] ); // Gas
}
// The producer
{
const struct WellControls * ctrls1 = ctrls[1];
BOOST_CHECK_EQUAL( 3 , ctrls1->num); // The number of controls for the producer - now 3.
BOOST_CHECK_EQUAL( SURFACE_RATE , ctrls1->type[0] );
BOOST_CHECK_EQUAL( RESERVOIR_RATE , ctrls1->type[1] );
BOOST_CHECK_EQUAL( BHP , ctrls1->type[2] );
// The different targets
BOOST_CHECK_CLOSE( -999.0 / 86400 , ctrls1->target[0], 0.001);
BOOST_CHECK_CLOSE( -123.0 / 86400 , ctrls1->target[1], 0.001);
BOOST_CHECK_CLOSE( 100 * 100000 , ctrls1->target[2], 0.001);
// Which control is active
BOOST_CHECK_EQUAL( 1 , ctrls1->current );
// The phase distribution in the active target
BOOST_CHECK_EQUAL( 1 , ctrls1->distr[3] ); // Water
BOOST_CHECK_EQUAL( 1 , ctrls1->distr[4] ); // Oil
BOOST_CHECK_EQUAL( 1 , ctrls1->distr[5] ); // Gas
}
}
BOOST_AUTO_TEST_CASE(Constructor_Works) {
Opm::EclipseGridParser Deck("wells_manager_data.data");
Opm::GridManager gridManager(Deck);
Deck.setCurrentEpoch(0);
{
Opm::WellsManager wellsManager(Deck, *gridManager.c_grid(), NULL);
const Wells* wells = wellsManager.c_wells();
wells_static_check( wells );
check_controls_epoch0( wells->ctrls );
}
Deck.setCurrentEpoch(1);
{
Opm::WellsManager wellsManager(Deck, *gridManager.c_grid(), NULL);
const Wells* wells = wellsManager.c_wells();
wells_static_check( wells );
check_controls_epoch1( wells->ctrls );
}
}

View File

@ -3,15 +3,15 @@ GAS
WATER WATER
DIMENS DIMENS
15 5 5 / 10 10 5 /
GRID GRID
DXV DXV
15*1000.0 / 10*1000.0 /
DYV DYV
5*1000.0 / 10*1000.0 /
DZV DZV
10.0 20.0 30.0 10.0 5.0 / 10.0 20.0 30.0 10.0 5.0 /
@ -26,18 +26,31 @@ WELSPECS
COMPDAT COMPDAT
'INJ1' 1 1 1 1 'OPEN' 1 10.6092 0.5 / 'INJ1' 1 1 1 1 'OPEN' 1 10.6092 0.5 /
'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 / 'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 /
/
/
WCONPROD WCONPROD
'PROD1' 'OPEN' 'ORAT' 20000 4* 1000 / 'PROD1' 'OPEN' 'ORAT' 20000 4* 1000 /
/ /
WCONINJE WCONINJE
'INJ1' 'GAS' 'OPEN' 'RATE' 100000 100000 50000/ 'INJ1' 'GAS' 'OPEN' 'RATE' 100 200 400 /
/ /
DATES
1 'FEB' 2000 /
/
WCONPROD
'PROD1' 'OPEN' 'RESV' 999 3* 123 100 /
/
WCONINJE
'INJ1' 'WATER' 'OPEN' 'RESV' 10 20 40 /
/
TSTEP TSTEP
14.0 14.0
/ /