Merge pull request #1843 from joakim-hove/restart-recover-udq

Recover UDQ values from restart file
This commit is contained in:
Bård Skaflestad
2020-06-25 16:41:20 +02:00
committed by GitHub
5 changed files with 928 additions and 1 deletions

View File

@@ -431,6 +431,8 @@ if(ENABLE_ECL_OUTPUT)
tests/SPE1CASE1A.SMSPEC
tests/SPE9_CP_PACKED.DATA
tests/SOFR_TEST.DATA
tests/UDQ_BASE.DATA
tests/UDQ_RESTART.DATA
tests/UDQ_TEST_WCONPROD_IUAD-2.DATA
tests/UDQ_ACTIONX_TEST1.DATA
tests/UDQ_ACTIONX_TEST1_U.DATA

View File

@@ -50,6 +50,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
#include <algorithm>
#include <cmath>
@@ -249,6 +250,48 @@ namespace {
return { begin, end };
}
}
// ---------------------------------------------------------------------
class UDQVectors
{
public:
template <typename T>
using Window = boost::iterator_range<typename std::vector<T>::const_iterator>;
UDQVectors(std::shared_ptr<RestartFileView> rst_view) :
rstView_(rst_view)
{
const auto& intehead = rst_view->getKeyword<int>("INTEHEAD");
this->num_wells = intehead[VI::intehead::NWMAXZ];
this->num_groups = intehead[VI::intehead::NGMAXZ];
}
Window<double> next_dudw() {
return getDataWindow(this->rstView_->getKeyword<double>("DUDW"),
this->num_wells, this->udq_well_index++);
}
Window<double> next_dudg() {
return getDataWindow(this->rstView_->getKeyword<double>("DUDG"),
this->num_groups, this->udq_group_index++);
}
double next_dudf() {
return this->rstView_->getKeyword<double>("DUDF")[ this->udq_field_index++ ];
}
const std::vector<std::string>& zudn() {
return this->rstView_->getKeyword<std::string>("ZUDN");
}
private:
std::size_t num_wells;
std::size_t num_groups;
std::shared_ptr<RestartFileView> rstView_;
std::size_t udq_well_index = 0;
std::size_t udq_group_index = 0;
std::size_t udq_field_index = 0;
};
// ---------------------------------------------------------------------
@@ -1403,6 +1446,48 @@ namespace {
smry.update(key("GITH"), xgrp[VI::XGroup::index::HistGasInjTotal]);
}
void restore_udq(::Opm::SummaryState& smry,
const ::Opm::Schedule& schedule,
std::shared_ptr<RestartFileView>& rst_view)
{
if (!rst_view->hasKeyword<std::string>(std::string("ZUDN")))
return;
const auto sim_step = rst_view->simStep();
const auto& wnames = schedule.wellNames(sim_step);
const auto& groups = schedule.restart_groups(sim_step);
UDQVectors udq_vectors(rst_view);
for (const auto& udq : udq_vectors.zudn()) {
if (udq[0] == 'W') {
const auto& dudw = udq_vectors.next_dudw();
for (std::size_t well_index = 0; well_index < wnames.size(); well_index++) {
const auto& value = dudw[well_index];
if (value != ::Opm::UDQ::restart_default)
smry.update_well_var(wnames[well_index], udq, value);
}
}
if (udq[0] == 'G') {
const auto& dudg = udq_vectors.next_dudg();
for (std::size_t group_index = 0; group_index < groups.size(); group_index++) {
const auto& value = dudg[group_index];
if (value != ::Opm::UDQ::restart_default) {
const auto& group_name = groups[group_index]->name();
smry.update_group_var(group_name, udq, value);
}
}
}
if (udq[0] == 'F') {
const auto& value = udq_vectors.next_dudf();
if (value != ::Opm::UDQ::restart_default)
smry.update(udq, value);
}
}
}
void restore_cumulative(::Opm::SummaryState& smry,
const ::Opm::Schedule& schedule,
std::shared_ptr<RestartFileView> rst_view)
@@ -1487,8 +1572,8 @@ namespace Opm { namespace RestartIO {
restore_aquifers(es, rst_view, rst_value);
}
restore_udq(summary_state, schedule, rst_view);
restore_cumulative(summary_state, schedule, std::move(rst_view));
return rst_value;
}

