Use Schedule constructor.

This commit is contained in:
Joakim Hove 2017-10-29 21:06:19 +01:00 committed by Joakim Hove (IT SI SIB)
parent 63f4b6d734
commit 566f4fbb02
55 changed files with 267 additions and 106 deletions

View File

@ -138,25 +138,24 @@ int main(int argc, char** argv)
Opm::checkDeck(*deck, parser); Opm::checkDeck(*deck, parser);
Opm::MissingFeatures::checkKeywords(*deck); Opm::MissingFeatures::checkKeywords(*deck);
} }
std::shared_ptr<Opm::EclipseState> eclipseState =
std::make_shared< Opm::EclipseState > ( *deck, parseContext );
Opm::Runspec runspec( *deck ); Opm::Runspec runspec( *deck );
const auto& phases = runspec.phases(); const auto& phases = runspec.phases();
// Twophase cases std::shared_ptr<Opm::EclipseState> eclipseState = std::make_shared< Opm::EclipseState > ( *deck, parseContext );
std::shared_ptr<Opm::Schedule> schedule = std::make_shared<Opm::Schedule>(*deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), phases, parseContext);
std::shared_ptr<Opm::SummaryConfig> summary_config = std::make_shared<Opm::SummaryConfig>(*deck, *schedule, eclipseState->getTableManager(), parseContext);
// Twophase cases
if( phases.size() == 2 ) { if( phases.size() == 2 ) {
// oil-gas // oil-gas
if (phases.active( Opm::Phase::GAS )) if (phases.active( Opm::Phase::GAS ))
{ {
Opm::flowEbosGasOilSetDeck(*deck, *eclipseState); Opm::flowEbosGasOilSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosGasOilMain(argc, argv); return Opm::flowEbosGasOilMain(argc, argv);
} }
// oil-water // oil-water
else if ( phases.active( Opm::Phase::WATER ) ) else if ( phases.active( Opm::Phase::WATER ) )
{ {
Opm::flowEbosOilWaterSetDeck(*deck, *eclipseState); Opm::flowEbosOilWaterSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosOilWaterMain(argc, argv); return Opm::flowEbosOilWaterMain(argc, argv);
} }
else { else {
@ -167,17 +166,17 @@ int main(int argc, char** argv)
} }
// Polymer case // Polymer case
else if ( phases.active( Opm::Phase::POLYMER ) ) { else if ( phases.active( Opm::Phase::POLYMER ) ) {
Opm::flowEbosPolymerSetDeck(*deck, *eclipseState); Opm::flowEbosPolymerSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosPolymerMain(argc, argv); return Opm::flowEbosPolymerMain(argc, argv);
} }
// Solvent case // Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) { else if ( phases.active( Opm::Phase::SOLVENT ) ) {
Opm::flowEbosSolventSetDeck(*deck, *eclipseState); Opm::flowEbosSolventSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosSolventMain(argc, argv); return Opm::flowEbosSolventMain(argc, argv);
} }
// Blackoil case // Blackoil case
else if( phases.size() == 3 ) { else if( phases.size() == 3 ) {
Opm::flowEbosBlackoilSetDeck(*deck, *eclipseState); Opm::flowEbosBlackoilSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosBlackoilMain(argc, argv); return Opm::flowEbosBlackoilMain(argc, argv);
} }
else else

View File

@ -36,7 +36,6 @@ main(int argc, char** argv)
{ {
typedef UnstructuredGrid Grid; typedef UnstructuredGrid Grid;
typedef Opm::SimulatorFullyImplicitBlackoilMultiSegment<Grid> Simulator; typedef Opm::SimulatorFullyImplicitBlackoilMultiSegment<Grid> Simulator;
Opm::FlowMain<Grid, Simulator> mainfunc; Opm::FlowMain<Grid, Simulator> mainfunc;
return mainfunc.execute(argc, argv); return mainfunc.execute(argc, argv);
} }

View File

