Merge pull request #3550 from akva2/vappars_solution_section

fixed: apply VAPPARS from SOLUTION section
This commit is contained in:
Bård Skaflestad
2023-05-31 17:12:47 +02:00
committed by GitHub
4 changed files with 55 additions and 4 deletions

View File

@@ -185,6 +185,7 @@
#include <unordered_map>
#include <map>
#include <optional>
#include <string>
namespace Opm {

View File

@@ -91,6 +91,7 @@ namespace Opm
double sumthin{-1.0};
bool rptonly{false};
bool gaslift_opt_active{false};
std::optional<OilVaporizationProperties> oilVap;
ScheduleStatic() = default;

View File

@@ -139,6 +139,19 @@ namespace {
return rptonly;
}
std::optional<Opm::OilVaporizationProperties>
vappars_solution_section(const Opm::SOLUTIONSection& section, const int numpvt) {
if (section.hasKeyword("VAPPARS")) {
const auto& record = section.getKeyword("VAPPARS").getRecord(0);
Opm::OilVaporizationProperties ovp(numpvt);
double vap1 = record.getItem("OIL_VAP_PROPENSITY").get< double >(0);
double vap2 = record.getItem("OIL_DENSITY_PROPENSITY").get< double >(0);
Opm::OilVaporizationProperties::updateVAPPARS(ovp, vap1, vap2);
return ovp;
}
return std::nullopt;
}
}
namespace Opm {
@@ -160,7 +173,9 @@ namespace Opm {
output_interval(output_interval_),
sumthin(sumthin_summary_section(SUMMARYSection{ deck })),
rptonly(rptonly_summary_section(SUMMARYSection{ deck })),
gaslift_opt_active(deck.hasKeyword<ParserKeywords::LIFTOPT>())
gaslift_opt_active(deck.hasKeyword<ParserKeywords::LIFTOPT>()),
oilVap(vappars_solution_section(SOLUTIONSection{deck},
runspec.tabdims().getNumPVTTables()))
{
}
@@ -2247,7 +2262,11 @@ void Schedule::create_first(const time_point& start_time, const std::optional<ti
const auto& runspec = this->m_static.m_runspec;
auto& sched_state = snapshots.back();
sched_state.init_nupcol( runspec.nupcol() );
sched_state.update_oilvap( OilVaporizationProperties( runspec.tabdims().getNumPVTTables() ));
if (this->m_static.oilVap.has_value()) {
sched_state.update_oilvap(*this->m_static.oilVap);
} else {
sched_state.update_oilvap( OilVaporizationProperties( runspec.tabdims().getNumPVTTables() ));
}
sched_state.update_message_limits( this->m_static.m_deck_message_limits );
sched_state.pavg.update( PAvg() );
sched_state.wtest_config.update( WellTestConfig() );

View File

@@ -1684,6 +1684,8 @@ VAPPARS
)";
const auto& schedule = make_schedule(input);
const OilVaporizationProperties& ovap0 = schedule[0].oilvap();
BOOST_CHECK(ovap0.getType() == OilVaporizationProperties::OilVaporization::UNDEF);
size_t currentStep = 1;
const OilVaporizationProperties& ovap = schedule[currentStep].oilvap();
BOOST_CHECK(ovap.getType() == OilVaporizationProperties::OilVaporization::VAPPARS);
@@ -1691,11 +1693,39 @@ VAPPARS
BOOST_CHECK_EQUAL(2, vap1);
double vap2 = ovap.vap2();
BOOST_CHECK_EQUAL(0.100, vap2);
BOOST_CHECK_EQUAL(false, ovap.drsdtActive());
BOOST_CHECK_EQUAL(false, ovap.drvdtActive());
BOOST_CHECK_EQUAL(false, ovap.drsdtActive());
BOOST_CHECK_EQUAL(false, ovap.drvdtActive());
}
BOOST_AUTO_TEST_CASE(createDeckWithVAPPARSInSOLUTION) {
std::string input = R"(
SOLUTION
VAPPARS
2 0.100
/
START -- 0
19 JUN 2007 /
SCHEDULE
DATES -- 1
10 OKT 2008 /
/
)";
const auto& schedule = make_schedule(input);
for (int i = 0; i < 2; ++i) {
const OilVaporizationProperties& ovap = schedule[i].oilvap();
BOOST_CHECK(ovap.getType() == OilVaporizationProperties::OilVaporization::VAPPARS);
double vap1 = ovap.vap1();
BOOST_CHECK_EQUAL(2, vap1);
double vap2 = ovap.vap2();
BOOST_CHECK_EQUAL(0.100, vap2);
BOOST_CHECK_EQUAL(false, ovap.drsdtActive());
BOOST_CHECK_EQUAL(false, ovap.drvdtActive());
}
}
BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
std::string input = R"(
START -- 0