Address Review Comments

In particular, add more unit testing and give names to a number of
index constants.

Thanks to [at]blattms for reviewing the initial version of this
patch.
This commit is contained in:
Bård Skaflestad 2022-05-24 18:14:32 +02:00
parent 188d7802a3
commit b4cebad6a9
7 changed files with 506 additions and 36 deletions

View File

@ -52,7 +52,7 @@ namespace Opm {
}
private:
enum class Prevent : unsigned char { No, First, Every };
enum class Prevent : unsigned char { No, ReportFirst, ReportEvery };
bool m_explicit{false};
bool m_shut{false};

View File

@ -35,7 +35,14 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
WatRateLimit = 7, // Group's water production target/limit
GasRateLimit = 8, // Group's gas production target/limit
LiqRateLimit = 9, // Group's liquid production target/limit
GLOMaxSupply = 34, // Group's maximum supply of lift gas
GasRateLimit_2 = 39, // Copy of group's gas production target/limit
OilRateLimit_2 = 52, // Copy of group's oil production target/limit
WatRateLimit_2 = 53, // Copy of group's water production target/limit
LiqRateLimit_2 = 54, // Copy of group's liquid production target/limit
GLOMaxRate = 91, // Group's maximum lift gas rate
};
@ -44,17 +51,38 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
oilResRateLimit = 11, // Group's oil reservoir volume injection rate target/limit
oilReinjectionLimit = 12, // Group's oil reinjection fraction target/limit
oilVoidageLimit = 13, // Group's oil voidage injection fraction target/limit
waterSurfRateLimit = 15, // Group's water surface volume injection rate target/limit
waterResRateLimit = 16, // Group's water reservoir volume injection rate target/limit
waterReinjectionLimit = 17, // Group's water reinjection fraction target/limit
waterVoidageLimit = 18, // Group's water voidage injection fraction target/limit
waterGuideRate = 19,
waterGuideRate = 19, // Group's water injection guide rate
gasSurfRateLimit = 20, // Group's gas surface volume injection rate target/limit
gasResRateLimit = 21, // Group's gas reservoir volume injection rate target/limit
gasReinjectionLimit = 22, // Group's gas reinjection fraction target/limit
gasVoidageLimit = 23, // Group's gas voidage injection fraction target/limit
gasGuideRate = 24,
gasGuideRate = 24, // Group's gas injection guide rate
oilSurfRateLimit_2 = 57, // Copy of group's oil surface volume injection rate target/limit
oilResRateLimit_2 = 58, // Copy of group's oil reservoir volume injection rate target/limit
oilReinjectionLimit_2 = 59, // Copy of group's oil reinjection fraction target/limit
oilVoidageLimit_2 = 60, // Copy of group's oil voidage injection fraction target/limit
waterSurfRateLimit_2 = 61, // Copy of group's water surface volume injection rate target/limit
waterResRateLimit_2 = 62, // Copy of group's water reservoir volume injection rate target/limit
waterReinjectionLimit_2 = 63, // Copy of group's water reinjection fraction target/limit
waterVoidageLimit_2 = 64, // Copy of group's water voidage injection fraction target/limit
gasSurfRateLimit_2 = 65, // Copy of group's gas surface volume injection rate target/limit
gasResRateLimit_2 = 66, // Copy of group's gas reservoir volume injection rate target/limit
gasReinjectionLimit_2 = 67, // Copy of group's gas reinjection fraction target/limit
gasVoidageLimit_2 = 68, // Copy of group's gas voidage injection fraction target/limit
};
namespace Value {
constexpr auto NoGLOLimit = -10.0f;
} // namespace Value
} // SGroup

View File