@ -88,6 +88,7 @@ try
// If we have a "deck_filename", grid and props will be read from that. // If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename"); bool use_deck = param.has("deck_filename");
std::shared_ptr< EclipseState > eclipseState; std::shared_ptr< EclipseState > eclipseState;
std::shared_ptr< Schedule > schedule;
std::unique_ptr<GridManager> grid; std::unique_ptr<GridManager> grid;
std::unique_ptr<BlackoilPropertiesInterface> props; std::unique_ptr<BlackoilPropertiesInterface> props;
std::unique_ptr<RockCompressibility> rock_comp; std::unique_ptr<RockCompressibility> rock_comp;
@ -104,6 +105,12 @@ try
std::string deck_filename = param.get<std::string>("deck_filename"); std::string deck_filename = param.get<std::string>("deck_filename");
auto deck = parser.parseFile(deck_filename , parseContext); auto deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset(new EclipseState(deck, parseContext)); eclipseState.reset(new EclipseState(deck, parseContext));
schedule.reset( new Schedule(deck,
eclipseState->getInputGrid(),
eclipseState->get3DProperties(),
eclipseState->runspec().phases(),
parseContext));
// Grid init // Grid init
grid.reset(new GridManager(eclipseState->getInputGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
@ -234,7 +241,7 @@ try
int step = 0; int step = 0;
SimulatorTimer simtimer; SimulatorTimer simtimer;
// Use timer for last epoch to obtain total time. // Use timer for last epoch to obtain total time.
const auto& timeMap = eclipseState->getSchedule().getTimeMap(); const auto& timeMap = schedule->getTimeMap();
simtimer.init(timeMap); simtimer.init(timeMap);
const double total_time = simtimer.totalTime(); const double total_time = simtimer.totalTime();
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) { for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
@ -247,7 +254,7 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush; << simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, well_state // Create new wells, well_state
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid()); WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
// @@@ HACK: we should really make a new well state and // @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step, // properly transfer old well state to it every report step,
// since number of wells may change etc. // since number of wells may change etc.

View File

@ -101,7 +101,7 @@ try
// If we have a "deck_filename", grid and props will be read from that. // If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename"); bool use_deck = param.has("deck_filename");
std::shared_ptr< EclipseState > eclipseState; std::shared_ptr< EclipseState > eclipseState;
std::shared_ptr< Schedule > schedule;
std::unique_ptr<GridManager> grid; std::unique_ptr<GridManager> grid;
std::unique_ptr<IncompPropertiesInterface> props; std::unique_ptr<IncompPropertiesInterface> props;
std::unique_ptr<RockCompressibility> rock_comp; std::unique_ptr<RockCompressibility> rock_comp;
@ -117,6 +117,11 @@ try
std::string deck_filename = param.get<std::string>("deck_filename"); std::string deck_filename = param.get<std::string>("deck_filename");
auto deck = parser.parseFile(deck_filename , parseContext); auto deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(deck, parseContext)); eclipseState.reset( new EclipseState(deck, parseContext));
schedule.reset( new Schedule(deck,
eclipseState->getInputGrid(),
eclipseState->get3DProperties(),
eclipseState->runspec().phases(),
parseContext));
// Grid init // Grid init
grid.reset(new GridManager(eclipseState->getInputGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
@ -244,7 +249,7 @@ try
rep = simulator.run(simtimer, *state, well_state); rep = simulator.run(simtimer, *state, well_state);
} else { } else {
// With a deck, we may have more epochs etc. // With a deck, we may have more epochs etc.
const auto& timeMap = eclipseState->getSchedule().getTimeMap(); const auto& timeMap = schedule->getTimeMap();
std::cout << "\n\n================ Starting main simulation loop ===============\n" std::cout << "\n\n================ Starting main simulation loop ===============\n"
<< " (number of report steps: " << " (number of report steps: "
@ -268,7 +273,7 @@ try
// << simtimer.numSteps() - step << ")\n\n" << std::flush; // << simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, well_state // Create new wells, well_state
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid()); WellsManager wells(*eclipseState, *schedule, reportStepIdx , *grid->c_grid());
// @@@ HACK: we should really make a new well state and // @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step, // properly transfer old well state to it every report step,
// since number of wells may change etc. // since number of wells may change etc.

View File

@ -107,6 +107,7 @@ try
std::unique_ptr<RockCompressibility> rock_comp; std::unique_ptr<RockCompressibility> rock_comp;
std::unique_ptr<TwophaseState> state; std::unique_ptr<TwophaseState> state;
std::shared_ptr< EclipseState > eclipseState; std::shared_ptr< EclipseState > eclipseState;
std::shared_ptr< Schedule > schedule;
// bool check_well_controls = false; // bool check_well_controls = false;
// int max_well_control_iterations = 0; // int max_well_control_iterations = 0;
@ -116,6 +117,11 @@ try
Opm::ParseContext parseContext; Opm::ParseContext parseContext;
auto deck = parser.parseFile(deck_filename, parseContext); auto deck = parser.parseFile(deck_filename, parseContext);
eclipseState.reset(new EclipseState(deck , parseContext)); eclipseState.reset(new EclipseState(deck , parseContext));
schedule.reset( new Schedule(deck,
eclipseState->getInputGrid(),
eclipseState->get3DProperties(),
eclipseState->runspec().phases(),
parseContext));
// Grid init // Grid init
grid.reset(new GridManager(eclipseState->getInputGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
@ -248,7 +254,7 @@ try
} else { } else {
// With a deck, we may have more report steps etc. // With a deck, we may have more report steps etc.
WellState well_state; WellState well_state;
const auto& timeMap = eclipseState->getSchedule().getTimeMap(); const auto& timeMap = schedule->getTimeMap();
SimulatorTimer simtimer; SimulatorTimer simtimer;
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) { for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
// Report on start of report step. // Report on start of report step.
@ -257,7 +263,7 @@ try
<< timeMap.numTimesteps() - reportStepIdx << ")\n\n" << std::flush; << timeMap.numTimesteps() - reportStepIdx << ")\n\n" << std::flush;
// Create new wells, well_state // Create new wells, well_state
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid()); WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
// @@@ HACK: we should really make a new well state and // @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step, // properly transfer old well state to it every report step,
// since number of wells may change etc. // since number of wells may change etc.

View File

@ -96,6 +96,7 @@ try
Opm::PolymerProperties poly_props; Opm::PolymerProperties poly_props;
Opm::Deck deck; Opm::Deck deck;
std::unique_ptr< EclipseState > eclipseState; std::unique_ptr< EclipseState > eclipseState;
std::unique_ptr< Schedule> schedule;
// bool check_well_controls = false; // bool check_well_controls = false;
// int max_well_control_iterations = 0; // int max_well_control_iterations = 0;
double gravity[3] = { 0.0 }; double gravity[3] = { 0.0 };
@ -105,7 +106,7 @@ try
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }}); Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
deck = parser.parseFile(deck_filename , parseContext); deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(deck , parseContext) ); eclipseState.reset( new EclipseState(deck , parseContext) );
schedule.reset( new Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext ));
// Grid init // Grid init
grid.reset(new GridManager(eclipseState->getInputGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
@ -282,13 +283,13 @@ try
// Create new wells, polymer inflow controls. // Create new wells, polymer inflow controls.
eclipseState.reset( new EclipseState( deck ) ); eclipseState.reset( new EclipseState( deck ) );
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid()); WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow; boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
if (use_wpolymer) { if (use_wpolymer) {
if (wells.c_wells() == 0) { if (wells.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells."); OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
} }
polymer_inflow.reset(new PolymerInflowFromDeck(*eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum())); polymer_inflow.reset(new PolymerInflowFromDeck( *schedule, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
} else { } else {
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day, polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day, param.getDefault("poly_end_days", 800.0)*Opm::unit::day,

View File

@ -94,6 +94,7 @@ try
boost::scoped_ptr<IncompPropertiesInterface> props; boost::scoped_ptr<IncompPropertiesInterface> props;
boost::scoped_ptr<RockCompressibility> rock_comp; boost::scoped_ptr<RockCompressibility> rock_comp;
std::shared_ptr< EclipseState > eclipseState; std::shared_ptr< EclipseState > eclipseState;
std::shared_ptr<Schedule> schedule;
std::unique_ptr<PolymerState> state; std::unique_ptr<PolymerState> state;
Opm::PolymerProperties poly_props; Opm::PolymerProperties poly_props;
// bool check_well_controls = false; // bool check_well_controls = false;
@ -106,7 +107,7 @@ try
deck = parser.parseFile(deck_filename , parseContext); deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset(new Opm::EclipseState(deck , parseContext)); eclipseState.reset(new Opm::EclipseState(deck , parseContext));
schedule.reset( new Opm::Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext));
// Grid init // Grid init
grid.reset(new GridManager(eclipseState->getInputGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
@ -295,7 +296,7 @@ try
WellState well_state; WellState well_state;
int step = 0; int step = 0;
const auto& timeMap = eclipseState->getSchedule().getTimeMap(); const auto& timeMap = schedule->getTimeMap();
SimulatorTimer simtimer; SimulatorTimer simtimer;
simtimer.init(timeMap); simtimer.init(timeMap);
// Check for WPOLYMER presence in last epoch to decide // Check for WPOLYMER presence in last epoch to decide
@ -316,13 +317,13 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush; << simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, polymer inflow controls. // Create new wells, polymer inflow controls.
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid()); WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow; boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
if (use_wpolymer) { if (use_wpolymer) {
if (wells.c_wells() == 0) { if (wells.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells."); OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
} }
polymer_inflow.reset(new PolymerInflowFromDeck(*eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum())); polymer_inflow.reset(new PolymerInflowFromDeck(*schedule, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
} else { } else {
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day, polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day, param.getDefault("poly_end_days", 800.0)*Opm::unit::day,

View File

@ -38,6 +38,7 @@ try
Opm::Parser parser; Opm::Parser parser;
Opm::Deck deck = parser.parseFile(file_name , parseContext); Opm::Deck deck = parser.parseFile(file_name , parseContext);
Opm::EclipseState eclipseState(deck , parseContext); Opm::EclipseState eclipseState(deck , parseContext);
Opm::Schedule schedule(deck, eclipseState.getInputGrid(), eclipseState.get3DProperties(), eclipseState.runspec().phases(), parseContext);
std::cout << "Done!" << std::endl; std::cout << "Done!" << std::endl;
// Setup grid // Setup grid
@ -48,7 +49,7 @@ try
RockCompressibility rock_comp(eclipseState); RockCompressibility rock_comp(eclipseState);
// Finally handle the wells // Finally handle the wells
WellsManager wells(eclipseState , 0 , *grid.c_grid()); WellsManager wells(eclipseState , schedule, 0 , *grid.c_grid());
double gravity[3] = {0.0, 0.0, parameters.getDefault<double>("gravity", 0.0)}; double gravity[3] = {0.0, 0.0, parameters.getDefault<double>("gravity", 0.0)};
Opm::LinearSolverFactory linsolver(parameters); Opm::LinearSolverFactory linsolver(parameters);

View File

@ -68,11 +68,13 @@ namespace Opm {
const StandardWells& std_wells, const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const Opm::EclipseState > eclState, std::shared_ptr< const Opm::EclipseState > eclState,
std::shared_ptr< const Opm::Schedule> schedule,
std::shared_ptr< const Opm::SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
eclState, has_disgas, has_vapoil, terminal_output) eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)
{ {
} }
}; };

View File

@ -153,6 +153,8 @@ namespace Opm {
const WellModel& well_model, const WellModel& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output); const bool terminal_output);

View File

@ -106,6 +106,8 @@ typedef Eigen::Array<double,
const WellModel& well_model, const WellModel& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const Opm::EclipseState > eclState, std::shared_ptr< const Opm::EclipseState > eclState,
std::shared_ptr<const Opm::Schedule> schedule,
std::shared_ptr<const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)

View File

@ -89,6 +89,8 @@ namespace Opm {
const MultisegmentWells& well_model, const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr<const Schedule> schedule,
std::shared_ptr<const SummaryConfig> summaryConfig,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output); const bool terminal_output);

View File

@ -65,11 +65,13 @@ namespace Opm {
const MultisegmentWells& well_model, const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr<const Schedule> schedule,
std::shared_ptr<const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver,
eclState, has_disgas, has_vapoil, terminal_output) eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)
{ {
} }

View File

@ -72,11 +72,13 @@ namespace Opm {
const StandardWells& std_wells, const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState> eclState, std::shared_ptr< const EclipseState> eclState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
eclState, has_disgas, has_vapoil, terminal_output), eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output),
state0_(3), state0_(3),
max_dp_rel_(std::numeric_limits<double>::infinity()), max_dp_rel_(std::numeric_limits<double>::infinity()),
scaling_{ ADB::null(), ADB::null(), ADB::null() } scaling_{ ADB::null(), ADB::null(), ADB::null() }

View File

@ -233,17 +233,19 @@ namespace Opm {
const StandardWells& std_wells, const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr<const EclipseState> eclState, std::shared_ptr<const EclipseState> eclState,
std::shared_ptr<const Schedule> schedule,
std::shared_ptr<const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
eclState, has_disgas, has_vapoil, terminal_output) eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)
, graph_(Base::ops_) , graph_(Base::ops_)
, props_(dynamic_cast<const BlackoilPropsAdFromDeck&>(fluid)) // TODO: remove the need for this cast. , props_(dynamic_cast<const BlackoilPropsAdFromDeck&>(fluid)) // TODO: remove the need for this cast.
, state0_{ ReservoirState(0, 0, 0), WellState(), V(), V() } , state0_{ ReservoirState(0, 0, 0), WellState(), V(), V() }
, state_{ ReservoirState(0, 0, 0), WellState(), V(), V() } , state_{ ReservoirState(0, 0, 0), WellState(), V(), V() }
, tr_model_(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver, , tr_model_(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
eclState, has_disgas, has_vapoil, terminal_output) eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)
{ {
// Set up the common parts of the mass balance equations // Set up the common parts of the mass balance equations
// for each active phase. // for each active phase.

View File

@ -84,13 +84,15 @@ namespace Opm {
const WellModel well_model, const WellModel well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: pressure_model_(new PressureModel(param, grid, fluid, geo, rock_comp_props, well_model, : pressure_model_(new PressureModel(param, grid, fluid, geo, rock_comp_props, well_model,
linsolver, eclState, has_disgas, has_vapoil, terminal_output)), linsolver, eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)),
transport_model_(new TransportModel(param, grid, fluid, geo, rock_comp_props, well_model, transport_model_(new TransportModel(param, grid, fluid, geo, rock_comp_props, well_model,
linsolver, eclState, has_disgas, has_vapoil, terminal_output)), linsolver, eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)),
// TODO: fix solver parameters for pressure and transport solver. // TODO: fix solver parameters for pressure and transport solver.
pressure_solver_(typename PressureSolver::SolverParameters(), std::move(pressure_model_)), pressure_solver_(typename PressureSolver::SolverParameters(), std::move(pressure_model_)),
transport_solver_(typename TransportSolver::SolverParameters(), std::move(transport_model_)), transport_solver_(typename TransportSolver::SolverParameters(), std::move(transport_model_)),

View File

@ -73,6 +73,8 @@ namespace Opm {
const StandardWellsSolvent& well_model, const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output, const bool terminal_output,

View File

@ -79,13 +79,15 @@ namespace Opm {
const StandardWellsSolvent& well_model, const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclState, std::shared_ptr< const EclipseState > eclState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output, const bool terminal_output,
const bool has_solvent, const bool has_solvent,
const bool is_miscible) const bool is_miscible)
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver,
eclState, has_disgas, has_vapoil, terminal_output), eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output),
has_solvent_(has_solvent), has_solvent_(has_solvent),
solvent_pos_(detail::solventPos(fluid.phaseUsage())), solvent_pos_(detail::solventPos(fluid.phaseUsage())),
solvent_props_(solvent_props), solvent_props_(solvent_props),

View File

@ -66,11 +66,13 @@ namespace Opm {
const StandardWells& std_wells, const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr<const EclipseState> eclState, std::shared_ptr<const EclipseState> eclState,
std::shared_ptr<const Schedule> schedule,
std::shared_ptr<const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver, : Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
eclState, has_disgas, has_vapoil, terminal_output) eclState, schedule, summary_config, has_disgas, has_vapoil, terminal_output)
{ {
} }

