Skip to content

Commit

Permalink
Replaced gaussianfft as python module for simulation of gaussian fiel…
Browse files Browse the repository at this point in the history
…ds with gstools.
  • Loading branch information
oddvarlia committed Oct 25, 2023
1 parent e5a153e commit 6791921
Show file tree
Hide file tree
Showing 14 changed files with 499 additions and 818 deletions.
2 changes: 2 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pytest-httpserver
pytest-snapshot
rstcheck-core<=1.0.3
xlwt
gstools
gaussianfft
104 changes: 44 additions & 60 deletions tests/jobs/localisation/example_case/README
Original file line number Diff line number Diff line change
@@ -1,60 +1,44 @@
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.
## 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`
- **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 `sim_fields.py`. This file can be generated by `scripts/init_test_case.py`
### Typical Workflow:
1. **Preparation:** Prepare ERT config input by running `scripts/init_test_case.py`.
2. Directories for observations are created automatically according to the default settings.
3. Make the directory `init_files` if not existing.
4. Activate or deactivate localisation in ERT config file (`HOOK_WORKFLOW LOAD_WORKFLOW` for localisation).
5. Now ready to run ERT.
### What the Script `sim_fields.py` Does:
1. Get iteration and realisation number from ERT using ERT environment variables `_ERT_ITERATION_NUMBER` and `_ERT_REALIZATION_NUMBER`. If running with an old Komodo version, the script will require iteration and realisation_number as command line input.
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 selected grid cells related to the upscaled grid) and write `GEN_DATA` files.
4. Optionally write some files for QC purpose.Directory for test case for non-adaptive localisation (LOCALISATION_JOB)
44 changes: 0 additions & 44 deletions tests/jobs/localisation/example_case/example_case.yml

This file was deleted.

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

ARGLIST <ITERATION> <REALNUMBER> <TEST_SETTINGS>
ARGLIST <ITER> <IENS>

STDERR sim_fields.stderr
STDOUT sim_fields.stdout
Loading

0 comments on commit 6791921

Please sign in to comment.