Add test case for maybeChopSubStep()

This commit is contained in:
Håkon Hægland 2025-01-14 07:08:40 +01:00
parent 990c3f0248
commit 6e50ec9569
12 changed files with 7894 additions and 1 deletions

View File

@ -491,6 +491,7 @@ target_sources(test_outputdir PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_equil PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_RestartSerialization PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_glift1 PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_chopstep PRIVATE $<TARGET_OBJECTS:moduleVersion>)
include (${CMAKE_CURRENT_SOURCE_DIR}/modelTests.cmake)

View File

@ -541,6 +541,7 @@ list (APPEND TEST_DATA_FILES
tests/options_flexiblesolver.json
tests/options_flexiblesolver_simple.json
tests/GLIFT1.DATA
tests/RC-01_MAST_PRED.DATA
tests/include/flowl_b_vfp.ecl
tests/include/flowl_c_vfp.ecl
tests/include/permx_model5.grdecl
@ -550,6 +551,13 @@ list (APPEND TEST_DATA_FILES
tests/include/summary.inc
tests/include/test1_20x30x10.grdecl
tests/include/well_vfp.ecl
tests/include/b1_vfp_flowline.inc
tests/include/d1_vfp_flowline.inc
tests/include/edit_nnc.inc
tests/include/flowline_e1_vfp.inc
tests/include/PVT-WET-GAS.INC
tests/include/scal_mod2.inc
tests/include/summary_rc.inc
tests/test10.partition
tests/parametersystem.ini
tests/data/co2injection.dgf
@ -1172,7 +1180,7 @@ if(dune-alugrid_FOUND)
examples/fracture_discretefracture.cpp
)
endif()
if(USE_MPI)
if(MPI_FOUND)
list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/ReservoirCoupling.cpp
opm/simulators/flow/ReservoirCouplingMaster.cpp
@ -1185,6 +1193,9 @@ if(USE_MPI)
opm/simulators/flow/ReservoirCouplingSlave.hpp
opm/simulators/flow/ReservoirCouplingSpawnSlaves.hpp
)
list (APPEND TEST_SOURCE_FILES
tests/rescoup/test_chopstep.cpp
)
endif()
if(HYPRE_FOUND)
list(APPEND PUBLIC_HEADER_FILES

View File

@ -47,6 +47,9 @@ public:
this->master_slave_comm_.push_back(comm);
}
void addSlaveName(const std::string &name) { this->slave_names_.push_back(name); }
void addSlaveNextReportTimeOffset(double offset) {
this->slave_next_report_time_offsets_.push_back(offset);
}
void addSlaveStartDate(std::time_t date) { this->slave_start_dates_.push_back(date); }
double getActivationDate() const { return this->activation_date_; }
int getArgc() const { return this->argc_; }
@ -64,6 +67,11 @@ public:
void resizeSlaveStartDates(int size) { this->slave_start_dates_.resize(size); }
void resizeNextReportDates(int size) { this->slave_next_report_time_offsets_.resize(size); }
void sendNextTimeStepToSlaves(double next_time_step);
// These are currently only used for unit testing
void setSlaveStartDate(int index, std::time_t date) { this->slave_start_dates_[index] = date; }
void setSlaveNextReportTimeOffset(int index, double offset) {
this->slave_next_report_time_offsets_[index] = offset;
}
private:
double getMasterActivationDate_() const;

332
tests/RC-01_MAST_PRED.DATA Normal file
View File