373
tests/UDQ_BASE.DATA Normal file
View File

@@ -0,0 +1,373 @@
RUNSPEC
TITLE
2 PRODUCERS AND INJECTORS, 2 WELL GROUPS AND ONE INTERMEDIATE GROUP LEVEL BELOW THE FIELD LEVEL
DIMENS
10 5 10 /
START
1 'JAN' 2000 /
OIL
WATER
GAS
DISGAS
FIELD
TABDIMS
1 1 15 15 2 15 /
EQLDIMS
2 /
WELLDIMS
5 20 4 2 /
UNIFIN
UNIFOUT
FMTIN
FMTOUT
-- Dimensions for used defined quantity facility
-- max functions permitted in a quantity definition
-- max arguments permitted in a quantity definition
-- max user defined connection quantities
-- max user defined field quantities
-- max user defined group quantities
-- max user defined region quantities
-- max user defined segment quantities
-- max user defined well quantities
-- max user defined aquifer quantities
-- max user defined block quantities
-- whether new randon number generator seed computed for restart runs
UDQDIMS
50 25 0 50 50 0 0 50 0 20 /
-- Dimensions for the user defined arguments facility
-- number of keyword arguments in which UDQs replace numerical values
-- ratained for back-compatibility
-- total number of unique instances in which a UDQ is used in a keyword argument
UDADIMS
10 1* 10 /
-- RPTRUNSP
GRID =========================================================
--NOGGF
BOX
1 10 1 5 1 1 /
TOPS
50*7000 /
BOX
1 10 1 5 1 10 /
DXV
10*100 /
DYV
5*100 /
DZV
2*20 100 7*20 /
EQUALS
-- 'DX' 100 /
-- 'DY' 100 /
'PERMX' 50 /
'PERMZ' 5 /
-- 'DZ' 20 /
'PORO' 0.2 /
-- 'TOPS' 7000 1 10 1 5 1 1 /
--'DZ' 100 1 10 1 5 3 3 /
'PORO' 0.0 1 10 1 5 3 3 /
/
COPY
PERMX PERMY /
/
PORO
500*0.15 /
RPTGRID
-- Report Levels for Grid Section Data
--
/
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 /
/
RPTPROPS
-- PROPS Reporting Options
--
/
REGIONS ===========================================================
FIPNUM
100*1
400*2
/
EQLNUM
100*1
400*2
/
RPTREGS
/
SOLUTION ============================================================
EQUIL
7020.00 2700.00 7990.00 .00000 7020.00 .00000 0 0 5 /
7200.00 3700.00 7300.00 .00000 7000.00 .00000 1 0 5 /
RSVD 2 TABLES 3 NODES IN EACH FIELD 12:00 17 AUG 83
7000.0 1.0000
7990.0 1.0000
/
7000.0 1.0000
7400.0 1.0000
/
RPTRST
-- Restart File Output Control
--
'BASIC=2' 'FLOWS' 'POT' 'PRES' /
SUMMARY ===========================================================
FOPR
WOPR
/
FGPR
FWPR
FWIR
FWCT
FGOR
--RUNSUM
ALL
MSUMLINS
MSUMNEWT
SEPARATE
SCHEDULE ===========================================================
DEBUG
1 3 /
DRSDT
1.0E20 /
RPTSCHED
'PRES' 'SWAT' 'SGAS' 'RESTART=1' 'RS' 'WELLS=2' 'SUMMARY=2'
'CPU=2' 'WELSPECS' 'NEWTON=2' /
GRUPTREE
'GRP1' 'FIELD' /
'WGRP1' 'GRP1' /
'WGRP2' 'GRP1' /
/
WELSPECS
'PROD1' 'WGRP1' 1 5 7030 'OIL' 0.0 'STD' 'STOP' /
'PROD2' 'WGRP2' 1 5 7030 'OIL' 0.0 'STD' 'STOP' /
'WINJ1' 'WGRP1' 10 1 7030 'WAT' 0.0 'STD' 'STOP' /
'WINJ2' 'WGRP2' 10 1 7030 'WAT' 0.0 'STD' 'STOP' /
/
COMPDAT
'PROD1' 1 5 2 2 3* 0.2 3* 'X' /
'PROD1' 2 5 2 2 3* 0.2 3* 'X' /
'PROD1' 3 5 2 2 3* 0.2 3* 'X' /
'PROD2' 4 5 2 2 3* 0.2 3* 'X' /
'PROD2' 5 5 2 2 3* 0.2 3* 'X' /
'WINJ1' 10 1 9 9 3* 0.2 3* 'X' /
'WINJ1' 9 1 9 9 3* 0.2 3* 'X' /
'WINJ1' 8 1 9 9 3* 0.2 3* 'X' /
'WINJ2' 7 1 9 9 3* 0.2 3* 'X' /
'WINJ2' 6 1 9 9 3* 0.2 3* 'X' /
/
UDQ
-- test
--oil & liquid capacities at GEFAC = 0.8995
DEFINE WUOPRL (WOPR PROD1 - 150) * 0.90 /
DEFINE WULPRL (WLPR PROD1 - 200) * 0.90 /
DEFINE WUOPRU (WOPR PROD2 - 250) * 0.80 /
DEFINE GUOPRU (GOPR GRP1 - 449) * 0.77 /
DEFINE WULPRU (WLPR PROD2 - 300) * 0.80 /
ASSIGN WULPRL 400. /
DEFINE FULPR (FLPR - 543) * 0.65 /
DEFINE WUOPRL (WOPR PROD1 - 170) * 0.60 /
-- units
UNITS WUOPRL SM3/DAY /
UNITS WULPRL SM3/DAY /
UNITS GUOPRU SM3/DAY /
UNITS WUOPRU SM3/DAY /
UNITS WULPRU SM3/DAY /
UNITS FULPR SM3/DAY /
--
/
WCONPROD
'PROD1' 'OPEN' 'GRUP' WUOPRU 1* 1* WULPRU 1* 60.0 / single wells
'PROD2' 'OPEN' 'GRUP' WUOPRU 1* 1* WULPRU 1* 60.0 / single wells
/
DATES
1 'FEB' 2000 /
/
DATES
1 'MAR' 2000 /
/
DATES
1 'APR' 2000 /
/
END

