Remove unused stuff

This commit is contained in:
Tor Harald Sandve 2018-01-18 11:11:18 +01:00
parent 45267477b4
commit ba29cfa81e
8 changed files with 44 additions and 458 deletions

View File

@ -176,7 +176,7 @@ public:
data::Solution,
data::Wells,
std::map<std::string, double> misc_summary_values,
std::map<std::string, std::vector<double>> region_summary_values = {},
std::map<std::string, std::vector<double>> region_summary_values,
std::map<std::string, std::vector<double>> extra_restart = {},
bool write_double = false);

View File

@ -59,7 +59,6 @@ class Summary {
const std::map<std::string, double>& misc_values,
const std::map<std::string, std::vector<double>>& region_values = {});
void set_initial( const data::Solution& );
void write();
~Summary();
@ -73,8 +72,6 @@ class Summary {
std::unique_ptr< keyword_handlers > handlers;
const ecl_sum_tstep_type* prev_tstep = nullptr;
double prev_time_elapsed = 0;
double initial_oip = 0.0;
const std::vector<double> porv;
};
}

View File

@ -401,13 +401,6 @@ void EclipseIO::writeInitial( data::Solution simProps, std::map<std::string, std
this->impl->writeEGRIDFile( nnc );
}
this->impl->summary.set_initial( simProps );
}
void EclipseIO::overwriteInitialOIP( const data::Solution& simProps )
{
this->impl->summary.set_initial( simProps );
}
// implementation of the writeTimeStep method
@ -419,7 +412,7 @@ void EclipseIO::writeTimeStep(int report_step,
std::map<std::string, double> misc_summary_values,
std::map<std::string, std::vector<double>> region_summary_values,
std::map<std::string, std::vector<double>> extra_restart,
bool write_double)
bool write_double)
{
if( !this->impl->output_enabled )

View File

@ -161,8 +161,6 @@ struct fn_args {
const data::Solution& state;
const out::RegionCache& regionCache;
const EclipseGrid& grid;
double initial_oip;
const std::vector<double>& pv;
};
/* Since there are several enums in opm scattered about more-or-less
@ -401,172 +399,6 @@ quantity region_rate( const fn_args& args ) {
return { -sum, rate_unit< phase >() };
}
quantity region_sum( const fn_args& args , const std::string& keyword , UnitSystem::measure unit) {
const auto& cells = args.regionCache.cells( args.num );
if (cells.empty())
return { 0.0 , unit };
double sum = 0;
if( args.state.count( keyword ) == 0 )
return { 0.0, unit };
const std::vector<double>& sim_value = args.state.data( keyword );
if (sim_value.size() != args.grid.getNumActive()) {
std::stringstream str;
str << "Wrongly sized data array passed to output for keyword "
<< keyword << ", size=" << sim_value.size() << ", expected=" << args.grid.getNumActive() << ".";
throw std::runtime_error(str.str());
}
for (auto cell_index : cells)
sum += sim_value[cell_index];
return { sum , unit };
}
quantity fpr( const fn_args& args ) {
if( !args.state.has( "PRESSURE" ) )
return { 0.0, measure::pressure };
const auto& p = args.state.data( "PRESSURE" );
const auto& pv = args.pv;
const bool hasSwat = args.state.has( "SWAT" );
const auto& swat = hasSwat? args.state.data( "SWAT" ): std::vector<double>(p.size(),0.0);
double fpr = 0.0;
double sum_hcpv = 0.0;
for (size_t cell_index = 0; cell_index < p.size(); ++cell_index) {
double hcs= 1.0;
hcs -= swat[cell_index];
double hcpv = pv[cell_index]*hcs;
fpr += hcpv * p[cell_index];
sum_hcpv += hcpv;
}
return { fpr / sum_hcpv, measure::pressure };
}
quantity fprp( const fn_args& args ) {
if( !args.state.has( "PRESSURE" ) )
return { 0.0, measure::pressure };
const auto& p = args.state.data( "PRESSURE" );
const auto& pv = args.pv;
double fprp = 0.0;
double sum_pv = 0.0;
for (size_t cell_index = 0; cell_index < p.size(); ++cell_index) {
fprp += pv[cell_index] * p[cell_index];
sum_pv += pv[cell_index];
}
return { fprp / sum_pv, measure::pressure };
}
quantity rpr(const fn_args& args) {
const auto& cells = args.regionCache.cells( args.num );
if (cells.empty())
return { 0.0 , measure::pressure };
if( !args.state.has( "PRESSURE" ) )
return { 0.0, measure::pressure };
const auto& p = args.state.data( "PRESSURE" );
const auto& pv = args.pv;
const bool hasSwat = args.state.has( "SWAT" );
const auto& swat = hasSwat? args.state.data( "SWAT" ): std::vector<double>(cells.size(),0.0);
double rpr = 0.0;
double sum_hcpv = 0.0;
for (auto cell_index : cells) {
double hcs= 1.0;
hcs -= swat[cell_index];
double hcpv = pv[cell_index]*hcs;
rpr += hcpv * p[cell_index];
sum_hcpv += hcpv;
}
return { rpr / sum_hcpv, measure::pressure };
}
quantity roip(const fn_args& args) {
return region_sum( args , "OIP", measure::volume );
}
quantity rgip(const fn_args& args) {
return region_sum( args , "GIP", measure::volume );
}
quantity rwip(const fn_args& args) {
return region_sum( args , "WIP", measure::volume );
}
quantity roipl(const fn_args& args) {
return region_sum( args , "OIPL", measure::volume );
}
quantity roipg(const fn_args& args) {
return region_sum( args , "OIPG", measure::volume );
}
quantity rgipl(const fn_args& args) {
return region_sum( args , "GIPL", measure::volume );
}
quantity rgipg(const fn_args& args) {
return region_sum( args , "GIPG", measure::volume );
}
quantity fgip( const fn_args& args ) {
quantity zero { 0.0, measure::volume };
if( !args.state.has( "GIP" ) )
return zero;
const auto& cells = args.state.at( "GIP" ).data;
return { std::accumulate( cells.begin(), cells.end(), 0.0 ),
measure::volume };
}
quantity fgipg( const fn_args& args ) {
quantity zero { 0.0, measure::volume };
if( !args.state.has( "GIPG" ) )
return zero;
const auto& cells = args.state.at( "GIPG" ).data;
return { std::accumulate( cells.begin(), cells.end(), 0.0 ),
measure::volume };
}
quantity foip( const fn_args& args ) {
if( !args.state.has( "OIP" ) )
return { 0.0, measure::volume };
const auto& cells = args.state.at( "OIP" ).data;
return { std::accumulate( cells.begin(), cells.end(), 0.0 ),
measure::volume };
}
quantity foipl( const fn_args& args ) {
if( !args.state.has( "OIPL" ) )
return { 0.0, measure::volume };
const auto& cells = args.state.at( "OIPL" ).data;
return { std::accumulate( cells.begin(), cells.end(), 0.0 ),
measure::volume };
}
quantity fwip( const fn_args& args ) {
if( !args.state.has( "WIP" ) )
return { 0.0, measure::volume };
const auto& cells = args.state.at( "WIP" ).data;
return { std::accumulate( cells.begin(), cells.end(), 0.0 ),
measure::volume };
}
quantity foe( const fn_args& args ) {
const quantity val = { foip( args ).value, measure::identity };
return (args.initial_oip - val) / args.initial_oip;
}
quantity bpr( const fn_args& args) {
if (!args.state.has("PRESSURE"))
return { 0.0 , measure::pressure };
@ -849,13 +681,6 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "FVIT", mul( sum( sum( rate< rt::reservoir_water, injector>, rate< rt::reservoir_oil, injector >),
rate< rt::reservoir_gas, injector>), duration)},
{ "FOIP", foip },
{ "FOIPL", foipl },
{ "FGIP", fgip },
{ "FGIPG", fgipg },
{ "FWIP", fwip },
{ "FOE", foe },
{ "FWPRH", production_history< Phase::WATER > },
{ "FOPRH", production_history< Phase::OIL > },
{ "FGPRH", production_history< Phase::GAS > },
@ -890,19 +715,9 @@ static const std::unordered_map< std::string, ofun > funs = {
production_history< Phase::OIL > ) ) },
{ "FMWIN", flowing< injector > },
{ "FMWPR", flowing< producer > },
// { "FPR", fpr },
{ "FPRP", fprp },
{ "FVPRT", res_vol_production_target },
/* Region properties */
// { "RPR" , rpr},
// { "ROIP" , roip},
// { "ROIPL" , roipl},
// { "ROIPG" , roipg},
// { "RGIP" , rgip},
// { "RGIPL" , rgipl},
// { "RGIPG" , rgipg},
// { "RWIP" , rwip},
{ "ROIR" , region_rate< rt::oil, injector > },
{ "RGIR" , region_rate< rt::gas, injector > },
{ "RWIR" , region_rate< rt::wat, injector > },
@ -1024,8 +839,7 @@ Summary::Summary( const EclipseState& st,
const char* basename ) :
grid( grid_arg ),
regionCache( st.get3DProperties( ) , grid_arg, schedule ),
handlers( new keyword_handlers() ),
porv( st.get3DProperties().getDoubleGridProperty("PORV").compressedCopy(grid_arg))
handlers( new keyword_handlers() )
{
const auto& init_config = st.getInitConfig();
@ -1056,35 +870,40 @@ Summary::Summary( const EclipseState& st,
for( const auto& node : sum ) {
const auto* keyword = node.keyword();
const auto misc_pair = misc_units.find( keyword );
const auto funs_pair = funs.find( keyword );
const auto region_pair = region_units.find( keyword );
const auto misc_pair = misc_units.find( keyword );
const auto funs_pair = funs.find( keyword );
const auto region_pair = region_units.find( keyword );
/*
All summary values of the type ECL_SMSPEC_MISC_VAR must be
passed explicitly in the misc_values map when calling
add_timestep.
*/
if (misc_pair != misc_units.end()) {
/*
All summary values of the type ECL_SMSPEC_MISC_VAR
and ECL_SMSPEC_FIELD_VAR must be passed explicitly
in the misc_values map when calling
add_timestep.
*/
if (misc_pair != misc_units.end()) {
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
if ((node.type() != ECL_SMSPEC_FIELD_VAR) && (node.type() != ECL_SMSPEC_MISC_VAR)) {
continue;
}
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
st.getUnits().name( misc_pair->second ),
0 );
0 );
this->handlers->misc_nodes.emplace( keyword, nodeptr );
this->handlers->misc_nodes.emplace( keyword, nodeptr );
} else if (region_pair != region_units.end()) {
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
st.getUnits().name( region_pair->second ),
0 );
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
st.getUnits().name( region_pair->second ),
0 );
this->handlers->region_nodes.emplace( keyword, nodeptr );
this->handlers->region_nodes.emplace( keyword, nodeptr );
} else if (funs_pair != funs.end()) {
@ -1105,22 +924,20 @@ Summary::Summary( const EclipseState& st,
{}, // Well results - data::Wells
{}, // Solution::State
{}, // Region <-> cell mappings.
this->grid,
this->initial_oip,
{} };
this->grid};
const auto val = handle( no_args );
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
st.getUnits().name( val.unit ),
0 );
auto* nodeptr = ecl_sum_add_var( this->ecl_sum.get(),
keyword,
node.wgname(),
node.num(),
st.getUnits().name( val.unit ),
0 );
this->handlers->handlers.emplace_back( nodeptr, handle );
this->handlers->handlers.emplace_back( nodeptr, handle );
} else {
unsupported_keywords.insert(keyword);
unsupported_keywords.insert(keyword);
}
}
for ( const auto& keyword : unsupported_keywords ) {
@ -1153,9 +970,7 @@ void Summary::add_timestep( int report_step,
wells,
state,
this->regionCache,
this->grid,
this->initial_oip,
this->porv});
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
@ -1194,13 +1009,6 @@ void Summary::add_timestep( int report_step,
this->prev_time_elapsed = secs_elapsed;
}
void Summary::set_initial( const data::Solution& sol ) {
if( !sol.has( "OIP" ) ) return;
const auto& cells = sol.at( "OIP" ).data;
this->initial_oip = std::accumulate( cells.begin(), cells.end(), 0.0 );
}
void Summary::write() {
ecl_sum_fwrite( this->ecl_sum.get() );
}

