Merge pull request #1315 from joakim-hove/extract-schedule

Use Schedule constructor.
This commit is contained in:
Joakim Hove 2017-11-06 17:06:49 +01:00 committed by GitHub
commit e125334847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 267 additions and 473 deletions

View File

@ -131,7 +131,6 @@ list (APPEND EXAMPLE_SOURCE_FILES
examples/sim_2p_incomp_ad.cpp
examples/sim_2p_comp_reorder.cpp
examples/sim_simple.cpp
examples/opm_init_check.cpp
examples/sim_poly2p_comp_reorder.cpp
examples/sim_poly2p_incomp_reorder.cpp
examples/flow_polymer.cpp

View File

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

View File

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

View File

@ -1,366 +0,0 @@
/*
Copyright 2014 Statoil ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <iostream>
#include <fstream>
#include <memory>
#include <vector>
#include <string>
#include <ert/ecl/ecl_file.h>
#include <ert/ecl/ecl_kw.h>
#include <ert/ecl/ecl_grid.h>
#include <ert/ecl/ecl_nnc_export.h>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/core/grid.h>
#include <opm/core/grid/GridManager.hpp>
#include <opm/core/wells/WellsManager.hpp>
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoil.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
using namespace Opm;
class CellTrans {
public:
CellTrans(const std::tuple<int,int,int>& ijk) :
m_ijk(ijk)
{
}
void update(const std::tuple<int,int,int>& ijk , double trans) {
auto iter = m_trans.find( ijk );
if (iter == m_trans.end())
m_trans.insert( std::pair<std::tuple<int,int,int> , double>(ijk , trans));
else
iter->second *= trans;
}
int numConnections() const {
return m_trans.size();
}
static void jsonDumpIJK(std::ostream& os , const std::tuple<int,int,int>& ijk ) {
os << "[" << std::get<0>(ijk) << "," << std::get<1>(ijk) << "," << std::get<2>(ijk) << "]";
}
void jsonDump(std::ostream& os , bool first) {
if (!first)
os <<",";
os << "[";
jsonDumpIJK(os , m_ijk );
os << ",[";
{
size_t count = 0;
for (auto transIter = m_trans.begin(); transIter != m_trans.end(); ++transIter) {
std::tuple<int,int,int> ijk = transIter->first;
double t = transIter->second;
os << "[";
jsonDumpIJK( os , ijk );
os << "," << t << "]";
count++;
if (count < m_trans.size())
os << ",";
else
os << "]";
}
}
os << "]" << std::endl;
}
std::tuple<int,int,int> m_ijk;
std::map<std::tuple<int,int,int> , double> m_trans;
};
class TransGraph {
public:
TransGraph(int nx , int ny , int nz) :
m_nx(nx),
m_ny(ny),
m_nz(nz)
{
m_transVector.resize( nx*ny*nz );
}
void update(int global_index1 , int global_index2 , double trans) {
int size = m_nx * m_ny * m_nz;
if ((global_index1 >= 0) &&
(global_index2 >= 0) &&
(global_index1 < size) &&
(global_index2 < size)) {
size_t g1 = std::min( global_index1 , global_index2 );
size_t g2 = std::max( global_index1 , global_index2 );
std::shared_ptr<CellTrans> cellTrans = m_transVector[g1];
if (!cellTrans) {
cellTrans = std::make_shared<CellTrans>( getIJK(g1) );
m_transVector[g1] = cellTrans;
}
cellTrans->update( getIJK(g2) , trans );
}
}
int activeCells() const {
int count = 0;
for (size_t g= 0; g < m_transVector.size(); g++) {
std::shared_ptr<CellTrans> cellTrans = m_transVector[g];
if (cellTrans)
count++;
}
return count;
}
int activeConnections() const {
int count = 0;
for (size_t g= 0; g < m_transVector.size(); g++) {
std::shared_ptr<CellTrans> cellTrans = m_transVector[g];
if (cellTrans)
count += cellTrans->numConnections();
}
return count;
}
std::tuple<int,int,int> getIJK(int g) const {
int k = g / (m_nx * m_ny);
int j = (g - k*m_nx*m_ny) / m_nx;
int i = g - k*m_nx*m_ny - j*m_nx;
return std::tuple<int,int,int>(i,j,k);
}
void jsonDump(const std::string& outputFile) {
std::ofstream os;
bool first = true;
os.open(outputFile.c_str());
os << "{ \"dims\" : [" << m_nx << "," << m_ny << "," << m_nz << "]" << " , \"graph\":[";
for (size_t g= 0; g < m_transVector.size(); g++) {
std::shared_ptr<CellTrans> cellTrans = m_transVector[g];
if (cellTrans) {
cellTrans->jsonDump(os , first);
first = false;
}
}
os << "]}" << std::endl;
os.close();
}
int m_nx;
int m_ny;
int m_nz;
std::vector<std::shared_ptr<CellTrans> > m_transVector;
};
/*****************************************************************/
void initOPMTrans(TransGraph& opmTrans, const Deck& deck, const EclipseState& eclipseState) {
std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( eclipseState.getInputGrid(),
eclipseState.get3DProperties().getDoubleGridProperty( "PORV" ).getData() );
const struct UnstructuredGrid * cGrid = grid->c_grid();
std::shared_ptr<BlackoilPropsAdFromDeck> props;
props.reset(new BlackoilPropsAdFromDeck(deck, eclipseState, *grid->c_grid()));
DerivedGeology geology(*grid->c_grid() , *props, eclipseState, false);
const double * opm_trans_data = geology.transmissibility().data();
double SIconversion = Opm::unit::cubic(Opm::unit::meter) * Opm::unit::day * Opm::unit::barsa / (Opm::prefix::centi * Opm::unit::Poise);
{
for (int face_index = 0; face_index < cGrid->number_of_faces; face_index++ ) {
int global_index1 = cGrid->global_cell[ cGrid->face_cells[2*face_index] ];
int global_index2 = cGrid->global_cell[ cGrid->face_cells[2*face_index + 1] ];
opmTrans.update( global_index1 , global_index2 , opm_trans_data[ face_index ] * SIconversion );
}
}
}
void initEclipseTrans(TransGraph& eclipseTrans , const ecl_grid_type * ecl_grid , const ecl_file_type * ecl_init) {
int nx = ecl_grid_get_nx( ecl_grid );
int ny = ecl_grid_get_ny( ecl_grid );
int nz = ecl_grid_get_nz( ecl_grid );
if (ecl_file_has_kw( ecl_init , "TRANX")) {
ecl_kw_type * tranx_kw = ecl_file_iget_named_kw( ecl_init , "TRANX" , 0 );
ecl_kw_type * trany_kw = ecl_file_iget_named_kw( ecl_init , "TRANY" , 0 );
ecl_kw_type * tranz_kw = ecl_file_iget_named_kw( ecl_init , "TRANZ" , 0 );
for (int k=0; k < nz; k++) {
for (int j= 0; j < ny; j++) {
for (int i=0; i < nx; i++) {
if (ecl_grid_cell_active3( ecl_grid , i , j , k )) {
size_t g1 = ecl_grid_get_global_index3( ecl_grid , i , j , k );
int a = ecl_grid_get_active_index1( ecl_grid , g1 );
if (a >= 0) {
if (i < (nx - 1) && ecl_grid_cell_active3( ecl_grid , i + 1 , j , k)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i + 1, j , k );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( tranx_kw , a ));
}
if (j < (ny - 1) && ecl_grid_cell_active3( ecl_grid , i , j + 1, k)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i , j + 1, k );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( trany_kw , a ));
}
if (k < (nz - 1) && ecl_grid_cell_active3( ecl_grid , i , j , k + 1)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i , j , k + 1 );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( tranz_kw , a ));
}
}
}
}
}
}
} else
std::cerr << "Init file does not have TRAN[XYZ] keywords" << std::endl;
if (ecl_file_has_kw( ecl_init , "TRANX-")) {
ecl_kw_type * tranxm_kw = ecl_file_iget_named_kw( ecl_init , "TRANX-" , 0 );
ecl_kw_type * tranym_kw = ecl_file_iget_named_kw( ecl_init , "TRANY-" , 0 );
ecl_kw_type * tranzm_kw = ecl_file_iget_named_kw( ecl_init , "TRANZ-" , 0 );
for (int k=0; k < nz; k++) {
for (int j= 0; j < ny; j++) {
for (int i=0; i < nx; i++) {
if (ecl_grid_cell_active3( ecl_grid , i , j , k )) {
size_t g1 = ecl_grid_get_global_index3( ecl_grid , i , j , k );
int a = ecl_grid_get_active_index1( ecl_grid , g1 );
if (a >= 0) {
if (i > 0 && ecl_grid_cell_active3( ecl_grid , i - 1 , j , k)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i - 1, j , k );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( tranxm_kw , a ));
}
if (j > 0 && ecl_grid_cell_active3( ecl_grid , i , j - 1, k)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i , j - 1, k );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( tranym_kw , a ));
}
if (k > 0 && ecl_grid_cell_active3( ecl_grid , i , j , k - 1)) {
size_t g2 = ecl_grid_get_global_index3( ecl_grid , i , j , k - 1 );
eclipseTrans.update( g1 , g2 , ecl_kw_iget_float( tranzm_kw , a ));
}
}
}
}
}
}
}
// NNC
{
size_t num_nnc = static_cast<size_t>( ecl_nnc_export_get_size( ecl_grid ));
std::vector<ecl_nnc_type> nnc(num_nnc);
ecl_nnc_export( ecl_grid , ecl_init , nnc.data());
for (auto nnc_iter = nnc.begin(); nnc_iter != nnc.end(); ++nnc_iter)
eclipseTrans.update( nnc_iter->global_index1 , nnc_iter->global_index2 , nnc_iter->trans );
}
}
void dump_transGraph( const Deck& deck , const EclipseState& eclipseState , const ecl_grid_type * ecl_grid , const ecl_file_type * ecl_init) {
int nx = ecl_grid_get_nx( ecl_grid );
int ny = ecl_grid_get_ny( ecl_grid );
int nz = ecl_grid_get_nz( ecl_grid );
TransGraph opmTrans(nx , ny , nz );
TransGraph eclipseTrans( nx , ny , nz);
initOPMTrans( opmTrans , deck , eclipseState );
initEclipseTrans( eclipseTrans , ecl_grid , ecl_init );
opmTrans.jsonDump("opm_trans.json");
eclipseTrans.jsonDump("eclipse_trans.json");
}
int main(int argc, char** argv) {
if (argc < 4) {
std::cerr << "The opm_init_check program needs three arguments:" << std::endl << std::endl;;
std::cerr << " ECLIPSE.DATA ECLIPSE.INIT ECLIPSE.EGRID" << std::endl << std::endl;
std::cerr << "Where the ECLIPSE.INIT and ECLIPSE.EGRID are existing binary files";
exit(1);
}
std::string input_file = argv[1];
std::string init_file = argv[2];
std::string grid_file = argv[3];
Parser parser;
ParseContext parseContext;
std::cout << "Parsing input file ............: " << input_file << std::endl;
const Deck& deck = parser.parseFile(input_file, parseContext);
EclipseState state( deck , parseContext );
std::cout << "Loading eclipse INIT file .....: " << init_file << std::endl;
ecl_file_type * ecl_init = ecl_file_open( init_file.c_str() , 0 );
std::cout << "Loading eclipse EGRID file ....: " << grid_file << std::endl;
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file.c_str() );
dump_transGraph( deck , state , ecl_grid , ecl_init);
ecl_file_close( ecl_init );
ecl_grid_free( ecl_grid );
return 0;
}

