diff --git a/tests/jobs/localisation/example_case/example_test_config_D.yml b/tests/jobs/localisation/example_case/example_test_config_D.yml index 85564f4a3..54b942a60 100644 --- a/tests/jobs/localisation/example_case/example_test_config_D.yml +++ b/tests/jobs/localisation/example_case/example_test_config_D.yml @@ -1,33 +1,34 @@ -# GRDECL format standard RMS origo +# ROFF format standard Eclipse origo settings: + case_name: "D" model_size: - size: [ 7500.0, 12500.0, 50.0 ] - use_eclipse_grid_index_origo: False + size: [ 1000.0, 2000.0, 50.0 ] + use_eclipse_grid_index_origo: True field: name: "FIELDPAR" algorithm: "gstools" - file_format: "GRDECL" + file_format: "ROFF" initial_file_name: "init_files/FieldParam" updated_file_name: "FieldParam" seed_file: "randomseeds.txt" variogram: "gaussian" - correlation_range: [4000.0, 2000.0, 2.0] - correlation_azimuth: 45.0 + 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: [150, 250, 1] - grid_file_name: "GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID" + grid_dimension: [10, 20, 1] + grid_file_name: "GRID_STANDARD.EGRID" response: name: "UPSCALED" - grid_dimension: [15, 25, 1] + grid_dimension: [2,4,1] upscaled_file_name: "Upscaled" - grid_file_name: "UpscaleGrid.EGRID" - file_format: "GRDECL" + grid_file_name: "GRID_STANDARD_UPSCALED.EGRID" + file_format: "ROFF" write_upscaled_field: True response_function: "average" gen_data_file_name: "UpscaledField_0.txt" @@ -40,13 +41,10 @@ settings: reference_field_name: "ObsField" rel_error: 0.10 min_abs_error: 0.01 - selected_grid_cells: - - [5, 21, 1] - - [7, 14,1] - - [11, 6, 1] + obs_positions: [ [750.0, 750.0, 25.0], [250.0, 1750.0, 25.0] ] localisation: - method: "gaussian" + method: "constant" optional: - write_obs_pred_diff_field_file: True + write_obs_pred_diff_field_file: False diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_with_actnum_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_with_actnum_local.grdecl new file mode 100644 index 000000000..718a55f64 --- /dev/null +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_with_actnum_local.grdecl @@ -0,0 +1,35 @@ +FIELDPAR + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.003016 -0.494571 + -1.028435 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 -0.025932 -0.279426 -0.127581 0.017761 -0.193278 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 -0.829884 + -1.867067 -2.117355 -1.216993 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 -1.915480 -2.726342 -3.124574 + -2.504564 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 -0.876790 -0.636449 -0.371928 -0.186803 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.536597 0.157487 + 0.151960 0.261694 0.257023 0.275927 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.654710 -0.078125 -0.653691 -0.862671 + -0.729918 -0.454728 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.901444 + 0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.899565 0.992203 0.749731 0.404224 + -0.167782 -1.022487 -1.668451 -1.600215 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + -0.035406 1.009202 1.709299 1.983187 1.760534 0.946370 + 0.064703 -0.146747 0.213693 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.944598 + 1.588994 1.513464 1.166571 1.047943 1.075387 0.881568 + 0.389300 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.753952 1.023120 0.847401 + 0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791 + 999999999999999945575230987042816.000000 0.157758 0.172461 0.312229 0.509417 0.808807 + 1.215309 1.370256 0.795799 -0.342228 999999999999999945575230987042816.000000 -1.374976 + -0.900708 0.206069 1.040176 1.223922 1.279978 1.478402 + 1.243197 0.178017 999999999999999945575230987042816.000000 -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 999999999999999945575230987042816.000000 1.752741 1.156656 0.156627 -0.349148 + -0.425633 -0.648444 -1.098076 -1.299050 -0.878778 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 2.215707 0.622777 -1.049959 -1.704248 -1.537606 + -1.549673 -2.107112 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 + -1.249170 -2.481425 -2.643038 -2.015550 -1.732791 999999999999999945575230987042816.000000 + 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 / diff --git a/tests/jobs/localisation/example_case/scripts/common_functions.py b/tests/jobs/localisation/example_case/scripts/common_functions.py index c40af5424..4dfd5c053 100644 --- a/tests/jobs/localisation/example_case/scripts/common_functions.py +++ b/tests/jobs/localisation/example_case/scripts/common_functions.py @@ -1239,6 +1239,7 @@ def create_grid( return grid_object +# pylint: disable=too-many-statements def write_localisation_config( obs_positions: list, obs_index_list: list, @@ -1262,26 +1263,52 @@ def write_localisation_config( raise ValueError( "Inconsistency between observation list and cell-index_list" ) - - for obs_number in range(nobs): - (Iindx, Jindx, Kindx) = get_cell_indices(obs_number, nobs, obs_index_list) - obs_name = f"OBS_{Iindx+1}_{Jindx+1}_{Kindx+1}" - pos = obs_positions[obs_number] - file.write(f"{space}- name: CORR_{obs_number}\n") + if localisation_method.lower() != "constant": + for obs_number in range(nobs): + (Iindx, Jindx, Kindx) = get_cell_indices( + obs_number, nobs, obs_index_list + ) + obs_name = f"OBS_{Iindx+1}_{Jindx+1}_{Kindx+1}" + pos = obs_positions[obs_number] + file.write(f"{space}- name: CORR_{obs_number}\n") + file.write(f"{space2}obs_group:\n") + file.write(f'{space3}add: ["{obs_name}"]\n') + file.write(f"{space2}param_group:\n") + file.write(f'{space3}add: ["{field_name}"]\n') + file.write(f"{space2}field_scale:\n") + if localisation_method == "gaussian": + file.write(f"{space3}method: gaussian_decay\n") + file.write(f"{space3}main_range: {corr_ranges[0]}\n") + file.write(f"{space3}perp_range: {corr_ranges[1]}\n") + file.write(f"{space3}azimuth: {azimuth}\n") + file.write(f"{space3}ref_point: [ {pos[0]}, {pos[1]} ]\n") + elif localisation_method == "constant": + file.write(f"{space3}method: constant\n") + file.write(f"{space3}value: 1.0\n") + else: + # Constant scaling factor, use only one correlation group + file.write(f"{space}- name: CORR\n") file.write(f"{space2}obs_group:\n") - file.write(f'{space3}add: ["{obs_name}"]\n') + file.write(f"{space3}add: [ ") + obs_list = "" + for obs_number in range(nobs): + (Iindx, Jindx, Kindx) = get_cell_indices( + obs_number, nobs, 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") - if localisation_method == "gaussian": - file.write(f"{space3}method: gaussian_decay\n") - file.write(f"{space3}main_range: {corr_ranges[0]}\n") - file.write(f"{space3}perp_range: {corr_ranges[1]}\n") - file.write(f"{space3}azimuth: {azimuth}\n") - file.write(f"{space3}ref_point: [ {pos[0]}, {pos[1]} ]\n") - elif localisation_method == "constant": - file.write(f"{space3}method: constant\n") - file.write(f"{space3}value: 1.0\n") + file.write(f"{space3}method: constant\n") + file.write(f"{space3}value: 1.0\n") def generate_seed_file( diff --git a/tests/jobs/localisation/example_case/sim_field_case_D.ert b/tests/jobs/localisation/example_case/sim_field_case_D.ert index 4e9e52cc2..31a66a78a 100644 --- a/tests/jobs/localisation/example_case/sim_field_case_D.ert +++ b/tests/jobs/localisation/example_case/sim_field_case_D.ert @@ -1,5 +1,4 @@ DEFINE $USER -DEFINE /scratch/fmu DEFINE sim_field_D DEFINE randomseeds.txt DEFINE /example_test_config_D.yml @@ -10,7 +9,6 @@ INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD DEFINE /observations/observations.obs OBS_CONFIG -TIME_MAP time_map.txt JOBNAME sim_fields_ @@ -19,12 +17,13 @@ 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 - -RUNPATH ///realization-/iter- +-- 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 @@ -45,13 +44,13 @@ FORWARD_MODEL MAKE_DIRECTORY(=) -- The common seed file FORWARD_MODEL COPY_FILE(=/, =/) -- For QC purpose only -FORWARD_MODEL COPY_FILE(=/init_files/ObsField.GRDECL, =/init_files/ObsField.GRDECL) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID, =/GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID) -FORWARD_MODEL MAKE_SYMLINK(=/UpscaleGrid.EGRID, =/UpscaleGrid.EGRID) --- The main forward model simulating gaussian field with trend, and upscale -FORWARD_MODEL SIM_FIELD(=, =, =) +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_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID -- Necessary for AHM using field parameters +GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters -FIELD FIELDPAR PARAMETER FieldParam.GRDECL INIT_FILES:init_files/FieldParam.GRDECL MIN:-5.0 MAX:5.0 FORWARD_INIT:True +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_D.ert b/tests/jobs/localisation/example_case/sim_field_local_case_D.ert index 5b3630d2f..cfe50f757 100644 --- a/tests/jobs/localisation/example_case/sim_field_local_case_D.ert +++ b/tests/jobs/localisation/example_case/sim_field_local_case_D.ert @@ -1,5 +1,4 @@ DEFINE $USER -DEFINE /scratch/fmu DEFINE sim_field_local_D DEFINE randomseeds.txt DEFINE /example_test_config_D.yml @@ -10,7 +9,6 @@ INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD DEFINE /observations/observations.obs OBS_CONFIG -TIME_MAP time_map.txt JOBNAME sim_fields_ @@ -19,12 +17,13 @@ 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 - -RUNPATH ///realization-/iter- +-- 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 @@ -45,13 +44,13 @@ FORWARD_MODEL MAKE_DIRECTORY(=) -- The common seed file FORWARD_MODEL COPY_FILE(=/, =/) -- For QC purpose only -FORWARD_MODEL COPY_FILE(=/init_files/ObsField.GRDECL, =/init_files/ObsField.GRDECL) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID, =/GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID) -FORWARD_MODEL MAKE_SYMLINK(=/UpscaleGrid.EGRID, =/UpscaleGrid.EGRID) +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(=, =, =) +FORWARD_MODEL SIM_FIELD(=, =, =, =) -GRID /GRID_RMS_STANDARD_GRID_INDEX_ORIGO.EGRID -- Necessary for AHM using field parameters +GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters -FIELD FIELDPAR PARAMETER FieldParam.GRDECL INIT_FILES:init_files/FieldParam.GRDECL MIN:-5.0 MAX:5.0 FORWARD_INIT:True +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 5c515925a..3e9e67dcc 100644 --- a/tests/jobs/localisation/example_case/test_full.py +++ b/tests/jobs/localisation/example_case/test_full.py @@ -64,9 +64,11 @@ }, "field": { "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", }, "response": { "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", }, } ), @@ -78,9 +80,11 @@ }, "field": { "file_format": "GRDECL", + "grid_file_name": "GRID_STANDARD.EGRID", }, "response": { "file_format": "GRDECL", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", }, } ), @@ -117,6 +121,25 @@ }, } ), + pytest.param( + { + "case_name": "D", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "localisation": { + "method": "constant", + }, + } + ), ], ) def test_that_localization_works_with_different_settings( @@ -249,6 +272,15 @@ def test_that_localization_works_with_different_settings( reference_file_updated = "FieldParam_real5_iter1_A_with_actnum_local.grdecl" test_example_config = "example_test_config_A_with_actnum.yml" grid_file_name = "GRID_WITH_ACTNUM.EGRID" + elif settings.case_name == "D": + # Scaling factor =1 and one correlation group + # The result should be identical to not running localisation like + # case A without localisation + ert_config_file = "sim_field_local_case_D.ert" + reference_file_initial = "FieldParam_real5_iter0_A_ordinary.grdecl" + reference_file_updated = "FieldParam_real5_iter1_A_ordinary.grdecl" + test_example_config = "example_test_config_D.yml" + grid_file_name = "GRID_STANDARD.EGRID" shutil.copy(Path(__file__).parent / ert_config_file, ert_config_file) shutil.copy(