View File

@ -342,6 +342,7 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) {
first_step - start_time,
sol,
wells,
{},
{});

View File

@ -145,6 +145,7 @@ BOOST_AUTO_TEST_CASE(test_RFT) {
step_time - start_time,
createBlackoilState( 2, numCells ),
wells,
{},
{});
}
@ -221,6 +222,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2) {
step_time - start_time,
createBlackoilState( 2, numCells ),
wells,
{},
{});
}
verifyRFTFile2("TESTRFT.RFT");

View File

@ -805,55 +805,11 @@ BOOST_AUTO_TEST_CASE(field_keywords) {
BOOST_CHECK_CLOSE( ggor, ecl_sum_get_field_var( resp, 1, "FGOR" ), 1e-5 );
BOOST_CHECK_CLOSE( ggor, ecl_sum_get_field_var( resp, 1, "FGORH" ), 1e-5 );
const double foip = 11.0 * 1000 - 2*10; // Cell (1,2,10) is inactive.
const double foipl = 10.0 * 1000 - (2*10 - 1); // Cell (1,2,10) is inactive.
const double fgip = 11.55 * 1000 - 2.1*10; // Cell (1,2,10) is inactive.
const double fgipg = 12.55 * 1000 - (2.1*10 + 1); // Cell (1,2,10) is inactive.
const double fwip = 12.1 * 1000 - 2.2*10; // Cell (1,2,10) is inactive.
BOOST_CHECK_CLOSE( foip, ecl_sum_get_field_var( resp, 1, "FOIP" ), 1e-5 );
BOOST_CHECK_CLOSE( foipl, ecl_sum_get_field_var( resp, 1, "FOIPL" ), 1e-5 );
BOOST_CHECK_CLOSE( fgip, ecl_sum_get_field_var( resp, 1, "FGIP" ), 1e-5 );
BOOST_CHECK_CLOSE( fgipg, ecl_sum_get_field_var( resp, 1, "FGIPG" ), 1e-5 );
BOOST_CHECK_CLOSE( fwip, ecl_sum_get_field_var( resp, 1, "FWIP" ), 1e-5 );
BOOST_CHECK_EQUAL( 1, ecl_sum_get_field_var( resp, 1, "FMWIN" ) );
BOOST_CHECK_EQUAL( 2, ecl_sum_get_field_var( resp, 1, "FMWPR" ) );
UnitSystem units( UnitSystem::UnitType::UNIT_TYPE_METRIC );
const double fpr_si = (5.5 * 1000 - 10) / 999;
const double fpr = units.from_si( UnitSystem::measure::pressure, fpr_si );
BOOST_CHECK_CLOSE( fpr, ecl_sum_get_field_var( resp, 1, "FPR" ), 1e-5 ); //
/* in this test, the initial OIP wasn't set */
BOOST_CHECK_EQUAL( 0.0, ecl_sum_get_field_var( resp, 1, "FOE" ) );
BOOST_CHECK_EQUAL( 0.0, ecl_sum_get_field_var( resp, 2, "FOE" ) );
}
BOOST_AUTO_TEST_CASE(foe_test) {
setup cfg( "foe" );
std::vector< double > oip( cfg.grid.getNumActive(), 12.0 );
data::Solution sol;
sol.insert( "OIP", UnitSystem::measure::volume, oip, data::TargetType::RESTART_AUXILIARY );
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.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 );
const auto* resp = res.get();
const double oip0 = 12 * cfg.grid.getNumActive();
const double oip1 = 11.0 * 1000 - 2*10;
const double foe = (oip0 - oip1) / oip0;
BOOST_CHECK_CLOSE( foe, ecl_sum_get_field_var( resp, 1, "FOE" ), 1e-5 );
BOOST_CHECK_CLOSE( foe, ecl_sum_get_field_var( resp, 2, "FOE" ), 1e-5 );
}
BOOST_AUTO_TEST_CASE(report_steps_time) {
setup cfg( "test_Summary_report_steps_time" );
@ -894,54 +850,6 @@ BOOST_AUTO_TEST_CASE(skip_unknown_var) {
}
BOOST_AUTO_TEST_CASE(region_vars) {
setup cfg( "region_vars" );
{
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 );
const auto* resp = res.get();
BOOST_CHECK( ecl_sum_has_general_var( resp , "RPR:1"));
BOOST_CHECK( ecl_sum_has_general_var( resp , "RPR:10"));
BOOST_CHECK( !ecl_sum_has_general_var( resp , "RPR:11"));
UnitSystem units( UnitSystem::UnitType::UNIT_TYPE_METRIC );
for (size_t r=1; r <= 10; r++) {
std::string rpr_key = "RPR:" + std::to_string( r );
std::string roip_key = "ROIP:" + std::to_string( r );
std::string rwip_key = "RWIP:" + std::to_string( r );
std::string rgip_key = "RGIP:" + std::to_string( r );
std::string roipl_key = "ROIPL:" + std::to_string( r );
std::string roipg_key = "ROIPG:" + std::to_string( r );
std::string rgipl_key = "RGIPL:" + std::to_string( r );
std::string rgipg_key = "RGIPG:" + std::to_string( r );
double area = cfg.grid.getNX() * cfg.grid.getNY();
BOOST_CHECK_CLOSE( r * 1.0 , units.to_si( UnitSystem::measure::pressure , ecl_sum_get_general_var( resp, 1, rpr_key.c_str())) , 1e-5);
// There is one inactive cell in the bottom layer.
if (r == 10)
area -= 1;
BOOST_CHECK_CLOSE( area * 2*r * 1.0 , units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, roip_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * (2*r - 1) * 1.0 , units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, roipl_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * (2*r + 1 ) * 1.0 , units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, roipg_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * 2.1*r * 1.0 , units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, rgip_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * (2.1*r - 1) * 1.0, units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, rgipl_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * (2.1*r + 1) * 1.0, units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, rgipg_key.c_str())) , 1e-5);
BOOST_CHECK_CLOSE( area * 2.2*r * 1.0 , units.to_si( UnitSystem::measure::volume , ecl_sum_get_general_var( resp, 1, rwip_key.c_str())) , 1e-5);
}
}
BOOST_AUTO_TEST_CASE(region_production) {
setup cfg( "region_production" );
@ -1066,130 +974,6 @@ 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.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 );
const auto* resp = res.get();
UnitSystem units( UnitSystem::UnitType::UNIT_TYPE_METRIC );
// fpr = sum_ (p * hcpv ) / hcpv, hcpv = pv * (1 - sw)
const double fpr_si = ( (3 * 0.1 + 8 * 0.2) * 500 * (1 - 8.0) ) / ( (500*0.1 + 500*0.2) * (1 - 8.0));
const double fpr = units.from_si( UnitSystem::measure::pressure, fpr_si );
BOOST_CHECK_CLOSE( fpr, ecl_sum_get_field_var( resp, 1, "FPR" ), 1e-5 ); //
// change sw and pressure and test again.
size_t g = 0;
for (size_t k=0; k < cfg.grid.getNZ(); k++) {
for (size_t j=0; j < cfg.grid.getNY(); j++) {
for (size_t i=0; i < cfg.grid.getNX(); i++) {
if (cfg.grid.cellActive(i,j,k)) {
cfg.solution.data("SWAT")[g] = 0.1*(k);
cfg.solution.data("PRESSURE")[g] = units.to_si( UnitSystem::measure::pressure, 1 );
g++;
}
}
}
}
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 );
const auto* resp2 = res2.get();
// fpr = sum_ (p * hcpv ) / hcpv, hcpv = pv * (1 - sw)
const double fpr2_si = ( (0.8 * 0.1 + 0.3 * 0.2) * 500 * 1 ) / ( (0.8 * 0.1 + 0.3 * 0.2) * 500);
BOOST_CHECK_CLOSE( fpr2_si, ecl_sum_get_field_var( resp2, 1, "FPR" ), 1e-5 ); //
}
BOOST_AUTO_TEST_CASE(fprp) {
setup cfg( "test_fprp", "summary_deck_non_constant_porosity.DATA");
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 );
const auto* resp = res.get();
UnitSystem units( UnitSystem::UnitType::UNIT_TYPE_METRIC );
// fprp = sum_ (p * pv ) / pv
const double fprp_si = ( (3 * 0.1 + 8 * 0.2) * 500 ) / ( (500*0.1 + 500*0.2));
const double fprp = units.from_si( UnitSystem::measure::pressure, fprp_si );
BOOST_CHECK_CLOSE( fprp, ecl_sum_get_field_var( resp, 1, "FPRP" ), 1e-5 );
// Change pressure and check again
for (size_t g = 0; g < cfg.grid.getNumActive(); g++){
cfg.solution.data("PRESSURE")[g] = units.to_si( UnitSystem::measure::pressure, 1 );
}
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 );
const auto* resp2 = res2.get();
// fprp = sum_ (p * pv ) / pv
const double fprp2_si = ( (0.8 * 0.1 + 0.3 * 0.2) * 500) / ( (0.8 * 0.1 + 0.3 * 0.2) * 500);
BOOST_CHECK_CLOSE( fprp2_si, ecl_sum_get_field_var( resp2, 1, "FPRP" ), 1e-5 );
}
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.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 );
const auto* resp = res.get();
BOOST_CHECK( ecl_sum_has_general_var( resp , "RPR:1"));
BOOST_CHECK( ecl_sum_has_general_var( resp , "RPR:3"));
BOOST_CHECK( !ecl_sum_has_general_var( resp , "RPR:4"));
UnitSystem units( UnitSystem::UnitType::UNIT_TYPE_METRIC );
// rpr = sum_ (p * hcpv ) / hcpv, hcpv = pv * (1 - sw)
// region 1; layer 1:4
{
const double rpr_si = ( 2.5 * 0.1 * 400 * (1 - 8.0) ) / ( (400*0.1) * (1 - 8.0));
std::string rpr_key = "RPR:1";
BOOST_CHECK_CLOSE( rpr_si , units.to_si( UnitSystem::measure::pressure , ecl_sum_get_general_var( resp, 1, rpr_key.c_str())) , 1e-5);
}
// region 2; layer 5:6
{
const double rpr_si = ( (5 * 0.1 + 6 * 0.2) * 100 * (1 - 8.0) ) / ( (0.1 + 0.2) * 100 * (1 - 8.0));
std::string rpr_key = "RPR:2";
BOOST_CHECK_CLOSE( rpr_si , units.to_si( UnitSystem::measure::pressure , ecl_sum_get_general_var( resp, 1, rpr_key.c_str())) , 1e-5);
}
// region 3; layer 7:10
{
const double rpr_si = ( 8.5 * 0.2 * 400 * (1 - 8.0) ) / ( (400*0.2) * (1 - 8.0));
std::string rpr_key = "RPR:3";
BOOST_CHECK_CLOSE( rpr_si , units.to_si( UnitSystem::measure::pressure , ecl_sum_get_general_var( resp, 1, rpr_key.c_str())) , 1e-5);
}
}
BOOST_AUTO_TEST_CASE(MISC) {
setup cfg( "test_MISC");

View File

@ -161,6 +161,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
timestep,
solution,
wells ,
{},
{} );
}