mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use shared SummaryState when instantiating WellsManager
This commit is contained in:
parent
c6af5f11b6
commit
a0aa7fcc2b
@ -200,6 +200,7 @@ namespace Opm
|
|||||||
/// Construct wells from deck.
|
/// Construct wells from deck.
|
||||||
WellsManager::WellsManager(const Opm::EclipseState& eclipseState,
|
WellsManager::WellsManager(const Opm::EclipseState& eclipseState,
|
||||||
const Opm::Schedule& schedule,
|
const Opm::Schedule& schedule,
|
||||||
|
const SummaryState& summaryState,
|
||||||
const size_t timeStep,
|
const size_t timeStep,
|
||||||
const UnstructuredGrid& grid)
|
const UnstructuredGrid& grid)
|
||||||
: w_(create_wells(0,0,0)), is_parallel_run_(false)
|
: w_(create_wells(0,0,0)), is_parallel_run_(false)
|
||||||
|
@ -85,6 +85,7 @@ namespace Opm
|
|||||||
template<class F2C, class FC>
|
template<class F2C, class FC>
|
||||||
WellsManager(const Opm::EclipseState& eclipseState,
|
WellsManager(const Opm::EclipseState& eclipseState,
|
||||||
const Opm::Schedule& schedule,
|
const Opm::Schedule& schedule,
|
||||||
|
const SummaryState& summaryState,
|
||||||
const size_t timeStep,
|
const size_t timeStep,
|
||||||
int num_cells,
|
int num_cells,
|
||||||
const int* global_cell,
|
const int* global_cell,
|
||||||
@ -97,6 +98,7 @@ namespace Opm
|
|||||||
|
|
||||||
WellsManager(const Opm::EclipseState& eclipseState,
|
WellsManager(const Opm::EclipseState& eclipseState,
|
||||||
const Opm::Schedule& schedule,
|
const Opm::Schedule& schedule,
|
||||||
|
const Opm::SummaryState& summaryState,
|
||||||
const size_t timeStep,
|
const size_t timeStep,
|
||||||
const UnstructuredGrid& grid);
|
const UnstructuredGrid& grid);
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
|
@ -267,6 +267,7 @@ template <class C2F, class FC>
|
|||||||
WellsManager::
|
WellsManager::
|
||||||
WellsManager(const Opm::EclipseState& eclipseState,
|
WellsManager(const Opm::EclipseState& eclipseState,
|
||||||
const Opm::Schedule& schedule,
|
const Opm::Schedule& schedule,
|
||||||
|
const Opm::SummaryState& summaryState,
|
||||||
const size_t timeStep,
|
const size_t timeStep,
|
||||||
int number_of_cells,
|
int number_of_cells,
|
||||||
const int* global_cell,
|
const int* global_cell,
|
||||||
|
@ -212,11 +212,13 @@ namespace Opm {
|
|||||||
const Grid& grid = ebosSimulator_.vanguard().grid();
|
const Grid& grid = ebosSimulator_.vanguard().grid();
|
||||||
const auto& defunct_well_names = ebosSimulator_.vanguard().defunctWellNames();
|
const auto& defunct_well_names = ebosSimulator_.vanguard().defunctWellNames();
|
||||||
const auto& eclState = ebosSimulator_.vanguard().eclState();
|
const auto& eclState = ebosSimulator_.vanguard().eclState();
|
||||||
|
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||||
wells_ecl_ = schedule().getWells2(timeStepIdx);
|
wells_ecl_ = schedule().getWells2(timeStepIdx);
|
||||||
|
|
||||||
// Create wells and well state.
|
// Create wells and well state.
|
||||||
wells_manager_.reset( new WellsManager (eclState,
|
wells_manager_.reset( new WellsManager (eclState,
|
||||||
schedule(),
|
schedule(),
|
||||||
|
summaryState,
|
||||||
timeStepIdx,
|
timeStepIdx,
|
||||||
Opm::UgGridHelpers::numCells(grid),
|
Opm::UgGridHelpers::numCells(grid),
|
||||||
Opm::UgGridHelpers::globalCell(grid),
|
Opm::UgGridHelpers::globalCell(grid),
|
||||||
@ -478,9 +480,11 @@ namespace Opm {
|
|||||||
// will not be present in a restart file. Use the previous time step to retrieve
|
// will not be present in a restart file. Use the previous time step to retrieve
|
||||||
// wells that have information written to the restart file.
|
// wells that have information written to the restart file.
|
||||||
const int report_step = std::max(eclState().getInitConfig().getRestartStep() - 1, 0);
|
const int report_step = std::max(eclState().getInitConfig().getRestartStep() - 1, 0);
|
||||||
|
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||||
|
|
||||||
WellsManager wellsmanager(eclState(),
|
WellsManager wellsmanager(eclState(),
|
||||||
schedule(),
|
schedule(),
|
||||||
|
summaryState,
|
||||||
report_step,
|
report_step,
|
||||||
Opm::UgGridHelpers::numCells(grid()),
|
Opm::UgGridHelpers::numCells(grid()),
|
||||||
Opm::UgGridHelpers::globalCell(grid()),
|
Opm::UgGridHelpers::globalCell(grid()),
|
||||||
|
@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
|
|||||||
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
double target_surfacerate_inj;
|
double target_surfacerate_inj;
|
||||||
double target_surfacerate_prod;
|
double target_surfacerate_prod;
|
||||||
@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
|
|||||||
|
|
||||||
// Both wells are open in the first schedule step
|
// Both wells are open in the first schedule step
|
||||||
{
|
{
|
||||||
Opm::WellsManager wellsManager(eclipseState , sched, 0, *vanguard.c_grid());
|
Opm::WellsManager wellsManager(eclipseState , sched, summaryState, 0, *vanguard.c_grid());
|
||||||
const Wells* wells = wellsManager.c_wells();
|
const Wells* wells = wellsManager.c_wells();
|
||||||
const struct WellControls* ctrls0 = wells->ctrls[0];
|
const struct WellControls* ctrls0 = wells->ctrls[0];
|
||||||
const struct WellControls* ctrls1 = wells->ctrls[1];
|
const struct WellControls* ctrls1 = wells->ctrls[1];
|
||||||
@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
|
|||||||
|
|
||||||
// The injector is stopped
|
// The injector is stopped
|
||||||
{
|
{
|
||||||
Opm::WellsManager wellsManager(eclipseState, sched, 1 , *vanguard.c_grid());
|
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 1 , *vanguard.c_grid());
|
||||||
const Wells* wells = wellsManager.c_wells();
|
const Wells* wells = wellsManager.c_wells();
|
||||||
const struct WellControls* ctrls0 = wells->ctrls[0];
|
const struct WellControls* ctrls0 = wells->ctrls[0];
|
||||||
const struct WellControls* ctrls1 = wells->ctrls[1];
|
const struct WellControls* ctrls1 = wells->ctrls[1];
|
||||||
|
@ -93,6 +93,7 @@ struct SetupTest {
|
|||||||
// Create wells.
|
// Create wells.
|
||||||
wells_manager.reset(new Opm::WellsManager(*ecl_state,
|
wells_manager.reset(new Opm::WellsManager(*ecl_state,
|
||||||
*schedule,
|
*schedule,
|
||||||
|
summaryState,
|
||||||
current_timestep,
|
current_timestep,
|
||||||
Opm::UgGridHelpers::numCells(grid),
|
Opm::UgGridHelpers::numCells(grid),
|
||||||
Opm::UgGridHelpers::globalCell(grid),
|
Opm::UgGridHelpers::globalCell(grid),
|
||||||
@ -108,6 +109,7 @@ struct SetupTest {
|
|||||||
std::unique_ptr<const Opm::WellsManager> wells_manager;
|
std::unique_ptr<const Opm::WellsManager> wells_manager;
|
||||||
std::unique_ptr<const Opm::EclipseState> ecl_state;
|
std::unique_ptr<const Opm::EclipseState> ecl_state;
|
||||||
std::unique_ptr<const Opm::Schedule> schedule;
|
std::unique_ptr<const Opm::Schedule> schedule;
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
int current_timestep;
|
int current_timestep;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,22 +184,22 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Opm::WellsManager wellsManager(eclipseState, sched, 0, *vanguard.c_grid());
|
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
|
||||||
wells_static_check(wellsManager.c_wells());
|
wells_static_check(wellsManager.c_wells());
|
||||||
check_controls_epoch0(wellsManager.c_wells()->ctrls);
|
check_controls_epoch0(wellsManager.c_wells()->ctrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Opm::WellsManager wellsManager(eclipseState, sched, 1, *vanguard.c_grid());
|
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 1, *vanguard.c_grid());
|
||||||
wells_static_check(wellsManager.c_wells());
|
wells_static_check(wellsManager.c_wells());
|
||||||
check_controls_epoch1(wellsManager.c_wells()->ctrls);
|
check_controls_epoch1(wellsManager.c_wells()->ctrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Opm::WellsManager wellsManager(eclipseState, sched, 3, *vanguard.c_grid());
|
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 3, *vanguard.c_grid());
|
||||||
const Wells* wells = wellsManager.c_wells();
|
const Wells* wells = wellsManager.c_wells();
|
||||||
|
|
||||||
// There is 3 wells in total in the deck at the 3rd schedule step.
|
// There is 3 wells in total in the deck at the 3rd schedule step.
|
||||||
@ -225,10 +225,11 @@ BOOST_AUTO_TEST_CASE(WellsEqual) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
|
|
||||||
Opm::WellsManager wellsManager0(eclipseState, sched, 0, *vanguard.c_grid());
|
Opm::WellsManager wellsManager0(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
|
||||||
Opm::WellsManager wellsManager1(eclipseState, sched, 1, *vanguard.c_grid());
|
Opm::WellsManager wellsManager1(eclipseState, sched, summaryState, 1, *vanguard.c_grid());
|
||||||
|
|
||||||
BOOST_CHECK(wells_equal( wellsManager0.c_wells() , wellsManager0.c_wells(),false));
|
BOOST_CHECK(wells_equal( wellsManager0.c_wells() , wellsManager0.c_wells(),false));
|
||||||
BOOST_CHECK(!wells_equal( wellsManager0.c_wells() , wellsManager1.c_wells(),false));
|
BOOST_CHECK(!wells_equal( wellsManager0.c_wells() , wellsManager1.c_wells(),false));
|
||||||
@ -245,11 +246,11 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
|
|
||||||
|
Opm::WellsManager wellsManager0(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
|
||||||
Opm::WellsManager wellsManager0(eclipseState, sched, 0, *vanguard.c_grid());
|
Opm::WellsManager wellsManager1(eclipseState, sched, summaryState, 1, *vanguard.c_grid());
|
||||||
Opm::WellsManager wellsManager1(eclipseState, sched, 1, *vanguard.c_grid());
|
|
||||||
|
|
||||||
BOOST_CHECK(well_controls_equal( wellsManager0.c_wells()->ctrls[0] , wellsManager0.c_wells()->ctrls[0] , false));
|
BOOST_CHECK(well_controls_equal( wellsManager0.c_wells()->ctrls[0] , wellsManager0.c_wells()->ctrls[0] , false));
|
||||||
BOOST_CHECK(well_controls_equal( wellsManager0.c_wells()->ctrls[1] , wellsManager0.c_wells()->ctrls[1] , false));
|
BOOST_CHECK(well_controls_equal( wellsManager0.c_wells()->ctrls[1] , wellsManager0.c_wells()->ctrls[1] , false));
|
||||||
@ -273,9 +274,9 @@ BOOST_AUTO_TEST_CASE(WellShutOK) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
|
Opm::WellsManager wellsManager2(eclipseState, sched, summaryState, 2, *vanguard.c_grid());
|
||||||
Opm::WellsManager wellsManager2(eclipseState, sched, 2, *vanguard.c_grid());
|
|
||||||
|
|
||||||
// Shut wells are not added to the deck. i.e number of wells should be 2-1
|
// Shut wells are not added to the deck. i.e number of wells should be 2-1
|
||||||
BOOST_CHECK(wellsManager2.c_wells()->number_of_wells == 1);
|
BOOST_CHECK(wellsManager2.c_wells()->number_of_wells == 1);
|
||||||
@ -294,10 +295,10 @@ BOOST_AUTO_TEST_CASE(WellSTOPOK) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
const Opm::Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
|
|
||||||
|
|
||||||
|
Opm::WellsManager wellsManager(eclipseState, sched, summaryState, 0, *vanguard.c_grid());
|
||||||
Opm::WellsManager wellsManager(eclipseState, sched, 0, *vanguard.c_grid());
|
|
||||||
|
|
||||||
const Wells* wells = wellsManager.c_wells();
|
const Wells* wells = wellsManager.c_wells();
|
||||||
const struct WellControls* ctrls0 = wells->ctrls[0];
|
const struct WellControls* ctrls0 = wells->ctrls[0];
|
||||||
@ -318,13 +319,13 @@ BOOST_AUTO_TEST_CASE(removeWellWithNoPerforation) {
|
|||||||
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, inputGrid);
|
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, inputGrid);
|
||||||
const Opm::Runspec runspec (deck);
|
const Opm::Runspec runspec (deck);
|
||||||
Opm::Schedule sched(deck, inputGrid, eclipseProperties, runspec);
|
Opm::Schedule sched(deck, inputGrid, eclipseProperties, runspec);
|
||||||
|
Opm::SummaryState summaryState;
|
||||||
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(*gridManager.c_grid(), inputGrid);
|
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(*gridManager.c_grid(), inputGrid);
|
||||||
sched.filterConnections(eclipseGrid);
|
sched.filterConnections(eclipseGrid);
|
||||||
|
|
||||||
Opm::WellsManager wellsManager0(eclipseState, sched, 0, *gridManager.c_grid());
|
Opm::WellsManager wellsManager0(eclipseState, sched, summaryState, 0, *gridManager.c_grid());
|
||||||
BOOST_CHECK_EQUAL( wellsManager0.c_wells()->number_of_wells, 1);
|
BOOST_CHECK_EQUAL( wellsManager0.c_wells()->number_of_wells, 1);
|
||||||
|
|
||||||
Opm::WellsManager wellsManager5(eclipseState, sched, 5, *gridManager.c_grid());
|
Opm::WellsManager wellsManager5(eclipseState, sched, summaryState, 5, *gridManager.c_grid());
|
||||||
BOOST_CHECK_EQUAL( wellsManager5.c_wells()->number_of_wells, 1);
|
BOOST_CHECK_EQUAL( wellsManager5.c_wells()->number_of_wells, 1);
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,14 @@ struct Setup
|
|||||||
, pu (Opm::phaseUsageFromDeck(es))
|
, pu (Opm::phaseUsageFromDeck(es))
|
||||||
, grid (es.getInputGrid())
|
, grid (es.getInputGrid())
|
||||||
, sched(deck, es)
|
, sched(deck, es)
|
||||||
|
, st()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Opm::EclipseState es;
|
Opm::EclipseState es;
|
||||||
Opm::PhaseUsage pu;
|
Opm::PhaseUsage pu;
|
||||||
Opm::GridManager grid;
|
Opm::GridManager grid;
|
||||||
Opm::Schedule sched;
|
Opm::Schedule sched;
|
||||||
|
Opm::SummaryState st;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -69,9 +71,7 @@ namespace {
|
|||||||
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
||||||
100.0*Opm::unit::barsa);
|
100.0*Opm::unit::barsa);
|
||||||
|
|
||||||
const Opm::WellsManager wmgr{
|
const Opm::WellsManager wmgr{setup.es, setup.sched, setup.st, timeStep, *setup.grid.c_grid()};
|
||||||
setup.es, setup.sched, timeStep, *setup.grid.c_grid()
|
|
||||||
};
|
|
||||||
|
|
||||||
state.init(wmgr.c_wells(), cpress, setup.sched,
|
state.init(wmgr.c_wells(), cpress, setup.sched,
|
||||||
setup.sched.getWells2(timeStep),
|
setup.sched.getWells2(timeStep),
|
||||||
|
Loading…
Reference in New Issue
Block a user