View File

@ -216,6 +216,8 @@ namespace Opm
// readDeckInput() // readDeckInput()
std::shared_ptr<Deck> deck_; std::shared_ptr<Deck> deck_;
std::shared_ptr<EclipseState> eclipse_state_; std::shared_ptr<EclipseState> eclipse_state_;
std::shared_ptr<Schedule> schedule_;
std::shared_ptr<SummaryConfig> summary_config_;
// setupGridAndProps() // setupGridAndProps()
std::unique_ptr<GridInit<Grid>> grid_init_; std::unique_ptr<GridInit<Grid>> grid_init_;
std::shared_ptr<MaterialLawManager> material_law_manager_; std::shared_ptr<MaterialLawManager> material_law_manager_;
@ -427,7 +429,7 @@ namespace Opm
OpmLog::addBackend( "STREAMLOG", streamLog); OpmLog::addBackend( "STREAMLOG", streamLog);
std::shared_ptr<StreamLog> debugLog = std::make_shared<EclipsePRTLog>(debugFile, Log::DefaultMessageTypes, false, output_cout_); std::shared_ptr<StreamLog> debugLog = std::make_shared<EclipsePRTLog>(debugFile, Log::DefaultMessageTypes, false, output_cout_);
OpmLog::addBackend( "DEBUGLOG" , debugLog); OpmLog::addBackend( "DEBUGLOG" , debugLog);
const auto& msgLimits = eclipse_state_->getSchedule().getMessageLimits(); const auto& msgLimits = schedule_->getMessageLimits();
const std::map<int64_t, int> limits = {{Log::MessageType::Note, msgLimits.getCommentPrintLimit(0)}, const std::map<int64_t, int> limits = {{Log::MessageType::Note, msgLimits.getCommentPrintLimit(0)},
{Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)}, {Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)},
{Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)}, {Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)},
@ -501,6 +503,15 @@ namespace Opm
} }
eclipse_state_.reset(new EclipseState(*deck_, parseContext)); eclipse_state_.reset(new EclipseState(*deck_, parseContext));
schedule_.reset(new Schedule(*deck_,
eclipse_state_->getInputGrid(),
eclipse_state_->get3DProperties(),
eclipse_state_->runspec().phases(),
parseContext));
summary_config_.reset(new SummaryConfig(*deck_,
*schedule_,
eclipse_state_->getTableManager(),
parseContext));
} }
catch (const std::invalid_argument& e) { catch (const std::invalid_argument& e) {
std::cerr << "Failed to create valid EclipseState object. See logfile: " << logFile_ << std::endl; std::cerr << "Failed to create valid EclipseState object. See logfile: " << logFile_ << std::endl;
@ -682,7 +693,7 @@ namespace Opm
// and initilialize new properties and states for it. // and initilialize new properties and states for it.
if (must_distribute_) { if (must_distribute_) {
defunct_well_names_ = defunct_well_names_ =
distributeGridAndData(grid_init_->grid(), *deck_, *eclipse_state_, distributeGridAndData(grid_init_->grid(), *deck_, *eclipse_state_, *schedule_,
*state_, *fluidprops_, *geoprops_, *state_, *fluidprops_, *geoprops_,
material_law_manager_, threshold_pressures_, material_law_manager_, threshold_pressures_,
parallel_information_, use_local_perm_); parallel_information_, use_local_perm_);
@ -752,7 +763,10 @@ namespace Opm
if( output && output_ecl && output_cout_) if( output && output_ecl && output_cout_)
{ {
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid(); const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
eclipse_writer_.reset(new EclipseIO(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid ))); eclipse_writer_.reset(new EclipseIO(*eclipse_state_,
UgGridHelpers::createEclipseGrid( grid , inputGrid ),
*schedule_,
*summary_config_ ));
eclipse_writer_->writeInitial(geoprops_->simProps(grid), eclipse_writer_->writeInitial(geoprops_->simProps(grid),
geoprops_->nonCartesianConnections()); geoprops_->nonCartesianConnections());
} }
@ -770,6 +784,8 @@ namespace Opm
output_writer_.reset(new OutputWriter(grid_init_->grid(), output_writer_.reset(new OutputWriter(grid_init_->grid(),
param_, param_,
*eclipse_state_, *eclipse_state_,
*schedule_,
*summary_config_,
std::move(eclipse_writer_), std::move(eclipse_writer_),
Opm::phaseUsageFromDeck(*deck_))); Opm::phaseUsageFromDeck(*deck_)));
} }
@ -815,8 +831,7 @@ namespace Opm
// Returns EXIT_SUCCESS if it does not throw. // Returns EXIT_SUCCESS if it does not throw.
int runSimulator() int runSimulator()
{ {
const auto& schedule = eclipse_state_->getSchedule(); const auto& timeMap = schedule_->getTimeMap();
const auto& timeMap = schedule.getTimeMap();
auto& ioConfig = eclipse_state_->getIOConfig(); auto& ioConfig = eclipse_state_->getIOConfig();
SimulatorTimer simtimer; SimulatorTimer simtimer;
@ -904,6 +919,8 @@ namespace Opm
Base::deck_->hasKeyword("DISGAS"), Base::deck_->hasKeyword("DISGAS"),
Base::deck_->hasKeyword("VAPOIL"), Base::deck_->hasKeyword("VAPOIL"),
Base::eclipse_state_, Base::eclipse_state_,
Base::schedule_,
Base::summary_config_,
*Base::output_writer_, *Base::output_writer_,
Base::threshold_pressures_, Base::threshold_pressures_,
Base::defunct_well_names_)); Base::defunct_well_names_));

View File