@ -0,0 +1,332 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- Copyright (C) 2024 Equinor
-- This deck tests usage of reservoir coupling.
-- This case is a pure prediction case (no history). The master model includes one grid cell
-- and no wells. The master deck is used only for controlling production and injection
-- from the two slave models.
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
RUNSPEC
------------------------------------------------------------------------------------------------
DIMENS
1 1 1 /
OIL
WATER
GAS
DISGAS
VAPOIL
METRIC
START
1 'OCT' 2018 /
EQLDIMS
1 1* 25 /
VFPPDIMS
--max.rate max.THP max.fw max.fg max.ALQ max.tabs
25 15 15 15 0 60 /
--
--
WELLDIMS
--max.well max.con/well max.grup max.w/grup
5 10 10 10 /
--
TABDIMS
--ntsfun ntpvt max.nssfun max.nppvt max.ntfip max.nrpvt
1 1 50 60 72 60 /
--
UNIFIN
UNIFOUT
NETWORK
5 3 /
------------------------------------------------------------------------------------------------
GRID
------------------------------------------------------------------------------------------------
--
NEWTRAN
--
GRIDFILE
0 1 /
--
GRIDUNIT
METRES /
--
INIT
SPECGRID
1 1 1 1 F /
COORD
2000.0000 2000.0000 2000.0000 2000.0000 2000.0000 2002.5000
2100.0000 2000.0000 2000.0000 2100.0000 2000.0000 2002.5000
2000.0000 2100.0000 2000.0000 2000.0000 2100.0000 2002.5000
2100.0000 2100.0000 2000.0000 2100.0000 2100.0000 2002.5000
/
ZCORN
2000.0000 2000.0000 2000.0000 2000.0000 2002.5000 2002.5000
2002.5000 2002.5000 /
PORO
0.25 /
PERMX
2100 /
COPY
PERMX PERMY /
PERMX PERMZ /
/
MULTIPLY
'PERMZ' 0.1 /
/
RPTGRID
'ALLNNC' /
------------------------------------------------------------------------------------------------
EDIT
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
PROPS
------------------------------------------------------------------------------------------------
NOECHO
INCLUDE
'include/PVT-WET-GAS.INC' /
INCLUDE
'include/scal_mod2.inc' /
FILLEPS
------------------------------------------------------------------------------------------------
REGIONS
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
SOLUTION
------------------------------------------------------------------------------------------------
RPTRST
BASIC=2 /
EQUIL
-- Datum P woc Pc goc Pc Rsvd Rvvd N
2300.00 300.0 2300.0 0.0 1800.00 0.0 1 1 0 /
PBVD
2000.0 100.0
2300.0 100.0 /
PDVD
2000.0 100.0
2300.0 100.0 /
/
------------------------------------------------------------------------------------------------
SUMMARY
-----------------------------------------------------------------------------------------------
INCLUDE
'include/summary_rc.inc' /
------------------------------------------------------------------------------------------------
SCHEDULE
------------------------------------------------------------------------------------------------
TUNING
1.0 5.0 /
/
/
INCLUDE
'include/b1_vfp_flowline.inc' /
INCLUDE
'include/d1_vfp_flowline.inc' /
INCLUDE
'./include/flowline_e1_vfp.inc' /
GRUPTREE
'PLAT-A' 'FIELD' /
'MOD1' 'PLAT-A' /
'B1_M' 'MOD1' /
'D1_M' 'MOD1' /
'C1_M' 'MOD1' /
'E1_M' 'PLAT-A' /
/
SLAVES
'RES-1' 'RC-01_MOD1_PRED' 1* '../mod1' 4 /
'RES-2' 'RC-01_MOD2_PRED' 1* '../mod2' 1 /
/
GRUPMAST
'D1_M' 'RES-1' 'MANI-D' 1* /
'B1_M' 'RES-1' 'MANI-B' 1* /
'C1_M' 'RES-1' 'MANI-C' 1* /
'E1_M' 'RES-2' 'E1' 1* /
/
-- DUMPCUPL
-- F /
BRANPROP
-- Downtree Uptree #VFP ALQ
B1_M 'PLAT-A' 3 1* /
D1_M 'PLAT-A' 4 1* /
E1_M 'PLAT-A' 5 1* /
/
NODEPROP
-- Node_name Press autoChoke? addGasLift? Group_name
PLAT-A 21.0 NO NO 1* /
B1_M 1* NO NO 1* /
D1_M 1* NO NO 1* /
E1_M 1* NO NO 1* /
/
GUIDERAT
30.0 OIL 1.0 1.0 1* 1* 1.0 0.2 1* 0.1 /
GCONPROD
'FIELD' 'ORAT' 9200.0 1* 6.9E6 1* 'RATE' /
'D1_M' 'ORAT' 9200.0 1* 6.9E6 1* 'RATE' 1* 1* 'FORM' /
'B1_M' 'ORAT' 9200.0 1* 6.9E6 1* 'RATE' 1* 1* 'FORM' /
'C1_M' 'ORAT' 9200.0 1* 6.9E6 1* 'RATE' 1* 1* 'FORM' /
'E1_M' 'ORAT' 9200.0 1* 6.9E6 1* 'RATE' 1* 1* 'FORM' /
/
GCONSUMP
'FIELD' 200000 /
/
GCONINJE
'FIELD' 'GAS' 'REIN' 4.0E6 1* 1.0 /
'D1_M' 'GAS' 'RATE' 4.0E6 4* 1.0 'RATE' /
'B1_M' 'GAS' 'RATE' 4.0E6 4* 1.0 'RATE' /
'C1_M' 'GAS' 'RATE' 4.0E6 4* 1.0 'RATE' /
'E1_M' 'GAS' 'RATE' 4.0E6 4* 1.0 'RATE' /
'D1_M' 'WATER' 'RATE' 4.0E6 4* 1.0 'RATE' /
'B1_M' 'WATER' 'RATE' 4.0E6 4* 1.0 'RATE' /
'C1_M' 'WATER' 'RATE' 4.0E6 4* 1.0 'RATE' /
'E1_M' 'WATER' 'RATE' 4.0E6 4* 1.0 'RATE' /
/
DATES
1 NOV 2018 /
/
GCONINJE
'MOD1' 'WATER' 'VREP' 10000.0 2* 1.0 /
/
DATES
1 DEC 2018 /
1 JAN 2019 /
/
GCONPROD
'FIELD' 'ORAT' 13100.0 1* 6.9E6 1* 'RATE' /
/
DATES
1 FEB 2019 /
/
DATES
1 MAR 2019 /
1 APR 2019 /
1 MAY 2019 /
1 JUN 2019 /
1 JUL 2019 /
/
GCONSALE
FIELD 1.0E6 1.05E6 0.99E6 RATE /
/
DATES
1 AUG 2019 /
1 SEP 2019 /
1 OCT 2019 /
1 NOV 2019 /
1 DEC 2019 /
/
DATES
1 JAN 2020 /
1 FEB 2020 /
1 MAR 2020 /
1 APR 2020 /
1 MAY 2020 /
1 JUN 2020 /
1 JUL 2020 /
1 AUG 2020 /
1 SEP 2020 /
1 OCT 2020 /
1 NOV 2020 /
1 DEC 2020 /
/
DATES
1 JAN 2021 /
1 FEB 2021 /
1 MAR 2021 /
1 APR 2021 /
1 MAY 2021 /
1 JUN 2021 /
1 JUL 2021 /
1 AUG 2021 /
1 SEP 2021 /
1 OCT 2021 /
1 NOV 2021 /
1 DEC 2021 /
/
END

View File

