Skip to content

Commit

Permalink
Add test case for non-adaptive localisation
Browse files Browse the repository at this point in the history
Add option to specify alternative settings for the test case using a yml file
  • Loading branch information
oddvarlia committed Oct 22, 2023
1 parent d54ab46 commit 9e03be5
Show file tree
Hide file tree
Showing 18 changed files with 1,583 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/jobs/localisation/example_case/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Directory for test case for non-adaptive localisation (LOCALISATION_JOB)
Main components:
ERT config file: sim_field.ert

The ERT model depends on:
scripts/sim_fields.py
scripts/common_functions.py

Example of optional input config scripts to
scripts/init_test_case.py and scripts/sim_fields.py:
example_case.yml
modify_variogram.yml

ERT keyword input:
GRID: Input grid is made by scripts/init_test_case.py
OBS_CONFIG: Observations are extracted from an upscaled realization made by scripts/init_test_case.py
GEN_DATA : Prediction of observables made by forward model SIM_FIELD which runs scripts/sim_fields.py
FIELD: Prior realizations of field made by forward model SIM_FIELD which runs scripts/sim_fields.py

Other ERT input files:
time_map.txt
localisation.wf

Other files:
randomseeds.txt - Not used by ERT, but by sim_fields.py
This file can be generated by scripts/init_test_case.py
UpscaledGrid.EGRID - Not used by ERT, but by scripts/sim_fields.py
This file can be generated by scripts/init_test_case.py

Typical workflow:
1. Prepare ERT config input by running scripts/init_test_case.py. If run without any arguments, a set of hardcoded
default settings are used. Optionally add one argument (a yml file where the settings for the test case can be modified.
See example of two such yml files: example_case.yml containing all available settings and modify_variogram.yml
where only a few parameters are modified and the rest of the settings are using default values.
Edit the input yml file to change settings.
2. Directories for observations are created automatically according to the default (or modified) settings.
3. Make the directory init_files if not existing.
4. Run the script init_test_case.py located under scripts from the example_case dirctory.
Run it with or without one argument which is a specification of settings.
Default settings are used for settings not specified. The file can be ommited if one want to use the default
settings for all parameters. Example file containing all possible settings is the file example_case.yml
5. If non-default settings are specified and the init_test_case.py is run with an yml file as argument, also the ERT forward
model SIM_FIELD need the same input as the third argument for the script sim_fields.py
The first two arguments are iteration and realisation number. Edit FM_SIM_FIELD and specify wanted settings file (yml file).
5. Activate/not activate localisation in ERT config file (HOOK_WORKFLOW LOAD_WORKFLOW for localisation)
6. Now ready to run ERT.



What the script sim_fields.py do:
1. Get iteration and realisation number from ERT using ERT environment variables _ERT_ITERATION_NUMBER and _ERT_REALIZATION_NUMBER
If running with old komodo version, the script will require iteration and realisation_number as command line input and optionally the yml settings file.
2. If iteration = 0 then
simulate field and export to file to be used in FIELD keyword in ERT config file.
upscale field and optionally export to file for QC purpose
else
import updated field from ERT
upscale field and optionally export file for QC purpose
3. Extract predicted values of observables from upscaled field (values for some selected grid cells related to the upscaled grid) and write GEN_DATA files
4. Optionally write some files for QC purpose.
45 changes: 45 additions & 0 deletions tests/jobs/localisation/example_case/example_case.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
settings:
grid_size:
xsize: 7500.0
ysize: 12500.0
zsize: 50.0
use_eclipse_grid_index_origo: "eclipse"

field:
name: "FIELDPARAM"
initial_file_name: "init_files/FieldParam.roff"
updated_file_name: "FieldParam.roff"
seed_file: "randomseeds.txt"
variogram: "gaussian"
correlation_range: [5000.0, 3000.0, 2.0]
correlation_azimuth: 45.0
correlation_dip: 0.0
trend_use: False
trend_params: [ 1.0, -1.0 ]
trend_relstd: 0.15
grid_dimension: [150, 250, 1]
grid_file_name: "GRID.EGRID"

response:
grid_dimension: [15, 25, 1]
upscaled_file_name: "Upscaled.roff"
grid_file_name: "UpscaleGrid.EGRID"
response_function: "average"
gen_data_file_name: "UpscaledField_0.txt"
calculate_all_cells: True

observation:
directory: "observations"
file_name: "observations.obs"
data_dir: "obs_data"
3D_param_file_name: "init_files/UpscaledObsField.roff"
rel_error: 0.10
min_abs_error: 0.01
selected_grid_cells:
- [5, 10, 1]
- [10, 20, 1]

optional:
write_upscaled_to_file: True
write_obs_pred_diff_field_file: True

7 changes: 7 additions & 0 deletions tests/jobs/localisation/example_case/init_files/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Directory where initial ensemble realisation is saved:
FieldParam.roff - The field parameter
Upscaled.roff - The upscaled field parameter (for QC purpose)
UpscaledObsField.roff - The upscaled field parameter used when
extracting observations (selected grid cells to be used as observables)
UpscaledConditionedCells.roff - A coarse grid parameter with all cells except the cells defined as observable
with a dummy value and the observable grid cells with the values used as observations.
1 change: 1 addition & 0 deletions tests/jobs/localisation/example_case/localisation.wf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCALISATION_JOB local_config.yml
15 changes: 15 additions & 0 deletions tests/jobs/localisation/example_case/modify_variogram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
settings:

field:
variogram: "spherical"
correlation_range: [4000.0, 4000.0, 2.0]

observation:
directory: "observations2"
data_dir: "obs_data2"
3D_param_file_name: "init_files/UpscaledObsField2.roff"





6 changes: 6 additions & 0 deletions tests/jobs/localisation/example_case/scripts/FM_SIM_FIELD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EXECUTABLE ./sim_fields.py

ARGLIST <ITERATION> <REALNUMBER> <TEST_SETTINGS>

STDERR sim_fields.stderr
STDOUT sim_fields.stdout
13 changes: 13 additions & 0 deletions tests/jobs/localisation/example_case/scripts/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Source code scripts:
common_functions.py - Functions used by the two scripts init_test_case.py and sim_fields.py
init_test_case.py - Create grid files, random seed file localisation config file and observation files for the test case
sim_fields.py - This script is run from ERT config file as a FORWARD model.
FM_SIM_FIELD - ERT configuration of forward model SIM_FIELD
using sim_fields.py.

Scripts used in RMS project to load and visualize the realizations.
These are not needed to run the test and alternatives for visualizing the realizations exists (coviz, webviz?):
import_field_parameters.py
import_field_parameters_local.py
import_upscaled_field_parameters_local.py
import_upscaled_field_parameters.py
Empty file.
Loading

0 comments on commit 9e03be5

Please sign in to comment.