@ -329,7 +329,7 @@ namespace Opm
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::StdoutMessageTypes); std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::StdoutMessageTypes);
OpmLog::addBackend( "STREAMLOG", streamLog); OpmLog::addBackend( "STREAMLOG", streamLog);
const auto& msgLimits = eclState().getSchedule().getMessageLimits(); const auto& msgLimits = schedule().getMessageLimits();
const std::map<int64_t, int> limits = {{Log::MessageType::Note, msgLimits.getCommentPrintLimit(0)}, const std::map<int64_t, int> limits = {{Log::MessageType::Note, msgLimits.getCommentPrintLimit(0)},
{Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)}, {Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)},
{Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)}, {Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)},
@ -462,6 +462,12 @@ namespace Opm
EclipseState& eclState() EclipseState& eclState()
{ return ebosSimulator_->gridManager().eclState(); } { return ebosSimulator_->gridManager().eclState(); }
const Schedule& schedule() const
{ return ebosSimulator_->gridManager().schedule(); }
const SummaryConfig& summaryConfig() const
{ return ebosSimulator_->gridManager().summaryConfig(); }
// Initialise the reservoir state. Updated fluid props for SWATINIT. // Initialise the reservoir state. Updated fluid props for SWATINIT.
// Writes to: // Writes to:
// state_ // state_
@ -613,7 +619,10 @@ namespace Opm
exportNncStructure_(); exportNncStructure_();
const EclipseGrid& inputGrid = eclState().getInputGrid(); const EclipseGrid& inputGrid = eclState().getInputGrid();
eclIO_.reset(new EclipseIO(eclState(), UgGridHelpers::createEclipseGrid( this->globalGrid() , inputGrid ))); eclIO_.reset(new EclipseIO(eclState(),
UgGridHelpers::createEclipseGrid( this->globalGrid() , inputGrid ),
schedule(),
summaryConfig()));
eclIO_->writeInitial(computeLegacySimProps_(), nnc_); eclIO_->writeInitial(computeLegacySimProps_(), nnc_);
} }
} }
@ -629,6 +638,8 @@ namespace Opm
output_writer_.reset(new OutputWriter(grid(), output_writer_.reset(new OutputWriter(grid(),
param_, param_,
eclState(), eclState(),
schedule(),
summaryConfig(),
std::move(eclIO_), std::move(eclIO_),
Opm::phaseUsageFromDeck(deck())) ); Opm::phaseUsageFromDeck(deck())) );
} }
@ -637,7 +648,7 @@ namespace Opm
// Returns EXIT_SUCCESS if it does not throw. // Returns EXIT_SUCCESS if it does not throw.
int runSimulator() int runSimulator()
{ {
const auto& schedule = eclState().getSchedule(); const auto& schedule = this->schedule();
const auto& timeMap = schedule.getTimeMap(); const auto& timeMap = schedule.getTimeMap();
auto& ioConfig = eclState().getIOConfig(); auto& ioConfig = eclState().getIOConfig();
SimulatorTimer simtimer; SimulatorTimer simtimer;

View File

@ -146,6 +146,8 @@ namespace Opm
Base::deck_->hasKeyword("PLYSHLOG"), Base::deck_->hasKeyword("PLYSHLOG"),
Base::deck_->hasKeyword("SHRATE"), Base::deck_->hasKeyword("SHRATE"),
Base::eclipse_state_, Base::eclipse_state_,
Base::schedule_,
Base::summary_config_,
*Base::output_writer_, *Base::output_writer_,
Base::deck_, Base::deck_,
Base::threshold_pressures_)); Base::threshold_pressures_));

View File

@ -36,6 +36,8 @@ namespace Opm
protected: protected:
using Base = FlowMainBase<FlowMainSequential<Grid, Simulator>, Grid, Simulator>; using Base = FlowMainBase<FlowMainSequential<Grid, Simulator>, Grid, Simulator>;
using Base::eclipse_state_; using Base::eclipse_state_;
using Base::schedule_;
using Base::summary_config_;
using Base::param_; using Base::param_;
using Base::fis_solver_; using Base::fis_solver_;
using Base::parallel_information_; using Base::parallel_information_;
@ -127,6 +129,8 @@ namespace Opm
Base::deck_->hasKeyword("DISGAS"), Base::deck_->hasKeyword("DISGAS"),
Base::deck_->hasKeyword("VAPOIL"), Base::deck_->hasKeyword("VAPOIL"),
Base::eclipse_state_, Base::eclipse_state_,
Base::schedule_,
Base::summary_config_,
*Base::output_writer_, *Base::output_writer_,
Base::threshold_pressures_)); Base::threshold_pressures_));
} }

View File

@ -101,6 +101,8 @@ namespace Opm
Base::deck_->hasKeyword("DISGAS"), Base::deck_->hasKeyword("DISGAS"),
Base::deck_->hasKeyword("VAPOIL"), Base::deck_->hasKeyword("VAPOIL"),
Base::eclipse_state_, Base::eclipse_state_,
Base::schedule_,
Base::summary_config_,
*Base::output_writer_, *Base::output_writer_,
Base::deck_, Base::deck_,
Base::threshold_pressures_, Base::threshold_pressures_,

View File