View File

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

View File

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

View File

@ -96,6 +96,7 @@ try
Opm::PolymerProperties poly_props;
Opm::Deck deck;
std::unique_ptr< EclipseState > eclipseState;
std::unique_ptr< Schedule> schedule;
// bool check_well_controls = false;
// int max_well_control_iterations = 0;
double gravity[3] = { 0.0 };
@ -105,7 +106,7 @@ try
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(deck , parseContext) );
schedule.reset( new Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext ));
// Grid init
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
@ -282,13 +283,13 @@ try
// Create new wells, polymer inflow controls.
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;
if (use_wpolymer) {
if (wells.c_wells() == 0) {
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 {
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,

View File

@ -94,6 +94,7 @@ try
boost::scoped_ptr<IncompPropertiesInterface> props;
boost::scoped_ptr<RockCompressibility> rock_comp;
std::shared_ptr< EclipseState > eclipseState;
std::shared_ptr<Schedule> schedule;
std::unique_ptr<PolymerState> state;
Opm::PolymerProperties poly_props;
// bool check_well_controls = false;
@ -106,7 +107,7 @@ try
deck = parser.parseFile(deck_filename , 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.reset(new GridManager(eclipseState->getInputGrid()));
{
@ -295,7 +296,7 @@ try
WellState well_state;
int step = 0;
const auto& timeMap = eclipseState->getSchedule().getTimeMap();
const auto& timeMap = schedule->getTimeMap();
SimulatorTimer simtimer;
simtimer.init(timeMap);
// Check for WPOLYMER presence in last epoch to decide
@ -316,13 +317,13 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
// 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;
if (use_wpolymer) {
if (wells.c_wells() == 0) {
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 {
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,

View File

@ -38,6 +38,7 @@ try
Opm::Parser parser;
Opm::Deck deck = parser.parseFile(file_name , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::Schedule schedule(deck, eclipseState.getInputGrid(), eclipseState.get3DProperties(), eclipseState.runspec().phases(), parseContext);
std::cout << "Done!" << std::endl;
// Setup grid
@ -48,7 +49,7 @@ try
RockCompressibility rock_comp(eclipseState);
// 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)};
Opm::LinearSolverFactory linsolver(parameters);

View File

@ -68,11 +68,13 @@ namespace Opm {
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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 NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output);

View File

@ -106,6 +106,8 @@ typedef Eigen::Array<double,
const WellModel& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)

View File

@ -89,6 +89,8 @@ namespace Opm {
const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output);

View File

@ -65,11 +65,13 @@ namespace Opm {
const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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 NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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),
max_dp_rel_(std::numeric_limits<double>::infinity()),
scaling_{ ADB::null(), ADB::null(), ADB::null() }

View File

@ -233,17 +233,19 @@ namespace Opm {
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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_)
, props_(dynamic_cast<const BlackoilPropsAdFromDeck&>(fluid)) // TODO: remove the need for this cast.
, state0_{ 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,
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
// for each active phase.

View File

@ -84,13 +84,15 @@ namespace Opm {
const WellModel well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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,
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.
pressure_solver_(typename PressureSolver::SolverParameters(), std::move(pressure_model_)),
transport_solver_(typename TransportSolver::SolverParameters(), std::move(transport_model_)),

View File

@ -73,6 +73,8 @@ namespace Opm {
const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output,

View File

@ -79,13 +79,15 @@ namespace Opm {
const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output,
const bool has_solvent,
const bool is_miscible)
: 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),
solvent_pos_(detail::solventPos(fluid.phaseUsage())),
solvent_props_(solvent_props),

View File

@ -66,11 +66,13 @@ namespace Opm {
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool terminal_output)
: 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()
std::shared_ptr<Deck> deck_;
std::shared_ptr<EclipseState> eclipse_state_;
std::shared_ptr<Schedule> schedule_;
std::shared_ptr<SummaryConfig> summary_config_;
// setupGridAndProps()
std::unique_ptr<GridInit<Grid>> grid_init_;
std::shared_ptr<MaterialLawManager> material_law_manager_;
@ -427,7 +429,7 @@ namespace Opm
OpmLog::addBackend( "STREAMLOG", streamLog);
std::shared_ptr<StreamLog> debugLog = std::make_shared<EclipsePRTLog>(debugFile, Log::DefaultMessageTypes, false, output_cout_);
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)},
{Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)},
{Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)},
@ -501,6 +503,15 @@ namespace Opm
}
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) {
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.
if (must_distribute_) {
defunct_well_names_ =
distributeGridAndData(grid_init_->grid(), *deck_, *eclipse_state_,
distributeGridAndData(grid_init_->grid(), *deck_, *eclipse_state_, *schedule_,
*state_, *fluidprops_, *geoprops_,
material_law_manager_, threshold_pressures_,
parallel_information_, use_local_perm_);
@ -752,7 +763,10 @@ namespace Opm
if( output && output_ecl && output_cout_)
{
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),
geoprops_->nonCartesianConnections());
}
@ -770,6 +784,8 @@ namespace Opm
output_writer_.reset(new OutputWriter(grid_init_->grid(),
param_,
*eclipse_state_,
*schedule_,
*summary_config_,
std::move(eclipse_writer_),
Opm::phaseUsageFromDeck(*deck_)));
}
@ -815,8 +831,7 @@ namespace Opm
// Returns EXIT_SUCCESS if it does not throw.
int runSimulator()
{
const auto& schedule = eclipse_state_->getSchedule();
const auto& timeMap = schedule.getTimeMap();
const auto& timeMap = schedule_->getTimeMap();
auto& ioConfig = eclipse_state_->getIOConfig();
SimulatorTimer simtimer;
@ -904,6 +919,8 @@ namespace Opm
Base::deck_->hasKeyword("DISGAS"),
Base::deck_->hasKeyword("VAPOIL"),
Base::eclipse_state_,
Base::schedule_,
Base::summary_config_,
*Base::output_writer_,
Base::threshold_pressures_,
Base::defunct_well_names_));

View File

@ -327,7 +327,7 @@ namespace Opm
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::StdoutMessageTypes);
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)},
{Log::MessageType::Info, msgLimits.getMessagePrintLimit(0)},
{Log::MessageType::Warning, msgLimits.getWarningPrintLimit(0)},
@ -471,6 +471,12 @@ namespace Opm
EclipseState& 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.
// Writes to:
// state_
@ -622,7 +628,10 @@ namespace Opm
exportNncStructure_();
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_);
}
}
@ -638,6 +647,8 @@ namespace Opm
output_writer_.reset(new OutputWriter(grid(),
param_,
eclState(),
schedule(),
summaryConfig(),
std::move(eclIO_),
Opm::phaseUsageFromDeck(deck())) );
}
@ -646,7 +657,7 @@ namespace Opm
// Returns EXIT_SUCCESS if it does not throw.
int runSimulator()
{
const auto& schedule = eclState().getSchedule();
const auto& schedule = this->schedule();
const auto& timeMap = schedule.getTimeMap();
auto& ioConfig = eclState().getIOConfig();
SimulatorTimer simtimer;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,6 +43,8 @@ namespace Opm
const bool has_disgas,
const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
OutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names)
@ -59,6 +61,8 @@ namespace Opm
has_vapoil_(has_vapoil),
terminal_output_(param.getDefault("output_terminal", true)),
eclipse_state_(eclipse_state),
schedule_(schedule),
summary_config_(summary_config),
output_writer_(output_writer),
rateConverter_(props_.phaseUsage(), std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
threshold_pressures_by_face_(threshold_pressures_by_face),
@ -110,16 +114,14 @@ namespace Opm
tstep_os.open(tstep_filename.c_str());
}
const auto& schedule = eclipse_state_->getSchedule();
// adaptive time stepping
const auto& events = schedule.getEvents();
const auto& events = schedule_->getEvents();
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
if( param_.getDefault("timestep.adaptive", true ) )
{
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 {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
}
@ -172,6 +174,7 @@ namespace Opm
// Create wells and well state.
WellsManager wells_manager(*eclipse_state_,
*schedule_,
timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid_),
Opm::UgGridHelpers::globalCell(grid_),
@ -275,7 +278,7 @@ namespace Opm
// section
//
// 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);
geo_.update(grid_, props_, *eclipse_state_, gravity_);
}
@ -328,7 +331,7 @@ namespace Opm
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);
}
@ -474,6 +477,8 @@ namespace Opm
well_model,
solver_,
eclipse_state_,
schedule_,
summary_config_,
has_disgas_,
has_vapoil_,
terminal_output_));
@ -494,7 +499,7 @@ namespace Opm
{
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 std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap);