@ -52,9 +52,9 @@ namespace Opm {
m_explicit = (exp_imp == "EXP");
m_shut = (close == "YES");
if (prevent_thp == "YES1")
m_prevent = Prevent::First;
m_prevent = Prevent::ReportFirst;
else if (prevent_thp == "YES2")
m_prevent = Prevent::Every;
m_prevent = Prevent::ReportEvery;
else
m_prevent = Prevent::No;
}
@ -73,12 +73,12 @@ namespace Opm {
bool WVFPEXP::report_first() const
{
return this->m_prevent == Prevent::First;
return this->m_prevent == Prevent::ReportFirst;
}
bool WVFPEXP::report_every() const
{
return this->m_prevent == Prevent::Every;
return this->m_prevent == Prevent::ReportEvery;
}
bool WVFPEXP::operator!=(const WVFPEXP& other) const {

View File

@ -790,31 +790,31 @@ void assignGroupGasInjectionTargets(const Opm::Group& group,
(prop.surface_max_rate.is_numeric() || (cntl.surface_max_rate > 0.0)))
{
sGrp[Ix::gasSurfRateLimit] = sgprop(M::gas_surface_rate, cntl.surface_max_rate);
sGrp[65] = sGrp[Ix::gasSurfRateLimit];
sGrp[Ix::gasSurfRateLimit_2] = sGrp[Ix::gasSurfRateLimit];
}
if (group.has_control(Opm::Phase::GAS, Opm::Group::InjectionCMode::RESV) &&
(prop.resv_max_rate.is_numeric() || (cntl.resv_max_rate > 0.0)))
{
sGrp[Ix::gasResRateLimit] = sgprop(M::rate, cntl.resv_max_rate);
sGrp[66] = sGrp[Ix::gasResRateLimit];
sGrp[Ix::gasResRateLimit_2] = sGrp[Ix::gasResRateLimit];
}
if (group.has_control(Opm::Phase::GAS, Opm::Group::InjectionCMode::REIN) &&
(prop.target_reinj_fraction.is_numeric() || (cntl.target_reinj_fraction > 0.0)))
{
sGrp[Ix::gasReinjectionLimit] = cntl.target_reinj_fraction;
sGrp[67] = sGrp[Ix::gasReinjectionLimit];
sGrp[Ix::gasReinjectionLimit_2] = sGrp[Ix::gasReinjectionLimit];
}
if (group.has_control(Opm::Phase::GAS, Opm::Group::InjectionCMode::VREP) &&
(prop.target_void_fraction.is_numeric() || (cntl.target_void_fraction > 0.0)))
{
sGrp[Ix::gasVoidageLimit] = cntl.target_void_fraction;
sGrp[68] = sGrp[Ix::gasVoidageLimit];
sGrp[Ix::gasVoidageLimit_2] = sGrp[Ix::gasVoidageLimit];
}
sGrp[Ix::waterGuideRate] = cntl.guide_rate;
sGrp[Ix::gasGuideRate] = cntl.guide_rate;
}
template <typename SGProp, class SGrpArray>
@ -833,28 +833,28 @@ void assignGroupWaterInjectionTargets(const Opm::Group& group,
(prop.surface_max_rate.is_numeric() || (cntl.surface_max_rate > 0.0)))
{
sGrp[Ix::waterSurfRateLimit] = sgprop(M::liquid_surface_rate, cntl.surface_max_rate);
sGrp[61] = sGrp[Ix::waterSurfRateLimit];
sGrp[Ix::waterSurfRateLimit_2] = sGrp[Ix::waterSurfRateLimit];
}
if (group.has_control(Opm::Phase::WATER, Opm::Group::InjectionCMode::RESV) &&
(prop.resv_max_rate.is_numeric() || (cntl.resv_max_rate > 0.0)))
{
sGrp[Ix::waterResRateLimit] = sgprop(M::rate, cntl.resv_max_rate);
sGrp[62] = sGrp[Ix::waterResRateLimit];
sGrp[Ix::waterResRateLimit_2] = sGrp[Ix::waterResRateLimit];
}
if (group.has_control(Opm::Phase::WATER, Opm::Group::InjectionCMode::REIN) &&
(prop.target_reinj_fraction.is_numeric() || (cntl.target_reinj_fraction > 0.0)))
{
sGrp[Ix::waterReinjectionLimit] = cntl.target_reinj_fraction;
sGrp[63] = sGrp[Ix::waterReinjectionLimit];
sGrp[Ix::waterReinjectionLimit_2] = sGrp[Ix::waterReinjectionLimit];
}
if (group.has_control(Opm::Phase::WATER, Opm::Group::InjectionCMode::VREP) &&
(prop.target_void_fraction.is_numeric() || (cntl.target_void_fraction > 0.0)))
{
sGrp[Ix::waterVoidageLimit] = cntl.target_void_fraction;
sGrp[64] = sGrp[Ix::waterVoidageLimit];
sGrp[Ix::waterVoidageLimit_2] = sGrp[Ix::waterVoidageLimit];
}
sGrp[Ix::waterGuideRate] = cntl.guide_rate;
@ -876,28 +876,28 @@ void assignGroupOilInjectionTargets(const Opm::Group& group,
(prop.surface_max_rate.is_numeric() || (cntl.surface_max_rate > 0.0)))
{
sGrp[Ix::oilSurfRateLimit] = sgprop(M::liquid_surface_rate, cntl.surface_max_rate);
sGrp[57] = sGrp[Ix::oilSurfRateLimit];
sGrp[Ix::oilSurfRateLimit_2] = sGrp[Ix::oilSurfRateLimit];
}
if (group.has_control(Opm::Phase::OIL, Opm::Group::InjectionCMode::RESV) &&
(prop.resv_max_rate.is_numeric() || (cntl.resv_max_rate > 0.0)))
{
sGrp[Ix::oilResRateLimit] = sgprop(M::rate, cntl.resv_max_rate);
sGrp[58] = sGrp[Ix::oilResRateLimit];
sGrp[Ix::oilResRateLimit_2] = sGrp[Ix::oilResRateLimit];
}
if (group.has_control(Opm::Phase::OIL, Opm::Group::InjectionCMode::REIN) &&
(prop.target_reinj_fraction.is_numeric() || (cntl.target_reinj_fraction > 0.0)))
{
sGrp[Ix::oilReinjectionLimit] = cntl.target_reinj_fraction;
sGrp[59] = sGrp[Ix::oilReinjectionLimit];
sGrp[Ix::oilReinjectionLimit_2] = sGrp[Ix::oilReinjectionLimit];
}
if (group.has_control(Opm::Phase::OIL, Opm::Group::InjectionCMode::VREP) &&
(prop.target_void_fraction.is_numeric() || (cntl.target_void_fraction > 0.0)))
{
sGrp[Ix::oilVoidageLimit] = cntl.target_void_fraction;
sGrp[60] = sGrp[Ix::oilVoidageLimit];
sGrp[Ix::oilVoidageLimit_2] = sGrp[Ix::oilVoidageLimit];
}
}
@ -936,28 +936,28 @@ void assignGroupProductionTargets(const Opm::Group& group,
(prop.oil_target.is_numeric() || (cntl.oil_target > 0.0)))
{
sGrp[Ix::OilRateLimit] = sgprop(M::liquid_surface_rate, cntl.oil_target);
sGrp[52] = sGrp[Ix::OilRateLimit]; // "ORAT" control
sGrp[Ix::OilRateLimit_2] = sGrp[Ix::OilRateLimit]; // ORAT control
}
if (group.has_control(Opm::Group::ProductionCMode::WRAT) &&
(prop.water_target.is_numeric() || (cntl.water_target > 0.0)))
{
sGrp[Ix::WatRateLimit] = sgprop(M::liquid_surface_rate, cntl.water_target);
sGrp[53] = sGrp[Ix::WatRateLimit]; //"WRAT" control
sGrp[Ix::WatRateLimit_2] = sGrp[Ix::WatRateLimit]; // WRAT control
}
if (group.has_control(Opm::Group::ProductionCMode::GRAT) &&
(prop.gas_target.is_numeric() || (cntl.gas_target > 0.0)))
{
sGrp[Ix::GasRateLimit] = sgprop(M::gas_surface_rate, cntl.gas_target);
sGrp[39] = sGrp[Ix::GasRateLimit];
sGrp[Ix::GasRateLimit_2] = sGrp[Ix::GasRateLimit]; // GRAT control
}
if (group.has_control(Opm::Group::ProductionCMode::LRAT) &&
(prop.liquid_target.is_numeric() || (cntl.liquid_target > 0.0)))
{
sGrp[Ix::LiqRateLimit] = sgprop(M::liquid_surface_rate, cntl.liquid_target);
sGrp[54] = sGrp[Ix::LiqRateLimit]; //"LRAT" control
sGrp[Ix::LiqRateLimit_2] = sGrp[Ix::LiqRateLimit]; // LRAT control
}
}
@ -969,21 +969,16 @@ void assignGasLiftOptimisation(const Opm::GasLiftOpt::Group& group,
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SGroup::prod_index;
using M = ::Opm::UnitSystem::measure;
const auto no_limit = -10.0f;
sGrp[Ix::GLOMaxSupply] = sGrp[Ix::GLOMaxRate] =
::Opm::RestartIO::Helpers::VectorItems::SGroup::Value::NoGLOLimit;
if (const auto& max_supply = group.max_lift_gas(); max_supply.has_value()) {
sGrp[Ix::GLOMaxSupply] = sgprop(M::gas_surface_rate, max_supply.value());
}
else {
sGrp[Ix::GLOMaxSupply] = no_limit;
}
if (const auto& max_total = group.max_total_gas(); max_total.has_value()) {
sGrp[Ix::GLOMaxRate] = sgprop(M::gas_surface_rate, max_total.value());
}
else {
sGrp[Ix::GLOMaxRate] = no_limit;
}
}
template <class SGrpArray>