@ -81,6 +81,7 @@ namespace Opm
public: public:
ParallelDebugOutput ( const GridImpl& grid, ParallelDebugOutput ( const GridImpl& grid,
const EclipseState& /* eclipseState */, const EclipseState& /* eclipseState */,
const Schedule&,
const int, const int,
const Opm::PhaseUsage& ) const Opm::PhaseUsage& )
: grid_( grid ) {} : grid_( grid ) {}
@ -248,10 +249,12 @@ namespace Opm
/// \param permeability The permeabilities for the global(!) view. /// \param permeability The permeabilities for the global(!) view.
ParallelDebugOutput( const Dune::CpGrid& otherGrid, ParallelDebugOutput( const Dune::CpGrid& otherGrid,
const EclipseState& eclipseState, const EclipseState& eclipseState,
const Schedule& schedule,
const int numPhases, const int numPhases,
const Opm::PhaseUsage& phaseUsage) const Opm::PhaseUsage& phaseUsage)
: grid_(), : grid_(),
eclipseState_( eclipseState ), eclipseState_( eclipseState ),
schedule_(schedule),
globalCellData_(new data::Solution), globalCellData_(new data::Solution),
isIORank_(true), isIORank_(true),
phaseUsage_(phaseUsage) phaseUsage_(phaseUsage)
@ -605,6 +608,7 @@ namespace Opm
const DynamicListEconLimited dynamic_list_econ_limited; const DynamicListEconLimited dynamic_list_econ_limited;
// Create wells and well state. // Create wells and well state.
WellsManager wells_manager(eclipseState_, WellsManager wells_manager(eclipseState_,
schedule_,
wellStateStepNumber, wellStateStepNumber,
Opm::UgGridHelpers::numCells( globalGrid ), Opm::UgGridHelpers::numCells( globalGrid ),
Opm::UgGridHelpers::globalCell( globalGrid ), Opm::UgGridHelpers::globalCell( globalGrid ),
@ -675,6 +679,7 @@ namespace Opm
protected: protected:
std::unique_ptr< Dune::CpGrid > grid_; std::unique_ptr< Dune::CpGrid > grid_;
const EclipseState& eclipseState_; const EclipseState& eclipseState_;
const Schedule& schedule_;
P2PCommunicatorType toIORankComm_; P2PCommunicatorType toIORankComm_;
IndexMapType globalIndex_; IndexMapType globalIndex_;
IndexMapType localIndexMap_; IndexMapType localIndexMap_;

View File

@ -43,7 +43,8 @@ inline std::unordered_set<std::string>
distributeGridAndData( Grid& , distributeGridAndData( Grid& ,
const Opm::Deck& , const Opm::Deck& ,
const EclipseState& , const EclipseState& ,
BlackoilState& , const Schedule&,
BlackoilState&,
BlackoilPropsAdFromDeck& , BlackoilPropsAdFromDeck& ,
DerivedGeology&, DerivedGeology&,
std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>&, std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>&,
@ -489,6 +490,7 @@ std::unordered_set<std::string>
distributeGridAndData( Dune::CpGrid& grid, distributeGridAndData( Dune::CpGrid& grid,
const Opm::Deck& deck, const Opm::Deck& deck,
const EclipseState& eclipseState, const EclipseState& eclipseState,
const Schedule& schedule,
BlackoilState& state, BlackoilState& state,
BlackoilPropsAdFromDeck& properties, BlackoilPropsAdFromDeck& properties,
DerivedGeology& geology, DerivedGeology& geology,
@ -502,8 +504,8 @@ distributeGridAndData( Dune::CpGrid& grid,
// distribute the grid and switch to the distributed view // distribute the grid and switch to the distributed view
using std::get; using std::get;
auto my_defunct_wells = get<1>(grid.loadBalance(&eclipseState, auto wells = schedule.getWells();
geology.transmissibility().data())); auto my_defunct_wells = get<1>(grid.loadBalance(&wells, geology.transmissibility().data()));
grid.switchToDistributedView(); grid.switchToDistributedView();
std::vector<int> compressedToCartesianIdx; std::vector<int> compressedToCartesianIdx;
Opm::createGlobalCellArray(grid, compressedToCartesianIdx); Opm::createGlobalCellArray(grid, compressedToCartesianIdx);

View File

@ -131,6 +131,8 @@ namespace Opm
const bool disgas, const bool disgas,
const bool vapoil, const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
OutputWriter& output_writer, OutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names); const std::unordered_set<std::string>& defunct_well_names);
@ -212,6 +214,8 @@ namespace Opm
bool terminal_output_; bool terminal_output_;
// eclipse_state // eclipse_state
std::shared_ptr<EclipseState> eclipse_state_; std::shared_ptr<EclipseState> eclipse_state_;
std::shared_ptr<Schedule> schedule_;
std::shared_ptr<SummaryConfig> summary_config_;
// output_writer // output_writer
OutputWriter& output_writer_; OutputWriter& output_writer_;
RateConverterType rateConverter_; RateConverterType rateConverter_;

View File

@ -43,6 +43,8 @@ namespace Opm
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
OutputWriter& output_writer, OutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names) const std::unordered_set<std::string>& defunct_well_names)
@ -59,6 +61,8 @@ namespace Opm
has_vapoil_(has_vapoil), has_vapoil_(has_vapoil),
terminal_output_(param.getDefault("output_terminal", true)), terminal_output_(param.getDefault("output_terminal", true)),
eclipse_state_(eclipse_state), eclipse_state_(eclipse_state),
schedule_(schedule),
summary_config_(summary_config),
output_writer_(output_writer), output_writer_(output_writer),
rateConverter_(props_.phaseUsage(), std::vector<int>(AutoDiffGrid::numCells(grid_), 0)), rateConverter_(props_.phaseUsage(), std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
threshold_pressures_by_face_(threshold_pressures_by_face), threshold_pressures_by_face_(threshold_pressures_by_face),
@ -110,16 +114,14 @@ namespace Opm
tstep_os.open(tstep_filename.c_str()); tstep_os.open(tstep_filename.c_str());
} }
const auto& schedule = eclipse_state_->getSchedule();
// adaptive time stepping // adaptive time stepping
const auto& events = schedule.getEvents(); const auto& events = schedule_->getEvents();
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping; std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
if( param_.getDefault("timestep.adaptive", true ) ) if( param_.getDefault("timestep.adaptive", true ) )
{ {
if (param_.getDefault("use_TUNING", false)) { if (param_.getDefault("use_TUNING", false)) {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule.getTuning(), timer.currentStepNum(), param_, terminal_output_ ) ); adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule_->getTuning(), timer.currentStepNum(), param_, terminal_output_ ) );
} else { } else {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) ); adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
} }
@ -172,6 +174,7 @@ namespace Opm
// Create wells and well state. // Create wells and well state.
WellsManager wells_manager(*eclipse_state_, WellsManager wells_manager(*eclipse_state_,
*schedule_,
timer.currentStepNum(), timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid_), Opm::UgGridHelpers::numCells(grid_),
Opm::UgGridHelpers::globalCell(grid_), Opm::UgGridHelpers::globalCell(grid_),
@ -275,7 +278,7 @@ namespace Opm
// section // section
// //
// TODO (?): handle the parallel case (maybe this works out of the box) // TODO (?): handle the parallel case (maybe this works out of the box)
const auto& miniDeck = schedule.getModifierDeck(nextTimeStepIdx); const auto& miniDeck = schedule_->getModifierDeck(nextTimeStepIdx);
eclipse_state_->applyModifierDeck(miniDeck); eclipse_state_->applyModifierDeck(miniDeck);
geo_.update(grid_, props_, *eclipse_state_, gravity_); geo_.update(grid_, props_, *eclipse_state_, gravity_);
} }
@ -328,7 +331,7 @@ namespace Opm
prev_well_state = well_state; prev_well_state = well_state;
asImpl().updateListEconLimited(solver, eclipse_state_->getSchedule(), timer.currentStepNum(), wells, asImpl().updateListEconLimited(solver, *schedule_, timer.currentStepNum(), wells,
well_state, dynamic_list_econ_limited); well_state, dynamic_list_econ_limited);
} }
@ -474,6 +477,8 @@ namespace Opm
well_model, well_model,
solver_, solver_,
eclipse_state_, eclipse_state_,
schedule_,
summary_config_,
has_disgas_, has_disgas_,
has_vapoil_, has_vapoil_,
terminal_output_)); terminal_output_));
@ -494,7 +499,7 @@ namespace Opm
{ {
typedef SimFIBODetails::WellMap WellMap; typedef SimFIBODetails::WellMap WellMap;
const auto w_ecl = eclipse_state_->getSchedule().getWells(step); const auto w_ecl = schedule_->getWells(step);
const WellMap& wmap = SimFIBODetails::mapWells(w_ecl); const WellMap& wmap = SimFIBODetails::mapWells(w_ecl);
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap); const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap);

View File

@ -61,11 +61,13 @@ public:
const bool disgas, const bool disgas,
const bool vapoil, const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names) const std::unordered_set<std::string>& defunct_well_names)
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil, : Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
eclipse_state, output_writer, threshold_pressures_by_face, defunct_well_names) eclipse_state, schedule, summaryConfig, output_writer, threshold_pressures_by_face, defunct_well_names)
{} {}
}; };

View File

@ -177,16 +177,14 @@ public:
tstep_os.open(tstep_filename.c_str()); tstep_os.open(tstep_filename.c_str());
} }
const auto& schedule = eclState().getSchedule();
// adaptive time stepping // adaptive time stepping
const auto& events = schedule.getEvents(); const auto& events = schedule().getEvents();
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping; std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
if( param_.getDefault("timestep.adaptive", true ) ) if( param_.getDefault("timestep.adaptive", true ) )
{ {
if (param_.getDefault("use_TUNING", false)) { if (param_.getDefault("use_TUNING", false)) {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule.getTuning(), timer.currentStepNum(), param_, terminal_output_ ) ); adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule().getTuning(), timer.currentStepNum(), param_, terminal_output_ ) );
} else { } else {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) ); adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
} }
@ -246,6 +244,7 @@ public:
// Create wells and well state. // Create wells and well state.
WellsManager wells_manager(eclState(), WellsManager wells_manager(eclState(),
schedule(),
timer.currentStepNum(), timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid()), Opm::UgGridHelpers::numCells(grid()),
Opm::UgGridHelpers::globalCell(grid()), Opm::UgGridHelpers::globalCell(grid()),
@ -296,7 +295,7 @@ public:
// Run a multiple steps of the solver depending on the time step control. // Run a multiple steps of the solver depending on the time step control.
solver_timer.start(); solver_timer.start();
const auto& wells_ecl = eclState().getSchedule().getWells(timer.currentStepNum()); const auto& wells_ecl = schedule().getWells(timer.currentStepNum());
extractLegacyCellPvtRegionIndex_(); extractLegacyCellPvtRegionIndex_();
WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, model_param_, WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, model_param_,
rateConverter_, terminal_output_, timer.currentStepNum(), legacyCellPvtRegionIdx_); rateConverter_, terminal_output_, timer.currentStepNum(), legacyCellPvtRegionIdx_);
@ -456,7 +455,7 @@ public:
prev_well_state = well_state; prev_well_state = well_state;
updateListEconLimited(solver, eclState().getSchedule(), timer.currentStepNum(), wells, updateListEconLimited(solver, schedule(), timer.currentStepNum(), wells,
well_state, dynamic_list_econ_limited); well_state, dynamic_list_econ_limited);
} }
@ -517,7 +516,7 @@ protected:
{ {
typedef SimFIBODetails::WellMap WellMap; typedef SimFIBODetails::WellMap WellMap;
const auto w_ecl = eclState().getSchedule().getWells(step); const auto w_ecl = schedule().getWells(step);
const WellMap& wmap = SimFIBODetails::mapWells(w_ecl); const WellMap& wmap = SimFIBODetails::mapWells(w_ecl);
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap); const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap);
@ -842,6 +841,14 @@ protected:
const EclipseState& eclState() const const EclipseState& eclState() const
{ return ebosSimulator_.gridManager().eclState(); } { return ebosSimulator_.gridManager().eclState(); }
const Schedule& schedule() const
{ return ebosSimulator_.gridManager().schedule(); }
const SummaryConfig& summaryConfig() const
{ return ebosSimulator_.gridManager().summaryConfig( ); }
void extractLegacyCellPvtRegionIndex_() void extractLegacyCellPvtRegionIndex_()
{ {
const auto& grid = ebosSimulator_.gridManager().grid(); const auto& grid = ebosSimulator_.gridManager().grid();

View File

@ -72,11 +72,13 @@ public:
const bool disgas, const bool disgas,
const bool vapoil, const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names) const std::unordered_set<std::string>& defunct_well_names)
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil, : Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
eclipse_state, output_writer, threshold_pressures_by_face, defunct_well_names) eclipse_state, schedule, summary_config, output_writer, threshold_pressures_by_face, defunct_well_names)
{} {}
@ -92,6 +94,8 @@ protected:
using Base::solver_; using Base::solver_;
using Base::terminal_output_; using Base::terminal_output_;
using Base::eclipse_state_; using Base::eclipse_state_;
using Base::schedule_;
using Base::summary_config_;
using Base::grid_; using Base::grid_;
using Base::props_; using Base::props_;
using Base::is_parallel_run_; using Base::is_parallel_run_;

