From ab072c5f73f532474c7d303ad3ae3056e5ac8ac7 Mon Sep 17 00:00:00 2001 From: "Oddvar Lia (ST MSU GEO)" Date: Thu, 7 Dec 2023 12:46:59 +0100 Subject: [PATCH] Added test case using scaling field from file --- .../example_case/example_test_config_F.yml | 51 ++++++ .../FieldParam_real5_iter0_F_local.grdecl | 35 ++++ .../FieldParam_real5_iter1_F_local.grdecl | 35 ++++ .../init_files/region_polygons.txt | 153 ++++++++++++++++++ .../init_files/scaling_factor.grdecl | 63 ++++++++ .../example_case/scripts/common_functions.py | 29 +++- .../example_case/scripts/init_test_case.py | 1 + .../example_case/sim_field_case_F.ert | 57 +++++++ .../example_case/sim_field_local_case_F.ert | 57 +++++++ .../localisation/example_case/test_full.py | 44 ++++- 10 files changed, 521 insertions(+), 4 deletions(-) create mode 100644 tests/jobs/localisation/example_case/example_test_config_F.yml create mode 100644 tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_F_local.grdecl create mode 100644 tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_F_local.grdecl create mode 100644 tests/jobs/localisation/example_case/init_files/region_polygons.txt create mode 100644 tests/jobs/localisation/example_case/init_files/scaling_factor.grdecl create mode 100644 tests/jobs/localisation/example_case/sim_field_case_F.ert create mode 100644 tests/jobs/localisation/example_case/sim_field_local_case_F.ert diff --git a/tests/jobs/localisation/example_case/example_test_config_F.yml b/tests/jobs/localisation/example_case/example_test_config_F.yml new file mode 100644 index 000000000..c7296f748 --- /dev/null +++ b/tests/jobs/localisation/example_case/example_test_config_F.yml @@ -0,0 +1,51 @@ +# ROFF format standard Eclipse origo +settings: + case_name: "A" + model_size: + size: [ 1000.0, 2000.0, 50.0 ] + use_eclipse_grid_index_origo: True + + field: + name: "FIELDPAR" + algorithm: "gstools" + file_format: "ROFF" + initial_file_name: "init_files/FieldParam" + updated_file_name: "FieldParam" + seed_file: "randomseeds.txt" + variogram: "gaussian" + correlation_range: [250, 500, 2.0] + correlation_azimuth: 0.0 + correlation_dip: 0.0 + correlation_exponent: 1.9 + trend_use: False + trend_params: [ 1.0, -1.0 ] + trend_relstd: 0.15 + grid_dimension: [10, 20, 1] + grid_file_name: "GRID_STANDARD.EGRID" + + response: + name: "UPSCALED" + grid_dimension: [2,4,1] + upscaled_file_name: "Upscaled" + grid_file_name: "GRID_STANDARD_UPSCALED.EGRID" + file_format: "ROFF" + write_upscaled_field: True + response_function: "average" + gen_data_file_name: "UpscaledField_0.txt" + + observation: + directory: "observations" + file_name: "observations.obs" + data_dir: "obs_data" + reference_param_file: "init_files/ObsField" + reference_field_name: "ObsField" + rel_error: 0.10 + min_abs_error: 0.01 + obs_positions: [ [650.0, 850.0, 25.0] ] + + localisation: + method: "scaling_file" + scaling_file: "scaling_factor.grdecl" + + optional: + write_obs_pred_diff_field_file: False diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_F_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_F_local.grdecl new file mode 100644 index 000000000..13da8ea21 --- /dev/null +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_F_local.grdecl @@ -0,0 +1,35 @@ +FIELDPAR + 0.648341 0.376487 0.306689 0.234835 0.003016 -0.494571 + -1.028435 -1.095739 -0.725329 -0.679467 0.526481 0.509107 + 0.391517 -0.025932 -0.279426 -0.127581 0.017761 -0.193278 + -0.633775 -1.029683 0.859417 0.607622 0.091949 -0.829884 + -1.867067 -2.117355 -1.216993 -0.109772 0.090068 -0.479618 + 0.439765 -0.143754 -1.070861 -1.915480 -2.726342 -3.124574 + -2.504564 -1.177302 -0.224223 -0.178808 -0.057085 -0.287224 + -0.724738 -0.876790 -0.636449 -0.371928 -0.186803 0.130124 + 0.381840 0.089729 1.202264 0.996304 0.536597 0.157487 + 0.151960 0.261694 0.257023 0.275927 0.215435 -0.279581 + 1.430932 1.254107 0.654710 -0.078125 -0.653691 -0.862671 + -0.729918 -0.454728 -0.200309 -0.092174 1.324994 0.901444 + 0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499 + -0.598027 -0.028493 0.899565 0.992203 0.749731 0.404224 + -0.167782 -1.022487 -1.668451 -1.600215 -1.044804 -0.566005 + -0.035406 1.009202 1.709299 1.983187 1.760534 0.946370 + 0.064703 -0.146747 0.213693 0.432429 -0.049208 0.944598 + 1.588994 1.513464 1.166571 1.047943 1.075387 0.881568 + 0.389300 -0.185701 0.296088 0.753952 1.023120 0.847401 + 0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791 + 0.235147 0.157758 0.172461 0.312229 0.509417 0.808807 + 1.215309 1.370256 0.795799 -0.342228 -0.995523 -1.374976 + -0.900708 0.206069 1.040176 1.223922 1.279978 1.478402 + 1.243197 0.178017 -1.679243 -1.919407 -1.234238 0.040584 + 1.085511 1.344037 0.997618 0.657986 0.617346 0.557741 + -0.841584 -1.226023 -1.207091 -0.902073 -0.387598 0.025259 + -0.029104 -0.373039 -0.433728 0.006049 0.545837 -0.318973 + -0.824143 -0.816984 -0.678996 -0.777436 -0.967488 -0.856602 + -0.316280 0.517896 1.752741 1.156656 0.156627 -0.349148 + -0.425633 -0.648444 -1.098076 -1.299050 -0.878778 -0.019675 + 2.535338 2.215707 0.622777 -1.049959 -1.704248 -1.537606 + -1.549673 -2.107112 -2.676758 -2.857547 0.662012 0.092502 + -1.249170 -2.481425 -2.643038 -2.015550 -1.732791 -2.259825 + -3.021738 -3.374325 / diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_F_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_F_local.grdecl new file mode 100644 index 000000000..b00bac2de --- /dev/null +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_F_local.grdecl @@ -0,0 +1,35 @@ +FIELDPAR + 0.648341 0.376487 0.306689 0.234835 0.003016 -0.494571 + -1.028435 -1.095739 -0.725329 -0.679467 0.526481 0.509107 + 0.391373 -0.023863 -0.273252 -0.122432 0.016825 -0.198978 + -0.636868 -1.026450 0.854959 0.587476 0.076209 -0.826763 + -1.845099 -2.088035 -1.196661 -0.100295 0.101574 -0.460161 + 0.415938 -0.149304 -1.036409 -1.856251 -2.652239 -3.042570 + -2.427024 -1.126549 -0.197648 -0.149957 -0.055799 -0.292043 + -0.727052 -0.863093 -0.599287 -0.323443 -0.146332 0.151186 + 0.377892 0.099067 1.158963 0.913349 0.442244 0.082556 + 0.146261 0.328810 0.315104 0.315820 0.254455 -0.217157 + 1.381997 1.181857 0.605823 -0.074484 -0.511862 -0.597728 + -0.554966 -0.401634 -0.171522 -0.033980 1.299572 0.856299 + 0.038847 -0.813178 -1.368125 -1.447943 -1.280760 -0.998493 + -0.564469 -0.015730 0.869290 0.934190 0.685972 0.333878 + -0.201477 -0.827354 -1.266019 -1.401792 -1.056710 -0.581285 + -0.082711 0.882231 1.543495 1.769417 1.499963 0.847519 + 0.236675 -0.092023 0.064940 0.332343 -0.087109 0.849386 + 1.453566 1.347334 1.024914 0.842019 0.740843 0.667563 + 0.303510 -0.241788 0.283185 0.710210 0.964796 0.711048 + 0.278223 -0.015906 -0.270889 -0.166249 0.074077 -0.524802 + 0.217965 0.119890 0.144786 0.266507 0.272608 -0.069734 + -0.719513 -0.875290 -0.208943 -0.423925 -0.984397 -1.346187 + -0.885415 0.207652 0.990806 0.872062 0.270160 0.074325 + 0.431142 0.027639 -1.642468 -1.770741 -1.099022 0.083340 + 1.075341 1.224725 0.751074 0.389769 0.445177 0.474418 + -0.832105 -1.123364 -1.054472 -0.789282 -0.338498 0.032766 + -0.034032 -0.381875 -0.458273 -0.084596 0.478364 -0.390329 + -0.818225 -0.749366 -0.595022 -0.706270 -0.914178 -0.819816 + -0.313909 0.431625 1.639202 0.965610 0.033820 -0.378241 + -0.398494 -0.584058 -1.007251 -1.202067 -0.800682 0.002492 + 2.447703 2.021628 0.449580 -1.105881 -1.668227 -1.478590 + -1.479489 -1.990148 -2.506255 -2.667040 0.655640 0.057808 + -1.260025 -2.426540 -2.540915 -1.905988 -1.622376 -2.130691 + -2.866883 -3.212839 / diff --git a/tests/jobs/localisation/example_case/init_files/region_polygons.txt b/tests/jobs/localisation/example_case/init_files/region_polygons.txt new file mode 100644 index 000000000..0c5a68db4 --- /dev/null +++ b/tests/jobs/localisation/example_case/init_files/region_polygons.txt @@ -0,0 +1,153 @@ +424.509949 2079.387421 20.833294 +349.525574 2077.578644 23.765421 +260.721008 2077.669594 24.845678 +169.519867 2077.044716 25.000004 +86.164909 2070.750626 25.000002 +16.176638 2044.482727 25.000000 +-36.105103 1981.598633 25.000004 +-67.602112 1871.688156 25.000002 +-80.282654 1729.270020 25.000000 +-77.376656 1575.095093 25.000004 +-61.402237 1427.718933 24.845680 +-32.030331 1296.914978 23.765432 +11.779886 1190.261230 20.833336 +70.523544 1115.098511 15.586418 +142.512741 1077.817566 9.413568 +225.513870 1084.571716 4.166626 +316.264160 1136.641357 1.234479 +407.384247 1215.814209 0.154193 +490.465576 1299.004700 -0.000122 +559.404480 1367.602234 -0.000051 +617.315918 1420.894714 0.000038 +669.619995 1462.644531 0.000081 +720.154053 1495.998566 0.000036 +766.425232 1521.639862 -0.000063 +804.358276 1539.635681 -0.000163 +832.164429 1550.605621 -0.000220 +857.200378 1557.378571 -0.000241 +889.109863 1563.335663 -0.000244 +934.286072 1574.346130 -0.000244 +986.121887 1606.231659 -0.000244 +1034.759888 1677.301727 -0.000244 +1068.650513 1796.007446 -0.000244 +1069.475220 1931.365677 -0.000244 +1017.223267 2042.534809 -0.000244 +902.403015 2099.124138 0.154078 +757.601257 2112.546516 1.234336 +625.923889 2104.665764 4.166463 +538.766174 2093.921379 9.413428 +480.680878 2085.055855 15.586329 +424.509949 2079.387421 20.833294 +999.000000 999.000000 999.000000 +1175.375488 1016.951172 -0.000163 +1127.616089 1031.741028 -0.000216 +1066.552368 1035.509888 -0.000205 +995.064148 1029.995544 -0.000122 +916.582642 1016.936829 0.000030 +836.747009 998.074219 0.000200 +761.747864 975.148926 0.000326 +696.421936 947.580444 0.000360 +640.188721 905.502197 0.000332 +591.113647 836.726074 0.000285 +547.842468 735.448120 0.000256 +511.342438 621.401733 0.000246 +483.161316 520.704346 0.000244 +463.492584 453.733765 0.000243 +447.112701 417.910889 0.000232 +427.443970 404.916626 0.000203 +400.120544 407.141479 0.000152 +369.624359 419.813477 0.000092 +342.649261 438.869873 0.000041 +324.282745 461.092529 0.000014 +313.187164 486.642090 0.000014 +306.418579 516.523315 0.000041 +301.349274 551.017334 0.000092 +296.616669 587.508423 0.000152 +291.174377 622.656738 0.000203 +283.304962 654.361938 0.000232 +268.606812 685.481689 0.000243 +242.006943 720.113525 0.000244 +200.838959 760.598633 0.000244 +152.061737 802.254272 0.000244 +105.040504 838.642090 0.000244 +66.897408 864.863159 0.000244 +35.782269 882.177368 0.000244 +7.601859 893.384766 0.000244 +-20.563051 899.712036 0.000244 +-46.935501 896.092651 0.000244 +-68.564507 875.886963 0.000244 +-84.266357 831.946533 0.000244 +-99.926460 755.086914 0.000244 +-123.197540 635.614624 0.000244 +-156.755280 471.414795 0.000244 +-183.367401 290.685303 0.000244 +-180.824615 129.202026 0.000244 +-130.081009 14.246216 0.000244 +-24.744156 -60.882324 0.000244 +138.414948 -111.378418 0.000244 +355.891235 -149.908936 0.000244 +597.242981 -179.027344 0.000244 +825.294128 -198.758301 0.000244 +1009.999023 -207.018066 0.000244 +1149.831543 -193.288574 0.000244 +1250.396118 -144.943359 0.000244 +1316.705811 -52.310303 0.000244 +1351.408203 82.465698 0.000244 +1356.560181 254.284424 0.000244 +1336.038330 453.482178 0.000241 +1300.999146 652.138062 0.000220 +1264.419189 817.766602 0.000163 +1235.577637 926.227905 0.000060 +1208.965210 986.761230 -0.000060 +1175.375488 1016.951172 -0.000163 +999.000000 999.000000 999.000000 +1100.404907 1563.663239 -0.000244 +1093.085693 1580.043121 -0.000241 +1080.155762 1597.196869 -0.000220 +1049.040649 1608.933655 -0.000163 +990.550293 1609.417297 -0.000062 +909.037842 1594.230499 0.000048 +812.241943 1559.310425 0.000122 +707.159241 1502.077637 0.000128 +597.820374 1425.885376 0.000089 +487.514221 1335.570435 0.000041 +380.109985 1238.548706 0.000012 +281.798523 1152.554382 0.000002 +199.351074 1097.901123 0.000000 +137.217148 1087.896362 0.000000 +90.559929 1107.823669 0.000000 +52.220978 1135.960205 0.000000 +17.030819 1153.067566 0.000000 +-12.224041 1149.843445 0.000000 +-30.768122 1119.469666 0.000000 +-33.904774 1058.583801 0.000000 +-17.252659 977.645142 0.000000 +23.490715 890.568726 0.000000 +88.479721 808.518433 0.000000 +161.276154 731.652832 0.000000 +221.293686 657.379761 0.000000 +254.415771 584.146362 0.000000 +272.405029 514.559692 0.000000 +293.493774 452.265869 0.000000 +331.234711 402.557861 -0.000002 +380.462097 377.315674 -0.000012 +431.330383 390.064941 -0.000041 +475.952148 448.652710 -0.000090 +514.272339 538.209106 -0.000140 +548.194092 638.184570 -0.000163 +580.220703 730.961548 -0.000142 +615.257507 810.648438 -0.000102 +658.809998 874.285400 -0.000081 +715.118774 920.285522 -0.000104 +783.363953 952.553223 -0.000154 +861.460938 976.365906 -0.000203 +945.597290 999.150879 -0.000232 +1025.049927 1036.934814 -0.000243 +1087.368286 1107.894287 -0.000244 +1123.369019 1221.228210 -0.000244 +1136.937866 1350.224487 -0.000244 +1135.228271 1459.193237 -0.000244 +1125.039185 1521.875244 -0.000244 +1111.754639 1549.733948 -0.000244 +1100.404907 1563.663239 -0.000244 +999.000000 999.000000 999.000000 diff --git a/tests/jobs/localisation/example_case/init_files/scaling_factor.grdecl b/tests/jobs/localisation/example_case/init_files/scaling_factor.grdecl new file mode 100644 index 000000000..4d6f606f5 --- /dev/null +++ b/tests/jobs/localisation/example_case/init_files/scaling_factor.grdecl @@ -0,0 +1,63 @@ + +SCALING + 0 0 0 0 0 + 0 0 0 0 0 + + 0 0 0.0024178524 0.00884367712 0.0132498778 + 0.0161081199 0.0182318985 0.0201500896 0.0203383286 0.0155032165 + + 0.003006696 0.0156889092 0.0205063 0.0220940653 0.0239405781 + 0.0273311734 0.0326220095 0.0396278054 0.0452148803 0.0438990891 + + 0.0279479939 0.0363404155 0.03613998 0.0340526439 0.0340892971 + 0.0368285999 0.0430386923 0.0538446382 0.0647787303 0.0673846528 + + 0.0432741642 0.0517198518 0.0529378206 0.0574502349 0.0607241429 + 0.0538347289 0.0475190282 0.0564772375 0.0722196251 0.0810511559 + + 0.0468719564 0.0599104799 0.0680627897 0.0913911909 0.117351525 + 0.108548783 0.0624484308 0.0494863279 0.0646237284 0.0794273764 + + 0.0423487797 0.0586890392 0.0715542361 0.120984368 0.216681033 + 0.261977315 0.183652744 0.0777159408 0.0435763821 0.0589708723 + + 0.0365328901 0.0551960096 0.0803627595 0.175753772 0.354921192 + 0.496848464 0.433681875 0.222422212 0.0679221153 0.036710728 + + 0.0362647735 0.0638489351 0.109380685 0.24080199 0.456255645 + 0.638256907 0.630086362 0.419066995 0.165060177 0.0379007943 + + 0.0416177697 0.0837309957 0.136203006 0.264866084 0.480560392 + 0.683874905 0.733731925 0.542562187 0.313413531 0.103217475 + + 0.0437682532 0.0769556612 0.112662002 0.229829431 0.461149663 + 0.723126411 0.871051311 0.711820066 0.450462759 0.227276623 + + 0.0451645106 0.063203834 0.066589959 0.159034893 0.425005674 + 0.744041264 0.956496 0.911683619 0.516521394 0.283591837 + + 0.0492031202 0.0741543695 0.0527167879 0.0891754478 0.352179855 + 0.695928216 0.895608008 0.852726817 0.517417789 0.260448962 + + 0.0523970835 0.0939117745 0.0628247038 0.0399134271 0.198853135 + 0.46667394 0.65412581 0.635288835 0.387747556 0.149869889 + + 0.0571080595 0.113578357 0.0907923728 0.0506353714 0.069845207 + 0.152088627 0.252010256 0.238708615 0.124544971 0.055357337 + + 0.0635695606 0.127395019 0.125238523 0.0950208232 0.0677052438 + 0.0437932834 0.0376545079 0.0385723859 0.0507421643 0.0839931592 + + 0.0676470697 0.128882632 0.141776979 0.128613114 0.107911579 + 0.0893575996 0.0812080279 0.0852842182 0.10028512 0.122700267 + + 0.0620717965 0.114647269 0.134200275 0.135575622 0.131714463 + 0.128724501 0.129031375 0.13239418 0.137205586 0.140333056 + + 0.0413737856 0.0846893489 0.106586784 0.114918746 0.118551478 + 0.120768428 0.12276534 0.125401542 0.126825631 0.122835122 + + 0.00877429079 0.0441762544 0.0665985122 0.0785425529 0.0850359648 + 0.0885261223 0.0905158073 0.0923460945 0.0924721509 0.0868233591 + + / diff --git a/tests/jobs/localisation/example_case/scripts/common_functions.py b/tests/jobs/localisation/example_case/scripts/common_functions.py index 2b1859f1d..4cc7f6c45 100644 --- a/tests/jobs/localisation/example_case/scripts/common_functions.py +++ b/tests/jobs/localisation/example_case/scripts/common_functions.py @@ -163,11 +163,13 @@ class Localisation: method: str = "gaussian" region_polygons: str = None region_file: str = None + scaling_file: str = None def reset_to_default(self): self.method = "gaussian" self.region_polygons = None self.region_file = None + self.scaling_file = None @dataclass @@ -1311,7 +1313,7 @@ def create_grid( return grid_object -# pylint: disable=too-many-statements +# pylint: disable=too-many-statements,too-many-branches def write_localisation_config( obs_positions: list, obs_index_list: list, @@ -1322,6 +1324,7 @@ def write_localisation_config( write_scaling: bool = True, localisation_method: str = "gaussian", segment_file_name: str = None, + scaling_param_file_name: str = None, ): space = " " * 2 space2 = " " * 4 @@ -1402,6 +1405,30 @@ def write_localisation_config( file.write(f"{space3}scalingfactors: [ 1.0 ]\n") file.write(f"{space3}smooth_ranges: [ 1, 1 ]\n") + if local_method == "scaling_file": + # Use a scaling factor from file + file.write(f"{space}- name: CORR\n") + file.write(f"{space2}obs_group:\n") + file.write(f"{space3}add: [ ") + obs_list = "" + for obs_number in range(nobs): + (Iindx, Jindx, Kindx) = get_cell_indices(obs_number, obs_index_list) + obs_name = f' "OBS_{Iindx+1}_{Jindx+1}_{Kindx+1}" ' + obs_list += obs_name + if obs_number < (nobs - 1): + obs_list += ", " + else: + obs_list += " ]" + file.write(obs_list) + file.write("\n") + pos = obs_positions[0] + file.write(f"{space2}param_group:\n") + file.write(f'{space3}add: ["{field_name}"]\n') + file.write(f"{space2}field_scale:\n") + file.write(f"{space3}method: from_file\n") + file.write(f'{space3}filename: "{scaling_param_file_name}"\n') + file.write(f'{space3}param_name: "SCALING"\n') + def generate_seed_file( file_name: str, diff --git a/tests/jobs/localisation/example_case/scripts/init_test_case.py b/tests/jobs/localisation/example_case/scripts/init_test_case.py index 8354a9a37..e3eddda31 100755 --- a/tests/jobs/localisation/example_case/scripts/init_test_case.py +++ b/tests/jobs/localisation/example_case/scripts/init_test_case.py @@ -118,6 +118,7 @@ def main(config_file_name): write_scaling=True, localisation_method=settings.localisation.method, segment_file_name=settings.localisation.region_file, + scaling_param_file_name=settings.localisation.scaling_file, ) if settings.localisation.method == "region": diff --git a/tests/jobs/localisation/example_case/sim_field_case_F.ert b/tests/jobs/localisation/example_case/sim_field_case_F.ert new file mode 100644 index 000000000..f9f161bb6 --- /dev/null +++ b/tests/jobs/localisation/example_case/sim_field_case_F.ert @@ -0,0 +1,57 @@ +DEFINE $USER +DEFINE sim_field_F +DEFINE randomseeds.txt +DEFINE /example_config.yml +-- DEFINE /example_test_config_A.yml +INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD +----------------------------------------------------- +-- Observations +----------------------------------------------------- + +DEFINE /observations/observations.obs +OBS_CONFIG + +JOBNAME sim_fields_ + + +NUM_REALIZATIONS 10 -- Set number of realizations to run +MAX_RUNTIME 18000 -- Set the maximum allowed run time (in seconds) +MIN_REALIZATIONS 1 -- Success criteria +MAX_SUBMIT 1 -- How many times should the queue system retry a simulation. +-- QUEUE_OPTION LSF MAX_RUNNING 100 -- Choke the number of simultaneous run +-- QUEUE_OPTION LSF LSF_QUEUE mr -- Assign LSF cluster queue to use +QUEUE_SYSTEM LOCAL +QUEUE_OPTION LOCAL MAX_RUNNING 10 +RANDOM_SEED 123456 -- ERT seed value + +RUNPATH simulations//realization-/iter- +ENSPATH output//storage -- Storage of internal ert data +UPDATE_LOG_PATH output//update_log -- Info of active and inactive data points +RUNPATH_FILE output//runpath_file -- List of runpaths + +-- LOAD_WORKFLOW localisation.wf LOCALISATION_WORKFLOW +-- HOOK_WORKFLOW LOCALISATION_WORKFLOW PRE_FIRST_UPDATE + +--Result data from forward model-- +GEN_DATA RESULT_UPSCALED_FIELD RESULT_FILE:UpscaledField_%d.txt REPORT_STEPS:0 INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII + +----------------------------------------------------- +-- Forward models +----------------------------------------------------- +--Simulate Gaussian field with trend and calculate upscaled values. Observables are upscaled values of selected grid cells. +FORWARD_MODEL MAKE_DIRECTORY(=init_files) +-- Is used to identify iteration number (only relevant for old komodo versions) +FORWARD_MODEL MAKE_DIRECTORY(=) +-- The common seed file +FORWARD_MODEL COPY_FILE(=/, =/) +-- For QC purpose only +FORWARD_MODEL COPY_FILE(=/init_files/ObsField.roff, =/init_files/ObsField.roff) +FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD.EGRID, =/GRID_STANDARD.EGRID) +FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD_UPSCALED.EGRID, =/GRID_STANDARD_UPSCALED.EGRID) + +-- The main forward model simulating gaussian field with trend, and upscale +FORWARD_MODEL SIM_FIELD(=, =, =, =) + +GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters + +FIELD FIELDPAR PARAMETER FieldParam.roff INIT_FILES:init_files/FieldParam.roff MIN:-5.0 MAX:5.0 FORWARD_INIT:True diff --git a/tests/jobs/localisation/example_case/sim_field_local_case_F.ert b/tests/jobs/localisation/example_case/sim_field_local_case_F.ert new file mode 100644 index 000000000..35a0653e8 --- /dev/null +++ b/tests/jobs/localisation/example_case/sim_field_local_case_F.ert @@ -0,0 +1,57 @@ +DEFINE $USER +DEFINE sim_field_local_F +DEFINE randomseeds.txt +DEFINE /example_config.yml +-- DEFINE /example_test_config_A.yml +INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD +----------------------------------------------------- +-- Observations +----------------------------------------------------- + +DEFINE /observations/observations.obs +OBS_CONFIG + +JOBNAME sim_fields_ + + +NUM_REALIZATIONS 10 -- Set number of realizations to run +MAX_RUNTIME 18000 -- Set the maximum allowed run time (in seconds) +MIN_REALIZATIONS 1 -- Success criteria +MAX_SUBMIT 1 -- How many times should the queue system retry a simulation. +-- QUEUE_OPTION LSF MAX_RUNNING 100 -- Choke the number of simultaneous run +-- QUEUE_OPTION LSF LSF_QUEUE mr -- Assign LSF cluster queue to use +QUEUE_SYSTEM LOCAL +QUEUE_OPTION LOCAL MAX_RUNNING 10 +RANDOM_SEED 123456 -- ERT seed value + +RUNPATH simulations//realization-/iter- +ENSPATH output//storage -- Storage of internal ert data +UPDATE_LOG_PATH output//update_log -- Info of active and inactive data points +RUNPATH_FILE output//runpath_file -- List of runpaths + +LOAD_WORKFLOW localisation.wf LOCALISATION_WORKFLOW +HOOK_WORKFLOW LOCALISATION_WORKFLOW PRE_FIRST_UPDATE + +--Result data from forward model-- +GEN_DATA RESULT_UPSCALED_FIELD RESULT_FILE:UpscaledField_%d.txt REPORT_STEPS:0 INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII + +----------------------------------------------------- +-- Forward models +----------------------------------------------------- +--Simulate Gaussian field with trend and calculate upscaled values. Observables are upscaled values of selected grid cells. +FORWARD_MODEL MAKE_DIRECTORY(=init_files) +-- Is used to identify iteration number (only relevant for old komodo versions) +FORWARD_MODEL MAKE_DIRECTORY(=) +-- The common seed file +FORWARD_MODEL COPY_FILE(=/, =/) +-- For QC purpose only +FORWARD_MODEL COPY_FILE(=/init_files/ObsField.roff, =/init_files/ObsField.roff) +FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD.EGRID, =/GRID_STANDARD.EGRID) +FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD_UPSCALED.EGRID, =/GRID_STANDARD_UPSCALED.EGRID) + +-- The main forward model simulating gaussian field with trend, and upscale +FORWARD_MODEL SIM_FIELD(=, =, =, =) + +GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters + +FIELD FIELDPAR PARAMETER FieldParam.roff INIT_FILES:init_files/FieldParam.roff MIN:-5.0 MAX:5.0 FORWARD_INIT:True diff --git a/tests/jobs/localisation/example_case/test_full.py b/tests/jobs/localisation/example_case/test_full.py index 3b8345915..56964dade 100644 --- a/tests/jobs/localisation/example_case/test_full.py +++ b/tests/jobs/localisation/example_case/test_full.py @@ -120,7 +120,7 @@ "case_name": "A2", "model_size": { "use_eclipse_grid_index_origo": True, - "polygon_file": "init_files/Polygons.txt", + "polygon_file": "Polygons.txt", }, "field": { "file_format": "ROFF", @@ -182,6 +182,28 @@ }, } ), + pytest.param( + { + "case_name": "F", + "model_size": { + "use_eclipse_grid_index_origo": True, + "polygon_file": None, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "localisation": { + "method": "scaling_file", + "scaling_file": "scaling_factor.grdecl", + }, + "observation": {"obs_positions": [[650.0, 850.0, 25.0]]}, + } + ), ], ) def test_that_localization_works_with_different_settings( @@ -207,16 +229,26 @@ def test_that_localization_works_with_different_settings( if settings.case_name == "A2": polygon_file = "Polygons.txt" shutil.copy( - Path(__file__).parent / settings.model_size.polygon_file, polygon_file + Path(__file__).parent / "init_files" / settings.model_size.polygon_file, + polygon_file, ) if settings.case_name == "E": region_polygon_file = "region_polygons.txt" shutil.copy( - Path(__file__).parent / settings.localisation.region_polygons, + Path(__file__).parent + / "init_files" + / settings.localisation.region_polygons, region_polygon_file, ) + if settings.case_name == "F": + scaling_factor_param_file = "scaling_factor.grdecl" + shutil.copy( + Path(__file__).parent / "init_files" / settings.localisation.scaling_file, + scaling_factor_param_file, + ) + # Create grid for the field parameter grid_object = create_grid( settings.field.grid_file_name, @@ -310,6 +342,7 @@ def test_that_localization_works_with_different_settings( write_scaling=True, localisation_method=settings.localisation.method, segment_file_name=settings.localisation.region_file, + scaling_param_file_name=settings.localisation.scaling_file, ) parser = ArgumentParser(prog="test_main") @@ -346,6 +379,11 @@ def test_that_localization_works_with_different_settings( reference_file_initial = "FieldParam_real5_iter0_E_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_E_local.grdecl" grid_file_name = "GRID_STANDARD.EGRID" + elif settings.case_name == "F": + ert_config_file = "sim_field_local_case_F.ert" + reference_file_initial = "FieldParam_real5_iter0_F_local.grdecl" + reference_file_updated = "FieldParam_real5_iter1_F_local.grdecl" + grid_file_name = "GRID_STANDARD.EGRID" shutil.copy(Path(__file__).parent / ert_config_file, ert_config_file) shutil.copy(