Extract Schedule and SummaryConfig.
This commit is contained in:
parent
a8f07228ce
commit
21a2944885
@ -22,15 +22,15 @@
|
||||
#ifndef OPM_ECLIPSE_WRITER_HPP
|
||||
#define OPM_ECLIPSE_WRITER_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
|
||||
#include <opm/output/data/Cells.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
@ -39,6 +39,8 @@
|
||||
namespace Opm {
|
||||
|
||||
class EclipseState;
|
||||
class SummaryConfig;
|
||||
class Schedule;
|
||||
|
||||
/*!
|
||||
* \brief A class to write the reservoir state and the well state of a
|
||||
@ -50,7 +52,10 @@ public:
|
||||
* \brief Sets the common attributes required to write eclipse
|
||||
* binary files using ERT.
|
||||
*/
|
||||
EclipseIO( const EclipseState&, EclipseGrid );
|
||||
EclipseIO( const EclipseState& es,
|
||||
EclipseGrid grid,
|
||||
const Schedule& schedule,
|
||||
const SummaryConfig& summary_config);
|
||||
|
||||
|
||||
|
||||
|
@ -23,14 +23,15 @@
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
class EclipseState;
|
||||
class Eclipse3DProperties;
|
||||
class Schedule;
|
||||
class EclipseGrid;
|
||||
|
||||
namespace out {
|
||||
class RegionCache {
|
||||
public:
|
||||
RegionCache() = default;
|
||||
RegionCache(const EclipseState& state, const EclipseGrid& grid);
|
||||
RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule);
|
||||
const std::vector<size_t>& cells( int region_id ) const;
|
||||
const std::vector<std::pair<std::string,size_t>>& completions( int region_id ) const;
|
||||
|
||||
|
@ -79,6 +79,7 @@ void save(const std::string& filename,
|
||||
data::Wells wells,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
std::map<std::string, std::vector<double>> extra_data = {},
|
||||
bool write_double = false);
|
||||
|
||||
@ -88,6 +89,7 @@ RestartValue load( const std::string& filename,
|
||||
const std::map<std::string, RestartKey>& keys,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const std::map<std::string, bool>& extra_keys = {});
|
||||
|
||||
}
|
||||
|
@ -40,18 +40,20 @@ namespace Opm {
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class EclipseGrid;
|
||||
class Schedule;
|
||||
|
||||
namespace out {
|
||||
|
||||
class Summary {
|
||||
public:
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const std::string& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const char* basename );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const std::string& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const char* basename );
|
||||
|
||||
void add_timestep( int report_step,
|
||||
double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::Wells&,
|
||||
const data::Solution&,
|
||||
const std::map<std::string, double>& misc_values);
|
||||
|
@ -191,12 +191,13 @@ inline std::string uppercase( std::string x ) {
|
||||
|
||||
class EclipseIO::Impl {
|
||||
public:
|
||||
Impl( const EclipseState& es, EclipseGrid grid );
|
||||
Impl( const EclipseState&, EclipseGrid, const Schedule&, const SummaryConfig& );
|
||||
void writeINITFile( const data::Solution& simProps, const NNC& nnc) const;
|
||||
void writeEGRIDFile( const NNC& nnc ) const;
|
||||
|
||||
const EclipseState& es;
|
||||
EclipseGrid grid;
|
||||
const Schedule& schedule;
|
||||
std::string outputDir;
|
||||
std::string baseName;
|
||||
out::Summary summary;
|
||||
@ -205,12 +206,15 @@ class EclipseIO::Impl {
|
||||
};
|
||||
|
||||
EclipseIO::Impl::Impl( const EclipseState& eclipseState,
|
||||
EclipseGrid grid_)
|
||||
EclipseGrid grid_,
|
||||
const Schedule& schedule_,
|
||||
const SummaryConfig& summary_config)
|
||||
: es( eclipseState )
|
||||
, grid( std::move( grid_ ) )
|
||||
, schedule( schedule_ )
|
||||
, outputDir( eclipseState.getIOConfig().getOutputDir() )
|
||||
, baseName( uppercase( eclipseState.getIOConfig().getBaseName() ) )
|
||||
, summary( eclipseState, eclipseState.getSummaryConfig() , grid )
|
||||
, summary( eclipseState, summary_config, grid , schedule )
|
||||
, rft( outputDir.c_str(), baseName.c_str(), es.getIOConfig().getFMTOUT() )
|
||||
, output_enabled( eclipseState.getIOConfig().getOutputEnabled() )
|
||||
{}
|
||||
@ -253,7 +257,7 @@ void EclipseIO::Impl::writeINITFile( const data::Solution& simProps, const NNC&
|
||||
NULL,
|
||||
units.getEclType(),
|
||||
this->es.runspec( ).eclPhaseMask( ),
|
||||
this->es.getSchedule().posixStartTime( ));
|
||||
this->schedule.posixStartTime( ));
|
||||
|
||||
units.from_si( UnitSystem::measure::volume, ecl_data );
|
||||
writeKeyword( fortio, "PORV" , ecl_data );
|
||||
@ -406,6 +410,7 @@ void EclipseIO::writeTimeStep(int report_step,
|
||||
|
||||
const auto& es = this->impl->es;
|
||||
const auto& grid = this->impl->grid;
|
||||
const auto& schedule = this->impl->schedule;
|
||||
const auto& units = es.getUnits();
|
||||
const auto& ioConfig = es.getIOConfig();
|
||||
const auto& restart = es.cfg().restart();
|
||||
@ -419,6 +424,7 @@ void EclipseIO::writeTimeStep(int report_step,
|
||||
this->impl->summary.add_timestep( report_step,
|
||||
secs_elapsed,
|
||||
es,
|
||||
schedule,
|
||||
wells ,
|
||||
cells ,
|
||||
misc_summary_values );
|
||||
@ -439,7 +445,7 @@ void EclipseIO::writeTimeStep(int report_step,
|
||||
report_step,
|
||||
ioConfig.getFMTOUT() );
|
||||
|
||||
RestartIO::save( filename , report_step, secs_elapsed, cells, wells, es , grid , extra_restart , write_double);
|
||||
RestartIO::save( filename , report_step, secs_elapsed, cells, wells, es , grid , schedule, extra_restart , write_double);
|
||||
}
|
||||
|
||||
|
||||
@ -450,14 +456,13 @@ void EclipseIO::writeTimeStep(int report_step,
|
||||
return;
|
||||
|
||||
{
|
||||
const auto& schedule = es.getSchedule();
|
||||
std::vector<const Well*> sched_wells = schedule.getWells( report_step );
|
||||
std::vector<const Well*> sched_wells = this->impl->schedule.getWells( report_step );
|
||||
const auto rft_active = [report_step] (const Well* w) { return w->getRFTActive( report_step ) || w->getPLTActive( report_step ); };
|
||||
if (std::any_of(sched_wells.begin(), sched_wells.end(), rft_active)) {
|
||||
this->impl->rft.writeTimeStep( sched_wells,
|
||||
grid,
|
||||
report_step,
|
||||
secs_elapsed + schedule.posixStartTime(),
|
||||
secs_elapsed + this->impl->schedule.posixStartTime(),
|
||||
units.from_si( UnitSystem::measure::time, secs_elapsed ),
|
||||
units,
|
||||
cells );
|
||||
@ -471,6 +476,7 @@ void EclipseIO::writeTimeStep(int report_step,
|
||||
RestartValue EclipseIO::loadRestart(const std::map<std::string, RestartKey>& keys, const std::map<std::string, bool>& extra_keys) const {
|
||||
const auto& es = this->impl->es;
|
||||
const auto& grid = this->impl->grid;
|
||||
const auto& schedule = this->impl->schedule;
|
||||
const InitConfig& initConfig = es.getInitConfig();
|
||||
const auto& ioConfig = es.getIOConfig();
|
||||
const int report_step = initConfig.getRestartStep();
|
||||
@ -478,11 +484,14 @@ RestartValue EclipseIO::loadRestart(const std::map<std::string, RestartKey>& key
|
||||
report_step,
|
||||
false );
|
||||
|
||||
return RestartIO::load( filename , report_step , keys , es, grid , extra_keys);
|
||||
return RestartIO::load( filename , report_step , keys , es, grid , schedule, extra_keys);
|
||||
}
|
||||
|
||||
EclipseIO::EclipseIO( const EclipseState& es, EclipseGrid grid)
|
||||
: impl( new Impl( es, std::move( grid ) ) )
|
||||
EclipseIO::EclipseIO( const EclipseState& es,
|
||||
EclipseGrid grid,
|
||||
const Schedule& schedule,
|
||||
const SummaryConfig& summary_config)
|
||||
: impl( new Impl( es, std::move( grid ), schedule , summary_config) )
|
||||
{
|
||||
if( !this->impl->output_enabled )
|
||||
return;
|
||||
|
@ -30,8 +30,7 @@
|
||||
namespace Opm {
|
||||
namespace out {
|
||||
|
||||
RegionCache::RegionCache(const EclipseState& state, const EclipseGrid& grid) {
|
||||
const auto& properties = state.get3DProperties();
|
||||
RegionCache::RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule) {
|
||||
const auto& fipnum = properties.getIntGridProperty("FIPNUM");
|
||||
const auto& region_values = properties.getRegions( "FIPNUM" );
|
||||
|
||||
@ -40,7 +39,6 @@ namespace out {
|
||||
|
||||
|
||||
{
|
||||
const auto& schedule = state.getSchedule();
|
||||
const auto& wells = schedule.getWells();
|
||||
for (const auto& well : wells) {
|
||||
const auto& completions = well->getCompletions( );
|
||||
|
@ -144,9 +144,10 @@ data::Wells restore_wells( const ecl_kw_type * opm_xwel,
|
||||
const ecl_kw_type * opm_iwel,
|
||||
int restart_step,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid) {
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule) {
|
||||
|
||||
const auto& sched_wells = es.getSchedule().getWells( restart_step );
|
||||
const auto& sched_wells = schedule.getWells( restart_step );
|
||||
std::vector< rt > phases;
|
||||
{
|
||||
const auto& phase = es.runspec().phases();
|
||||
@ -222,6 +223,7 @@ RestartValue load( const std::string& filename,
|
||||
const std::map<std::string, RestartKey>& keys,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const std::map<std::string, bool>& extra_keys) {
|
||||
|
||||
const bool unified = ( ERT::EclFiletype( filename ) == ECL_UNIFIED_RESTART_FILE );
|
||||
@ -246,7 +248,7 @@ RestartValue load( const std::string& filename,
|
||||
|
||||
UnitSystem units( static_cast<ert_ecl_unit_enum>(ecl_kw_iget_int( intehead , INTEHEAD_UNIT_INDEX )));
|
||||
RestartValue rst_value( restoreSOLUTION( file_view, keys, units , grid.getNumActive( )),
|
||||
restore_wells( opm_xwel, opm_iwel, report_step , es, grid));
|
||||
restore_wells( opm_xwel, opm_iwel, report_step , es, grid, schedule));
|
||||
|
||||
for (const auto& pair : extra_keys) {
|
||||
const std::string& key = pair.first;
|
||||
@ -515,9 +517,7 @@ void writeExtraData(ecl_rst_file_type* rst_file, const std::map<std::string,std:
|
||||
|
||||
|
||||
|
||||
void writeWell(ecl_rst_file_type* rst_file, int report_step, const EclipseState& es , const EclipseGrid& grid, const data::Wells& wells) {
|
||||
|
||||
const auto& schedule = es.getSchedule();
|
||||
void writeWell(ecl_rst_file_type* rst_file, int report_step, const EclipseState& es , const EclipseGrid& grid, const Schedule& schedule, const data::Wells& wells) {
|
||||
const auto sched_wells = schedule.getWells(report_step);
|
||||
const auto& phases = es.runspec().phases();
|
||||
const size_t ncwmax = schedule.getMaxNumCompletionsForWells(report_step);
|
||||
@ -567,13 +567,13 @@ void save(const std::string& filename,
|
||||
data::Wells wells,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
std::map<std::string, std::vector<double>> extra_data,
|
||||
bool write_double)
|
||||
{
|
||||
checkSaveArguments( cells, grid, extra_data );
|
||||
{
|
||||
int ert_phase_mask = es.runspec().eclPhaseMask( );
|
||||
const Schedule& schedule = es.getSchedule();
|
||||
const auto& units = es.getUnits();
|
||||
time_t posix_time = schedule.posixStartTime() + seconds_elapsed;
|
||||
const auto sim_time = units.from_si( UnitSystem::measure::time, seconds_elapsed );
|
||||
@ -587,7 +587,7 @@ void save(const std::string& filename,
|
||||
|
||||
cells.convertFromSI( units );
|
||||
writeHeader( rst_file.get() , report_step, posix_time , sim_time, ert_phase_mask, units, schedule , grid );
|
||||
writeWell( rst_file.get() , report_step, es , grid, wells);
|
||||
writeWell( rst_file.get() , report_step, es , grid, schedule, wells);
|
||||
writeSolution( rst_file.get() , cells , write_double );
|
||||
writeExtraData( rst_file.get() , extra_data );
|
||||
}
|
||||
|
@ -809,24 +809,26 @@ class Summary::keyword_handlers {
|
||||
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum ,
|
||||
const EclipseGrid& grid_arg) :
|
||||
Summary( st, sum, grid_arg, st.getIOConfig().fullBasePath().c_str() )
|
||||
const EclipseGrid& grid_arg,
|
||||
const Schedule& schedule) :
|
||||
Summary( st, sum, grid_arg, schedule, st.getIOConfig().fullBasePath().c_str() )
|
||||
{}
|
||||
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum,
|
||||
const EclipseGrid& grid_arg,
|
||||
const Schedule& schedule,
|
||||
const std::string& basename ) :
|
||||
Summary( st, sum, grid_arg, basename.c_str() )
|
||||
Summary( st, sum, grid_arg, schedule, basename.c_str() )
|
||||
{}
|
||||
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum,
|
||||
const EclipseGrid& grid_arg,
|
||||
const Schedule& schedule,
|
||||
const char* basename ) :
|
||||
grid( grid_arg ),
|
||||
regionCache( st , grid_arg ),
|
||||
|
||||
regionCache( st.get3DProperties( ) , grid_arg, schedule ),
|
||||
handlers( new keyword_handlers() ),
|
||||
porv( st.get3DProperties().getDoubleGridProperty("PORV").compressedCopy(grid_arg))
|
||||
{
|
||||
@ -845,7 +847,7 @@ Summary::Summary( const EclipseState& st,
|
||||
st.getIOConfig().getFMTOUT(),
|
||||
st.getIOConfig().getUNIFOUT(),
|
||||
":",
|
||||
st.getSchedule().posixStartTime(),
|
||||
schedule.posixStartTime(),
|
||||
true,
|
||||
st.getInputGrid().getNX(),
|
||||
st.getInputGrid().getNY(),
|
||||
@ -916,15 +918,14 @@ Summary::Summary( const EclipseState& st,
|
||||
void Summary::add_timestep( int report_step,
|
||||
double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::Wells& wells ,
|
||||
const data::Solution& state,
|
||||
const std::map<std::string, double>& misc_values) {
|
||||
|
||||
auto* tstep = ecl_sum_add_tstep( this->ecl_sum.get(), report_step, secs_elapsed );
|
||||
const double duration = secs_elapsed - this->prev_time_elapsed;
|
||||
|
||||
const size_t timestep = report_step;
|
||||
const auto& schedule = es.getSchedule();
|
||||
|
||||
for( auto& f : this->handlers->handlers ) {
|
||||
const int num = smspec_node_get_num( f.first );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
@ -291,12 +292,15 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) {
|
||||
ERT::TestArea ta("test_ecl_writer");
|
||||
|
||||
auto write_and_check = [&]( int first = 1, int last = 5 ) {
|
||||
auto deck = Parser().parseString( deckString, ParseContext() );
|
||||
ParseContext parse_context;
|
||||
auto deck = Parser().parseString( deckString, parse_context );
|
||||
auto es = Parser::parse( deck );
|
||||
auto& eclGrid = es.getInputGrid();
|
||||
Schedule schedule(deck, eclGrid, es.get3DProperties(), es.runspec().phases(), parse_context);
|
||||
SummaryConfig summary_config( deck, schedule, es.getTableManager( ), parse_context);
|
||||
es.getIOConfig().setBaseName( "FOO" );
|
||||
|
||||
EclipseIO eclWriter( es, eclGrid );
|
||||
EclipseIO eclWriter( es, eclGrid , schedule, summary_config);
|
||||
|
||||
using measure = UnitSystem::measure;
|
||||
using TargetType = data::TargetType;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
@ -104,12 +105,13 @@ data::Solution createBlackoilState( int timeStepIdx, int numCells ) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_RFT) {
|
||||
|
||||
ParseContext parse_context;
|
||||
std::string eclipse_data_filename = "testRFT.DATA";
|
||||
ERT::TestArea test_area("test_RFT");
|
||||
test_area.copyFile( eclipse_data_filename );
|
||||
|
||||
auto eclipseState = Parser::parse( eclipse_data_filename );
|
||||
auto deck = Parser().parseFile( eclipse_data_filename, parse_context );
|
||||
auto eclipseState = Parser::parse( deck );
|
||||
{
|
||||
/* eclipseWriter is scoped here to ensure it is destroyed after the
|
||||
* file itself has been written, because we're going to reload it
|
||||
@ -119,10 +121,10 @@ BOOST_AUTO_TEST_CASE(test_RFT) {
|
||||
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
const auto numCells = grid.getCartesianSize( );
|
||||
|
||||
EclipseIO eclipseWriter( eclipseState, grid);
|
||||
time_t start_time = eclipseState.getSchedule().posixStartTime();
|
||||
/* step time read from deck and hard-coded here */
|
||||
Schedule schedule(deck, grid, eclipseState.get3DProperties(), eclipseState.runspec().phases(), parse_context);
|
||||
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), parse_context);
|
||||
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
|
||||
time_t start_time = schedule.posixStartTime();
|
||||
time_t step_time = ecl_util_make_date(10, 10, 2008 );
|
||||
|
||||
data::Rates r1, r2;
|
||||
@ -174,12 +176,13 @@ void verifyRFTFile2(const std::string& rft_filename) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_RFT2) {
|
||||
|
||||
ParseContext parse_context;
|
||||
std::string eclipse_data_filename = "testRFT.DATA";
|
||||
ERT::TestArea test_area("test_RFT");
|
||||
test_area.copyFile( eclipse_data_filename );
|
||||
|
||||
auto eclipseState = Parser::parse( eclipse_data_filename );
|
||||
auto deck = Parser().parseFile( eclipse_data_filename, parse_context );
|
||||
auto eclipseState = Parser::parse( deck );
|
||||
{
|
||||
/* eclipseWriter is scoped here to ensure it is destroyed after the
|
||||
* file itself has been written, because we're going to reload it
|
||||
@ -190,9 +193,11 @@ BOOST_AUTO_TEST_CASE(test_RFT2) {
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
const auto numCells = grid.getCartesianSize( );
|
||||
|
||||
EclipseIO eclipseWriter( eclipseState, grid);
|
||||
time_t start_time = eclipseState.getSchedule().posixStartTime();
|
||||
const auto& time_map = eclipseState.getSchedule().getTimeMap( );
|
||||
Schedule schedule(deck, grid, eclipseState.get3DProperties(), eclipseState.runspec().phases(), parse_context);
|
||||
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), parse_context);
|
||||
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
|
||||
time_t start_time = schedule.posixStartTime();
|
||||
const auto& time_map = schedule.getTimeMap( );
|
||||
|
||||
for (int counter = 0; counter < 2; counter++) {
|
||||
for (size_t step = 0; step < time_map.size(); step++) {
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -388,6 +389,27 @@ void compare( const RestartValue& fst,
|
||||
BOOST_CHECK_EQUAL( fst.wells, snd.wells );
|
||||
}
|
||||
|
||||
|
||||
struct Setup {
|
||||
Deck deck;
|
||||
EclipseState es;
|
||||
const EclipseGrid& grid;
|
||||
Schedule schedule;
|
||||
SummaryConfig summary_config;
|
||||
|
||||
Setup( const char* path, const ParseContext& parseContext = ParseContext( )) :
|
||||
deck( Parser().parseFile( path, parseContext ) ),
|
||||
es( deck, parseContext ),
|
||||
grid( es.getInputGrid( ) ),
|
||||
schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext),
|
||||
summary_config( deck, schedule, es.getTableManager( ), parseContext)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) {
|
||||
std::map<std::string, RestartKey> keys {{"PRESSURE" , RestartKey(UnitSystem::measure::pressure)},
|
||||
{"SWAT" , RestartKey(UnitSystem::measure::identity)},
|
||||
@ -396,10 +418,9 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) {
|
||||
ERT::TestArea testArea("test_Restart");
|
||||
testArea.copyFile( "FIRST_SIM.DATA" );
|
||||
|
||||
auto eclipseState = Parser::parse( "FIRST_SIM.DATA" );
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
EclipseIO eclWriter( eclipseState, grid);
|
||||
auto state1 = first_sim( eclipseState , eclWriter , false );
|
||||
Setup setup("FIRST_SIM.DATA");
|
||||
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
|
||||
auto state1 = first_sim( setup.es , eclWriter , false );
|
||||
auto state2 = second_sim( eclWriter , keys );
|
||||
compare(state1, state2 , keys);
|
||||
|
||||
@ -440,10 +461,10 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData_double) {
|
||||
ERT::TestArea testArea("test_Restart");
|
||||
testArea.copyFile( "FIRST_SIM.DATA" );
|
||||
|
||||
auto eclipseState = Parser::parse( "FIRST_SIM.DATA" );
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
EclipseIO eclWriter( eclipseState, grid);
|
||||
auto state1 = first_sim( eclipseState , eclWriter , true);
|
||||
Setup setup("FIRST_SIM.DATA");
|
||||
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
|
||||
|
||||
auto state1 = first_sim( setup.es , eclWriter , true);
|
||||
auto state2 = second_sim( eclWriter , keys );
|
||||
compare_equal( state1 , state2 , keys);
|
||||
}
|
||||
@ -454,11 +475,10 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
|
||||
if (std::getenv("TRAVIS_CI"))
|
||||
return;
|
||||
|
||||
const auto eclipseState = Parser::parse( "FIRST_SIM.DATA" );
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
Setup setup("FIRST_SIM.DATA");
|
||||
{
|
||||
ERT::TestArea testArea("test_Restart");
|
||||
auto num_cells = grid.getNumActive( ) + 1;
|
||||
auto num_cells = setup.grid.getNumActive( ) + 1;
|
||||
auto cells = mkSolution( num_cells );
|
||||
auto wells = mkWells();
|
||||
|
||||
@ -466,18 +486,19 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
|
||||
100,
|
||||
cells ,
|
||||
wells ,
|
||||
eclipseState ,
|
||||
grid ), std::runtime_error);
|
||||
setup.es,
|
||||
setup.grid ,
|
||||
setup.schedule),
|
||||
std::runtime_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
|
||||
auto eclipseState = Parser::parse( "FIRST_SIM.DATA" );
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
Setup setup("FIRST_SIM.DATA");
|
||||
{
|
||||
ERT::TestArea testArea("test_Restart");
|
||||
auto num_cells = grid.getNumActive( );
|
||||
auto num_cells = setup.grid.getNumActive( );
|
||||
auto cells = mkSolution( num_cells );
|
||||
auto wells = mkWells();
|
||||
|
||||
@ -489,8 +510,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
|
||||
100,
|
||||
cells ,
|
||||
wells ,
|
||||
eclipseState ,
|
||||
grid,
|
||||
setup.es,
|
||||
setup.grid,
|
||||
setup.schedule,
|
||||
extra),
|
||||
std::runtime_error);
|
||||
}
|
||||
@ -503,8 +525,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
|
||||
100,
|
||||
cells ,
|
||||
wells ,
|
||||
eclipseState ,
|
||||
grid,
|
||||
setup.es,
|
||||
setup.grid,
|
||||
setup.schedule,
|
||||
extra),
|
||||
std::runtime_error);
|
||||
}
|
||||
@ -517,8 +540,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
|
||||
100,
|
||||
cells ,
|
||||
wells ,
|
||||
eclipseState ,
|
||||
grid,
|
||||
setup.es,
|
||||
setup.grid,
|
||||
setup.schedule,
|
||||
extra),
|
||||
std::runtime_error);
|
||||
}
|
||||
@ -526,11 +550,10 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ExtraData_content) {
|
||||
auto eclipseState = Parser::parse( "FIRST_SIM.DATA" );
|
||||
const auto& grid = eclipseState.getInputGrid();
|
||||
Setup setup("FIRST_SIM.DATA");
|
||||
{
|
||||
ERT::TestArea testArea("test_Restart");
|
||||
auto num_cells = grid.getNumActive( );
|
||||
auto num_cells = setup.grid.getNumActive( );
|
||||
auto cells = mkSolution( num_cells );
|
||||
auto wells = mkWells();
|
||||
{
|
||||
@ -540,8 +563,9 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
|
||||
100,
|
||||
cells ,
|
||||
wells ,
|
||||
eclipseState ,
|
||||
grid,
|
||||
setup.es,
|
||||
setup.grid,
|
||||
setup.schedule,
|
||||
extra);
|
||||
|
||||
{
|
||||
@ -557,11 +581,11 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
|
||||
ecl_file_close( f );
|
||||
}
|
||||
|
||||
BOOST_CHECK_THROW( RestartIO::load( "FILE.UNRST" , 1 , {}, eclipseState, grid , {{"NOT-THIS", true}}) , std::runtime_error );
|
||||
BOOST_CHECK_THROW( RestartIO::load( "FILE.UNRST" , 1 , {}, setup.es, setup.grid , setup.schedule, {{"NOT-THIS", true}}) , std::runtime_error );
|
||||
{
|
||||
const auto rst_value = RestartIO::load( "FILE.UNRST" , 1 , {{"SWAT" , RestartKey(UnitSystem::measure::identity)},
|
||||
{"NO" , {UnitSystem::measure::identity, false}}},
|
||||
eclipseState, grid , {{"EXTRA", true}, {"EXTRA2", false}});
|
||||
setup.es, setup.grid , setup.schedule, {{"EXTRA", true}, {"EXTRA2", false}});
|
||||
const auto pair = rst_value.extra.find( "EXTRA" );
|
||||
const std::vector<double> extraval = pair->second;
|
||||
const std::vector<double> expected = {0,1,2,3};
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -203,8 +204,9 @@ ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > readsum( const std::string& ba
|
||||
struct setup {
|
||||
Deck deck;
|
||||
EclipseState es;
|
||||
SummaryConfig config;
|
||||
const EclipseGrid& grid;
|
||||
Schedule schedule;
|
||||
SummaryConfig config;
|
||||
data::Wells wells;
|
||||
std::string name;
|
||||
ERT::TestArea ta;
|
||||
@ -217,14 +219,14 @@ struct setup {
|
||||
setup( const std::string& fname , const char* path = "summary_deck.DATA", const ParseContext& parseContext = ParseContext( )) :
|
||||
deck( Parser().parseFile( path, parseContext ) ),
|
||||
es( deck, ParseContext() ),
|
||||
config( deck, es.getSchedule(), es.getTableManager(), parseContext ),
|
||||
grid( es.getInputGrid() ),
|
||||
schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext),
|
||||
config( deck, schedule, es.getTableManager(), parseContext ),
|
||||
wells( result_wells() ),
|
||||
name( fname ),
|
||||
ta( ERT::TestArea("test_summary") ),
|
||||
solution( make_solution( es.getInputGrid() ) )
|
||||
solution( make_solution( grid ) )
|
||||
{
|
||||
solution = make_solution( es.getInputGrid());
|
||||
}
|
||||
|
||||
};
|
||||
@ -242,10 +244,10 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
|
||||
util_make_path( "PATH" );
|
||||
cfg.name = "PATH/CASE";
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -378,10 +380,10 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
|
||||
BOOST_AUTO_TEST_CASE(group_keywords) {
|
||||
setup cfg( "test_Summary_group" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -476,10 +478,10 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
|
||||
BOOST_AUTO_TEST_CASE(group_group) {
|
||||
setup cfg( "test_Summary_group_group" , "group_group.DATA");
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution , {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution , {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -528,10 +530,10 @@ BOOST_AUTO_TEST_CASE(group_group) {
|
||||
BOOST_AUTO_TEST_CASE(completion_kewords) {
|
||||
setup cfg( "test_Summary_completion" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -581,10 +583,10 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
|
||||
BOOST_AUTO_TEST_CASE(field_keywords) {
|
||||
setup cfg( "test_Summary_field" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -678,11 +680,11 @@ BOOST_AUTO_TEST_CASE(foe_test) {
|
||||
data::Solution sol;
|
||||
sol.insert( "OIP", UnitSystem::measure::volume, oip, data::TargetType::RESTART_AUXILIARY );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.set_initial( sol );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -699,10 +701,10 @@ BOOST_AUTO_TEST_CASE(foe_test) {
|
||||
BOOST_AUTO_TEST_CASE(report_steps_time) {
|
||||
setup cfg( "test_Summary_report_steps_time" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -721,10 +723,10 @@ BOOST_AUTO_TEST_CASE(report_steps_time) {
|
||||
BOOST_AUTO_TEST_CASE(skip_unknown_var) {
|
||||
setup cfg( "test_Summary_skip_unknown_var" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -741,10 +743,10 @@ BOOST_AUTO_TEST_CASE(region_vars) {
|
||||
setup cfg( "region_vars" );
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.write();
|
||||
}
|
||||
|
||||
@ -788,10 +790,10 @@ BOOST_AUTO_TEST_CASE(region_production) {
|
||||
setup cfg( "region_production" );
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
}
|
||||
|
||||
@ -816,10 +818,10 @@ BOOST_AUTO_TEST_CASE(region_production) {
|
||||
BOOST_AUTO_TEST_CASE(region_injection) {
|
||||
setup cfg( "region_injection" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -845,10 +847,10 @@ BOOST_AUTO_TEST_CASE(region_injection) {
|
||||
BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) {
|
||||
setup cfg( "region_injection" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -891,7 +893,7 @@ BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) {
|
||||
BOOST_AUTO_TEST_CASE( require3D )
|
||||
{
|
||||
setup cfg( "XXXX" );
|
||||
const auto summaryConfig = cfg.es.getSummaryConfig( );
|
||||
const auto summaryConfig = cfg.config;
|
||||
|
||||
BOOST_CHECK( summaryConfig.require3DField( "PRESSURE" ));
|
||||
BOOST_CHECK( summaryConfig.require3DField( "SGAS" ));
|
||||
@ -911,10 +913,10 @@ BOOST_AUTO_TEST_CASE( require3D )
|
||||
BOOST_AUTO_TEST_CASE(fpr) {
|
||||
setup cfg( "test_fpr", "summary_deck_non_constant_porosity.DATA");
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -940,10 +942,10 @@ BOOST_AUTO_TEST_CASE(fpr) {
|
||||
}
|
||||
}
|
||||
|
||||
out::Summary writer2( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer2.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer2.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer2.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer2( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer2.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer2.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer2.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer2.write();
|
||||
|
||||
auto res2 = readsum( cfg.name );
|
||||
@ -958,10 +960,10 @@ BOOST_AUTO_TEST_CASE(rpr) {
|
||||
setup cfg( "test_rpr", "summary_deck_non_constant_porosity.DATA");
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells, cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.schedule, cfg.wells, cfg.solution, {});
|
||||
writer.write();
|
||||
}
|
||||
|
||||
@ -998,10 +1000,10 @@ BOOST_AUTO_TEST_CASE(rpr) {
|
||||
BOOST_AUTO_TEST_CASE(MISC) {
|
||||
setup cfg( "test_MISC");
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, {});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, {});
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -1014,17 +1016,17 @@ BOOST_AUTO_TEST_CASE(EXTRA) {
|
||||
setup cfg( "test_EXTRA");
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 0 }});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 1 }});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution, { {"TCPU" , 2}});
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 0 }});
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 1 }});
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"TCPU" , 2}});
|
||||
|
||||
/* Add a not-recognized key; that is OK */
|
||||
BOOST_CHECK_NO_THROW( writer.add_timestep( 3, 3 * day, cfg.es, cfg.wells , cfg.solution, { {"MISSING" , 2 }}));
|
||||
/* Add a not-recognized key; that is OK */
|
||||
BOOST_CHECK_NO_THROW( writer.add_timestep( 3, 3 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"MISSING" , 2 }}));
|
||||
|
||||
/* Override a NOT MISC variable - ignored. */
|
||||
writer.add_timestep( 4, 4 * day, cfg.es, cfg.wells , cfg.solution, { {"FOPR" , -1 }});
|
||||
writer.write();
|
||||
/* Override a NOT MISC variable - ignored. */
|
||||
writer.add_timestep( 4, 4 * day, cfg.es, cfg.schedule, cfg.wells , cfg.solution, { {"FOPR" , -1 }});
|
||||
writer.write();
|
||||
}
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/output/eclipse/RegionCache.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -47,7 +48,8 @@ BOOST_AUTO_TEST_CASE(create) {
|
||||
Deck deck( parser.parseFile( path, parseContext ));
|
||||
EclipseState es(deck , parseContext );
|
||||
const EclipseGrid& grid = es.getInputGrid();
|
||||
out::RegionCache rc(es , grid);
|
||||
Schedule schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), ParseContext() );
|
||||
out::RegionCache rc(es.get3DProperties() , grid, schedule);
|
||||
|
||||
|
||||
const auto& c1 = rc.cells( 1 );
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -134,15 +135,19 @@ void verifyWellState(const std::string& rst_filename,
|
||||
BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
|
||||
std::string eclipse_data_filename = "testBlackoilState3.DATA";
|
||||
std::string eclipse_restart_filename = "TESTBLACKOILSTATE3.X0004";
|
||||
|
||||
test_work_area_type * test_area = test_work_area_alloc("TEST_EclipseWriteNumWells");
|
||||
test_work_area_copy_file(test_area, eclipse_data_filename.c_str());
|
||||
|
||||
auto es = Parser::parse( eclipse_data_filename, ParseContext() );
|
||||
const auto num_cells = es.getInputGrid().getCartesianSize();
|
||||
EclipseIO eclipseWriter( es, es.getInputGrid() );
|
||||
|
||||
int countTimeStep = es.getSchedule().getTimeMap().numTimesteps();
|
||||
ParseContext parseContext;
|
||||
Parser parser;
|
||||
Deck deck( parser.parseFile( eclipse_data_filename, parseContext ));
|
||||
EclipseState es(deck , parseContext );
|
||||
const EclipseGrid& grid = es.getInputGrid();
|
||||
Schedule schedule( deck, grid, es.get3DProperties(), es.runspec().phases(), parseContext);
|
||||
SummaryConfig summary_config( deck, schedule, es.getTableManager( ), parseContext);
|
||||
const auto num_cells = grid.getCartesianSize();
|
||||
EclipseIO eclipseWriter( es, grid , schedule, summary_config);
|
||||
int countTimeStep = schedule.getTimeMap().numTimesteps();
|
||||
|
||||
data::Solution solution;
|
||||
solution.insert( "PRESSURE",UnitSystem::measure::pressure , std::vector< double >( num_cells, 1 ) , data::TargetType::RESTART_SOLUTION);
|
||||
@ -159,7 +164,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
|
||||
{} );
|
||||
}
|
||||
|
||||
verifyWellState(eclipse_restart_filename, es.getInputGrid(), es.getSchedule());
|
||||
verifyWellState(eclipse_restart_filename, grid, schedule);
|
||||
|
||||
test_work_area_free(test_area);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user