View File

@ -38,6 +38,8 @@ namespace Opm
well_model, well_model,
solver_, solver_,
eclipse_state_, eclipse_state_,
schedule_,
summary_config_,
has_disgas_, has_disgas_,
has_vapoil_, has_vapoil_,
terminal_output_)); terminal_output_));
@ -66,7 +68,7 @@ namespace Opm
std::ofstream tstep_os(tstep_filename.c_str()); std::ofstream tstep_os(tstep_filename.c_str());
// adaptive time stepping // adaptive time stepping
const auto& events = eclipse_state_->getSchedule().getEvents(); const auto& events = schedule_->getEvents();
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping; std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
if( param_.getDefault("timestep.adaptive", true ) ) if( param_.getDefault("timestep.adaptive", true ) )
{ {
@ -113,6 +115,7 @@ namespace Opm
// Create wells and well state. // Create wells and well state.
WellsManager wells_manager(*eclipse_state_, WellsManager wells_manager(*eclipse_state_,
*schedule_,
timer.currentStepNum(), timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid_), Opm::UgGridHelpers::numCells(grid_),
Opm::UgGridHelpers::globalCell(grid_), Opm::UgGridHelpers::globalCell(grid_),
@ -131,7 +134,7 @@ namespace Opm
WellState well_state; WellState well_state;
// well_state.init(wells, state, prev_well_state); // well_state.init(wells, state, prev_well_state);
const auto wells_ecl = eclipse_state_->getSchedule().getWells(timer.currentStepNum()); const auto wells_ecl = schedule_->getWells(timer.currentStepNum());
const int current_time_step = timer.currentStepNum(); const int current_time_step = timer.currentStepNum();
const WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, current_time_step); const WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, current_time_step);

View File

@ -462,6 +462,6 @@ namespace Opm
bool BlackoilOutputWriter::requireFIPNUM() const { bool BlackoilOutputWriter::requireFIPNUM() const {
return eclipseState_.getSummaryConfig().requireFIPNUM(); return summaryConfig_.requireFIPNUM();
} }
} }

View File

@ -44,6 +44,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp> #include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp> #include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/simulators/ensureDirectoryExists.hpp> #include <opm/simulators/ensureDirectoryExists.hpp>
@ -212,6 +213,8 @@ namespace Opm
BlackoilOutputWriter(const Grid& grid, BlackoilOutputWriter(const Grid& grid,
const ParameterGroup& param, const ParameterGroup& param,
const Opm::EclipseState& eclipseState, const Opm::EclipseState& eclipseState,
const Opm::Schedule& schedule,
const Opm::SummaryConfig& summaryConfig,
std::unique_ptr<EclipseIO>&& eclIO, std::unique_ptr<EclipseIO>&& eclIO,
const Opm::PhaseUsage &phaseUsage); const Opm::PhaseUsage &phaseUsage);
@ -320,6 +323,8 @@ namespace Opm
std::unique_ptr< BlackoilSubWriter > matlabWriter_; std::unique_ptr< BlackoilSubWriter > matlabWriter_;
std::unique_ptr< EclipseIO > eclIO_; std::unique_ptr< EclipseIO > eclIO_;
const EclipseState& eclipseState_; const EclipseState& eclipseState_;
const Schedule& schedule_;
const SummaryConfig& summaryConfig_;
std::unique_ptr< ThreadHandle > asyncOutput_; std::unique_ptr< ThreadHandle > asyncOutput_;
}; };
@ -336,6 +341,8 @@ namespace Opm
BlackoilOutputWriter(const Grid& grid, BlackoilOutputWriter(const Grid& grid,
const ParameterGroup& param, const ParameterGroup& param,
const Opm::EclipseState& eclipseState, const Opm::EclipseState& eclipseState,
const Opm::Schedule& schedule,
const Opm::SummaryConfig& summaryConfig,
std::unique_ptr<EclipseIO>&& eclIO, std::unique_ptr<EclipseIO>&& eclIO,
const Opm::PhaseUsage &phaseUsage) const Opm::PhaseUsage &phaseUsage)
: output_( [ &param ] () -> bool { : output_( [ &param ] () -> bool {
@ -344,12 +351,14 @@ namespace Opm
return ( outputString == "all" || outputString == "true" ); return ( outputString == "all" || outputString == "true" );
}() }()
), ),
parallelOutput_( output_ ? new ParallelDebugOutput< Grid >( grid, eclipseState, phaseUsage.num_phases, phaseUsage ) : 0 ), parallelOutput_( output_ ? new ParallelDebugOutput< Grid >( grid, eclipseState, schedule, phaseUsage.num_phases, phaseUsage ) : 0 ),
outputDir_( eclipseState.getIOConfig().getOutputDir() ), outputDir_( eclipseState.getIOConfig().getOutputDir() ),
restart_double_si_( output_ ? param.getDefault("restart_double_si", false) : false ), restart_double_si_( output_ ? param.getDefault("restart_double_si", false) : false ),
lastBackupReportStep_( -1 ), lastBackupReportStep_( -1 ),
phaseUsage_( phaseUsage ), phaseUsage_( phaseUsage ),
eclipseState_(eclipseState), eclipseState_(eclipseState),
schedule_(schedule),
summaryConfig_(summaryConfig),
asyncOutput_() asyncOutput_()
{ {
// For output. // For output.
@ -444,6 +453,7 @@ namespace Opm
// gives a dummy dynamic_list_econ_limited // gives a dummy dynamic_list_econ_limited
DynamicListEconLimited dummy_list_econ_limited; DynamicListEconLimited dummy_list_econ_limited;
WellsManager wellsmanager(eclipseState_, WellsManager wellsmanager(eclipseState_,
schedule_,
eclipseState_.getInitConfig().getRestartStep(), eclipseState_.getInitConfig().getRestartStep(),
Opm::UgGridHelpers::numCells(grid), Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid), Opm::UgGridHelpers::globalCell(grid),
@ -1002,7 +1012,6 @@ namespace Opm
{ {
data::Solution localCellData{}; data::Solution localCellData{};
const RestartConfig& restartConfig = eclipseState_.getRestartConfig(); const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
const int reportStepNum = timer.reportStepNum(); const int reportStepNum = timer.reportStepNum();
bool logMessages = output_ && parallelOutput_->isIORank(); bool logMessages = output_ && parallelOutput_->isIORank();
std::map<std::string, std::vector<double>> extraRestartData; std::map<std::string, std::vector<double>> extraRestartData;
@ -1024,7 +1033,7 @@ namespace Opm
restartConfig, reportStepNum, logMessages ); restartConfig, reportStepNum, logMessages );
// sd will be invalid after getRestartData has been called // sd will be invalid after getRestartData has been called
} }
detail::getSummaryData( localCellData, phaseUsage_, physicalModel, summaryConfig ); detail::getSummaryData( localCellData, phaseUsage_, physicalModel, summaryConfig_ );
assert(!localCellData.empty()); assert(!localCellData.empty());
// Add suggested next timestep to extra data. // Add suggested next timestep to extra data.

View File

@ -118,6 +118,8 @@ namespace Opm
const bool disgas, const bool disgas,
const bool vapoil, const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck, std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,

View File

@ -35,6 +35,8 @@ namespace Opm
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck, std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face, const std::vector<double>& threshold_pressures_by_face,
@ -49,6 +51,8 @@ namespace Opm
has_disgas, has_disgas,
has_vapoil, has_vapoil,
eclipse_state, eclipse_state,
schedule,
summary_config,
output_writer, output_writer,
threshold_pressures_by_face, threshold_pressures_by_face,
// names of deactivated wells in parallel run // names of deactivated wells in parallel run
@ -80,6 +84,8 @@ namespace Opm
well_model, well_model,
BaseType::solver_, BaseType::solver_,
BaseType::eclipse_state_, BaseType::eclipse_state_,
BaseType::schedule_,
BaseType::summary_config_,
BaseType::has_disgas_, BaseType::has_disgas_,
BaseType::has_vapoil_, BaseType::has_vapoil_,
BaseType::terminal_output_, BaseType::terminal_output_,
@ -105,9 +111,8 @@ namespace Opm
std::vector<double> perfcells_fraction(wells->well_connpos[nw], 0.0); std::vector<double> perfcells_fraction(wells->well_connpos[nw], 0.0);
size_t currentStep = timer.currentStepNum(); size_t currentStep = timer.currentStepNum();
const auto& schedule = BaseType::eclipse_state_->getSchedule();
for (const auto& well_solvent : schedule.getWells( currentStep )) { for (const auto& well_solvent : BaseType::schedule_->getWells( currentStep )) {
if (well_solvent->getStatus( currentStep ) == WellCommon::SHUT) { if (well_solvent->getStatus( currentStep ) == WellCommon::SHUT) {
continue; continue;
} }

View File

@ -66,10 +66,12 @@ public:
const bool disgas, const bool disgas,
const bool vapoil, const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face) const std::vector<double>& threshold_pressures_by_face)
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil, : Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
eclipse_state, output_writer, threshold_pressures_by_face, eclipse_state, schedule, summary_config, output_writer, threshold_pressures_by_face,
// names of deactivated wells in parallel run // names of deactivated wells in parallel run
std::unordered_set<std::string>()) std::unordered_set<std::string>())
{} {}