@ -0,0 +1,461 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- Copyright (C) 2018 Equinor
PVTG
-- PRESSURE RSG B-GAS VISCOSITY
-- BAR (CP)
50.00 0.00000497 0.024958 0.01441
0.00000248 0.024958 0.01440
0.00000000 0.024958 0.01440 /
70.00 0.00000521 0.017639 0.01491
0.00000261 0.017641 0.01490
0.00000000 0.017643 0.01490 /
90.00 0.00000627 0.013608 0.01547
0.00000313 0.013611 0.01546
0.00000000 0.013615 0.01544 /
110.00 0.00000798 0.011072 0.01609
0.00000399 0.011076 0.01607
0.00000000 0.011081 0.01605 /
130.00 0.00001041 0.009340 0.01677
0.00000520 0.009346 0.01674
0.00000000 0.009352 0.01671 /
150.00 0.00001365 0.008092 0.01752
0.00000683 0.008099 0.01748
0.00000000 0.008106 0.01743 /
170.00 0.00001786 0.007156 0.01834
0.00000893 0.007164 0.01827
0.00000000 0.007172 0.01819 /
190.00 0.00002316 0.006433 0.01923
0.00001158 0.006442 0.01912
0.00000000 0.006451 0.01900 /
210.00 0.00002972 0.005861 0.02019
0.00001486 0.005871 0.02001
0.00000000 0.005881 0.01984 /
230.00 0.00003767 0.005402 0.02121
0.00001883 0.005412 0.02095
0.00000000 0.005422 0.02071 /
250.80 0.00004756 0.005013 0.02234
0.00002378 0.005022 0.02197
0.00000000 0.005032 0.02162 /
268.42 0.00005757 0.004737 0.02335
0.00002878 0.004746 0.02287
0.00000000 0.004754 0.02240 /
285.33 0.00006853 0.004511 0.02438
0.00003427 0.004518 0.02375
0.00000000 0.004525 0.02315 /
301.59 0.00008041 0.004323 0.02542
0.00004020 0.004327 0.02463
0.00000000 0.004332 0.02387 /
317.23 0.00009313 0.004165 0.02648
0.00004657 0.004166 0.02549
0.00000000 0.004169 0.02456 /
332.29 0.00010668 0.004031 0.02755
0.00005334 0.004029 0.02634
0.00000000 0.004028 0.02522 /
346.80 0.00012100 0.003917 0.02863
0.00006050 0.003911 0.02719
0.00000000 0.003906 0.02585 /
360.80 0.00013607 0.003819 0.02974
0.00006803 0.003808 0.02803
0.00000000 0.003799 0.02645 /
374.31 0.00015188 0.003735 0.03087
0.00007594 0.003718 0.02887
0.00000000 0.003705 0.02703 /
387.36 0.00016843 0.003662 0.03202
0.00008421 0.003639 0.02970
0.00000000 0.003621 0.02758 /
399.99 0.00018571 0.003598 0.03320
0.00009286 0.003570 0.03053
0.00000000 0.003545 0.02810 /
412.21 0.00020375 0.003543 0.03442
0.00010188 0.003508 0.03137
0.00000000 0.003477 0.02861 /
424.05 0.00022256 0.003496 0.03566
0.00011128 0.003453 0.03220
0.00000000 0.003416 0.02909 /
435.53 0.00024218 0.003454 0.03695
0.00012109 0.003404 0.03305
0.00000000 0.003360 0.02956 /
446.68 0.00026266 0.003419 0.03828
0.00013133 0.003360 0.03390
0.00000000 0.003309 0.03000 /
457.51 0.00028404 0.003388 0.03967
0.00014202 0.003320 0.03477
0.00000000 0.003262 0.03043 /
468.04 0.00030639 0.003362 0.04110
0.00015319 0.003285 0.03566
0.00000000 0.003218 0.03085 /
478.30 0.00032980 0.003341 0.04261
0.00016490 0.003253 0.03656
0.00000000 0.003178 0.03125 /
488.30 0.00035436 0.003323 0.04418
0.00017718 0.003225 0.03749
0.00000000 0.003140 0.03164 /
498.06 0.00038020 0.003310 0.04583
0.00019010 0.003200 0.03845
0.00000000 0.003105 0.03202 /
507.59 0.00040745 0.003300 0.04758
0.00020373 0.003178 0.03944
0.00000000 0.003073 0.03238 /
516.92 0.00043630 0.003293 0.04943
0.00021815 0.003158 0.04048
0.00000000 0.003042 0.03273 /
526.06 0.00046694 0.003290 0.05141
0.00023347 0.003141 0.04156
0.00000000 0.003013 0.03308 /
535.02 0.00049963 0.003291 0.05353
0.00024981 0.003126 0.04271
0.00000000 0.002986 0.03342 /
543.83 0.00053469 0.003295 0.05582
0.00026734 0.003114 0.04393
0.00000000 0.002960 0.03374 /
552.49 0.00057251 0.003303 0.05830
0.00028625 0.003105 0.04523
0.00000000 0.002935 0.03407 /
561.04 0.00061359 0.003315 0.06103
0.00030679 0.003098 0.04664
0.00000000 0.002912 0.03438 /
569.48 0.00065855 0.003332 0.06405
0.00032928 0.003093 0.04818
0.00000000 0.002890 0.03469 /
577.82 0.00070820 0.003354 0.06744
0.00035410 0.003092 0.04988
0.00000000 0.002868 0.03500 /
586.09 0.00076355 0.003382 0.07127
0.00038178 0.003094 0.05178
0.00000000 0.002847 0.03530 /
594.29 0.00082592 0.003418 0.07567
0.00041296 0.003099 0.05394
0.00000000 0.002828 0.03560 /
/
PVTO
-- RSO PRESSURE B-OIL VISCOSITY
-- (BAR) (CP)
20.59 50.00 1.10615 1.180
75.00 1.10164 1.247
100.00 1.09744 1.315
125.00 1.09351 1.384
150.00 1.08984 1.453 /
28.19 70.00 1.12522 1.066
95.00 1.12047 1.124
120.00 1.11604 1.182
145.00 1.11191 1.241
170.00 1.10804 1.300 /
36.01 90.00 1.14458 0.964
115.00 1.13959 1.014
140.00 1.13494 1.064
165.00 1.13060 1.115
190.00 1.12653 1.166 /
44.09 110.00 1.16437 0.880
135.00 1.15915 0.924
160.00 1.15428 0.968
185.00 1.14973 1.012
210.00 1.14547 1.056 /
52.46 130.00 1.18467 0.805
155.00 1.17921 0.843
180.00 1.17413 0.882
205.00 1.16937 0.920
230.00 1.16491 0.959 /
61.13 150.00 1.20555 0.746
175.00 1.19985 0.780
200.00 1.19454 0.814
225.00 1.18958 0.849
250.00 1.18492 0.883 /
70.14 170.00 1.22704 0.698
195.00 1.22111 0.729
220.00 1.21558 0.759
245.00 1.21040 0.790
270.00 1.20555 0.821 /
79.50 190.00 1.24922 0.658
215.00 1.24305 0.686
240.00 1.23729 0.714
265.00 1.23190 0.742
290.00 1.22685 0.770 /
89.24 210.00 1.27214 0.637
235.00 1.26573 0.664
260.00 1.25974 0.693
285.00 1.25414 0.725
310.00 1.24888 0.760 /
99.39 230.00 1.29586 0.622
255.00 1.28921 0.641
280.00 1.28300 0.661
305.00 1.27718 0.680
330.00 1.27171 0.699 /
110.41 250.80 1.32148 0.610
275.80 1.31457 0.628
300.80 1.30812 0.647
325.80 1.30207 0.665
350.80 1.29638 0.682 /
120.32 268.42 1.34449 0.576
293.42 1.33735 0.593
318.42 1.33068 0.609
343.42 1.32442 0.626
368.42 1.31853 0.642 /
130.23 285.33 1.36737 0.5335
310.33 1.36001 0.5487
335.33 1.35313 0.5638
360.33 1.34667 0.5787
385.33 1.34059 0.5934 /
140.12 301.59 1.39015 0.4956
326.59 1.38257 0.5094
351.59 1.37548 0.5230
376.59 1.36882 0.5365
401.59 1.36255 0.5498 /
150.01 317.23 1.41282 0.4614
342.23 1.40503 0.4739
367.23 1.39773 0.4863
392.23 1.39088 0.4986
417.23 1.38443 0.5107 /
159.89 332.29 1.43539 0.43042
357.29 1.42739 0.44183
382.29 1.41990 0.45312
407.29 1.41286 0.46430
432.29 1.40622 0.47537 /
169.76 346.80 1.45788 0.41191
371.80 1.44967 0.42260
396.80 1.44198 0.43318
421.80 1.43475 0.44365
446.80 1.42794 0.45402 /
179.63 360.80 1.48028 0.39503
385.80 1.47187 0.40508
410.80 1.46398 0.41502
435.80 1.45657 0.42487
460.80 1.44958 0.43461 /
189.48 374.31 1.50260 0.37959
399.31 1.49399 0.38907
424.31 1.48591 0.39845
449.31 1.47832 0.40773
474.31 1.47116 0.41692 /
199.34 387.36 1.52484 0.36543
412.36 1.51603 0.37439
437.36 1.50777 0.38326
462.36 1.50000 0.39203
487.36 1.49267 0.40072 /
209.18 399.99 1.54700 0.35239
424.99 1.53800 0.36089
449.99 1.52956 0.36929
474.99 1.52161 0.37762
499.99 1.51411 0.38585 /
219.02 412.21 1.56910 0.34035
437.21 1.55991 0.34843
462.21 1.55128 0.35642
487.21 1.54316 0.36433
512.21 1.53549 0.37216 /
228.85 424.05 1.59112 0.32921
449.05 1.58174 0.33691
474.05 1.57294 0.34453
499.05 1.56464 0.35206
524.05 1.55681 0.35952 /
238.67 435.53 1.61307 0.31888
460.53 1.60351 0.32623
485.53 1.59453 0.33350
510.53 1.58606 0.34070
535.53 1.57807 0.34782 /
248.48 446.68 1.63496 0.30927
471.68 1.62522 0.31630
496.68 1.61606 0.32326
521.68 1.60743 0.33014
546.68 1.59927 0.33695 /
258.29 457.51 1.65678 0.30032
482.51 1.64686 0.30706
507.51 1.63753 0.31373
532.51 1.62873 0.32032
557.51 1.62042 0.32685 /
268.09 468.04 1.67853 0.29196
493.04 1.66843 0.29843
518.04 1.65893 0.30483
543.04 1.64997 0.31117
568.04 1.64150 0.31743 /
277.89 478.30 1.70022 0.28414
503.30 1.68994 0.29037
528.30 1.68028 0.29652
553.30 1.67116 0.30261
578.30 1.66253 0.30864 /
287.68 488.30 1.72184 0.27681
513.30 1.71139 0.28281
538.30 1.70156 0.28874
563.30 1.69228 0.29460
588.30 1.68350 0.30040 /
297.46 498.06 1.74339 0.26994
523.06 1.73277 0.27572
548.06 1.72278 0.28144
573.06 1.71334 0.28709
598.06 1.70442 0.29269 /
307.23 507.59 1.76487 0.26347
532.59 1.75409 0.26906
557.59 1.74393 0.27458
582.59 1.73434 0.28004
607.59 1.72527 0.28544 /
317.00 516.92 1.78628 0.25738
541.92 1.77533 0.26279
566.92 1.76502 0.26812
591.92 1.75528 0.27340
616.92 1.74606 0.27863 /
326.76 526.06 1.80761 0.25165
551.06 1.79651 0.25688
576.06 1.78604 0.26204
601.06 1.77615 0.26716
626.06 1.76679 0.27221 /
336.51 535.02 1.82887 0.24623
560.02 1.81761 0.25130
585.02 1.80699 0.25631
610.02 1.79696 0.26126
635.02 1.78746 0.26616 /
346.26 543.83 1.85005 0.24112
568.83 1.83864 0.24603
593.83 1.82787 0.25089
618.83 1.81770 0.25570
643.83 1.80806 0.26045 /
356.00 552.49 1.87115 0.23628
577.49 1.85959 0.24105
602.49 1.84868 0.24577
627.49 1.83836 0.25043
652.49 1.82858 0.25505 /
365.73 561.04 1.89217 0.23170
586.04 1.88046 0.23634
611.04 1.86940 0.24092
636.04 1.85895 0.24546
661.04 1.84904 0.24994 /
375.46 569.48 1.91309 0.22736
594.48 1.90124 0.23187
619.48 1.89004 0.23633
644.48 1.87946 0.24074
669.48 1.86942 0.24510 /
385.18 577.82 1.93391 0.22325
602.82 1.92192 0.22764
627.82 1.91060 0.23198
652.82 1.89988 0.23627
677.82 1.88971 0.24052 /
394.89 586.09 1.95464 0.21934
611.09 1.94252 0.22362
636.09 1.93106 0.22785
661.09 1.92021 0.23204
686.09 1.90993 0.23617 /
404.60 594.29 1.97527 0.21564
619.29 1.96301 0.21981
644.29 1.95143 0.22393
669.29 1.94046 0.22801
694.29 1.93005 0.23204 /
/
-- AVERAGE GAS DENSITY AT STD CONDITIONS = 0.854 KG/M3
-- AVERAGE OIL DENSITY AT STD CONDITIONS = 859.5 KG/M3
---------------------------------------------------------------------
-- ROCK COMPRESSIBILITY
--
-- REF.PRES. COMPR.
ROCK
277.0 4.84E-5 /
-- ==================================================================
-- PVT PROPERTIES OF WATER
--
-- REF.PRES. REF.FVF. COMPR. REF.VISC. VISCOSIBILITY
-- ==========================================================
PVTW
277.0 1.038 4.67E-5 0.318 0.0 /
---------------------------------------------------------------------
-- SURFACE DENSITIE OF RESERVOIR FLUIDS
-- OIL WATER GAS
DENSITY
859.5 1033.0 0.854 / Justert 22/7
--------------------------------------------------------------------
--
-- End of file --------
--
--------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- -- Copyright (C) 2018 Equinor
-- one nnc not present in grid (3 1 7 4 1 6 0.001)
EDITNNC
3 1 3 4 1 1 0.0100 /
3 1 4 4 1 1 0.0010 /
3 1 4 4 1 2 0.0050 /
3 1 5 4 1 2 0.0050 /
3 1 5 4 1 3 0.0100 /
3 1 6 4 1 3 0.0000 /
3 1 6 4 1 4 0.0000 /
3 1 7 4 1 4 0.0000 /
3 1 7 4 1 5 0.0001 /
3 2 3 4 2 1 0.0100 /
3 2 4 4 2 1 0.0010 /
3 2 4 4 2 2 0.0050 /
3 2 5 4 2 2 0.0050 /
3 2 5 4 2 3 0.0100 /
3 2 6 4 2 3 0.0000 /
3 2 6 4 2 4 0.0000 /
3 2 7 4 2 4 0.0000 /
3 2 7 4 2 5 0.0001 /
3 3 3 4 3 1 0.0100 /
3 3 4 4 3 1 0.0010 /
3 3 4 4 3 2 0.0050 /
3 3 5 4 3 2 0.0050 /
3 3 5 4 3 3 0.0100 /
3 3 6 4 3 3 0.0000 /
3 3 6 4 3 4 0.0000 /
3 3 7 4 3 4 0.0000 /
3 3 7 4 3 5 0.0001 /
3 4 3 4 4 1 0.0100 /
3 4 4 4 4 1 0.0010 /
3 4 4 4 4 2 0.0050 /
3 4 5 4 4 2 0.0050 /
3 4 5 4 4 3 0.0100 /
3 4 6 4 4 3 0.0000 /
3 4 6 4 4 4 0.0000 /
3 4 7 4 4 4 0.0000 /
3 4 7 4 4 5 0.0001 /
3 5 3 4 5 1 0.0100 /
3 5 4 4 5 1 0.0010 /
3 5 4 4 5 2 0.0050 /
3 5 5 4 5 2 0.0050 /
3 5 5 4 5 3 0.0100 /
3 5 6 4 5 3 0.0000 /
3 5 6 4 5 4 0.0000 /
3 5 7 4 5 4 0.0000 /
3 5 7 4 5 5 0.0001 /
-- NNC not present in grid
3 1 7 4 1 6 0.001 /
/