376
tests/UDQ_RESTART.DATA Normal file
View File

@@ -0,0 +1,376 @@
RUNSPEC
TITLE
2 PRODUCERS AND INJECTORS, 2 WELL GROUPS AND ONE INTERMEDIATE GROUP LEVEL BELOW THE FIELD LEVEL
DIMENS
10 5 10 /
START
1 'JAN' 2000 /
OIL
WATER
GAS
DISGAS
FIELD
TABDIMS
1 1 15 15 2 15 /
EQLDIMS
2 /
WELLDIMS
5 20 4 2 /
UNIFIN
UNIFOUT
FMTIN
FMTOUT
-- Dimensions for used defined quantity facility
-- max functions permitted in a quantity definition
-- max arguments permitted in a quantity definition
-- max user defined connection quantities
-- max user defined field quantities
-- max user defined group quantities
-- max user defined region quantities
-- max user defined segment quantities
-- max user defined well quantities
-- max user defined aquifer quantities
-- max user defined block quantities
-- whether new randon number generator seed computed for restart runs
UDQDIMS
50 25 0 50 50 0 0 50 0 20 /
-- Dimensions for the user defined arguments facility
-- number of keyword arguments in which UDQs replace numerical values
-- ratained for back-compatibility
-- total number of unique instances in which a UDQ is used in a keyword argument
UDADIMS
10 1* 10 /
-- RPTRUNSP
GRID =========================================================
--NOGGF
BOX
1 10 1 5 1 1 /
TOPS
50*7000 /
BOX
1 10 1 5 1 10 /
DXV
10*100 /
DYV
5*100 /
DZV
2*20 100 7*20 /
EQUALS
-- 'DX' 100 /
-- 'DY' 100 /
'PERMX' 50 /
'PERMZ' 5 /
-- 'DZ' 20 /
'PORO' 0.2 /
-- 'TOPS' 7000 1 10 1 5 1 1 /
--'DZ' 100 1 10 1 5 3 3 /
'PORO' 0.0 1 10 1 5 3 3 /
/
COPY
PERMX PERMY /
/
PORO
500*0.15 /
RPTGRID
-- Report Levels for Grid Section Data
--
/
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 /
/
RPTPROPS
-- PROPS Reporting Options
--
/
REGIONS ===========================================================
FIPNUM
100*1
400*2
/
EQLNUM
100*1
400*2
/
RPTREGS
/
SOLUTION ============================================================
RESTART
'UDQ_BASE' 1 /
RSVD 2 TABLES 3 NODES IN EACH FIELD 12:00 17 AUG 83
7000.0 1.0000
7990.0 1.0000
/
7000.0 1.0000
7400.0 1.0000
/
RPTRST
-- Restart File Output Control
--
'BASIC=2' 'FLOWS' 'POT' 'PRES' /
SUMMARY ===========================================================
FOPR
WOPR
/
FGPR
FWPR
FWIR
FWCT
FGOR
--RUNSUM
ALL
MSUMLINS
MSUMNEWT
SEPARATE
SCHEDULE ===========================================================
DEBUG
1 3 /
DRSDT
1.0E20 /
RPTSCHED
'PRES' 'SWAT' 'SGAS' 'RESTART=1' 'RS' 'WELLS=2' 'SUMMARY=2'
'CPU=2' 'WELSPECS' 'NEWTON=2' /
NOECHO
ECHO
GRUPTREE
'GRP1' 'FIELD' /
'WGRP1' 'GRP1' /
'WGRP2' 'GRP1' /
/
WELSPECS
'PROD1' 'WGRP1' 1 5 7030 'OIL' 0.0 'STD' 'STOP' /
'PROD2' 'WGRP2' 1 5 7030 'OIL' 0.0 'STD' 'STOP' /
'WINJ1' 'WGRP1' 10 1 7030 'WAT' 0.0 'STD' 'STOP' /
'WINJ2' 'WGRP2' 10 1 7030 'WAT' 0.0 'STD' 'STOP' /
/
COMPDAT
'PROD1' 1 5 2 2 3* 0.2 3* 'X' /
'PROD1' 2 5 2 2 3* 0.2 3* 'X' /
'PROD1' 3 5 2 2 3* 0.2 3* 'X' /
'PROD2' 4 5 2 2 3* 0.2 3* 'X' /
'PROD2' 5 5 2 2 3* 0.2 3* 'X' /
'WINJ1' 10 1 9 9 3* 0.2 3* 'X' /
'WINJ1' 9 1 9 9 3* 0.2 3* 'X' /
'WINJ1' 8 1 9 9 3* 0.2 3* 'X' /
'WINJ2' 7 1 9 9 3* 0.2 3* 'X' /
'WINJ2' 6 1 9 9 3* 0.2 3* 'X' /
/
UDQ
-- test
--oil & liquid capacities at GEFAC = 0.8995
DEFINE WUOPRL (WOPR PROD1 - 150) * 0.90 /
DEFINE WULPRL (WLPR PROD1 - 200) * 0.90 /
DEFINE WUOPRU (WOPR PROD2 - 250) * 0.80 /
DEFINE GUOPRU (GOPR GRP1 - 449) * 0.77 /
DEFINE WULPRU (WLPR PROD2 - 300) * 0.80 /
ASSIGN WULPRL 400. /
DEFINE FULPR (FLPR - 543) * 0.65 /
DEFINE WUOPRL (WOPR PROD1 - 170) * 0.60 /
-- units
UNITS WUOPRL SM3/DAY /
UNITS WULPRL SM3/DAY /
UNITS GUOPRU SM3/DAY /
UNITS WUOPRU SM3/DAY /
UNITS WULPRU SM3/DAY /
UNITS FULPR SM3/DAY /
--
/
WCONPROD
'PROD1' 'OPEN' 'GRUP' WUOPRU 1* 1* WULPRU 1* 60.0 / single wells
'PROD2' 'OPEN' 'GRUP' WUOPRU 1* 1* WULPRU 1* 60.0 / single wells
/
DATES
1 'FEB' 2000 /
/
DATES
1 'MAR' 2000 /
/
DATES
1 'APR' 2000 /
/
END