View File

@ -68,10 +68,9 @@ namespace Opm
void void
PolymerInflowFromDeck::setInflowValues(const Opm::EclipseState& eclipseState, PolymerInflowFromDeck::setInflowValues(const Opm::Schedule& schedule,
size_t currentStep) size_t currentStep)
{ {
const auto& schedule = eclipseState.getSchedule();
for (const auto& well : schedule.getWells(currentStep)) { for (const auto& well : schedule.getWells(currentStep)) {
WellInjectionProperties injection = well->getInjectionProperties(currentStep); WellInjectionProperties injection = well->getInjectionProperties(currentStep);
WellPolymerProperties polymer = well->getPolymerProperties(currentStep); WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
@ -99,13 +98,13 @@ namespace Opm
/// Constructor. /// Constructor.
/// @param[in] deck Input deck expected to contain WPOLYMER. /// @param[in] deck Input deck expected to contain WPOLYMER.
PolymerInflowFromDeck::PolymerInflowFromDeck(const Opm::EclipseState& eclipseState, PolymerInflowFromDeck::PolymerInflowFromDeck(const Opm::Schedule& schedule,
const Wells& wells, const Wells& wells,
const int num_cells, const int num_cells,
size_t currentStep) size_t currentStep)
: sparse_inflow_(num_cells) : sparse_inflow_(num_cells)
{ {
setInflowValues(eclipseState, currentStep); setInflowValues(schedule, currentStep);
std::unordered_map<std::string, double>::const_iterator map_it; std::unordered_map<std::string, double>::const_iterator map_it;
// Extract concentrations and put into cell->concentration map. // Extract concentrations and put into cell->concentration map.

View File

@ -93,7 +93,7 @@ namespace Opm
/// \param[in] wells Wells structure. /// \param[in] wells Wells structure.
/// \param[in] num_cells Number of cells in grid. /// \param[in] num_cells Number of cells in grid.
/// \param[in] currentStep Number of current simulation step. /// \param[in] currentStep Number of current simulation step.
PolymerInflowFromDeck(const Opm::EclipseState& eclipseState, PolymerInflowFromDeck(const Opm::Schedule& schedule,
const Wells& wells, const Wells& wells,
const int num_cells, const int num_cells,
size_t currentStep); size_t currentStep);
@ -108,9 +108,9 @@ namespace Opm
std::vector<double>& poly_inflow_c) const; std::vector<double>& poly_inflow_c) const;
private: private:
SparseVector<double> sparse_inflow_; SparseVector<double> sparse_inflow_;
std::unordered_map<std::string, double> wellPolymerRate_; std::unordered_map<std::string, double> wellPolymerRate_;
void setInflowValues(const Opm::EclipseState& eclipseState, void setInflowValues(const Opm::Schedule& schedule,
size_t currentStep); size_t currentStep);
}; };

View File

@ -83,6 +83,8 @@ namespace Opm {
const StandardWells& well_model, const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclipseState, std::shared_ptr< const EclipseState > eclipseState,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool has_polymer, const bool has_polymer,

View File

@ -83,6 +83,8 @@ namespace Opm {
const StandardWells& well_model, const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
std::shared_ptr< const EclipseState > eclipse_state, std::shared_ptr< const EclipseState > eclipse_state,
std::shared_ptr< const Schedule> schedule,
std::shared_ptr< const SummaryConfig> summary_config,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil, const bool has_vapoil,
const bool has_polymer, const bool has_polymer,
@ -93,7 +95,7 @@ namespace Opm {
const std::vector<double>& wells_bore_diameter, const std::vector<double>& wells_bore_diameter,
const bool terminal_output) const bool terminal_output)
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver, eclipse_state, : Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver, eclipse_state,
has_disgas, has_vapoil, terminal_output), schedule, summary_config, has_disgas, has_vapoil, terminal_output),
polymer_props_ad_(polymer_props_ad), polymer_props_ad_(polymer_props_ad),
has_polymer_(has_polymer), has_polymer_(has_polymer),
has_plyshlog_(has_plyshlog), has_plyshlog_(has_plyshlog),

View File

@ -122,6 +122,8 @@ namespace Opm
const bool plyshlog, const bool plyshlog,
const bool shrate, const bool shrate,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck, std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face); const std::vector<double>& threshold_pressures_by_face);
@ -157,7 +159,7 @@ namespace Opm
// and store the wellbore diameters // and store the wellbore diameters
// it will be used in the shear-thinning calcluation only. // it will be used in the shear-thinning calcluation only.
void void
computeRepRadiusPerfLength(const EclipseState& eclipseState, computeRepRadiusPerfLength(const Schedule& schedule,
const size_t timeStep, const size_t timeStep,
const GridT& grid, const GridT& grid,
std::vector<double>& wells_rep_radius, std::vector<double>& wells_rep_radius,

View File

@ -37,6 +37,8 @@ namespace Opm
const bool has_plyshlog, const bool has_plyshlog,
const bool has_shrate, const bool has_shrate,
std::shared_ptr<EclipseState> eclipse_state, std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer, BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck, std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face) const std::vector<double>& threshold_pressures_by_face)
@ -50,6 +52,8 @@ namespace Opm
has_disgas, has_disgas,
has_vapoil, has_vapoil,
eclipse_state, eclipse_state,
schedule,
summary_config,
output_writer, output_writer,
threshold_pressures_by_face, threshold_pressures_by_face,
// names of deactivated wells in parallel run // names of deactivated wells in parallel run
@ -79,6 +83,8 @@ namespace Opm
well_model, well_model,
BaseType::solver_, BaseType::solver_,
BaseType::eclipse_state_, BaseType::eclipse_state_,
BaseType::schedule_,
BaseType::summary_config_,
BaseType::has_disgas_, BaseType::has_disgas_,
BaseType::has_vapoil_, BaseType::has_vapoil_,
has_polymer_, has_polymer_,
@ -112,7 +118,7 @@ namespace Opm
if (wells_manager.c_wells() == 0) { if (wells_manager.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells."); OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
} }
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(*BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum())); polymer_inflow_ptr.reset(new PolymerInflowFromDeck(*BaseType::schedule_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
} else { } else {
OPM_MESSAGE("Warning: simulating with no WPOLYMER in deck (no polymer will be injected)."); OPM_MESSAGE("Warning: simulating with no WPOLYMER in deck (no polymer will be injected).");
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day, polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
@ -126,7 +132,7 @@ namespace Opm
well_state.polymerInflow() = polymer_inflow_c; well_state.polymerInflow() = polymer_inflow_c;
if (has_plyshlog_) { if (has_plyshlog_) {
computeRepRadiusPerfLength(*BaseType::eclipse_state_, timer.currentStepNum(), BaseType::grid_, wells_rep_radius_, wells_perf_length_, wells_bore_diameter_); computeRepRadiusPerfLength(*BaseType::schedule_, timer.currentStepNum(), BaseType::grid_, wells_rep_radius_, wells_perf_length_, wells_bore_diameter_);
} }
} }
@ -152,7 +158,7 @@ namespace Opm
template <class GridT> template <class GridT>
void SimulatorFullyImplicitBlackoilPolymer<GridT>:: void SimulatorFullyImplicitBlackoilPolymer<GridT>::
computeRepRadiusPerfLength(const Opm::EclipseState& eclipseState, computeRepRadiusPerfLength(const Opm::Schedule& schedule,
const size_t timeStep, const size_t timeStep,
const GridT& grid, const GridT& grid,
std::vector<double>& wells_rep_radius, std::vector<double>& wells_rep_radius,
@ -168,7 +174,7 @@ namespace Opm
auto cell_to_faces = Opm::UgGridHelpers::cell2Faces(grid); auto cell_to_faces = Opm::UgGridHelpers::cell2Faces(grid);
auto begin_face_centroids = Opm::UgGridHelpers::beginFaceCentroids(grid); auto begin_face_centroids = Opm::UgGridHelpers::beginFaceCentroids(grid);
if (eclipseState.getSchedule().numWells() == 0) { if (schedule.numWells() == 0) {
OPM_MESSAGE("No wells specified in Schedule section, " OPM_MESSAGE("No wells specified in Schedule section, "
"initializing no wells"); "initializing no wells");
return; return;
@ -189,7 +195,6 @@ namespace Opm
setupCompressedToCartesian(global_cell, number_of_cells, setupCompressedToCartesian(global_cell, number_of_cells,
cartesian_to_compressed); cartesian_to_compressed);
const auto& schedule = eclipseState.getSchedule();
auto wells = schedule.getWells(timeStep); auto wells = schedule.getWells(timeStep);
int well_index = 0; int well_index = 0;

View File

@ -34,12 +34,12 @@
namespace Opm { namespace Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState) void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowProblem) TypeTag; typedef TTAG(EclFlowProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager; typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState); GridManager::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -19,9 +19,12 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState); void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosBlackoilMain(int argc, char** argv); int flowEbosBlackoilMain(int argc, char** argv);
} }