File diff suppressed because it is too large Load Diff

105
tests/include/scal_mod2.inc Normal file
View File

@ -0,0 +1,105 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- Copyright (C) 2018 Equinor
SWOF
-- Table #1
-- Interpolation value used: 0.3719 (using the base and high input curves)
--['Sw', 'krw', 'krow', 'pcow']
1.5000E-01 0.0000E+00 1.0000E+00 5.0000E+00
1.7024E-01 8.8956E-07 9.8444E-01 2.1028E+00
1.9048E-01 7.5365E-06 9.6086E-01 9.3365E-01
2.1071E-01 2.9184E-05 9.3035E-01 6.0466E-01
2.3095E-01 7.9333E-05 8.9380E-01 4.4684E-01
2.5119E-01 1.7595E-04 8.5179E-01 3.5378E-01
2.7143E-01 3.4191E-04 8.0489E-01 2.9243E-01
2.9167E-01 6.0562E-04 7.5381E-01 2.4901E-01
3.1190E-01 1.0018E-03 6.9932E-01 2.1670E-01
3.3214E-01 1.5722E-03 6.4236E-01 1.9175E-01
3.5238E-01 2.3670E-03 5.8390E-01 1.7192E-01
3.7262E-01 3.4733E-03 5.2503E-01 1.5600E-01
3.9286E-01 4.9575E-03 4.6693E-01 1.4279E-01
4.1310E-01 6.9011E-03 4.1053E-01 1.3163E-01
4.3333E-01 9.4065E-03 3.5666E-01 1.2207E-01
4.5357E-01 1.2592E-02 3.0601E-01 1.1382E-01
4.7381E-01 1.6595E-02 2.5912E-01 1.0662E-01
4.9405E-01 2.1573E-02 2.1637E-01 1.0029E-01
5.1429E-01 2.7703E-02 1.7796E-01 9.4686E-02
5.3452E-01 3.5188E-02 1.4398E-01 8.9686E-02
5.5476E-01 4.4251E-02 1.1438E-01 8.5201E-02
5.7500E-01 5.5140E-02 8.8992E-02 8.1155E-02
5.9524E-01 6.8124E-02 6.7582E-02 7.7490E-02
6.1548E-01 8.3569E-02 4.9954E-02 7.4159E-02
6.3571E-01 1.0193E-01 3.5857E-02 7.1129E-02
6.5595E-01 1.2338E-01 2.4694E-02 6.8345E-02
6.7619E-01 1.4829E-01 1.6116E-02 6.5780E-02
6.9643E-01 1.7710E-01 9.7868E-03 6.3406E-02
7.1667E-01 2.1057E-01 5.3841E-03 6.1200E-02
7.3690E-01 2.5071E-01 2.6035E-03 5.9142E-02
7.5714E-01 3.0575E-01 1.0738E-03 5.7210E-02
7.7738E-01 3.5364E-01 4.3573E-04 5.5523E-02
7.9762E-01 4.0168E-01 1.2161E-04 5.3884E-02
8.1786E-01 4.5101E-01 1.1011E-05 5.2277E-02
8.3810E-01 5.0610E-01 0.0000E+00 5.0692E-02
8.5833E-01 5.6784E-01 0.0000E+00 4.9112E-02
8.7857E-01 6.2958E-01 0.0000E+00 4.7532E-02
8.9881E-01 6.9131E-01 0.0000E+00 4.2674E-02
9.1905E-01 7.5305E-01 0.0000E+00 3.6894E-02
9.3929E-01 8.1479E-01 0.0000E+00 2.7670E-02
9.5952E-01 8.7653E-01 0.0000E+00 1.8447E-02
9.7976E-01 9.3826E-01 0.0000E+00 9.2234E-03
1.0000E+00 1.0000E+00 0.0000E+00 0.0000E+00
/
--
SGOF
-- Table #1
--['Sg', 'krg', 'krog', 'pcgo']
0.0000E+00 0.0000E+00 1.0000E+00 0.0000E+00
2.0238E-02 1.5682E-06 9.5988E-01 0.0000E+00
4.0476E-02 1.5815E-05 9.1418E-01 0.0000E+00
6.0714E-02 6.2380E-05 8.6484E-01 0.0000E+00
8.0952E-02 1.6794E-04 8.1288E-01 0.0000E+00
1.0119E-01 3.6647E-04 7.5907E-01 0.0000E+00
1.2143E-01 6.9983E-04 7.0415E-01 0.0000E+00
1.4167E-01 1.2185E-03 6.4882E-01 0.0000E+00
1.6190E-01 1.9824E-03 5.9375E-01 0.0000E+00
1.8214E-01 3.0621E-03 5.3958E-01 0.0000E+00
2.0238E-01 4.5399E-03 4.8687E-01 0.0000E+00
2.2262E-01 6.5107E-03 4.3613E-01 0.0000E+00
2.4286E-01 9.0839E-03 3.8780E-01 0.0000E+00
2.6310E-01 1.2427E-02 3.4237E-01 0.0000E+00
2.8333E-01 1.6708E-02 3.0013E-01 0.0000E+00
3.0357E-01 2.2055E-02 2.6109E-01 0.0000E+00
3.2381E-01 2.8655E-02 2.2534E-01 0.0000E+00
3.4405E-01 3.6711E-02 1.9289E-01 0.0000E+00
3.6429E-01 4.6443E-02 1.6367E-01 0.0000E+00
3.8452E-01 5.8092E-02 1.3760E-01 0.0000E+00
4.0476E-01 7.1908E-02 1.1454E-01 0.0000E+00
4.2500E-01 8.8153E-02 9.4312E-02 0.0000E+00
4.4524E-01 1.0709E-01 7.6738E-02 0.0000E+00
4.6548E-01 1.2899E-01 6.1610E-02 0.0000E+00
4.8571E-01 1.5408E-01 4.8722E-02 0.0000E+00
5.0595E-01 1.8260E-01 3.7868E-02 0.0000E+00
5.2619E-01 2.1505E-01 2.8983E-02 0.0000E+00
5.4643E-01 2.5122E-01 2.1682E-02 0.0000E+00
5.6667E-01 2.9112E-01 1.5777E-02 0.0000E+00
5.8690E-01 3.3469E-01 1.1093E-02 0.0000E+00
6.0714E-01 3.8176E-01 7.4658E-03 0.0000E+00
6.2738E-01 4.3211E-01 4.7421E-03 0.0000E+00
6.4762E-01 4.8545E-01 2.7803E-03 0.0000E+00
6.6786E-01 5.4153E-01 1.4487E-03 0.0000E+00
6.8810E-01 6.0030E-01 6.2458E-04 0.0000E+00
7.0833E-01 6.6266E-01 1.9093E-04 0.0000E+00
7.2857E-01 7.3273E-01 2.8442E-05 0.0000E+00
7.4881E-01 7.8843E-01 2.0600E-06 0.0000E+00
7.6905E-01 8.3453E-01 0.0000E+00 0.0000E+00
7.8929E-01 8.7595E-01 0.0000E+00 0.0000E+00
8.0952E-01 9.1733E-01 0.0000E+00 0.0000E+00
8.2976E-01 9.5867E-01 0.0000E+00 0.0000E+00
8.5000E-01 1.0000E+00 0.0000E+00 0.0000E+00
/