View File

@ -1031,13 +1031,11 @@ namespace {
const std::string& wname,
SWellArray& sWell)
{
using Ix = VI::SWell::index;
std::fill(sWell.begin() + Ix::TracerOffset, sWell.end(), 0);
auto output_index = static_cast<std::size_t>(VI::SWell::index::TracerOffset);
std::size_t output_index = Ix::TracerOffset;
for (const auto& tracer : tracers) {
sWell[output_index] = smry.get_well_var(wname, fmt::format("WTIC{}", tracer.name), 0);
output_index++;
sWell[output_index++] =
smry.get_well_var(wname, fmt::format("WTIC{}", tracer.name), 0.0);
}
}

View File

@ -777,6 +777,7 @@ BOOST_AUTO_TEST_CASE (Declared_Group_Data)
}
}
// \todo Restore checks for IGRP[NWGMAX + 17]
BOOST_AUTO_TEST_CASE (Declared_Group_Data_2)
{
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;

View File

@ -406,6 +406,244 @@ TSTEP -- 9
return Opm::Parser{}.parseString(input);
}
Opm::Deck wecon_etc_sim()
{
// Mostly copy of tests/FIRST_SIM.DATA
const auto input = std::string {
R"~(
RUNSPEC
OIL
GAS
WATER
DISGAS
UNIFOUT
UNIFIN
DIMENS
10 10 10 /
WELLDIMS
6 20 1 6 /
TABDIMS
1 1 15 15 2 15 /
FIELD
EQLDIMS
1 /
GRID
DXV
10*100. /
DYV
10*100. /
DZV
10*100. /
TOPS
100*7000. /
PORO
1000*0.2 /
PERMX
1000*100. /
PERMY
1000*100. /
PERMZ
1000*10. /
PROPS ==========================================================
-- WATER RELATIVE PERMEABILITY AND CAPILLARY PRESSURE ARE TABULATED AS
-- A FUNCTION OF WATER SATURATION.
--
-- SWAT KRW PCOW
SWFN
0.12 0 0
1.0 0.00001 0 /
-- SIMILARLY FOR GAS
--
-- SGAS KRG PCOG
SGFN
0 0 0
0.02 0 0
0.05 0.005 0
0.12 0.025 0
0.2 0.075 0
0.25 0.125 0
0.3 0.19 0
0.4 0.41 0
0.45 0.6 0
0.5 0.72 0
0.6 0.87 0
0.7 0.94 0
0.85 0.98 0
1.0 1.0 0
/
-- OIL RELATIVE PERMEABILITY IS TABULATED AGAINST OIL SATURATION
-- FOR OIL-WATER AND OIL-GAS-CONNATE WATER CASES
--
-- SOIL KROW KROG
SOF3
0 0 0
0.18 0 0
0.28 0.0001 0.0001
0.38 0.001 0.001
0.43 0.01 0.01
0.48 0.021 0.021
0.58 0.09 0.09
0.63 0.2 0.2
0.68 0.35 0.35
0.76 0.7 0.7
0.83 0.98 0.98
0.86 0.997 0.997
0.879 1 1
0.88 1 1 /
-- PVT PROPERTIES OF WATER
--
-- REF. PRES. REF. FVF COMPRESSIBILITY REF VISCOSITY VISCOSIBILITY
PVTW
4014.7 1.029 3.13D-6 0.31 0 /
-- ROCK COMPRESSIBILITY
--
-- REF. PRES COMPRESSIBILITY
ROCK
14.7 3.0D-6 /
-- SURFACE DENSITIES OF RESERVOIR FLUIDS
--
-- OIL WATER GAS
DENSITY
49.1 64.79 0.06054 /
-- PVT PROPERTIES OF DRY GAS (NO VAPOURISED OIL)
-- WE WOULD USE PVTG TO SPECIFY THE PROPERTIES OF WET GAS
--
-- PGAS BGAS VISGAS
PVDG
14.7 166.666 0.008
264.7 12.093 0.0096
514.7 6.274 0.0112
1014.7 3.197 0.014
2014.7 1.614 0.0189
2514.7 1.294 0.0208
3014.7 1.080 0.0228
4014.7 0.811 0.0268
5014.7 0.649 0.0309
9014.7 0.386 0.047 /
-- PVT PROPERTIES OF LIVE OIL (WITH DISSOLVED GAS)
-- WE WOULD USE PVDO TO SPECIFY THE PROPERTIES OF DEAD OIL
--
-- FOR EACH VALUE OF RS THE SATURATION PRESSURE, FVF AND VISCOSITY
-- ARE SPECIFIED. FOR RS=1.27 AND 1.618, THE FVF AND VISCOSITY OF
-- UNDERSATURATED OIL ARE DEFINED AS A FUNCTION OF PRESSURE. DATA
-- FOR UNDERSATURATED OIL MAY BE SUPPLIED FOR ANY RS, BUT MUST BE
-- SUPPLIED FOR THE HIGHEST RS (1.618).
--
-- RS POIL FVFO VISO
PVTO
0.001 14.7 1.062 1.04 /
0.0905 264.7 1.15 0.975 /
0.18 514.7 1.207 0.91 /
0.371 1014.7 1.295 0.83 /
0.636 2014.7 1.435 0.695 /
0.775 2514.7 1.5 0.641 /
0.93 3014.7 1.565 0.594 /
1.270 4014.7 1.695 0.51
5014.7 1.671 0.549
9014.7 1.579 0.74 /
1.618 5014.7 1.827 0.449
9014.7 1.726 0.605 /
/
REGIONS ===========================================================
FIPNUM
1000*1
/
EQLNUM
1000*1
/
SOLUTION ============================================================
EQUIL
7020.00 2700.00 7990.00 .00000 7200.00 .00000 0 0 5 /
RSVD 2 TABLES 3 NODES IN EACH FIELD 12:00 17 AUG 83
7000.0 1.0000
7990.0 1.0000
/
SCHEDULE
RPTRST
BASIC=1
/
DATES -- 1
10 OKT 2008 /
/
WELSPECS
'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* /
'OP_2' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* /
/
COMPDAT
'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 /
'OP_2' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 /
'OP_1' 9 9 3 3 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 /
/
WTEST
'OP_1' 1 PGD 3 2 /
/
WCONPROD
'OP_1' 'OPEN' 'ORAT' 20000 4* 1000 /
/
WCONINJE
'OP_2' 'GAS' 'OPEN' 'RATE' 100 200 400 /
/
DATES -- 2
20 JAN 2011 /
/
WELSPECS
'OP_3' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* /
/
COMPDAT
'OP_3' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 /
/
WECON
'OP_1' 1.234 12.345 0.87 210.98 1* WELL NO /
'OP_3' 1* 1* 1* 0.0 0.0 +CON YES 1* POTN 0.56 PLUG 1* 10.23 /
/
WGRUPCON
OP_1 YES 123.456 GAS 0.75 /
OP_3 NO 100.0 /
/
TSTEP -- 3
10 /
)~" };
return Opm::Parser{}.parseString(input);
}
Opm::Deck msw_sim(const std::string& fname)
{
return Opm::Parser{}.parseFile(fname);
@ -888,6 +1126,216 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE (WECON)
{
const auto simCase = SimulationCase{wecon_etc_sim()};
const auto action_state = Opm::Action::State{};
const auto wtest_state = Opm::WellTestState{};
// Report Step 1: 2008-10-10 --> 2011-01-20
const auto rptStep = std::size_t{2};
const auto ih = MockIH {
static_cast<int>(simCase.sched.getWells(rptStep).size())
};
BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{3});
const auto smry = sim_state();
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
awd.captureDeclaredWellData(simCase.sched,
simCase.es.tracer(),
rptStep,
action_state,
wtest_state,
smry,
ih.value);
// IWEL (OP_1)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IWell::index;
namespace EconValue = Opm::RestartIO::Helpers::VectorItems::IWell::Value::EconLimit;
const auto start = 0*ih.niwelz;
const auto& iwell = awd.getIWell();
BOOST_CHECK_EQUAL(iwell[start + Ix::EconWorkoverProcedure],
EconValue::WOProcedure::StopOrShut);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconLimitEndRun],
EconValue::EndRun::No);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconLimitQuantity],
EconValue::Quantity::Rate);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconWorkoverProcedure_2],
EconValue::WOProcedure::StopOrShut);
}
// IWEL (OP_3)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IWell::index;
namespace EconValue = Opm::RestartIO::Helpers::VectorItems::IWell::Value::EconLimit;
const auto start = 2*ih.niwelz;
const auto& iwell = awd.getIWell();
BOOST_CHECK_EQUAL(iwell[start + Ix::EconWorkoverProcedure],
EconValue::WOProcedure::ConAndBelow);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconLimitEndRun],
EconValue::EndRun::Yes);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconLimitQuantity],
EconValue::Quantity::Potential);
BOOST_CHECK_EQUAL(iwell[start + Ix::EconWorkoverProcedure_2],
EconValue::WOProcedure::Plug);
}
// SWEL (OP_1)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
const auto i0 = 0*ih.nswelz;
const auto& swell = awd.getSWell();
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMinOil], 1.234f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMinGas], 12.345f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMaxWct], 0.87f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMaxGor], 210.98f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMaxWct_2], 0.0f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::EconLimitMinLiq], 0.0f, 1.0e-7f);
}
// SWEL (OP_3)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
const auto i2 = 2*ih.nswelz;
const auto& swell = awd.getSWell();
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMinOil], 0.0f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMinGas], 0.0f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMaxWct], 1.0e+20f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMaxGor], 1.0e+20f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMaxWct_2], 0.56f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::EconLimitMinLiq], 10.23f, 1.0e-7f);
}
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE (WGRUPCON)
{
const auto simCase = SimulationCase{wecon_etc_sim()};
const auto action_state = Opm::Action::State{};
const auto wtest_state = Opm::WellTestState{};
// Report Step 1: 2008-10-10 --> 2011-01-20
const auto rptStep = std::size_t{2};
const auto ih = MockIH {
static_cast<int>(simCase.sched.getWells(rptStep).size())
};
BOOST_CHECK_EQUAL(ih.nwells, MockIH::Sz{3});
const auto smry = sim_state();
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
awd.captureDeclaredWellData(simCase.sched,
simCase.es.tracer(),
rptStep,
action_state,
wtest_state,
smry,
ih.value);
// IWEL (OP_1)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IWell::index;
namespace GrupConValue = Opm::RestartIO::Helpers::VectorItems::IWell::Value::WGrupCon;
const auto start = 0*ih.niwelz;
const auto& iwell = awd.getIWell();
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConControllable],
GrupConValue::Controllable::Yes);
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConGRPhase],
GrupConValue::GRPhase::Gas);
}
// IWEL (OP_3)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IWell::index;
namespace GrupConValue = Opm::RestartIO::Helpers::VectorItems::IWell::Value::WGrupCon;
const auto start = 1*ih.niwelz;
const auto& iwell = awd.getIWell();
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConControllable],
GrupConValue::Controllable::Yes);
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConGRPhase],
GrupConValue::GRPhase::Defaulted);
}
// IWEL (OP_3)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IWell::index;
namespace GrupConValue = Opm::RestartIO::Helpers::VectorItems::IWell::Value::WGrupCon;
const auto start = 2*ih.niwelz;
const auto& iwell = awd.getIWell();
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConControllable],
GrupConValue::Controllable::No);
BOOST_CHECK_EQUAL(iwell[start + Ix::WGrupConGRPhase],
GrupConValue::GRPhase::Defaulted);
}
// SWEL (OP_1)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
const auto i0 = 0*ih.nswelz;
const auto& swell = awd.getSWell();
BOOST_CHECK_CLOSE(swell[i0 + Ix::WGrupConGuideRate], 123.456f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i0 + Ix::WGrupConGRScaling], 0.75f, 1.0e-7f);
}
// SWEL (OP_2)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
const auto i1 = 1*ih.nswelz;
const auto& swell = awd.getSWell();
BOOST_CHECK_CLOSE(swell[i1 + Ix::WGrupConGuideRate], -1.0e+20f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i1 + Ix::WGrupConGRScaling], 1.0f, 1.0e-7f);
}
// SWEL (OP_3)
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
const auto i2 = 2*ih.nswelz;
const auto& swell = awd.getSWell();
BOOST_CHECK_CLOSE(swell[i2 + Ix::WGrupConGuideRate], 100.0f, 1.0e-7f);
BOOST_CHECK_CLOSE(swell[i2 + Ix::WGrupConGRScaling], 1.0f, 1.0e-7f);
}
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE (Declared_Well_Data_MSW_well_data)
{
const auto simCase = SimulationCase{msw_sim("0A4_GRCTRL_LRAT_LRAT_GGR_BASE_MODEL2_MSW_ALL.DATA")};