Merge pull request #2326 from joakim-hove/summary-add-fp

Add fieldprops argument to SummaryConfig constructor
This commit is contained in:
Joakim Hove
2021-03-08 12:25:13 +01:00
committed by GitHub
17 changed files with 37 additions and 27 deletions

View File

@@ -43,7 +43,7 @@ int main(int /* argc */, char** argv) {
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard); Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
Opm::EclipseState state(deck); Opm::EclipseState state(deck);
Opm::Schedule schedule(deck, state, parse_context, error_guard, python); Opm::Schedule schedule(deck, state, parse_context, error_guard, python);
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), state.aquifer(), Opm::SummaryConfig summary_config(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer(),
parse_context, error_guard); parse_context, error_guard);
if (error_guard) { if (error_guard) {

View File

@@ -71,7 +71,7 @@ inline void loadDeck( const char * deck_file) {
std::cout << "creating SummaryConfig .... "; std::cout.flush(); std::cout << "creating SummaryConfig .... "; std::cout.flush();
start = Opm::TimeService::now(); start = Opm::TimeService::now();
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), state.aquifer(), Opm::SummaryConfig summary( deck, schedule, state.fieldProps(), state.getTableManager( ), state.aquifer(),
parseContext, errors ); parseContext, errors );
auto summary_time = Opm::TimeService::now() - start; auto summary_time = Opm::TimeService::now() - start;

View File

@@ -128,6 +128,7 @@ namespace Opm {
class Schedule; class Schedule;
class TableManager; class TableManager;
class AquiferConfig; class AquiferConfig;
class FieldPropsManager;
class SummaryConfig { class SummaryConfig {
public: public:
@@ -138,6 +139,7 @@ namespace Opm {
SummaryConfig() = default; SummaryConfig() = default;
SummaryConfig( const Deck&, SummaryConfig( const Deck&,
const Schedule&, const Schedule&,
const FieldPropsManager&,
const TableManager&, const TableManager&,
const AquiferConfig&, const AquiferConfig&,
const ParseContext&, const ParseContext&,
@@ -146,6 +148,7 @@ namespace Opm {
template <typename T> template <typename T>
SummaryConfig( const Deck&, SummaryConfig( const Deck&,
const Schedule&, const Schedule&,
const FieldPropsManager&,
const TableManager&, const TableManager&,
const AquiferConfig&, const AquiferConfig&,
const ParseContext&, const ParseContext&,
@@ -153,6 +156,7 @@ namespace Opm {
SummaryConfig( const Deck&, SummaryConfig( const Deck&,
const Schedule&, const Schedule&,
const FieldPropsManager&,
const TableManager&, const TableManager&,
const AquiferConfig&); const AquiferConfig&);
@@ -220,6 +224,7 @@ namespace Opm {
private: private:
SummaryConfig( const Deck& deck, SummaryConfig( const Deck& deck,
const Schedule& schedule, const Schedule& schedule,
const FieldPropsManager& field_props,
const TableManager& tables, const TableManager& tables,
const AquiferConfig& aquiferConfig, const AquiferConfig& aquiferConfig,
const ParseContext& parseContext, const ParseContext& parseContext,

View File

@@ -18,7 +18,7 @@ void python::common::export_EclipseConfig(py::module& module)
py::class_< SummaryConfig >( module, "SummaryConfig") py::class_< SummaryConfig >( module, "SummaryConfig")
.def(py::init([](const Deck& deck, const EclipseState& state, const Schedule& schedule) { .def(py::init([](const Deck& deck, const EclipseState& state, const Schedule& schedule) {
return SummaryConfig( deck, schedule, state.getTableManager(), state.aquifer() ); return SummaryConfig( deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer() );
} ) ) } ) )
.def( "__contains__", &SummaryConfig::hasKeyword ); .def( "__contains__", &SummaryConfig::hasKeyword );

View File

@@ -51,6 +51,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
namespace Opm { namespace Opm {
@@ -1367,6 +1368,7 @@ bool operator<(const SummaryConfigNode& lhs, const SummaryConfigNode& rhs)
SummaryConfig::SummaryConfig( const Deck& deck, SummaryConfig::SummaryConfig( const Deck& deck,
const Schedule& schedule, const Schedule& schedule,
const FieldPropsManager& field_props,
const TableManager& tables, const TableManager& tables,
const AquiferConfig& aquiferConfig, const AquiferConfig& aquiferConfig,
const ParseContext& parseContext, const ParseContext& parseContext,
@@ -1418,30 +1420,33 @@ SummaryConfig::SummaryConfig( const Deck& deck,
SummaryConfig::SummaryConfig( const Deck& deck, SummaryConfig::SummaryConfig( const Deck& deck,
const Schedule& schedule, const Schedule& schedule,
const FieldPropsManager& field_props,
const TableManager& tables, const TableManager& tables,
const AquiferConfig& aquiferConfig, const AquiferConfig& aquiferConfig,
const ParseContext& parseContext, const ParseContext& parseContext,
ErrorGuard& errors) : ErrorGuard& errors) :
SummaryConfig( deck , schedule, tables, aquiferConfig, parseContext, errors, GridDims( deck )) SummaryConfig( deck , schedule, field_props, tables, aquiferConfig, parseContext, errors, GridDims( deck ))
{ } { }
template <typename T> template <typename T>
SummaryConfig::SummaryConfig( const Deck& deck, SummaryConfig::SummaryConfig( const Deck& deck,
const Schedule& schedule, const Schedule& schedule,
const FieldPropsManager& field_props,
const TableManager& tables, const TableManager& tables,
const AquiferConfig& aquiferConfig, const AquiferConfig& aquiferConfig,
const ParseContext& parseContext, const ParseContext& parseContext,
T&& errors) : T&& errors) :
SummaryConfig(deck, schedule, tables, aquiferConfig, parseContext, errors) SummaryConfig(deck, schedule, field_props, tables, aquiferConfig, parseContext, errors)
{} {}
SummaryConfig::SummaryConfig( const Deck& deck, SummaryConfig::SummaryConfig( const Deck& deck,
const Schedule& schedule, const Schedule& schedule,
const TableManager& tables, const FieldPropsManager& field_props,
const AquiferConfig& aquiferConfig) : const TableManager& tables,
SummaryConfig(deck, schedule, tables, aquiferConfig, ParseContext(), ErrorGuard()) const AquiferConfig& aquiferConfig) :
SummaryConfig(deck, schedule, field_props, tables, aquiferConfig, ParseContext(), ErrorGuard())
{} {}

View File

@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(RUN) {
Deck deck = parser.parseFile("SPE1CASE1.DATA"); Deck deck = parser.parseFile("SPE1CASE1.DATA");
EclipseState state(deck); EclipseState state(deck);
Schedule schedule(deck, state, python); Schedule schedule(deck, state, python);
SummaryConfig summary_config(deck, schedule, state.getTableManager(), state.aquifer()); SummaryConfig summary_config(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer());
msim msim(state); msim msim(state);
msim.well_rate("PROD", data::Rates::opt::oil, prod_opr); msim.well_rate("PROD", data::Rates::opt::oil, prod_opr);

View File

@@ -63,7 +63,7 @@ struct test_data {
state( this->deck ), state( this->deck ),
python( std::make_shared<Python>() ), python( std::make_shared<Python>() ),
schedule( this->deck, this->state, this->python), schedule( this->deck, this->state, this->python),
summary_config( this->deck, this->schedule, this->state.getTableManager(), this->state.aquifer() ) summary_config( this->deck, this->schedule, this->state.fieldProps(), this->state.getTableManager(), this->state.aquifer() )
{ {
auto& ioconfig = this->state.getIOConfig(); auto& ioconfig = this->state.getIOConfig();
ioconfig.setBaseName("MSIM"); ioconfig.setBaseName("MSIM");

View File

@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(MSIM_EXIT_TEST) {
Opm::Deck deck = parser.parseFile(deck_file); Opm::Deck deck = parser.parseFile(deck_file);
Opm::EclipseState state(deck); Opm::EclipseState state(deck);
Opm::Schedule schedule(deck, state, python); Opm::Schedule schedule(deck, state, python);
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), state.aquifer()); Opm::SummaryConfig summary_config(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer());
{ {
WorkArea work_area("test_msim"); WorkArea work_area("test_msim");

View File

@@ -193,7 +193,7 @@ END
const auto es = EclipseState{ deck }; const auto es = EclipseState{ deck };
const auto grid = es.getInputGrid(); const auto grid = es.getInputGrid();
auto sched = Schedule{ deck, es }; auto sched = Schedule{ deck, es };
auto summary_config = SummaryConfig{deck, sched, es.getTableManager(), es.aquifer()}; auto summary_config = SummaryConfig{deck, sched, es.fieldProps(), es.getTableManager(), es.aquifer()};
const auto& w1 = sched.getWell("P1", 0); const auto& w1 = sched.getWell("P1", 0);
const auto& porv = es.globalFieldProps().porv(true); const auto& porv = es.globalFieldProps().porv(true);
auto calc = w1.pavg_calculator(grid, porv); auto calc = w1.pavg_calculator(grid, porv);

View File

@@ -181,7 +181,7 @@ static SummaryConfig createSummary( std::string input , const ParseContext& pars
auto python = std::make_shared<Python>(); auto python = std::make_shared<Python>();
EclipseState state( deck ); EclipseState state( deck );
Schedule schedule(deck, state, parseContext, errors, python); Schedule schedule(deck, state, parseContext, errors, python);
return SummaryConfig(deck, schedule, state.getTableManager(), state.aquifer(), parseContext, errors); return SummaryConfig(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer(), parseContext, errors);
} }
BOOST_AUTO_TEST_CASE(wells_all) { BOOST_AUTO_TEST_CASE(wells_all) {
@@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE(EMPTY) {
auto python = std::make_shared<Python>(); auto python = std::make_shared<Python>();
EclipseState state( deck ); EclipseState state( deck );
Schedule schedule(deck, state, python); Schedule schedule(deck, state, python);
SummaryConfig conf(deck, schedule, state.getTableManager(), state.aquifer()); SummaryConfig conf(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer());
BOOST_CHECK_EQUAL( conf.size(), 0U ); BOOST_CHECK_EQUAL( conf.size(), 0U );
} }
@@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(wells_missingI) {
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION); parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION);
EclipseState state( deck ); EclipseState state( deck );
Schedule schedule(deck, state, parseContext, errors, python ); Schedule schedule(deck, state, parseContext, errors, python );
BOOST_CHECK_NO_THROW(SummaryConfig(deck, schedule, state.getTableManager(), state.aquifer(), parseContext, errors)); BOOST_CHECK_NO_THROW(SummaryConfig(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer(), parseContext, errors));
} }
@@ -779,7 +779,7 @@ BOOST_AUTO_TEST_CASE(Summary_Segment)
const auto schedule = Schedule { deck, state, python}; const auto schedule = Schedule { deck, state, python};
const auto summary = SummaryConfig { const auto summary = SummaryConfig {
deck, schedule, state.getTableManager(), state.aquifer() deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer()
}; };
// SOFR PROD01 segments 1, 10, 21. // SOFR PROD01 segments 1, 10, 21.
@@ -1123,7 +1123,7 @@ END
const auto parseContext = ParseContext{}; const auto parseContext = ParseContext{};
const auto state = EclipseState (deck); const auto state = EclipseState (deck);
const auto schedule = Schedule (deck, state, parseContext, errors, std::make_shared<const Python>()); const auto schedule = Schedule (deck, state, parseContext, errors, std::make_shared<const Python>());
const auto smry = SummaryConfig(deck, schedule, state.getTableManager(), state.aquifer(), parseContext, errors); const auto smry = SummaryConfig(deck, schedule, state.fieldProps(), state.getTableManager(), state.aquifer(), parseContext, errors);
BOOST_CHECK_MESSAGE(deck.hasKeyword("GPR"), R"(Deck must have "GPR" keyword)"); BOOST_CHECK_MESSAGE(deck.hasKeyword("GPR"), R"(Deck must have "GPR" keyword)");
BOOST_CHECK_MESSAGE(smry.hasKeyword("GPR"), R"(SummaryConfig must have "GPR" keyword)"); BOOST_CHECK_MESSAGE(smry.hasKeyword("GPR"), R"(SummaryConfig must have "GPR" keyword)");

View File

@@ -34,7 +34,7 @@ inline void loadDeck( const char * deck_file) {
auto deck = parser.parseFile(deck_file); auto deck = parser.parseFile(deck_file);
Opm::EclipseState state( deck); Opm::EclipseState state( deck);
Opm::Schedule schedule( deck, state, python); Opm::Schedule schedule( deck, state, python);
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), state.aquifer() ); Opm::SummaryConfig summary( deck, schedule, state.fieldProps(), state.getTableManager( ), state.aquifer() );
{ {
std::stringstream ss; std::stringstream ss;

View File

@@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) {
auto& eclGrid = es.getInputGrid(); auto& eclGrid = es.getInputGrid();
auto python = std::make_shared<Python>(); auto python = std::make_shared<Python>();
Schedule schedule(deck, es, python); Schedule schedule(deck, es, python);
SummaryConfig summary_config( deck, schedule, es.getTableManager( ), es.aquifer()); SummaryConfig summary_config( deck, schedule, es.fieldProps(), es.getTableManager( ), es.aquifer());
SummaryState st(TimeService::now()); SummaryState st(TimeService::now());
es.getIOConfig().setBaseName( "FOO" ); es.getIOConfig().setBaseName( "FOO" );

View File

@@ -270,7 +270,7 @@ BOOST_AUTO_TEST_CASE(test_RFT)
const auto numCells = grid.getCartesianSize( ); const auto numCells = grid.getCartesianSize( );
const Schedule schedule(deck, eclipseState, python); const Schedule schedule(deck, eclipseState, python);
const SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), eclipseState.aquifer() ); const SummaryConfig summary_config( deck, schedule, eclipseState.fieldProps(), eclipseState.getTableManager( ), eclipseState.aquifer() );
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config ); EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
@@ -397,7 +397,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2)
const auto numCells = grid.getCartesianSize( ); const auto numCells = grid.getCartesianSize( );
Schedule schedule(deck, eclipseState, python); Schedule schedule(deck, eclipseState, python);
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), eclipseState.aquifer() ); SummaryConfig summary_config( deck, schedule, eclipseState.fieldProps(), eclipseState.getTableManager( ), eclipseState.aquifer() );
SummaryState st(Opm::TimeService::now()); SummaryState st(Opm::TimeService::now());
Action::State action_state; Action::State action_state;
UDQState udq_state(10); UDQState udq_state(10);

View File

@@ -362,7 +362,7 @@ struct Setup {
grid( es.getInputGrid( ) ), grid( es.getInputGrid( ) ),
python( std::make_shared<Python>() ), python( std::make_shared<Python>() ),
schedule( deck, es, python ), schedule( deck, es, python ),
summary_config( deck, schedule, es.getTableManager( ), es.aquifer() ) summary_config( deck, schedule, es.fieldProps(), es.getTableManager( ), es.aquifer() )
{ {
auto& io_config = es.getIOConfig(); auto& io_config = es.getIOConfig();
io_config.setEclCompatibleRST(false); io_config.setEclCompatibleRST(false);

View File

@@ -456,7 +456,7 @@ struct setup {
grid( es.getInputGrid() ), grid( es.getInputGrid() ),
python( std::make_shared<Python>() ), python( std::make_shared<Python>() ),
schedule( deck, es, python), schedule( deck, es, python),
config( deck, schedule, es.getTableManager(), es.aquifer()), config( deck, schedule, es.fieldProps(), es.getTableManager(), es.aquifer()),
wells( result_wells(w3_injector) ), wells( result_wells(w3_injector) ),
grp_nwrk( result_group_nwrk() ), grp_nwrk( result_group_nwrk() ),
name( toupper(std::move(fname)) ), name( toupper(std::move(fname)) ),

View File

@@ -233,7 +233,7 @@ struct setup {
grid( es.getInputGrid() ), grid( es.getInputGrid() ),
python( std::make_shared<Python>() ), python( std::make_shared<Python>() ),
schedule( deck, es, python), schedule( deck, es, python),
config( deck, schedule, es.getTableManager(), es.aquifer() ), config( deck, schedule, es.fieldProps(), es.getTableManager(), es.aquifer() ),
wells( result_wells() ), wells( result_wells() ),
grp_nwrk( result_group_network() ), grp_nwrk( result_group_network() ),
name( toupper(std::move(fname)) ), name( toupper(std::move(fname)) ),

View File

@@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
Opm::EclipseState es(deck); Opm::EclipseState es(deck);
const Opm::EclipseGrid& grid = es.getInputGrid(); const Opm::EclipseGrid& grid = es.getInputGrid();
Opm::Schedule schedule( deck, es, python); Opm::Schedule schedule( deck, es, python);
Opm::SummaryConfig summary_config( deck, schedule, es.getTableManager( ), es.aquifer()); Opm::SummaryConfig summary_config( deck, schedule, es.fieldProps(), es.getTableManager( ), es.aquifer());
const auto num_cells = grid.getCartesianSize(); const auto num_cells = grid.getCartesianSize();
Opm::EclipseIO eclipseWriter( es, grid , schedule, summary_config); Opm::EclipseIO eclipseWriter( es, grid , schedule, summary_config);
int countTimeStep = schedule.size() - 1; int countTimeStep = schedule.size() - 1;