View File

@ -45,12 +45,12 @@ SET_TYPE_PROP(EclFlowGasOilProblem, Indices,
}} }}
namespace Opm { namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState) void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowGasOilProblem) TypeTag; typedef TTAG(EclFlowGasOilProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager; typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState); GridManager::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
} }

View File

@ -19,10 +19,12 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState); void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosGasOilMain(int argc, char** argv); int flowEbosGasOilMain(int argc, char** argv);
} }
#endif // FLOW_EBOS_GASOIL_HPP #endif // FLOW_EBOS_GASOIL_HPP

View File

@ -45,12 +45,12 @@ SET_TYPE_PROP(EclFlowOilWaterProblem, Indices,
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState) void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowOilWaterProblem) TypeTag; typedef TTAG(EclFlowOilWaterProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager; typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState); GridManager::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -19,10 +19,13 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState); void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosOilWaterMain(int argc, char** argv); int flowEbosOilWaterMain(int argc, char** argv);
} }
#endif // FLOW_EBOS_OILWATER_HPP #endif // FLOW_EBOS_OILWATER_HPP

View File

@ -36,12 +36,12 @@ SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState) void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowPolymerProblem) TypeTag; typedef TTAG(EclFlowPolymerProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager; typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState); GridManager::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState); void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosPolymerMain(int argc, char** argv); int flowEbosPolymerMain(int argc, char** argv);
} }

View File

@ -36,14 +36,15 @@ SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState) void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowSolventProblem) TypeTag; typedef TTAG(EclFlowSolventProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager; typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState); GridManager::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int flowEbosSolventMain(int argc, char** argv) int flowEbosSolventMain(int argc, char** argv)
{ {

View File

@ -19,10 +19,13 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState); void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosSolventMain(int argc, char** argv); int flowEbosSolventMain(int argc, char** argv);
} }
#endif // FLOW_EBOS_SOLVENT_HPP #endif // FLOW_EBOS_SOLVENT_HPP

View File

@ -75,6 +75,7 @@ struct SetupMSW {
Opm::Parser parser; Opm::Parser parser;
auto deck = parser.parseFile("msw.data", parse_context); auto deck = parser.parseFile("msw.data", parse_context);
Opm::EclipseState ecl_state(deck , parse_context); Opm::EclipseState ecl_state(deck , parse_context);
Opm::Schedule schedule(deck, ecl_state.getInputGrid(), ecl_state.get3DProperties(), Opm::Phases(true, true, true), parse_context );
// Create grid. // Create grid.
const std::vector<double>& porv = const std::vector<double>& porv =
@ -90,6 +91,7 @@ struct SetupMSW {
// Create wells. // Create wells.
Opm::WellsManager wells_manager(ecl_state, Opm::WellsManager wells_manager(ecl_state,
schedule,
current_timestep, current_timestep,
Opm::UgGridHelpers::numCells(grid), Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid), Opm::UgGridHelpers::globalCell(grid),
@ -106,7 +108,7 @@ struct SetupMSW {
std::unordered_set<std::string>()); std::unordered_set<std::string>());
const Wells* wells = wells_manager.c_wells(); const Wells* wells = wells_manager.c_wells();
const auto& wells_ecl = ecl_state.getSchedule().getWells(current_timestep); const auto& wells_ecl = schedule.getWells(current_timestep);
ms_wells.reset(new Opm::MultisegmentWells(wells, &(wells_manager.wellCollection()), wells_ecl, current_timestep)); ms_wells.reset(new Opm::MultisegmentWells(wells, &(wells_manager.wellCollection()), wells_ecl, current_timestep));
}; };

View File

@ -37,6 +37,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp> #include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
@ -79,6 +80,11 @@ struct SetupTest {
Opm::Parser parser; Opm::Parser parser;
auto deck = parser.parseFile("TESTWELLMODEL.DATA", parse_context); auto deck = parser.parseFile("TESTWELLMODEL.DATA", parse_context);
ecl_state.reset(new Opm::EclipseState(deck , parse_context) ); ecl_state.reset(new Opm::EclipseState(deck , parse_context) );
{
const Opm::TableManager table ( deck );
const Opm::Eclipse3DProperties eclipseProperties ( deck , table, ecl_state->getInputGrid());
schedule.reset( new Opm::Schedule(deck, ecl_state->getInputGrid(), eclipseProperties, Opm::Phases(true, true, true), parse_context ));
}
// Create grid. // Create grid.
const std::vector<double>& porv = const std::vector<double>& porv =
@ -98,6 +104,7 @@ struct SetupTest {
// Create wells. // Create wells.
wells_manager.reset(new Opm::WellsManager(*ecl_state, wells_manager.reset(new Opm::WellsManager(*ecl_state,
*schedule,
current_timestep, current_timestep,
Opm::UgGridHelpers::numCells(grid), Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid), Opm::UgGridHelpers::globalCell(grid),
@ -113,6 +120,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;
int current_timestep; int current_timestep;
}; };
@ -120,7 +128,7 @@ struct SetupTest {
BOOST_AUTO_TEST_CASE(TestStandardWellInput) { BOOST_AUTO_TEST_CASE(TestStandardWellInput) {
SetupTest setup_test; SetupTest setup_test;
const Wells* wells = setup_test.wells_manager->c_wells(); const Wells* wells = setup_test.wells_manager->c_wells();
const auto& wells_ecl = setup_test.ecl_state->getSchedule().getWells(setup_test.current_timestep); const auto& wells_ecl = setup_test.schedule->getWells(setup_test.current_timestep);
BOOST_CHECK_EQUAL( wells_ecl.size(), 2); BOOST_CHECK_EQUAL( wells_ecl.size(), 2);
const Opm::Well* well = wells_ecl[1]; const Opm::Well* well = wells_ecl[1];
const Opm::BlackoilModelParameters param; const Opm::BlackoilModelParameters param;
@ -133,7 +141,7 @@ BOOST_AUTO_TEST_CASE(TestStandardWellInput) {
BOOST_AUTO_TEST_CASE(TestBehavoir) { BOOST_AUTO_TEST_CASE(TestBehavoir) {
SetupTest setup_test; SetupTest setup_test;
const Wells* wells_struct = setup_test.wells_manager->c_wells(); const Wells* wells_struct = setup_test.wells_manager->c_wells();
const auto& wells_ecl = setup_test.ecl_state->getSchedule().getWells(setup_test.current_timestep); const auto& wells_ecl = setup_test.schedule->getWells(setup_test.current_timestep);
const int current_timestep = setup_test.current_timestep; const int current_timestep = setup_test.current_timestep;
std::vector<std::unique_ptr<const StandardWell> > wells; std::vector<std::unique_ptr<const StandardWell> > wells;