View File

@@ -39,6 +39,8 @@
#include <opm/parser/eclipse/Utility/Functional.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
#include <opm/io/eclipse/OutputStream.hpp>
#include <opm/io/eclipse/EclIOdata.hpp>
@@ -362,6 +364,22 @@ struct Setup {
};
void init_st(SummaryState& st) {
st.update_well_var("PROD1", "WOPR", 100);
st.update_well_var("PROD1", "WLPR", 100);
st.update_well_var("PROD2", "WOPR", 100);
st.update_well_var("PROD2", "WLPR", 100);
st.update_well_var("WINJ1", "WOPR", 100);
st.update_well_var("WINJ1", "WLPR", 100);
st.update_well_var("WINJ2", "WOPR", 100);
st.update_well_var("WINJ2", "WLPR", 100);
st.update_group_var("GRP1", "GOPR", 100);
st.update_group_var("WGRP1", "GOPR", 100);
st.update_group_var("WGRP1", "GOPR", 100);
st.update("FLPR", 100);
}
RestartValue first_sim(const Setup& setup, Action::State& action_state, SummaryState& st, bool write_double) {
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
auto num_cells = setup.grid.getNumActive( );
@@ -371,8 +389,11 @@ RestartValue first_sim(const Setup& setup, Action::State& action_state, SummaryS
auto sol = mkSolution( num_cells );
auto wells = mkWells();
const auto& udq = setup.schedule.getUDQConfig(report_step);
RestartValue restart_value(sol, wells);
init_st(st);
udq.eval(st);
eclWriter.writeTimeStep( action_state,
st,
report_step,
@@ -957,4 +978,74 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives)
}
BOOST_AUTO_TEST_CASE(UDQ_RESTART) {
std::vector<RestartKey> keys {{"PRESSURE" , UnitSystem::measure::pressure},
{"SWAT" , UnitSystem::measure::identity},
{"SGAS" , UnitSystem::measure::identity}};
WorkArea test_area("test_udq_restart");
test_area.copyIn("UDQ_BASE.DATA");
test_area.copyIn("UDQ_RESTART.DATA");
Setup base_setup("UDQ_BASE.DATA");
SummaryState st1(std::chrono::system_clock::now());
SummaryState st2(std::chrono::system_clock::now());
Action::State action_state;
auto state1 = first_sim( base_setup , action_state, st1, false );
Setup restart_setup("UDQ_RESTART.DATA");
auto state2 = second_sim( restart_setup , action_state, st2 , keys );
BOOST_CHECK(st1.wells() == st2.wells());
BOOST_CHECK(st1.groups() == st2.groups());
const auto& udq = base_setup.schedule.getUDQConfig(1);
for (const auto& well : st1.wells()) {
for (const auto& def : udq.definitions(UDQVarType::WELL_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has_well_var(well, kw), st2.has_well_var(well, kw));
if (st1.has_well_var(well, def.keyword()))
BOOST_CHECK_EQUAL(st1.get_well_var(well, kw), st2.get_well_var(well, kw));
}
}
for (const auto& group : st1.groups()) {
for (const auto& def : udq.definitions(UDQVarType::GROUP_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has_group_var(group, kw), st2.has_group_var(group, kw));
if (st1.has_group_var(group, def.keyword()))
BOOST_CHECK_EQUAL(st1.get_group_var(group, kw), st2.get_group_var(group, kw));
}
}
for (const auto& well : st1.wells()) {
for (const auto& def : udq.assignments(UDQVarType::WELL_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has_well_var(well, kw), st2.has_well_var(well, kw));
if (st1.has_well_var(well, def.keyword()))
BOOST_CHECK_EQUAL(st1.get_well_var(well, kw), st2.get_well_var(well, kw));
}
}
for (const auto& group : st1.groups()) {
for (const auto& def : udq.assignments(UDQVarType::GROUP_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has_group_var(group, kw), st2.has_group_var(group, kw));
if (st1.has_group_var(group, def.keyword()))
BOOST_CHECK_EQUAL(st1.get_group_var(group, kw), st2.get_group_var(group, kw));
}
}
for (const auto& def : udq.assignments(UDQVarType::FIELD_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has(kw), st2.has(kw));
if (st1.has(kw))
BOOST_CHECK_EQUAL(st1.get(kw), st2.get(kw));
}
for (const auto& def : udq.definitions(UDQVarType::FIELD_VAR)) {
const auto& kw = def.keyword();
BOOST_CHECK_EQUAL( st1.has(kw), st2.has(kw));
if (st1.has(kw))
BOOST_CHECK_EQUAL(st1.get(kw), st2.get(kw));
}
}
}