View File

@ -61,11 +61,13 @@ public:
const bool disgas,
const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig,
BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names)
: 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());
}
const auto& schedule = eclState().getSchedule();
// adaptive time stepping
const auto& events = schedule.getEvents();
const auto& events = schedule().getEvents();
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
if( param_.getDefault("timestep.adaptive", true ) )
{
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 {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
}
@ -246,6 +244,7 @@ public:
// Create wells and well state.
WellsManager wells_manager(eclState(),
schedule(),
timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid()),
Opm::UgGridHelpers::globalCell(grid()),
@ -296,7 +295,7 @@ public:
// Run a multiple steps of the solver depending on the time step control.
solver_timer.start();
const auto& wells_ecl = eclState().getSchedule().getWells(timer.currentStepNum());
const auto& wells_ecl = schedule().getWells(timer.currentStepNum());
extractLegacyCellPvtRegionIndex_();
WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, model_param_,
rateConverter_, terminal_output_, timer.currentStepNum(), legacyCellPvtRegionIdx_);
@ -456,7 +455,7 @@ public:
prev_well_state = well_state;
updateListEconLimited(solver, eclState().getSchedule(), timer.currentStepNum(), wells,
updateListEconLimited(solver, schedule(), timer.currentStepNum(), wells,
well_state, dynamic_list_econ_limited);
}
@ -517,7 +516,7 @@ protected:
{
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 std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap);
@ -842,6 +841,14 @@ protected:
const EclipseState& eclState() const
{ return ebosSimulator_.gridManager().eclState(); }
const Schedule& schedule() const
{ return ebosSimulator_.gridManager().schedule(); }
const SummaryConfig& summaryConfig() const
{ return ebosSimulator_.gridManager().summaryConfig( ); }
void extractLegacyCellPvtRegionIndex_()
{
const auto& grid = ebosSimulator_.gridManager().grid();

View File

@ -72,11 +72,13 @@ public:
const bool disgas,
const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face,
const std::unordered_set<std::string>& defunct_well_names)
: 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::terminal_output_;
using Base::eclipse_state_;
using Base::schedule_;
using Base::summary_config_;
using Base::grid_;
using Base::props_;
using Base::is_parallel_run_;

