Check that completion corresponds to active cell.
This commit is contained in:
parent
cd2ee0e897
commit
ac4640effe
@ -39,6 +39,7 @@ namespace Opm {
|
||||
class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class EclipseGrid;
|
||||
|
||||
namespace out {
|
||||
|
||||
@ -46,13 +47,12 @@ namespace out {
|
||||
|
||||
class Summary {
|
||||
public:
|
||||
Summary( const EclipseState&, const SummaryConfig& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const std::string& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const char* basename );
|
||||
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 );
|
||||
|
||||
void add_timestep( int report_step,
|
||||
double secs_elapsed,
|
||||
const EclipseGrid& grid,
|
||||
const EclipseState& es,
|
||||
const RegionCache& regionCache,
|
||||
const data::Wells&,
|
||||
@ -64,6 +64,7 @@ class Summary {
|
||||
private:
|
||||
class keyword_handlers;
|
||||
|
||||
const EclipseGrid& grid;
|
||||
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
|
||||
std::unique_ptr< keyword_handlers > handlers;
|
||||
const ecl_sum_tstep_type* prev_tstep = nullptr;
|
||||
|
@ -420,7 +420,7 @@ EclipseWriter::Impl::Impl( const EclipseState& eclipseState,
|
||||
, regionCache( es , grid )
|
||||
, outputDir( eclipseState.getIOConfig().getOutputDir() )
|
||||
, baseName( uppercase( eclipseState.getIOConfig().getBaseName() ) )
|
||||
, summary( eclipseState, eclipseState.getSummaryConfig() )
|
||||
, summary( eclipseState, eclipseState.getSummaryConfig() , grid )
|
||||
, rft( outputDir.c_str(), baseName.c_str(), es.getIOConfig().getFMTOUT() )
|
||||
, sim_start_time( es.getSchedule().posixStartTime() )
|
||||
, output_enabled( eclipseState.getIOConfig().getOutputEnabled() )
|
||||
@ -804,7 +804,6 @@ void EclipseWriter::writeTimeStep(int report_step,
|
||||
|
||||
this->impl->summary.add_timestep( report_step,
|
||||
secs_elapsed,
|
||||
this->impl->grid,
|
||||
this->impl->es,
|
||||
this->impl->regionCache,
|
||||
wells ,
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <opm/output/eclipse/Summary.hpp>
|
||||
#include <opm/output/eclipse/RegionCache.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
|
||||
/*
|
||||
* This class takes simulator state and parser-provided information and
|
||||
* orchestrates ert to write simulation results as requested by the SUMMARY
|
||||
@ -205,10 +207,6 @@ inline quantity flowing( const fn_args& args ) {
|
||||
template< rt phase, bool injection = true >
|
||||
inline quantity crate( const fn_args& args ) {
|
||||
const quantity zero = { 0, rate_unit< phase >() };
|
||||
// A negative value for num is used for the initial pass which
|
||||
// only purpose is to determine the correct unit.
|
||||
if (args.num < 0) return zero;
|
||||
|
||||
// The args.num value is the literal value which will go to the
|
||||
// NUMS array in the eclispe SMSPEC file; the values in this array
|
||||
// are offset 1 - whereas we need to use this index here to look
|
||||
@ -673,19 +671,24 @@ class Summary::keyword_handlers {
|
||||
std::vector< std::pair< smspec_node_type*, fn > > handlers;
|
||||
};
|
||||
|
||||
Summary::Summary( const EclipseState& st, const SummaryConfig& sum ) :
|
||||
Summary( st, sum, st.getIOConfig().fullBasePath().c_str() )
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum ,
|
||||
const EclipseGrid& grid) :
|
||||
Summary( st, sum, grid, st.getIOConfig().fullBasePath().c_str() )
|
||||
{}
|
||||
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum,
|
||||
const EclipseGrid& grid,
|
||||
const std::string& basename ) :
|
||||
Summary( st, sum, basename.c_str() )
|
||||
Summary( st, sum, grid, basename.c_str() )
|
||||
{}
|
||||
|
||||
Summary::Summary( const EclipseState& st,
|
||||
const SummaryConfig& sum,
|
||||
const EclipseGrid& grid_,
|
||||
const char* basename ) :
|
||||
grid( grid_ ),
|
||||
ecl_sum(
|
||||
ecl_sum_alloc_writer(
|
||||
basename,
|
||||
@ -708,18 +711,25 @@ Summary::Summary( const EclipseState& st,
|
||||
const auto* keyword = node.keyword();
|
||||
if( funs.find( keyword ) == funs.end() ) continue;
|
||||
|
||||
if (node.type() == ECL_SMSPEC_COMPLETION_VAR) {
|
||||
int global_index = node.num() - 1;
|
||||
if (!this->grid.cellActive(global_index))
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get unit strings by calling each function with dummy input */
|
||||
const auto handle = funs.find( keyword )->second;
|
||||
const std::vector< const Well* > dummy_wells;
|
||||
EclipseGrid dummy_grid(1,1,1);
|
||||
|
||||
const fn_args no_args { dummy_wells, // Wells from Schedule object
|
||||
0, // Duration of time step
|
||||
0, // Timestep number
|
||||
-1, // NUMS value for the summary output.
|
||||
node.num(), // NUMS value for the summary output.
|
||||
{}, // Well results - data::Wells
|
||||
{}, // EclipseState
|
||||
{}, // Region <-> cell mappings.
|
||||
dummy_grid };
|
||||
this->grid };
|
||||
|
||||
const auto val = handle( no_args );
|
||||
const auto* unit = st.getUnits().name( val.unit );
|
||||
|
||||
@ -731,7 +741,6 @@ Summary::Summary( const EclipseState& st,
|
||||
|
||||
void Summary::add_timestep( int report_step,
|
||||
double secs_elapsed,
|
||||
const EclipseGrid& grid,
|
||||
const EclipseState& es,
|
||||
const RegionCache& regionCache,
|
||||
const data::Wells& wells ,
|
||||
@ -748,7 +757,7 @@ void Summary::add_timestep( int report_step,
|
||||
const auto* genkey = smspec_node_get_gen_key1( f.first );
|
||||
|
||||
const auto schedule_wells = find_wells( schedule, f.first, timestep );
|
||||
const auto val = f.second( { schedule_wells, duration, timestep, num, wells , state , regionCache , grid} );
|
||||
const auto val = f.second( { schedule_wells, duration, timestep, num, wells , state , regionCache , this->grid} );
|
||||
|
||||
const auto unit_applied_val = es.getUnits().from_si( val.unit, val.value );
|
||||
const auto res = smspec_node_is_total( f.first ) && prev_tstep
|
||||
|
@ -229,10 +229,10 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
|
||||
util_make_path( "PATH" );
|
||||
cfg.name = "PATH/CASE";
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -365,10 +365,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.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -454,10 +454,10 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
|
||||
BOOST_AUTO_TEST_CASE(completion_kewords) {
|
||||
setup cfg( "test_Summary_completion" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -507,10 +507,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.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -591,10 +591,10 @@ BOOST_AUTO_TEST_CASE(field_keywords) {
|
||||
BOOST_AUTO_TEST_CASE(report_steps_time) {
|
||||
setup cfg( "test_Summary_report_steps_time" );
|
||||
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -613,10 +613,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.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
|
||||
auto res = readsum( cfg.name );
|
||||
@ -633,10 +633,10 @@ BOOST_AUTO_TEST_CASE(region_vars) {
|
||||
setup cfg( "region_vars" );
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.grid , cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.grid , cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.grid , cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
|
||||
writer.write();
|
||||
}
|
||||
|
||||
@ -670,10 +670,10 @@ BOOST_AUTO_TEST_CASE(region_production) {
|
||||
setup cfg( "region_production" );
|
||||
|
||||
{
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.grid, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
|
||||
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
|
||||
writer.write();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user