View File

@ -0,0 +1,80 @@
-- This reservoir simulation deck is made available under the Open Database
-- License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in
-- individual contents of the database are licensed under the Database Contents
-- License: http://opendatacommons.org/licenses/dbcl/1.0/
-- Copyright (C) 2024 Equinor
TCPU
TIMESTEP
FOPR
FGPR
FGIR
FGOR
FWCT
GOPR
/
GGPR
/
GGIR
/
GGOR
/
WGIR
/
WBHP
/
WOPR
/
ROIP
/
FOIP
FPR
FOPT
GPR
/
GVPR
/
GVIR
/
GWIR
/
FVIR
/
GGIR
/
FGIR
/
FUGINJT
FGSR
GOPGR
/

View File

@ -0,0 +1,286 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include "config.h"
#define BOOST_TEST_MODULE ResCoup_ChopStep
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/parametersystem.hpp>
#include <opm/models/utils/start.hh>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Schedule/ResCoup/ReservoirCouplingInfo.hpp>
#include <opm/input/eclipse/Schedule/ResCoup/MasterGroup.hpp>
#include <opm/input/eclipse/Schedule/ResCoup/Slaves.hpp>
#include <opm/simulators/flow/FlowGenericVanguard.hpp>
#include <opm/simulators/flow/Main.hpp>
#include <opm/simulators/flow/ReservoirCoupling.hpp>
#include <opm/simulators/flow/ReservoirCouplingMaster.hpp>
#include <opm/simulators/flow/ReservoirCouplingSlave.hpp>
#include <opm/simulators/utils/DeferredLogger.hpp>
#include <opm/simulators/flow/BlackoilModel.hpp>
#include <opm/simulators/flow/FlowProblemBlackoil.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
#include <boost/test/unit_test.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION / 100000 == 1 && BOOST_VERSION / 100 % 1000 < 71
#include <boost/test/floating_point_comparison.hpp>
#else
#include <boost/test/tools/floating_point_comparison.hpp>
#endif
namespace Opm {
class MainTestWrapper : public Main
{
public:
using TypeTag = Properties::TTag::FlowProblemTPFA;
using FlowMainPtr = std::unique_ptr<FlowMain<TypeTag>>;
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
MainTestWrapper(int argc, char** argv) :
// NOTE: passing ownMPI=false to prevent each test from initializing MPI (which is illegal)
Main{argc, argv, /*ownMPI=*/false}
, exit_code_{EXIT_SUCCESS}
, flow_main_{nullptr}
, simulator_{nullptr}
{
this->exit_code_ = EXIT_SUCCESS;
if (initialize_<Properties::TTag::FlowEarlyBird>(this->exit_code_, /*keep_keywords=*/false)) {
this->setupVanguard();
this->flow_main_ = std::make_unique<FlowMain<TypeTag>>(
this->argc_, this->argv_, this->outputCout_, this->outputFiles_
);
this->exit_code_ = this->flow_main_->executeInitStep();
if (this->exit_code_ == EXIT_SUCCESS) {
this->simulator_ = this->flow_main_->getSimulatorPtr();
}
}
}
Simulator* getSimulator() { return simulator_; }
private:
int exit_code_;
FlowMainPtr flow_main_;
Simulator *simulator_;
};
} // namespace Opm
namespace {
class OpmSimulatorTestCase
{
public:
using MainTestWrapper = Opm::MainTestWrapper;
using Simulator = Opm::MainTestWrapper::Simulator;
OpmSimulatorTestCase(
const std::string& prog_name,
const std::string& deck_filename,
const std::vector<std::string>& args
)
{
this->save_argv_.push_back(prog_name);
this->save_argv_.insert(save_argv_.end(), args.begin(), args.end());
this->save_argv_.push_back(deck_filename);
this->argv_.reserve(this->save_argv_.size() + 1); // +1 for nullptr
for (const auto& arg : this->save_argv_) {
this->argv_.push_back(const_cast<char*>(arg.c_str()));
}
// Make sure the last element is nullptr, this is required by MPI_Init()
this->argv_.push_back(nullptr);
char **argv = this->argv_.data();
int argc = this->argv_.size() - 1;
this->main_ = std::make_unique<MainTestWrapper>(argc, argv);
}
MainTestWrapper& getMain()
{
return *main_;
}
Simulator* getSimulatorPtr()
{
return main_->getSimulator();
}
private:
std::unique_ptr<MainTestWrapper> main_;
std::vector<std::string> save_argv_;
std::vector<char *> argv_;
};
struct SimulatorFixture
{
using Simulator = Opm::MainTestWrapper::Simulator;
SimulatorFixture() :
simulator_wrapper{
/*prog_name=*/"flow_test_chopstep",
/*deck_filename=*/"RC-01_MAST_PRED.DATA",
/*args=*/{"--parsing-strictness=low"} // Need this until PR #5643 is merged
},
simulator{simulator_wrapper.getSimulatorPtr()},
schedule{simulator->vanguard().schedule()},
rc_master{Opm::FlowGenericVanguard::comm(), schedule, 0, nullptr},
start_date{static_cast<double>(schedule.getStartTime())}
{
rc_master.addSlaveName("RES-1");
rc_master.addSlaveName("RES-2");
rc_master.resizeSlaveStartDates(2);
rc_master.resizeNextReportDates(2);
}
void setSlaveData(int slave_number, double slave_start_date, double report_time_step_size)
{
rc_master.setSlaveStartDate(slave_number, slave_start_date);
rc_master.setSlaveNextReportTimeOffset(slave_number, report_time_step_size);
}
OpmSimulatorTestCase simulator_wrapper;
Simulator *simulator;
Opm::Schedule& schedule;
Opm::ReservoirCouplingMaster rc_master;
double start_date;
};
struct GlobalTestFixture
{
// NOTE: We can only call MPI_Init() and MPI_Finalize() once per process, so we prevent
// Opm::Main() from initializing MPI by setting ownMPI=false in the constructor, and instead do
// the initialization once for the whole test case process here.
GlobalTestFixture()
{
int argc = boost::unit_test::framework::master_test_suite().argc;
char** argv = boost::unit_test::framework::master_test_suite().argv;
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
#else
Dune::MPIHelper::instance(argc, argv);
#endif
Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
}
};
} // Anonymous namespace
BOOST_GLOBAL_FIXTURE(GlobalTestFixture);
BOOST_FIXTURE_TEST_SUITE(ResCoupTestSuite, SimulatorFixture)
BOOST_AUTO_TEST_CASE(NoChop)
{
BOOST_CHECK_EQUAL(start_date, 1538352000); // 1538352000 = 2018-10-01 00:00:00
double time_step = 60*60*24; // 1 day
double elapsed_time = 0.0;
auto tol = Opm::ReservoirCoupling::Seconds::reltol / 2;
// Check that the time step is not chopped when slave processes have identical start dates
setSlaveData(/*slave_number=*/0, /*start_date=*/start_date, /*report_time_step_size=*/time_step);
setSlaveData(/*slave_number=*/1, /*start_date=*/start_date, /*report_time_step_size=*/time_step);
auto new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step, 1e-16);
// Check that the time step is not chopped when slave processes start at the same time as
// the master but their report steps end after the master process
setSlaveData(/*slave_number=*/0, /*start_date=*/start_date, /*report_time_step_size=*/time_step+1);
setSlaveData(/*slave_number=*/1, /*start_date=*/start_date, /*report_time_step_size=*/time_step+2);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step, 1e-16);
// Check that the time step is not chopped when slave processes start at the same time as
// the master but their report steps end before the master process but within the tolerance
setSlaveData(/*slave_number=*/0, /*start_date=*/start_date, /*report_time_step_size=*/time_step-tol);
setSlaveData(/*slave_number=*/1, /*start_date=*/start_date, /*report_time_step_size=*/time_step+2);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step, 1e-16);
// Check that the time step is not chopped when slave processes start before
// the master but their report steps end after the master process
setSlaveData(/*slave_number=*/0, /*start_date=*/start_date-1, /*report_time_step_size=*/time_step+1+tol);
setSlaveData(/*slave_number=*/1, /*start_date=*/start_date-2, /*report_time_step_size=*/time_step+2+tol);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step, 1e-16);
// Check that the time step is not chopped when slave processes starts after the master's
// report step has ended
setSlaveData(/*slave_number=*/0,
/*start_date=*/start_date+time_step+1,
/*report_time_step_size=*/time_step);
setSlaveData(/*slave_number=*/1,
/*start_date=*/start_date+time_step+tol,
/*report_time_step_size=*/time_step);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step, 1e-16);
}
BOOST_AUTO_TEST_CASE(Chop)
{
BOOST_CHECK_EQUAL(start_date, 1538352000); // 1538352000 = 2018-10-01 00:00:00
double time_step = 60*60*24; // 1 day
double elapsed_time = 0.0;
double tol;
double new_time_step;
// Check that the time step is chopped when slave processes start in the middle of the master's
// report step
setSlaveData(/*slave_number=*/0,
/*start_date=*/start_date+time_step/2,
/*report_time_step_size=*/time_step);
setSlaveData(/*slave_number=*/1,
/*start_date=*/start_date+time_step/2,
/*report_time_step_size=*/time_step);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK_CLOSE(new_time_step, time_step/2, 1e-16);
// Check that the time step is chopped when slave processes start at the beginning of the master's
// report step, but ends within but just outside the tolerance of the master's report step
// NOTE: microseconds are approximately the smallest time units that can be represented accurately
// for epoch values in this century (2000-2100), so first check this
tol = 1e-8; // This is then too small, and should not cause the time step to be chopped
setSlaveData(/*slave_number=*/0,
/*start_date=*/start_date,
/*report_time_step_size=*/time_step - tol);
setSlaveData(/*slave_number=*/1,
/*start_date=*/start_date+time_step,
/*report_time_step_size=*/time_step);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK(Opm::ReservoirCoupling::Seconds::compare_eq(new_time_step, time_step));
tol = 1e-5; // This is greater than 1e-6 small, and should cause the time step to be chopped
setSlaveData(/*slave_number=*/0,
/*start_date=*/start_date,
/*report_time_step_size=*/time_step - tol);
setSlaveData(/*slave_number=*/1,
/*start_date=*/start_date+time_step,
/*report_time_step_size=*/time_step);
new_time_step = rc_master.maybeChopSubStep(time_step, elapsed_time);
BOOST_CHECK(!Opm::ReservoirCoupling::Seconds::compare_gt_or_eq(new_time_step, time_step));
}
BOOST_AUTO_TEST_SUITE_END()