View File

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

View File

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

View File

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

View File

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

View File

@ -35,6 +35,8 @@ namespace Opm
const bool has_disgas,
const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face,
@ -49,6 +51,8 @@ namespace Opm
has_disgas,
has_vapoil,
eclipse_state,
schedule,
summary_config,
output_writer,
threshold_pressures_by_face,
// names of deactivated wells in parallel run
@ -80,6 +84,8 @@ namespace Opm
well_model,
BaseType::solver_,
BaseType::eclipse_state_,
BaseType::schedule_,
BaseType::summary_config_,
BaseType::has_disgas_,
BaseType::has_vapoil_,
BaseType::terminal_output_,
@ -105,9 +111,8 @@ namespace Opm
std::vector<double> perfcells_fraction(wells->well_connpos[nw], 0.0);
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) {
continue;
}

View File

@ -66,10 +66,12 @@ public:
const bool disgas,
const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer,
const std::vector<double>& threshold_pressures_by_face)
: 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
std::unordered_set<std::string>())
{}

View File

@ -68,10 +68,9 @@ namespace Opm
void
PolymerInflowFromDeck::setInflowValues(const Opm::EclipseState& eclipseState,
PolymerInflowFromDeck::setInflowValues(const Opm::Schedule& schedule,
size_t currentStep)
{
const auto& schedule = eclipseState.getSchedule();
for (const auto& well : schedule.getWells(currentStep)) {
WellInjectionProperties injection = well->getInjectionProperties(currentStep);
WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
@ -99,13 +98,13 @@ namespace Opm
/// Constructor.
/// @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 int num_cells,
size_t currentStep)
: sparse_inflow_(num_cells)
{
setInflowValues(eclipseState, currentStep);
setInflowValues(schedule, currentStep);
std::unordered_map<std::string, double>::const_iterator map_it;
// Extract concentrations and put into cell->concentration map.

View File

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

View File

@ -83,6 +83,8 @@ namespace Opm {
const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool has_polymer,

View File

@ -83,6 +83,8 @@ namespace Opm {
const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
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_vapoil,
const bool has_polymer,
@ -93,7 +95,7 @@ namespace Opm {
const std::vector<double>& wells_bore_diameter,
const bool terminal_output)
: 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),
has_polymer_(has_polymer),
has_plyshlog_(has_plyshlog),

View File

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

View File

@ -37,6 +37,8 @@ namespace Opm
const bool has_plyshlog,
const bool has_shrate,
std::shared_ptr<EclipseState> eclipse_state,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summary_config,
BlackoilOutputWriter& output_writer,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face)
@ -50,6 +52,8 @@ namespace Opm
has_disgas,
has_vapoil,
eclipse_state,
schedule,
summary_config,
output_writer,
threshold_pressures_by_face,
// names of deactivated wells in parallel run
@ -79,6 +83,8 @@ namespace Opm
well_model,
BaseType::solver_,
BaseType::eclipse_state_,
BaseType::schedule_,
BaseType::summary_config_,
BaseType::has_disgas_,
BaseType::has_vapoil_,
has_polymer_,
@ -112,7 +118,7 @@ namespace Opm
if (wells_manager.c_wells() == 0) {
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 {
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,
@ -126,7 +132,7 @@ namespace Opm
well_state.polymerInflow() = polymer_inflow_c;
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>
void SimulatorFullyImplicitBlackoilPolymer<GridT>::
computeRepRadiusPerfLength(const Opm::EclipseState& eclipseState,
computeRepRadiusPerfLength(const Opm::Schedule& schedule,
const size_t timeStep,
const GridT& grid,
std::vector<double>& wells_rep_radius,
@ -168,7 +174,7 @@ namespace Opm
auto cell_to_faces = Opm::UgGridHelpers::cell2Faces(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, "
"initializing no wells");
return;
@ -189,7 +195,6 @@ namespace Opm
setupCompressedToCartesian(global_cell, number_of_cells,
cartesian_to_compressed);
const auto& schedule = eclipseState.getSchedule();
auto wells = schedule.getWells(timeStep);
int well_index = 0;

View File

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

View File

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

View File

@ -45,12 +45,12 @@ SET_TYPE_PROP(EclFlowGasOilProblem, Indices,
}}
namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState)
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{
typedef TTAG(EclFlowGasOilProblem) TypeTag;
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/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosGasOilMain(int argc, char** argv);
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosGasOilMain(int argc, char** argv);
}
#endif // FLOW_EBOS_GASOIL_HPP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -75,6 +75,7 @@ struct SetupMSW {
Opm::Parser parser;
auto deck = parser.parseFile("msw.data", 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.
const std::vector<double>& porv =
@ -90,6 +91,7 @@ struct SetupMSW {
// Create wells.
Opm::WellsManager wells_manager(ecl_state,
schedule,
current_timestep,
Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid),
@ -106,7 +108,7 @@ struct SetupMSW {
std::unordered_set<std::string>());
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));
};

View File

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