diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 2e84704150..120a368ea9 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -16,7 +16,7 @@ In addition to any definition or interpretation of the open source code of condu If at any point concerns are raised that a group or member is not acting according to our values, the behaviour in question should cease, be discussed, and tried to be resolved. -We expect everyone to have a low threshold for raising issues, or in general discuss how we live up to our values. +We expect everyone to have a low threshold for raising issues, or in general discuss how we live up to our values. Equally, we encourage all community members to appreciate when concerns are raised and do their best to solve them. Project maintainers are responsible both for *what* is delivered, as well as *how* it is delivered. diff --git a/WINDOWS.md b/WINDOWS.md index 7d0ab2ebc4..419958b2b1 100644 --- a/WINDOWS.md +++ b/WINDOWS.md @@ -3,7 +3,7 @@ ## Prerequisits: * Python 2.7 or 3.x https://www.python.org/ or https://anaconda.org/ * Microsoft Visual Studio https://visualstudio.microsoft.com/downloads/ -* Local copy of **_libecl_** +* Local copy of **_libecl_** ## Instructions: 1. Download or clone the **_libecl_** Github repository to your local disk. @@ -13,9 +13,9 @@ 3. Download and install Microsoft Visual Studio . At a minimum **_libecl_** requires the VS Studio packages for cmake, msbuild, c and c++ compilers (CL.exe). -4. Open a MSVC command prompt such as _x64 Native Tools Command Prompt for VS 2017_ from your start menu. In the open prompt, navigate to the **_libecl_** source directory you created in step 1. Use the Python package manager **pip** to install **_libecl_** requirements via `pip install -r requirements.txt`. If Python is not accessible from the prompt it may be necessary to add the Python environment location to your system path variable `PATH`. - -5. Execute the build commands with the desired CMAKE parameters from `README.md`. The cmake generator can be _`NMake Makefiles`_ , _`Ninja`_ or an appropriate version of _`MSVC`_. For the availble options type `cmake -G` in the MSVC command prompt. +4. Open a MSVC command prompt such as _x64 Native Tools Command Prompt for VS 2017_ from your start menu. In the open prompt, navigate to the **_libecl_** source directory you created in step 1. Use the Python package manager **pip** to install **_libecl_** requirements via `pip install -r requirements.txt`. If Python is not accessible from the prompt it may be necessary to add the Python environment location to your system path variable `PATH`. + +5. Execute the build commands with the desired CMAKE parameters from `README.md`. The cmake generator can be _`NMake Makefiles`_ , _`Ninja`_ or an appropriate version of _`MSVC`_. For the availble options type `cmake -G` in the MSVC command prompt. An example build and install is provided below where %VARIABLE% are user defined directory paths: ~~~~ diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt index 3b23ba6d35..1b8c9935c1 100644 --- a/applications/CMakeLists.txt +++ b/applications/CMakeLists.txt @@ -51,19 +51,6 @@ if(BUILD_APPLICATIONS) set_target_properties(summary PROPERTIES SUFFIX ".x") endif() - # This minor eclipse application depends on the config parser library and - # should be moved to the libres repository - it can not be built here. - if(BUILD_ERT) - add_executable(ecl_quantile ecl/ecl_quantile.c) - target_link_libraries(ecl_quantile config) - list(APPEND apps ecl_quantile) - endif() - if(PTHREAD_LIBRARY) - add_executable(bls block_fs/bls.c) - target_link_libecl(bls) - list(APPEND apps bls) - endif() - add_executable(segment_info well/segment_info.c) add_executable(CF_dump well/well_CF_dump.c) add_executable(ri_well_test well/ri_well_test.c) diff --git a/applications/ecl/ecl_quantile.c b/applications/ecl/ecl_quantile.c deleted file mode 100644 index 73b4c77ee9..0000000000 --- a/applications/ecl/ecl_quantile.c +++ /dev/null @@ -1,889 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'ecl_quantile.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#define _GNU_SOURCE /* Must define this to get access to pthread_rwlock_t */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#define DEFAULT_NUM_INTERP 50 -#define SUMMARY_JOIN ":" -#define MIN_SIZE 10 -#define LOAD_THREADS 4 - -typedef enum { - S3GRAPH = 1, - HEADER = 2, /* Columns of numbers like summary.x - with a header */ - PLAIN = 3 /* Columns of numbers like summary.x - no header */ -} format_type; - -typedef struct { - ecl_sum_type *ecl_sum; - double_vector_type *interp_data; - const time_t_vector_type *interp_time; - time_t start_time; - time_t end_time; -} sum_case_type; - -/** - Microscopic data structure representing one column of data; - i.e. one ECLIPSE summary key and one accompanying quantile value. -*/ - -typedef struct { - char *sum_key; - double quantile; -} quant_key_type; - -typedef struct { - vector_type *keys; /* Vector of quant_key_type instances. */ - char *file; - format_type format; -} output_type; - -typedef struct { - vector_type *data; - time_t_vector_type *interp_time; - int num_interp; - time_t start_time; - time_t end_time; - const ecl_sum_type * - refcase; /* Pointer to an arbitrary ecl_sum instance in the ensemble - to have access to indexing functions. */ - pthread_rwlock_t rwlock; -} ensemble_type; - -#define S3GRAPH_STRING "S3GRAPH" -#define HEADER_STRING "HEADER" -#define PLAIN_STRING "PLAIN" - -static quant_key_type *quant_key_alloc(const char *sum_key, double quantile) { - quant_key_type *qkey = util_malloc(sizeof *qkey); - qkey->sum_key = util_alloc_string_copy(sum_key); - qkey->quantile = quantile; - return qkey; -} - -static void quant_key_free(quant_key_type *qkey) { - free(qkey->sum_key); - free(qkey); -} - -static void quant_key_free__(void *qkey) { - quant_key_free((quant_key_type *)qkey); -} - -sum_case_type *sum_case_fread_alloc(const char *data_file, - const time_t_vector_type *interp_time) { - sum_case_type *sum_case = util_malloc(sizeof *sum_case); - - sum_case->ecl_sum = ecl_sum_fread_alloc_case(data_file, SUMMARY_JOIN); - sum_case->interp_data = double_vector_alloc(0, 0); - sum_case->interp_time = interp_time; - sum_case->start_time = ecl_sum_get_start_time(sum_case->ecl_sum); - sum_case->end_time = ecl_sum_get_end_time(sum_case->ecl_sum); - return sum_case; -} - -void sum_case_free(sum_case_type *sum_case) { - ecl_sum_free(sum_case->ecl_sum); - double_vector_free(sum_case->interp_data); - free(sum_case); -} - -void sum_case_free__(void *sum_case) { - sum_case_free((sum_case_type *)sum_case); -} - -void ensemble_add_case(ensemble_type *ensemble, const char *data_file) { - sum_case_type *sum_case = - sum_case_fread_alloc(data_file, ensemble->interp_time); - - pthread_rwlock_wrlock(&ensemble->rwlock); - { - printf("Loading case: %s \n", data_file); - vector_append_owned_ref(ensemble->data, sum_case, sum_case_free__); - if (ensemble->start_time > 0) - ensemble->start_time = - util_time_t_min(ensemble->start_time, sum_case->start_time); - else - ensemble->start_time = ecl_sum_get_start_time(sum_case->ecl_sum); - - ensemble->end_time = - util_time_t_max(ensemble->end_time, sum_case->end_time); - } - pthread_rwlock_unlock(&ensemble->rwlock); -} - -void *ensemble_add_case__(void *arg) { - arg_pack_type *arg_pack = arg_pack_safe_cast(arg); - ensemble_type *ensemble = arg_pack_iget_ptr(arg, 0); - const char *data_file = arg_pack_iget_ptr(arg, 1); - ensemble_add_case(ensemble, data_file); - arg_pack_free(arg_pack); - return NULL; -} - -void ensemble_init_time_interp(ensemble_type *ensemble) { - int i; - for (i = 0; i < ensemble->num_interp; i++) - time_t_vector_append( - ensemble->interp_time, - ensemble->start_time + - i * (ensemble->end_time - ensemble->start_time) / - (ensemble->num_interp - 1)); -} - -void ensemble_load_from_glob(ensemble_type *ensemble, const char *pattern, - thread_pool_type *tp) { - glob_t pglob; - int i; - glob(pattern, GLOB_NOSORT, NULL, &pglob); - - for (i = 0; i < pglob.gl_pathc; i++) { - arg_pack_type *arg_pack = arg_pack_alloc(); - arg_pack_append_ptr(arg_pack, ensemble); - arg_pack_append_owned_ptr( - arg_pack, util_alloc_string_copy(pglob.gl_pathv[i]), free); - thread_pool_add_job(tp, ensemble_add_case__, arg_pack); - } - - globfree(&pglob); -} - -ensemble_type *ensemble_alloc() { - ensemble_type *ensemble = util_malloc(sizeof *ensemble); - - ensemble->num_interp = DEFAULT_NUM_INTERP; - ensemble->start_time = -1; - ensemble->end_time = -1; - ensemble->data = vector_alloc_new(); - ensemble->interp_time = time_t_vector_alloc(0, -1); - pthread_rwlock_init(&ensemble->rwlock, NULL); - return ensemble; -} - -void ensemble_init(ensemble_type *ensemble, config_content_type *config) { - - /*1 : Loading ensembles and settings from the config instance */ - /*1a: Loading the eclipse summary cases. */ - { - thread_pool_type *tp = thread_pool_alloc(LOAD_THREADS, true); - { - int i, j; - if (config_content_has_item(config, "CASE_LIST")) { - const config_content_item_type *case_item = - config_content_get_item(config, "CASE_LIST"); - for (j = 0; j < config_content_item_get_size(case_item); j++) { - const config_content_node_type *case_node = - config_content_item_iget_node(case_item, j); - for (i = 0; i < config_content_node_get_size(case_node); - i++) { - const char *case_glob = - config_content_node_iget(case_node, i); - ensemble_load_from_glob(ensemble, case_glob, tp); - } - } - } - } - thread_pool_join(tp); - thread_pool_free(tp); - } - - { - const sum_case_type *tmp = vector_iget_const(ensemble->data, 0); - ensemble->refcase = tmp->ecl_sum; - } - - /*1b: Other config settings */ - if (config_content_has_item(config, "NUM_INTERP")) - ensemble->num_interp = - config_content_iget_as_int(config, "NUM_INTERP", 0, 0); - - /*2: Remaining initialization */ - ensemble_init_time_interp(ensemble); - if (vector_get_size(ensemble->data) < MIN_SIZE) - util_exit("Sorry - quantiles make no sense with with < %d " - "realizations; should have ~> 100.\n", - MIN_SIZE); -} - -const ecl_sum_type *ensemble_get_refcase(const ensemble_type *ensemble) { - return ensemble->refcase; -} - -void ensemble_free(ensemble_type *ensemble) { - vector_free(ensemble->data); - time_t_vector_free(ensemble->interp_time); - free(ensemble); -} - -static output_type *output_alloc(const char *file, const char *format_string) { - output_type *output = util_malloc(sizeof *output); - output->keys = vector_alloc_new(); - output->file = util_alloc_string_copy(file); - { - format_type format; - - if (util_string_equal(format_string, S3GRAPH_STRING)) - format = S3GRAPH; - else if (util_string_equal(format_string, HEADER_STRING)) - format = HEADER; - else if (util_string_equal(format_string, PLAIN_STRING)) - format = PLAIN; - else { - format = PLAIN; /* Compiler shut up. */ - util_abort("%s: unrecognized format string:%s \n", __func__, - format_string); - } - output->format = format; - } - - return output; -} - -static void output_free(output_type *output) { - vector_free(output->keys); - free(output->file); - free(output); -} - -static void output_free__(void *arg) { output_free((output_type *)arg); } - -/** - The @qkey input argument can contain wildcards in the summary key; - i.e. to get 75% quantile of all wells starting with 'B' you can use - qkey == 'WOPR:B*:0.75' - the expansion is done based on the refcase - provided. -*/ - -static void output_add_key(const ecl_sum_type *refcase, output_type *output, - const char *qkey) { - int tokens; - double quantile; - char **tmp; - char *sum_key; - - util_split_string(qkey, SUMMARY_JOIN, &tokens, &tmp); - if (tokens == 1) - util_exit("Hmmm - the key:%s is malformed - must be of the form " - "SUMMARY_KEY:QUANTILE.\n", - qkey); - - if (!util_sscanf_double(tmp[tokens - 1], &quantile)) - util_exit("Hmmmm - failed to interpret:%s as a quantile - must be a " - "number (0,1).\n", - tmp[tokens - 1]); - - if (quantile <= 0 || quantile >= 1.0) - util_exit("Invalid quantile value:%g - must be in interval (0,1)\n", - quantile); - - sum_key = - util_alloc_joined_string((const char **)tmp, tokens - 1, SUMMARY_JOIN); - { - stringlist_type *matching_keys = stringlist_alloc_new(); - int i; - ecl_sum_select_matching_general_var_list(refcase, sum_key, - matching_keys); - for (i = 0; i < stringlist_get_size(matching_keys); i++) - vector_append_owned_ref( - output->keys, - quant_key_alloc(stringlist_iget(matching_keys, i), quantile), - quant_key_free__); - - if (stringlist_get_size(matching_keys) == 0) - fprintf(stderr, - "** Warning: No summary vectors matching:\'%s\' found?? \n", - sum_key); - stringlist_free(matching_keys); - } - - util_free_stringlist(tmp, tokens); -} - -/** - Each output line should be of the format: - - OUTPUT output_file key.q key.q key.q key.q ... -*/ - -void output_table_init(const ecl_sum_type *refcase, hash_type *output_table, - const config_content_type *config) { - int i, j; - if (config_content_has_item(config, "OUTPUT")) { - const config_content_item_type *output_item = - config_content_get_item(config, "OUTPUT"); - for (i = 0; i < config_content_item_get_size(output_item); i++) { - const config_content_node_type *output_node = - config_content_item_iget_node(output_item, i); - - const char *file = config_content_node_iget(output_node, 0); - const char *format_string = - config_content_node_iget(output_node, 1); - output_type *output = output_alloc(file, format_string); - - /* All the keys are just added - without any check. */ - for (j = 2; j < config_content_node_get_size(output_node); j++) - output_add_key(refcase, output, - config_content_node_iget(output_node, j)); - - hash_insert_hash_owned_ref(output_table, file, output, - output_free__); - } - } -} - -/** - Will print the string variable @var and the numerical variable @q - padded to a total width of @w: - - 'var:0.001 ' -*/ - -static void print_var(FILE *stream, const char *var, double q, - const char *kw_fmt) { - char *qvar = util_alloc_sprintf("%s:%3.1f", var, q); - fprintf(stream, kw_fmt, qvar); - free(qvar); -} - -/* - ** The columns are separated! ** - - An ECLIPSE summary variable is generally characterized by three - variable values from SMSPEC vectors; the three vectors are - KEYWORDS, WGNAMES and NUMS. - - The main variable is the KEYWORDS variable which says what type of - variable it is. Examples of KEYWORDS variable values are 'WWCT', - 'WOPR' and 'GWPT'. To make the variable unique we then need - additional information from one, or both of WGNAMES and NUMS. For - instance for a well variable or group variable we will need the - well name from WGNAMES and for a block property we will need the - block number (as i + j*nx + k*nx*ny) from the NUMS vector. - - When writing the S3Graph header I don't understand how to enter the - different parts of header information. The current implementation, - which seems to work reasonably well[*] , does the following: - - 1. Write a line like this: - - DATE TIME KEYWORD1:xxx KEYWORD2:xxx KEYWORD3:xxxx - - Here KEYWORD is an eclipse variable memnonic from the KEYWORDS - array, i.e. FOPT or WWCT. The :xxx part is the quantile we are - looking at, i.e. 0.10 or 0.90. It seems adding the quantile - does not confuse S3Graph. - - 2. Write a line with units: - - DATE TIME KEYWORD1:xxx KEYWORD2:xxx KEYWORD3:xxxx - DAYS UNIT1 UNIT2 UNIT2 <---- New line - - - 3. Write a line with keyword qualifiers, i.e. extra information: - - DATE TIME WOPR:xxx FOPT:xxxx BPR - DAYS UNIT1 UNIT2 UNIT2 - OP1 1000 <---- New line - - Now - the totally confusing part is that it is not clear what - S3Graph expects on this third line, in the case of well/group - variables it is a well/group name from the WGNAMES array, - whereas for e.g. a region or block varaiable it wants an - element from the NUMS array, and for e.g. a field variable it - wants nothing extra. When it comes to variables which need - both NUMS and WGNAMES to become unique (e.g completion - variables) it is not clear how - if at all possible - to - support it. In the current implementation a string - concatenation of WGNAMES and NUMS is used. - - - [*] : I do not really understand why it seems to work. - -*/ - -void output_save_S3Graph(const output_type *output, ensemble_type *ensemble, - const double **data) { - FILE *stream = util_mkdir_fopen(output->file, "w"); - const char *kw_fmt = "\t%s"; - const char *unit_fmt = "\t%s"; - const char *wgname_fmt = "\t%s"; - const char *num_fmt = "\t%d"; - const char *float_fmt = "\t%0.4f"; - const char *days_fmt = "\t%0.2f"; - - const char *empty_fmt = "\t"; - const char *date_fmt = "%d/%d/%d"; - const char *time_header = "DATE\tTIME"; - const char *time_unit = "\tDAYS"; - const char *time_blank = "\t"; - const int data_columns = vector_get_size(output->keys); - const int data_rows = time_t_vector_size(ensemble->interp_time); - int row_nr, column_nr; - - { - char *origin; - util_alloc_file_components(output->file, NULL, &origin, NULL); - fprintf(stream, "ORIGIN %s\n", origin); - free(origin); - } - - /* 1: Writing first header line with variables. */ - fprintf(stream, time_header); - for (column_nr = 0; column_nr < data_columns; column_nr++) { - const quant_key_type *qkey = vector_iget(output->keys, column_nr); - print_var(stream, ecl_sum_get_keyword(ensemble->refcase, qkey->sum_key), - qkey->quantile, kw_fmt); - } - fprintf(stream, "\n"); - - /* 2: Writing second header line with units. */ - fprintf(stream, time_unit); - for (column_nr = 0; column_nr < data_columns; column_nr++) { - const quant_key_type *qkey = vector_iget(output->keys, column_nr); - fprintf(stream, unit_fmt, - ecl_sum_get_unit(ensemble->refcase, qkey->sum_key)); - } - fprintf(stream, "\n"); - - /*3: Writing third header line with WGNAMES / NUMS - extra information - - breaks completely down with LGR information. */ - fprintf(stream, time_blank); - { - for (column_nr = 0; column_nr < data_columns; column_nr++) { - const quant_key_type *qkey = vector_iget(output->keys, column_nr); - const char *ecl_key = qkey->sum_key; - const char *wgname = ecl_sum_get_wgname(ensemble->refcase, ecl_key); - int num = ecl_sum_get_num(ensemble->refcase, ecl_key); - ecl_smspec_var_type var_type = - ecl_sum_get_var_type(ensemble->refcase, ecl_key); - bool need_num = ecl_smspec_needs_num(var_type); - bool need_wgname = ecl_smspec_needs_wgname(var_type); - - if (need_num && need_wgname) { - /** Do not know how to include both - will just create a - mangled name as a combination. */ - char *wgname_num = util_alloc_sprintf("%s:%d", wgname, num); - fprintf(stream, wgname_fmt, wgname_num); - free(wgname_num); - } else if (need_num) - fprintf(stream, num_fmt, num); - else if (need_wgname) - fprintf(stream, wgname_fmt, wgname); - else - fprintf(stream, empty_fmt); - } - fprintf(stream, "\n"); - } - - /*4: Writing the actual data. */ - for (row_nr = 0; row_nr < data_rows; row_nr++) { - time_t interp_time = time_t_vector_iget(ensemble->interp_time, row_nr); - { - int mday, month, year; - ecl_util_set_date_values(interp_time, &mday, &month, &year); - fprintf(stream, date_fmt, mday, month, year); - } - fprintf(stream, days_fmt, - 1.0 * (interp_time - ensemble->start_time) / 86400); - - for (column_nr = 0; column_nr < data_columns; column_nr++) { - fprintf(stream, float_fmt, data[row_nr][column_nr]); - } - fprintf(stream, "\n"); - } -} - -void output_save_plain__(const output_type *output, ensemble_type *ensemble, - const double **data, bool add_header) { - FILE *stream = util_mkdir_fopen(output->file, "w"); - const char *key_fmt = " %18s:%4.2f "; - const char *time_header = "-- DAYS DATE "; - const char *time_dash = "------------------------"; - const char *key_dash = "-------------------------"; - const char *float_fmt = "%24.5f "; - const char *days_fmt = "%10.2f "; - const char *date_fmt = " %02d/%02d/%04d "; - const int data_columns = vector_get_size(output->keys); - const int data_rows = time_t_vector_size(ensemble->interp_time); - int row_nr, column_nr; - - if (add_header) { - fprintf(stream, time_header); - for (int i = 0; i < vector_get_size(output->keys); i++) { - const quant_key_type *qkey = vector_iget(output->keys, i); - fprintf(stream, key_fmt, qkey->sum_key, qkey->quantile); - } - fprintf(stream, "\n"); - - fprintf(stream, time_dash); - for (int i = 0; i < vector_get_size(output->keys); i++) - fprintf(stream, key_dash); - fprintf(stream, "\n"); - } - - /*4: Writing the actual data. */ - for (row_nr = 0; row_nr < data_rows; row_nr++) { - time_t interp_time = time_t_vector_iget(ensemble->interp_time, row_nr); - fprintf(stream, days_fmt, - 1.0 * (interp_time - ensemble->start_time) / 86400); - { - int mday, month, year; - ecl_util_set_date_values(interp_time, &mday, &month, &year); - fprintf(stream, date_fmt, mday, month, year); - } - - for (column_nr = 0; column_nr < data_columns; column_nr++) { - fprintf(stream, float_fmt, data[row_nr][column_nr]); - } - fprintf(stream, "\n"); - } -} - -void output_save(const output_type *output, ensemble_type *ensemble, - const double **data) { - switch (output->format) { - case (S3GRAPH): - output_save_S3Graph(output, ensemble, data); - break; - case (PLAIN): - output_save_plain__(output, ensemble, data, false); - break; - case (HEADER): - output_save_plain__(output, ensemble, data, true); - break; - default: - util_exit("Sorry: output_format:%d not supported \n", output->format); - } -} - -void output_run_line(const output_type *output, ensemble_type *ensemble) { - - const int data_columns = vector_get_size(output->keys); - const int data_rows = time_t_vector_size(ensemble->interp_time); - double **data; - int row_nr, column_nr; - - data = util_calloc(data_rows, sizeof *data); - /* - time-direction, i.e. the row index is the first index and the - column number (i.e. the different keys) is the second index. - */ - for (row_nr = 0; row_nr < data_rows; row_nr++) - data[row_nr] = util_calloc(data_columns, sizeof *data[row_nr]); - - printf("Creating output file: %s \n", output->file); - - /* - Go through all the cases and check that they have this key; - exit if missing. Could also ignore the missing keys and just - continue; and even defer the checking to the inner loop. - */ - for (column_nr = 0; column_nr < vector_get_size(output->keys); - column_nr++) { - const quant_key_type *qkey = vector_iget(output->keys, column_nr); - { - bool OK = true; - - for (int iens = 0; iens < vector_get_size(ensemble->data); iens++) { - const sum_case_type *sum_case = - vector_iget_const(ensemble->data, iens); - - if (!ecl_sum_has_general_var(sum_case->ecl_sum, - qkey->sum_key)) { - OK = false; - fprintf(stderr, - "** Sorry: the case:%s does not have the summary " - "key:%s \n", - ecl_sum_get_case(sum_case->ecl_sum), qkey->sum_key); - } - } - - if (!OK) - util_exit("Exiting due to missing summary vector(s).\n"); - } - } - - /* The main loop - outer loop is running over time. */ - { - /** - In the quite typical case that we are asking for several - quantiles of the quantity, i.e. - - WWCT:OP_1:0.10 WWCT:OP_1:0.50 WWCT:OP_1:0.90 - - the interp_data_cache construction will ensure that the - underlying ecl_sum object is only queried once; and also the - sorting will be performed once. - */ - - hash_type *interp_data_cache = hash_alloc(); - - for (row_nr = 0; row_nr < data_rows; row_nr++) { - time_t interp_time = - time_t_vector_iget(ensemble->interp_time, row_nr); - for (column_nr = 0; column_nr < vector_get_size(output->keys); - column_nr++) { - const quant_key_type *qkey = - vector_iget(output->keys, column_nr); - double_vector_type *interp_data; - - /* Check if we have the vector in the cache table - if not create it. */ - if (!hash_has_key(interp_data_cache, qkey->sum_key)) { - interp_data = double_vector_alloc(0, 0); - hash_insert_hash_owned_ref(interp_data_cache, qkey->sum_key, - interp_data, - double_vector_free__); - } - interp_data = hash_get(interp_data_cache, qkey->sum_key); - - /* Check if the vector has data - if not initialize it. */ - if (double_vector_size(interp_data) == 0) { - for (int iens = 0; iens < vector_get_size(ensemble->data); - iens++) { - const sum_case_type *sum_case = - vector_iget_const(ensemble->data, iens); - - if ((interp_time >= sum_case->start_time) && - (interp_time <= - sum_case - ->end_time)) /* We allow the different simulations to have differing length */ - double_vector_append( - interp_data, - ecl_sum_get_general_var_from_sim_time( - sum_case->ecl_sum, interp_time, - qkey->sum_key)); - - double_vector_sort(interp_data); - } - } - data[row_nr][column_nr] = statistics_empirical_quantile__( - interp_data, qkey->quantile); - } - hash_apply(interp_data_cache, double_vector_reset__); - } - hash_free(interp_data_cache); - } - - output_save(output, ensemble, (const double **)data); - for (row_nr = 0; row_nr < data_rows; row_nr++) - free(data[row_nr]); - free(data); -} - -void output_table_run(hash_type *output_table, ensemble_type *ensemble) { - hash_iter_type *iter = hash_iter_alloc(output_table); - - while (!hash_iter_is_complete(iter)) { - const char *output_file = hash_iter_get_next_key(iter); - const output_type *output = hash_get(output_table, output_file); - output_run_line(output, ensemble); - } -} - -void config_init(config_parser_type *config) { - - config_add_schema_item(config, "CASE_LIST", true); - config_add_key_value(config, "NUM_INTERP", false, CONFIG_INT); - - { - config_schema_item_type *item; - item = config_add_schema_item(config, "OUTPUT", true); - config_schema_item_set_argc_minmax(item, 2, CONFIG_DEFAULT_ARG_MAX); - config_schema_item_set_indexed_selection_set( - item, 1, 3, - (const char *[3]){S3GRAPH_STRING, HEADER_STRING, PLAIN_STRING}); - } -} - -void usage() { - fprintf(stderr, "\nUse:\n\n ecl_quantile config_file\n\n"); - - printf("Help\n"); - printf("----\n"); - printf("\n"); - printf( - "The ecl_quantile program will load an ensemble of ECLIPSE summary\n"); - printf("files, it can then output quantiles of summary vectors over the " - "time\n"); - printf("span of the simulation. The program is based on a simple " - "configuration\n"); - printf("file which must be given as a commandline argument. The " - "configuration\n"); - printf("file only has three keywords:\n"); - printf("\n"); - printf("\n"); - printf(" CASE_LIST simulation*X/run*X/CASE*.DATA\n"); - printf(" CASE_LIST extra_simulation.DATA " - "even/more/simulations*GG/run*.DATA\n"); - printf(" OUTPUT FILE1 S3GRAPH WWCT:OP_1:0.10 WWCT:OP_1:0.50 " - "WOPR:OP_3\n"); - printf(" OUTPUT FILE2 PLAIN FOPT:0.10 FOPT:0.90 FGPT:0.10 " - "FGPT:0.90 FWPT:0.10 FWPT:0.90\n"); - printf(" NUM_INTERP 100\n"); - printf("\n"); - printf("\n"); - printf("CASE_LIST: This keyword is used to give the path to ECLIPSE data " - "files\n"); - printf(" corresponding to summaries which you want to load, observe that " - "the\n"); - printf( - " argument given to the CASE_LIST keyword can contain unix-style\n"); - printf(" wildcards like '*'. One CASE_LIST keyword can point to several " - "cases, \n"); - printf(" and in addition you can have several CASE_LIST keywords.\n"); - printf("\n"); - printf("\n"); - printf("OUTPUT: This keyword is used to denote what output you want from " - "the\n"); - printf(" program. The first argument to the OUTPUT keyword is the name " - "output\n"); - printf(" file you want to produce, in the example above we will create " - "two\n"); - printf(" output files (FILE1 and FILE2 respectively). The second argument " - "is \n"); - printf(" the wanted type of the output file, the three types currently " - "supported\n"); - printf(" are: \n\n"); - printf(" S3GRAPH: S3GRAPH user format - at least quite close...\n"); - printf(" PLAIN: Columns of data without any header information\n"); - printf(" HEADER: Like plain, but with a header at the top\n\n"); - printf( - " The remaining arguments on the output line corresponds to the \n"); - printf(" summary vector & quantile you are interested in. Each of these " - "values\n"); - printf(" is a \":\" separated string consting of:\n"); - printf(" \n"); - printf(" VAR: The ECLIPSE summary variable we are interested in, " - "(nearly)\n"); - printf( - " all variables found in the summary file are available,\n"); - printf(" e.g. RPR, WWCT or GOPT. \n"); - printf("\n"); - printf(" WG?: This is extra information added to the variable to make " - "it\n"); - printf(" unique, e.g. the name of a well or group for rate " - "variables\n"); - printf(" and the region number for a region. Not all variables, " - "in\n"); - printf(" particalar the field rates, Fxxx, have this string.\n"); - printf("\n"); - printf(" Q: The quantile we are interested in, e.g 0.10 to get the " - "P10\n"); - printf(" quantile and 0.90 to get the P90 quantile.\n"); - printf("\n"); - printf(" For the 'VAR' and 'WG?' parts of the keys you can use " - "shell-style\n"); - printf( - " wildcards to get all summary vectors matching a criteria, i.e. \n"); - printf(" 'WOPR:A-*:0.50' will give the P50 quantile of WOPR for all wells " - "\n"); - printf(" starting with 'A-'\n"); - printf("\n"); - printf(" Examples are:\n"); - printf("\n"); - printf(" WWCT:OPX:0.75 The P75 quantile of the watercut in well " - "OPX.\n"); - printf(" BPR:10,10,5:0.50 The P50 quantile of the Block Pressure in " - "block 10,10,5\n"); - printf(" FOPT:0.90 The P90 quantile of the field oil " - "production total.\n"); - printf(" RPR:*:0.50 The P50 quantile of all regions.\n"); - printf("\n"); - printf("\n"); - printf("NUM_INTERP: Before the program can calculate quantiles it must\n"); - printf(" interpolate all the simulated data down on the same time axis. " - "This\n"); - printf(" keyword regulates how many points should be used when " - "interpolating\n"); - printf(" the time axis; the default is 50 which is probably quite OK. " - "Observe\n"); - printf(" that for rate variable the program will not do linear " - "interpolation\n"); - printf(" between ECLIPSE report steps, the might therefore look a bit " - "jagged\n"); - printf(" if NUM_INTERP is set too high. This keyword is optional.\n"); - printf("\n"); - printf("All filenames in the configuration file will be interpreted " - "relative to\n"); - printf("the location of the configuration file, i.e. irrespective of the " - "current\n"); - printf("working directory when invoking the ecl_quantile program.\n\n"); - exit(0); -} - -int main(int argc, char **argv) { - if (argc != 2) - usage(); - else { - hash_type *output_table = hash_alloc(); - ensemble_type *ensemble = ensemble_alloc(); - { - config_parser_type *config = config_alloc(); - config_content_type *content; - const char *config_arg = argv[1]; - - config_init(config); - content = config_parse(config, config_arg, "--", NULL, NULL, NULL, - CONFIG_UNRECOGNIZED_WARN, true); - - if (config_content_is_valid(content)) { - char *config_path; - util_alloc_file_components(config_arg, &config_path, NULL, - NULL); - if (config_path != NULL) { - util_chdir(config_path); - free(config_path); - } - } else { - config_error_type *error = config_content_get_errors(content); - config_error_fprintf(error, true, stderr); - exit(1); - } - - ensemble_init(ensemble, content); - output_table_init(ensemble_get_refcase(ensemble), output_table, - content); - config_content_free(content); - config_free(config); - } - output_table_run(output_table, ensemble); - ensemble_free(ensemble); - hash_free(output_table); - } -} diff --git a/applications/ecl/grdecl_grid.c b/applications/ecl/grdecl_grid.c index e0f47dbb24..b174230a3b 100644 --- a/applications/ecl/grdecl_grid.c +++ b/applications/ecl/grdecl_grid.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Equinor ASA, Norway. - - The file 'grdecl_grid.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Equinor ASA, Norway. + + The file 'grdecl_grid.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/grdecl_test.c b/applications/ecl/grdecl_test.c index d7807da8e8..c8f42f4f53 100644 --- a/applications/ecl/grdecl_test.c +++ b/applications/ecl/grdecl_test.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Equinor ASA, Norway. - - The file 'grdecl_test.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Equinor ASA, Norway. + + The file 'grdecl_test.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/grid_dump.c b/applications/ecl/grid_dump.c index 56208273d9..a68bcc5880 100644 --- a/applications/ecl/grid_dump.c +++ b/applications/ecl/grid_dump.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'grid_info.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2011 Equinor ASA, Norway. + + The file 'grid_info.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/grid_dump_ascii.c b/applications/ecl/grid_dump_ascii.c index cbd1fca72f..cbbdfb5360 100644 --- a/applications/ecl/grid_dump_ascii.c +++ b/applications/ecl/grid_dump_ascii.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Equinor ASA, Norway. - - The file 'grid_dump_ascii.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Equinor ASA, Norway. + + The file 'grid_dump_ascii.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/grid_layer.c b/applications/ecl/grid_layer.c deleted file mode 100644 index 8ce2900c89..0000000000 --- a/applications/ecl/grid_layer.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'grid_layer.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include - -static void usage() { exit(1); } - -int main(int argc, char **argv) { - if (argc < 3) - usage(); - { - ecl_grid_type *ecl_grid = ecl_grid_alloc(argv[1]); - int nx, ny, nz; - int iarg; - { - const ecl_grid_type *lgr = ecl_grid_get_lgr(ecl_grid, "TROLLA"); - int i, j, k; - int global_cell; - global_cell = ecl_grid_get_parent_cell3(lgr, 9, 9, 5); - ecl_grid_get_ijk1(ecl_grid, global_cell, &i, &j, &k); - printf("Global cell(TROLLA , 10,10,6) = %d,%d,%d\n", i + 1, j + 1, - k + 1); - - global_cell = ecl_grid_get_parent_cell3(lgr, 9, 9, 2); - ecl_grid_get_ijk1(ecl_grid, global_cell, &i, &j, &k); - printf("Global cell(TROLLA , 10,10,3) = %d,%d,%d\n", i + 1, j + 1, - k + 1); - - global_cell = ecl_grid_get_parent_cell3(lgr, 25, 11, 0); - ecl_grid_get_ijk1(ecl_grid, global_cell, &i, &j, &k); - printf("Global cell(TROLLA , 26,12,1) = %d,%d,%d\n", i + 1, j + 1, - k + 1); - - lgr = ecl_grid_get_lgr(ecl_grid, "TROLLA2"); - global_cell = ecl_grid_get_parent_cell3(lgr, 9, 9, 2); - ecl_grid_get_ijk1(ecl_grid, global_cell, &i, &j, &k); - printf("Global cell(TROLLA2 , 10,10,3) = %d,%d,%d\n", i + 1, j + 1, - k + 1); - } - exit(1); - - ecl_grid_get_dims(ecl_grid, &nx, &ny, &nz, NULL); - for (iarg = 2; iarg < argc; iarg++) { - int k; - if (util_sscanf_int(argv[iarg], &k)) { - int i, j; - k--; - for (j = (ny - 1); j >= 0; j--) { - for (i = 0; i < nx; i++) { - if (ecl_grid_get_active_index3(ecl_grid, i, j, k) >= - 0) { - if ((i % 10) == 0) - printf("*"); - else - printf("X"); - } else - printf(" "); - } - printf("\n"); - } - } - } - } -} diff --git a/applications/ecl/key_list.c b/applications/ecl/key_list.c deleted file mode 100644 index 186f0bb377..0000000000 --- a/applications/ecl/key_list.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'key_list.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char **argv) { - const char *data_file = argv[1]; - - ecl_sum_type *ecl_sum = ecl_sum_fread_alloc_case(data_file, ":"); - if (ecl_sum != NULL) { - stringlist_type *keys = stringlist_alloc_new(); - - if (argc == 2) - ecl_sum_select_matching_general_var_list(ecl_sum, "*", keys); - else { - for (int iarg = 2; iarg < argc; iarg++) { - printf("Matchging:%s \n", argv[iarg]); - ecl_sum_select_matching_general_var_list(ecl_sum, argv[iarg], - keys); - } - } - - stringlist_sort(keys, NULL); - { - int i; - for (i = 0; i < stringlist_get_size(keys); i++) - printf("%s \n", stringlist_iget(keys, i)); - } - - stringlist_free(keys); - ecl_sum_free(ecl_sum); - } else - fprintf(stderr, "key_list.x: No summary data found for case:%s\n", - data_file); -} diff --git a/applications/ecl/load_test.c b/applications/ecl/load_test.c index 8b425f7816..ec278ce06b 100644 --- a/applications/ecl/load_test.c +++ b/applications/ecl/load_test.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'load_test.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2011 Equinor ASA, Norway. + + The file 'load_test.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/make_grid.c b/applications/ecl/make_grid.c index 985d498aaa..6745cdc4f9 100644 --- a/applications/ecl/make_grid.c +++ b/applications/ecl/make_grid.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Equinor ASA, Norway. - - The file 'make_grid.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Equinor ASA, Norway. + + The file 'make_grid.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/run_gravity.c b/applications/ecl/run_gravity.c deleted file mode 100644 index d536cf7162..0000000000 --- a/applications/ecl/run_gravity.c +++ /dev/null @@ -1,1094 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'run_gravity.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define WATER 1 -#define GAS 2 -#define OIL 4 - -#define ECLIPSE300 2 -#define ECLIPSE100 1 - -int simulator = ECLIPSE100; - -typedef struct { - double utm_x; - double utm_y; - double depth; - double grav_diff; - char *name; - bool has_obs; - double obs_gdiff; /* Measured difference in g. */ - double std_gdiff; /* Uncertainty in the observed g difference. */ -} grav_station_type; - -static void truncate_saturation(float *value) { - util_apply_float_limits(value, 0.0, 1.0); -} - -static bool has_phase(int phase_sum, int phase) { - if ((phase_sum & phase) == 0) - return false; - else - return true; -} - -static const float *safe_get_float_ptr(const ecl_kw_type *ecl_kw, - const float *alternative) { - if (ecl_kw != NULL) - return ecl_kw_get_float_ptr(ecl_kw); - else - return alternative; -} - -void print_usage(int line) { - printf("LINE: %d \n", line); - fprintf(stderr, "This program is used to calculate the change in " - "graviational response\n"); - fprintf(stderr, "between two timesteps in an eclipse simulation. To do the " - "calculations\n"); - fprintf(stderr, "the program needs the following information:\n"); - fprintf(stderr, "\n"); - fprintf(stderr, - " 1. Restart file(s) with solution data for the two timesteps.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, " 2. An EGRID or GRID file.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, " 3. An INIT file.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, " 4. A configuration file which lists at which " - "geographical locations\n"); - fprintf(stderr, " you want to measure the gravitational response. This " - "file should\n"); - fprintf(stderr, - " contain one position on each line, formatted as this:\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, - " name1 utm_x utm_y depth g_obs g_std \n"); - fprintf(stderr, - " name2 utm_x utm_y depth g_obs g_std \n"); - fprintf(stderr, " .....\n"); - fprintf(stderr, "\n"); - fprintf( - stderr, - " The name string is completely arbitrary - but can NOT contain\n"); - fprintf(stderr, " spaces. The two last columns - g_obs and g_std ar " - "optional, but\n"); - fprintf(stderr, " must be present on all lines - or on no lines. \n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "The required information should be passed from the user " - "with the help\n"); - fprintf( - stderr, - "of commandline arguments. This can be done in roughly speaking two\n"); - fprintf(stderr, "different ways:\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "All ECLIPSE files in one directory\n"); - fprintf(stderr, "----------------------------------\n"); - fprintf( - stderr, - "In the case where all the files are found in one directory you can\n"); - fprintf( - stderr, - "just give an ECLIPSE basename, and the run_gravity program will by\n"); - fprintf(stderr, "itself find the required restart/init/grid files. Observe " - "that both\n"); - fprintf(stderr, "unified and non-unified restart files will be checked. In " - "addition to\n"); - fprintf(stderr, "the ECLIPSE basename you must give two numbers indicating " - "which report\n"); - fprintf(stderr, "steps you are interested in comparing, and finally the " - "configuration\n"); - fprintf(stderr, "file with all the measurement positions.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Example:\n"); - fprintf(stderr, "\n"); - fprintf(stderr, " bash%% run_gravity.x BASE_CASE 10 178 " - "../config/grav_stations\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "This will look up restart/grid/init files in the current " - "dirtectory,\n"); - fprintf( - stderr, - "for a simulation with baseame 'BASE_CASE'. It will compare report\n"); - fprintf(stderr, - "steps 10 and 178, and load station locations from the file\n"); - fprintf(stderr, "'../config/grav_stations'. \n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "ECLIPSE files NOT in same directory\n"); - fprintf(stderr, "-----------------------------------\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "If the different ECLIPSE files are not in the same " - "directory you can\n"); - fprintf(stderr, "not let the run_gravity program find the required files " - "automatically,\n"); - fprintf(stderr, "and you must give all the required files as arguments on " - "the command\n"); - fprintf(stderr, "line. This is the most flexible approach, in addition to " - "files stored\n"); - fprintf( - stderr, - "different places this also allows to combine files with different\n"); - fprintf( - stderr, - "ECLISPE basenames. There are two different ways to enter restart\n"); - fprintf( - stderr, - "information, depending on whether you use unified or non-unified\n"); - fprintf(stderr, "restart files.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Example 1 (unified restart):\n"); - fprintf(stderr, "\n"); - fprintf(stderr, - " bash%% run_gravity.x /path/to/restart_files/CASE_3.UNRST 10 " - "178 /path/init/BASE_CASE.INIT /path/to/grid/BASE_CASE.EGRID " - "../config/stations.txt\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Example 2 (non-unified restart):\n"); - fprintf(stderr, "\n"); - fprintf(stderr, " bash%% run_gravity.x CASE_3.X0010 " - "../path/CASE_2.X0178 /path/init/BASE_CASE.INIT " - "/path/to/grid/BASE_CASE.EGRID ../config/stations.txt\n"); - fprintf(stderr, " \n"); - fprintf(stderr, "\n"); - fprintf(stderr, " When the program has completed succesfully it will " - "write the changes\n"); - fprintf(stderr, " in local gravity to a file 'RUN_GRAVITY.out', in " - "addition the same\n"); - fprintf(stderr, - " information (with something more) will be sent to stdout.\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - exit(1); -} - -static void grav_station_free__(void *arg) { - grav_station_type *grav = (grav_station_type *)arg; - free(grav->name); - free(grav); -} - -static grav_station_type *grav_station_alloc_new(const char *name, double x, - double y, double d) { - grav_station_type *s = util_malloc(sizeof *s); - s->name = util_alloc_string_copy(name); - s->utm_x = x; - s->utm_y = y; - s->depth = d; - s->grav_diff = 0.0; - s->obs_gdiff = 0.0; - s->std_gdiff = 0.0; - s->has_obs = false; - return s; -} - -static void grav_station_add_obs(grav_station_type *g, double obs, double std) { - g->obs_gdiff = obs; - g->std_gdiff = std; - g->has_obs = true; -} - -/** - The station information is in a file with the following rules: - - 1. Each station on a seperate line. - 2. For each station we have four items: ------ - name utm_x utm_y depth - - name is an arbitrary string - without spaces. -*/ - -static void load_stations(vector_type *grav_stations, const char *filename) { - printf("Loading from file:%s \n", filename); - { - int target_width; - FILE *stream = util_fopen(filename, "r"); - bool at_eof = false; - /** - When reading the first line we determine how many columns the - file contains. - */ - { - char *first_line = util_fscanf_alloc_line(stream, &at_eof); - char **token_list; - util_split_string(first_line, " \t", &target_width, &token_list); - util_free_stringlist(token_list, target_width); - fseek(stream, 0, SEEK_SET); - } - - while (!(at_eof)) { - double x, y, d; - double obs_gdiff, std_gdiff; - char station_name[32]; - int fscanf_return; - - if (target_width == 4) - fscanf_return = - fscanf(stream, "%s %lg %lg %lg", station_name, &x, &y, &d); - else - fscanf_return = - fscanf(stream, "%s %lg %lg %lg %lg %lg", station_name, &x, - &y, &d, &obs_gdiff, &std_gdiff); - - if (fscanf_return == target_width) { - grav_station_type *g = - grav_station_alloc_new(station_name, x, y, d); - if (target_width == 6) - grav_station_add_obs(g, obs_gdiff, std_gdiff); - - vector_append_owned_ref(grav_stations, g, grav_station_free__); - } else - at_eof = true; - } - fclose(stream); - } -} - -/** - This function will load, and return two ecl_file_type instances with the - restart information from the two relevant times. The input to this - function is a (char **) pointer, taken directly from the argv input - pointer. - - The function will start by calling ecl_util_get_file_type(input[0]), and - depending on the return value from this call it will follow three - different code-paths: - - - ECL_FILE_OTHER: This means that the first argument should be - interpreted not as an existing file name, but rather as an ECLIPSE - base name. The program will look for restart info in files in the - working directory with the following order: - - 1. Unified restart file - unformatted. - 2. Non unified restart files - unformatted. - 3. Unified restart file - formatted. - 4. Non unified restart files - formatted. - - The search will stop at the first success, if no restart - information is found the function will exit. The remaining - arguments in input[] will not be considered, but observe that the - use of ecl_base is signalled back to calling scope (through - reference), and the calling scope will look for GRID file and INIT - file also based on the ECLBASE found input[0]; formatted / - unformatted will be as returned from the four-way switch above. - - Example: - - bash% run_gravity ECLIPSE 10 128 xxxx - - - - ECL_RESTART_FILE: This means that input[0] is a non unified eclipse - restart file, this file will be loaded. And it is ASSUMED that - input[1] is the next non - unified restart file, loaded for the - next report step. - - Example: - - bash% run_gravity ECLIPSE.X0010 ECLIPSE.X0128 xxx - - - - ECL_UNIFIED_RESTART_FILE: This means that input[1] and input[2] are - interpreted as integers (i.e. report steps), and those two report - steps will be loaded from the unified restart file pointed to by - input[0]. - - Example: - - bash% run_gravity ECLIPSE.UNRST 10 128 xxx - - - - Observe that in all the examples above 'xxx' signifies argv arguments - which this function does not care about. The return the *arg_offset - variable will be set to indicate this index: - - char ** input = argv[1]; - int input_offset; - ecl_restart_file_type ** restart_info = load_restart_info(input , &input_offset, ...); - - Then the next argument is: input[input_offset]; -*/ - -ecl_file_type **load_restart_info( - const char **input, /* Input taken directly from argv */ - int input_length, /* The length of input. */ - int * - arg_offset, /* Integer - value corresponding to the *NEXT* element in input which should be used by the calling scope. */ - bool - *use_eclbase, /* Should input[0] be interpreted as an ECLBASE string? */ - bool * - fmt_file) { /* Only relevant if (*use_eclbase == true): was formatted file used? */ - - ecl_file_type **restart_files = util_calloc(2, sizeof *restart_files); - int report_nr; - ecl_file_enum file_type; - - *use_eclbase = false; - file_type = ecl_util_get_file_type(input[0], fmt_file, &report_nr); - - if (file_type == ECL_RESTART_FILE) { - /* Loading from two non-unified restart files. */ - if (input_length >= 2) { - file_type = ecl_util_get_file_type(input[1], fmt_file, &report_nr); - if (file_type == ECL_RESTART_FILE) { - restart_files[0] = ecl_file_open(input[0]); - restart_files[1] = ecl_file_open(input[1]); - *arg_offset = 2; - } else - print_usage(__LINE__); - } else - print_usage(__LINE__); - } else if (file_type == ECL_UNIFIED_RESTART_FILE) { - /* Loading from one unified restart file. */ - if (input_length >= 3) { - int report1, report2; - if ((util_sscanf_int(input[1], &report1) && - util_sscanf_int(input[2], &report2))) { - restart_files[0] = ecl_file_open(input[0]); - restart_files[1] = ecl_file_open(input[0]); - - ecl_file_select_rstblock_report_step(restart_files[0], report1); - ecl_file_select_rstblock_report_step(restart_files[1], report2); - *arg_offset = 3; - } else - print_usage(__LINE__); - } else - print_usage(__LINE__); - } else if (file_type == ECL_OTHER_FILE) { - if (input_length >= 3) { - int report1, report2; - if (!(util_sscanf_int(input[1], &report1) && - util_sscanf_int(input[2], &report2))) - print_usage(__LINE__); - else { - /* - input[0] is interpreted as an eclbase string, and not as the name of - an existing file. Go through various combinations of - unified/non-unified formatted/unformatted to find data. - */ - ecl_storage_enum storage_mode = ECL_INVALID_STORAGE; - const char *eclbase = input[0]; - char *unified_file = NULL; - char *file1 = NULL; - char *file2 = NULL; - - unified_file = ecl_util_alloc_filename( - NULL, eclbase, ECL_UNIFIED_RESTART_FILE, false, -1); - if (util_file_exists(unified_file)) - /* Binary unified */ - storage_mode = ECL_BINARY_UNIFIED; - else { - /* Binary non-unified */ - file1 = ecl_util_alloc_filename( - NULL, eclbase, ECL_RESTART_FILE, false, report1); - file2 = ecl_util_alloc_filename( - NULL, eclbase, ECL_RESTART_FILE, false, report2); - if ((util_file_exists(file1) && util_file_exists(file2))) - storage_mode = ECL_BINARY_NON_UNIFIED; - else { - free(unified_file); - /* ASCII unified */ - unified_file = ecl_util_alloc_filename( - NULL, eclbase, ECL_UNIFIED_RESTART_FILE, true, -1); - if (util_file_exists(unified_file)) - storage_mode = ECL_FORMATTED_UNIFIED; - else { - /* ASCII non unified */ - free(file1); - free(file2); - file1 = ecl_util_alloc_filename( - NULL, eclbase, ECL_RESTART_FILE, true, report1); - file2 = ecl_util_alloc_filename( - NULL, eclbase, ECL_RESTART_FILE, true, report2); - if ((util_file_exists(file1) && - util_file_exists(file2))) - storage_mode = ECL_FORMATTED_UNIFIED; - } - } - } - - if (storage_mode == ECL_INVALID_STORAGE) { - char *cwd = util_alloc_cwd(); - util_exit("Could not find any restart information for " - "ECLBASE:%s in %s \n", - eclbase, cwd); - free(cwd); - } - - if ((storage_mode == ECL_BINARY_UNIFIED) || - (storage_mode == ECL_FORMATTED_UNIFIED)) { - restart_files[0] = ecl_file_open(input[0]); - restart_files[1] = ecl_file_open(input[0]); - - if (!ecl_file_select_rstblock_report_step(restart_files[0], - report1)) - util_exit("Failed to load report:%d from %s \n", - report1, unified_file); - - if (!ecl_file_select_rstblock_report_step(restart_files[1], - report2)) - util_exit("Failed to load report:%d from %s \n", - report2, unified_file); - } else { - restart_files[0] = ecl_file_open(file1); - restart_files[1] = ecl_file_open(file2); - } - - *use_eclbase = true; - if ((storage_mode == ECL_BINARY_UNIFIED) || - (storage_mode == ECL_BINARY_NON_UNIFIED)) - *fmt_file = false; - else - *fmt_file = true; - - *arg_offset = 3; - - free(file1); - free(file2); - free(unified_file); - } - } - } - return restart_files; -} - -/* - This function calculates the gravimetric response for the - gravitation station given as input parameter grav_station. - - For code cleanliness the code is written in a way where this - function is called for every position we are interested in, - performance-wise it would be smarter to loop over the interesting - locations as the inner loop. - - This function does NOT check whether the restart_file / init_file - contains the necessary keywords - and will fail HARD if a required - keyword is not present. That the the input is well-formed should be - checked PRIOR to calling this function. -*/ - -static double gravity_response(const ecl_grid_type *ecl_grid, - const ecl_file_type *init_file, - const ecl_file_type *restart_file1, - const ecl_file_type *restart_file2, - const grav_station_type *grav_station, - int model_phases, int file_phases) { - - ecl_kw_type *rporv1_kw = NULL; - ecl_kw_type *rporv2_kw = NULL; - ecl_kw_type *oil_den1_kw = NULL; - ecl_kw_type *oil_den2_kw = NULL; - ecl_kw_type *gas_den1_kw = NULL; - ecl_kw_type *gas_den2_kw = NULL; - ecl_kw_type *wat_den1_kw = NULL; - ecl_kw_type *wat_den2_kw = NULL; - ecl_kw_type *sgas1_kw = NULL; - ecl_kw_type *sgas2_kw = NULL; - ecl_kw_type *swat1_kw = NULL; - ecl_kw_type *swat2_kw = NULL; - ecl_kw_type *aquifern_kw = NULL; - double local_deltag = 0; - - /* Extracting the pore volumes */ - rporv1_kw = ecl_file_iget_named_kw(restart_file1, "RPORV", 0); - rporv2_kw = ecl_file_iget_named_kw(restart_file2, "RPORV", 0); - - /** Extracting the densities */ - { - // OIL_DEN - if (has_phase(model_phases, OIL)) { - if (simulator == ECLIPSE100) { - oil_den1_kw = - ecl_file_iget_named_kw(restart_file1, "OIL_DEN", 0); - oil_den2_kw = - ecl_file_iget_named_kw(restart_file2, "OIL_DEN", 0); - } else { // ECLIPSE300 - oil_den1_kw = ecl_file_iget_named_kw(restart_file1, "DENO", 0); - oil_den2_kw = ecl_file_iget_named_kw(restart_file2, "DENO", 0); - }; - } - - // GAS_DEN - if (has_phase(model_phases, GAS)) { - if (simulator == ECLIPSE100) { - gas_den1_kw = - ecl_file_iget_named_kw(restart_file1, "GAS_DEN", 0); - gas_den2_kw = - ecl_file_iget_named_kw(restart_file2, "GAS_DEN", 0); - } else { // ECLIPSE300 - gas_den1_kw = ecl_file_iget_named_kw(restart_file1, "DENG", 0); - gas_den2_kw = ecl_file_iget_named_kw(restart_file2, "DENG", 0); - }; - } - - // WAT_DEN - if (has_phase(model_phases, WATER)) { - if (simulator == ECLIPSE100) { - wat_den1_kw = - ecl_file_iget_named_kw(restart_file1, "WAT_DEN", 0); - wat_den2_kw = - ecl_file_iget_named_kw(restart_file2, "WAT_DEN", 0); - } else { // ECLIPSE300 - wat_den1_kw = ecl_file_iget_named_kw(restart_file1, "DENW", 0); - wat_den2_kw = ecl_file_iget_named_kw(restart_file2, "DENW", 0); - }; - } - } - - /* Extracting the saturations */ - { - // SGAS - if (has_phase(file_phases, GAS)) { - sgas1_kw = ecl_file_iget_named_kw(restart_file1, "SGAS", 0); - sgas2_kw = ecl_file_iget_named_kw(restart_file2, "SGAS", 0); - } - - // SWAT - if (has_phase(file_phases, WATER)) { - swat1_kw = ecl_file_iget_named_kw(restart_file1, "SWAT", 0); - swat2_kw = ecl_file_iget_named_kw(restart_file2, "SWAT", 0); - } - } - - /* The numerical aquifer information */ - if (ecl_file_has_kw(init_file, "AQUIFERN")) - aquifern_kw = ecl_file_iget_named_kw(init_file, "AQUIFERN", 0); - { - int nactive = ecl_grid_get_active_size(ecl_grid); - float *zero = util_calloc( - nactive, - sizeof *zero); /* Fake vector of zeros used for densities / sturations when you do not have data. */ - int *int_zero = util_calloc( - nactive, - sizeof *int_zero); /* Fake vector of zeros used for AQUIFER when the init file does not supply data. */ - /* - Observe that the fake vectors are only a coding simplification, - they should not be really used. - */ - - { - int i; - for (i = 0; i < nactive; i++) { - zero[i] = 0; - int_zero[i] = 0; - } - } - { - const float *sgas1_v = safe_get_float_ptr(sgas1_kw, NULL); - const float *swat1_v = safe_get_float_ptr(swat1_kw, NULL); - const float *oil_den1 = safe_get_float_ptr(oil_den1_kw, zero); - const float *gas_den1 = safe_get_float_ptr(gas_den1_kw, zero); - const float *wat_den1 = safe_get_float_ptr(wat_den1_kw, zero); - - const float *sgas2_v = safe_get_float_ptr(sgas2_kw, NULL); - const float *swat2_v = safe_get_float_ptr(swat2_kw, NULL); - const float *oil_den2 = safe_get_float_ptr(oil_den2_kw, zero); - const float *gas_den2 = safe_get_float_ptr(gas_den2_kw, zero); - const float *wat_den2 = safe_get_float_ptr(wat_den2_kw, zero); - - const float *rporv1 = ecl_kw_get_float_ptr(rporv1_kw); - const float *rporv2 = ecl_kw_get_float_ptr(rporv2_kw); - double utm_x = grav_station->utm_x; - double utm_y = grav_station->utm_y; - double tvd = grav_station->depth; - - int *aquifern; - int global_index; - - if (aquifern_kw != NULL) - aquifern = ecl_kw_get_int_ptr(aquifern_kw); - else - aquifern = int_zero; - - for (global_index = 0; - global_index < ecl_grid_get_global_size(ecl_grid); - global_index++) { - const int act_index = - ecl_grid_get_active_index1(ecl_grid, global_index); - if (act_index >= 0) { - - // Not numerical aquifer - if (aquifern[act_index] >= 0) { - float swat1 = swat1_v[act_index]; - float swat2 = swat2_v[act_index]; - float sgas1 = 0; - float sgas2 = 0; - float soil1 = 0; - float soil2 = 0; - - truncate_saturation(&swat1); - truncate_saturation(&swat2); - - if (has_phase(model_phases, GAS)) { - if (has_phase(file_phases, GAS)) { - sgas1 = sgas1_v[act_index]; - sgas2 = sgas2_v[act_index]; - truncate_saturation(&sgas1); - truncate_saturation(&sgas2); - } else { - sgas1 = 1 - swat1; - sgas2 = 1 - swat2; - } - } - - if (has_phase(model_phases, OIL)) { - soil1 = 1 - sgas1 - swat1; - soil2 = 1 - sgas2 - swat2; - truncate_saturation(&soil1); - truncate_saturation(&soil2); - } - - /* - We have found all the info we need for one cell. - */ - - { - double mas1, mas2; - double xpos, ypos, zpos; - - mas1 = rporv1[act_index] * - (soil1 * oil_den1[act_index] + - sgas1 * gas_den1[act_index] + - swat1 * wat_den1[act_index]); - mas2 = rporv2[act_index] * - (soil2 * oil_den2[act_index] + - sgas2 * gas_den2[act_index] + - swat2 * wat_den2[act_index]); - - ecl_grid_get_xyz1(ecl_grid, global_index, &xpos, - &ypos, &zpos); - { - double dist_x = xpos - utm_x; - double dist_y = ypos - utm_y; - double dist_d = zpos - tvd; - double dist_sq = dist_x * dist_x + - dist_y * dist_y + - dist_d * dist_d; - - if (dist_sq == 0) { - exit(1); - } - local_deltag += - 6.67428E-3 * (mas2 - mas1) * dist_d / - pow(dist_sq, - 1.5); // Gravity in units of \mu Gal = 10^{-8} m/s^2 - } - } - } - } - } - } - free(zero); - free(int_zero); - } - return local_deltag; -} - -static void *gravity_response_mt(void *arg) { - arg_pack_type *arg_pack = arg_pack_safe_cast(arg); - vector_type *grav_stations = arg_pack_iget_ptr(arg_pack, 0); - const ecl_grid_type *ecl_grid = arg_pack_iget_ptr(arg_pack, 1); - const ecl_file_type *init_file = arg_pack_iget_ptr(arg_pack, 2); - ecl_file_type **restart_files = arg_pack_iget_ptr(arg_pack, 3); - int station1 = arg_pack_iget_int(arg_pack, 4); - int station2 = arg_pack_iget_int(arg_pack, 5); - int model_phases = arg_pack_iget_int(arg_pack, 6); - int file_phases = arg_pack_iget_int(arg_pack, 7); - - int station_nr; - for (station_nr = station1; station_nr < station2; station_nr++) { - grav_station_type *gs = vector_iget(grav_stations, station_nr); - - gs->grav_diff = - gravity_response(ecl_grid, init_file, restart_files[0], - restart_files[1], gs, model_phases, file_phases); - } - return NULL; -} - -/* - Validate input: - --------------- - This function tries to verify that the restart_files contain all - the necessary information. The required keywords are: - - 1. The restart files must contain RPORV and XXX_DEN (see info - about phases below). - - 2. The init file must contain the PORV keyword - this is only used - to check for the ECLIPSE_2008 bug in RPORV calculations. - - - - Determine phases: - ----------------- - Look at the restart files to determine which phases are - present. The restart files generally only contain (n - 1) phases, - i.e. for a WATER-OIL-GAS system the restart files will contain SGAS - and SWAT, but not SOIL. - - We must determine which phases are in the model, that is determined - by looking for the densities OIL_DEN, WAT_DEN and GAS_DEN. This is - stored in the variable model_phases. In addition we must determine - which saturations can be found in the restart files, that is stored - in the file_phases variable. The variables model_phases and - file_phases are returned by reference. - - - If the input is valid, the function will return zero, otherwise it - will return a non-zero error code: (ehhh - it will exit currently). - -*/ - -static int gravity_check_input(const ecl_grid_type *ecl_grid, - const ecl_file_type *init_file, - const ecl_file_type *restart_file1, - const ecl_file_type *restart_file2, - int *__model_phases, int *__file_phases) { - { - int model_phases = 0; - int file_phases = 0; - - /* Check which phases are present in the model */ - if (ecl_file_has_kw(restart_file1, "OIL_DEN")) { - model_phases += OIL; - simulator = ECLIPSE100; - } else if (ecl_file_has_kw(restart_file1, "DENO")) { - model_phases += OIL; - simulator = ECLIPSE300; - }; - - if (ecl_file_has_kw(restart_file1, "WAT_DEN")) { - model_phases += WATER; - simulator = ECLIPSE100; - } else if (ecl_file_has_kw(restart_file1, "DENW")) { - model_phases += WATER; - simulator = ECLIPSE300; - }; - - if (ecl_file_has_kw(restart_file1, "GAS_DEN")) { - model_phases += GAS; - simulator = ECLIPSE100; - } else if (ecl_file_has_kw(restart_file1, "DENG")) { - model_phases += GAS; - simulator = ECLIPSE300; - }; - - /* Check which phases are present in the restart files. We assume the restart file NEVER has SOIL information */ - if (ecl_file_has_kw(restart_file1, "SWAT")) - file_phases += WATER; - if (ecl_file_has_kw(restart_file1, "SGAS")) - file_phases += GAS; - - /* Consiency check */ - { - /** - The following assumptions are made: - - 1. All restart files should have water, i.e. the SWAT keyword. - 2. All phases present in the restart file should also be present as densities, - in addition the model must contain one additional phase. - 3. The restart files can never contain oil saturation. - - */ - if (!has_phase(file_phases, WATER)) - util_exit("Could not locate SWAT keyword in restart files\n"); - - if (has_phase(file_phases, OIL)) - util_exit("Can not handle restart files with SOIL keyword\n"); - - if (!has_phase(model_phases, WATER)) - util_exit( - "Could not locate WAT_DEN keyword in restart files\n"); - - if (has_phase(file_phases, GAS)) { - /** Restart file has both water and gas - means we need all three densities. */ - if (!(has_phase(model_phases, GAS) && - has_phase(model_phases, OIL))) - util_exit("Could not find GAS_DEN and OIL_DEN keywords in " - "restart files\n"); - } else { - /* This is (water + oil) or (water + gas) system. We enforce one of the densities.*/ - if (!has_phase(model_phases, GAS + OIL)) - util_exit("Could not find either GAS_DEN or OIL_DEN " - "kewyords in restart files\n"); - } - } - *__model_phases = model_phases; - *__file_phases = file_phases; - } - - /* Check that the restart files have RPORV information. This is ensured by giving the argument RPORV to the RPTRST keyword. */ - if (!(ecl_file_has_kw(restart_file1, "RPORV") && - ecl_file_has_kw(restart_file2, "RPORV"))) - util_exit("Sorry: the restartfiles do not contain RPORV\n"); - - /** - Check that the rporv values are in the right ballpark. For - ECLIPSE version 2008.2 they are way off. Check PORV - versus RPORV for ten 'random' locations in the grid. - */ - { - const ecl_kw_type *rporv1_kw = - ecl_file_iget_named_kw(restart_file1, "RPORV", 0); - const ecl_kw_type *rporv2_kw = - ecl_file_iget_named_kw(restart_file2, "RPORV", 0); - const ecl_kw_type *init_porv_kw = - ecl_file_iget_named_kw(init_file, "PORV", 0); - - int active_index; - int active_delta; - int active_size; - - ecl_grid_get_dims(ecl_grid, NULL, NULL, NULL, &active_size); - active_delta = active_size / 12; - for (active_index = active_delta; active_index < active_size; - active_index += active_delta) { - int global_index = - ecl_grid_get_global_index1A(ecl_grid, active_index); - double init_porv = ecl_kw_iget_as_double( - init_porv_kw, - global_index); /* NB - this uses global indexing. */ - double rporv1 = ecl_kw_iget_as_double(rporv1_kw, active_index); - double rporv2 = ecl_kw_iget_as_double(rporv2_kw, active_index); - double rporv12 = 0.5 * (rporv1 + rporv2); - double fraction = util_double_min(init_porv, rporv12) / - util_double_max(init_porv, rporv12); - - if (fraction < 0.50) { - fprintf(stderr, "----------------------------------------------" - "-------------------\n"); - fprintf(stderr, "INIT PORV: %g \n", init_porv); - fprintf(stderr, "RPORV1 : %g \n", rporv1); - fprintf(stderr, "RPORV2 : %g \n", rporv2); - fprintf(stderr, "Hmmm - the RPORV values extracted from the " - "restart file seem to be \n"); - fprintf(stderr, "veeery different from the initial rporv " - "value. This might indicated\n"); - fprintf(stderr, "an ECLIPSE bug. Version 2007.2 is known to be " - "ok in this respect, \n"); - fprintf(stderr, - "whereas version 2008.2 is known to have a bug. \n"); - fprintf(stderr, "----------------------------------------------" - "-------------------\n"); - exit(1); - } - } - } - - return 0; -} - -void install_SIGNALS(void) { - signal( - SIGSEGV, - util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */ - signal(SIGINT, util_abort_signal); /* Control C */ - signal( - SIGTERM, - util_abort_signal); /* If killing the program with SIGTERM (the default kill signal) you will get a backtrace. - Killing with SIGKILL (-9) will not give a backtrace.*/ -} - -int main(int argc, char **argv) { - install_SIGNALS(); - - if (argc > 1) { - if (strcmp(argv[1], "-h") == 0) - print_usage(__LINE__); - } - - if (argc < 2) - print_usage(__LINE__); - - else { - char **input = &argv[1]; /* Skipping the name of the executable */ - int input_length = argc - 1; - int input_offset = 0; - bool use_eclbase, fmt_file; - - const char *report_filen = "RUN_GRAVITY.out"; - - ecl_file_type **restart_files; - ecl_file_type *init_file; - ecl_grid_type *ecl_grid; - - int model_phases; - int file_phases; - vector_type *grav_stations = vector_alloc_new(); - - /* Restart info */ - restart_files = - load_restart_info((const char **)input, input_length, &input_offset, - &use_eclbase, &fmt_file); - - /* INIT and GRID/EGRID files */ - { - char *grid_filename = NULL; - char *init_filename = NULL; - if (use_eclbase) { - /* - The first command line argument is interpreted as ECLBASE, and we - search for grid and init files in cwd. - */ - init_filename = ecl_util_alloc_exfilename_anyfmt( - NULL, input[0], ECL_INIT_FILE, fmt_file, -1); - grid_filename = ecl_util_alloc_exfilename_anyfmt( - NULL, input[0], ECL_EGRID_FILE, fmt_file, -1); - if (grid_filename == NULL) - grid_filename = ecl_util_alloc_exfilename_anyfmt( - NULL, input[0], ECL_GRID_FILE, fmt_file, -1); - - if ((init_filename == NULL) || - (grid_filename == NULL)) /* Means we could not find them. */ - util_exit("Could not find INIT or GRID|EGRID file \n"); - } else { - if ((input_length - input_offset) > 1) { - init_filename = util_alloc_string_copy(input[input_offset]); - grid_filename = - util_alloc_string_copy(input[input_offset + 1]); - input_offset += 2; - } else - print_usage(__LINE__); - } - - init_file = ecl_file_open(init_filename); - ecl_grid = ecl_grid_alloc(grid_filename); - free(init_filename); - free(grid_filename); - } - - // Load the station_file - if (input_length > input_offset) { - char *station_file = input[input_offset]; - if (util_file_exists(station_file)) - load_stations(grav_stations, station_file); - else - util_exit("Can not find file:%s \n", station_file); - } else - print_usage(__LINE__); - - /** - OK - now everything is loaded - check that all required - keywords+++ are present. - */ - gravity_check_input(ecl_grid, init_file, restart_files[0], - restart_files[1], &model_phases, &file_phases); - - /* - OK - now it seems the provided files have all the information - we need. Let us start using it. The main loop is run in - parallell on four threads - most people have four cores these - days. - */ - { - int i; - int num_threads = 4; - thread_pool_type *tp = thread_pool_alloc(num_threads, true); - arg_pack_type **arg_list = - util_calloc(num_threads, sizeof *arg_list); - { - int station_delta = - vector_get_size(grav_stations) / num_threads; - for (i = 0; i < num_threads; i++) { - int station1 = i * station_delta; - int station2 = station1 + station_delta; - if (i == num_threads) - station2 = vector_get_size(grav_stations); - - arg_list[i] = arg_pack_alloc(); - - arg_pack_append_ptr(arg_list[i], grav_stations); - arg_pack_append_ptr(arg_list[i], ecl_grid); - arg_pack_append_ptr(arg_list[i], init_file); - arg_pack_append_ptr(arg_list[i], restart_files); - arg_pack_append_int(arg_list[i], station1); - arg_pack_append_int(arg_list[i], station2); - arg_pack_append_int(arg_list[i], model_phases); - arg_pack_append_int(arg_list[i], file_phases); - - thread_pool_add_job(tp, gravity_response_mt, arg_list[i]); - } - } - thread_pool_join(tp); - for (i = 0; i < num_threads; i++) - arg_pack_free(arg_list[i]); - free(arg_list); - } - - { - FILE *stream = util_fopen(report_filen, "w"); - int station_nr; - double total_chisq = 0; - for (station_nr = 0; station_nr < vector_get_size(grav_stations); - station_nr++) { - const grav_station_type *g_s = - vector_iget_const(grav_stations, station_nr); - fprintf(stream, "%f", g_s->grav_diff); - printf("DELTA_G %4s[%02d]: %12.6f %12.6f %12.6f %12.6f", - g_s->name, station_nr, g_s->grav_diff, g_s->utm_x, - g_s->utm_y, g_s->depth); - - if (g_s->has_obs) { - double y = - (g_s->grav_diff - g_s->obs_gdiff) / g_s->std_gdiff; - double chi_sq = y * y; - total_chisq += chi_sq; - fprintf(stream, " %g", chi_sq); - printf(" %g", chi_sq); - } - - fprintf(stream, " \n"); - printf("\n"); - } - if (total_chisq > 0) { - printf("Total chisq misfit: %g \n", total_chisq); - } - fclose(stream); - } - - vector_free(grav_stations); - ecl_grid_free(ecl_grid); - ecl_file_close(restart_files[0]); - ecl_file_close(restart_files[1]); - free(restart_files); - ecl_file_close(init_file); - } -} diff --git a/applications/ecl/select_test.c b/applications/ecl/select_test.c index d01704f831..6c31ebe3ff 100644 --- a/applications/ecl/select_test.c +++ b/applications/ecl/select_test.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Equinor ASA, Norway. - - The file 'select_test.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Equinor ASA, Norway. + + The file 'select_test.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/applications/ecl/summary2csv2.c b/applications/ecl/summary2csv2.c deleted file mode 100644 index 49aa32a504..0000000000 --- a/applications/ecl/summary2csv2.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - Copyright (C) 2013 Equinor ASA, Norway. - The file 'summary2csv2.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include -#include -#include - -#include -#include - -#include - -static void fprintf_line(const ecl_sum_type *ecl_sum, - const ecl_sum_fmt_type *fmt, const char *well, - int time_index, const stringlist_type *var_list, - FILE *stream) { - /* WELL */ - fprintf(stream, fmt->header_fmt, well); - fprintf(stream, fmt->sep); - - /* DAYS */ - fprintf(stream, fmt->days_fmt, ecl_sum_iget_sim_days(ecl_sum, time_index)); - fprintf(stream, fmt->sep); - - /* DATE */ - { - struct tm ts; - const int DATE_STRING_LENGTH = 128; - char *date_string = - util_malloc(DATE_STRING_LENGTH * sizeof *date_string); - time_t sim_time = ecl_sum_iget_sim_time(ecl_sum, time_index); - util_localtime(&sim_time, &ts); - strftime(date_string, DATE_STRING_LENGTH - 1, fmt->date_fmt, &ts); - fprintf(stream, date_string); - free(date_string); - } - - { - int ivar; - for (ivar = 0; ivar < stringlist_get_size(var_list); ivar++) { - const char *var = stringlist_iget(var_list, ivar); - double value = 0; - if (ecl_sum_has_well_var(ecl_sum, well, var)) - value = ecl_sum_get_well_var(ecl_sum, time_index, well, var); - else - fprintf(stderr, - "Missing variable:%s for well:%s - substituting 0.0 \n", - var, well); - - fprintf(stream, fmt->sep); - fprintf(stream, fmt->value_fmt, value); - } - fprintf(stream, fmt->newline); - } -} - -int main(int argc, char **argv) { - { - ecl_sum_fmt_type fmt; - bool include_restart = true; - int arg_offset = 1; - - if (argc != 2) { - printf("You must supply the name of a case as:\n\n " - "summary2csv.exe ECLIPSE_CASE\n\nThe case can optionally " - "contain a leading path component.\n"); - exit(1); - } - - { - char *data_file = argv[arg_offset]; - ecl_sum_type *ecl_sum; - stringlist_type *var_list = stringlist_alloc_new(); - - stringlist_append_ref(var_list, "WOPR"); - stringlist_append_ref(var_list, "WOPT"); - stringlist_append_ref(var_list, "WGPR"); - stringlist_append_ref(var_list, "WGPT"); - stringlist_append_ref(var_list, "WWPR"); - stringlist_append_ref(var_list, "WWPT"); - - ecl_sum_fmt_init_csv(&fmt); - ecl_sum = - ecl_sum_fread_alloc_case__(data_file, ":", include_restart); - if (ecl_sum != NULL) { - char *csv_file = util_alloc_filename( - NULL, ecl_sum_get_base(ecl_sum), - "txt"); // Will save to current path; can use ecl_sum_get_path() to save to target path instead. - FILE *stream = util_fopen(csv_file, "w"); - - stringlist_type *well_list = - ecl_sum_alloc_well_list(ecl_sum, NULL); - stringlist_type *key_list = stringlist_alloc_new(); - - fprintf(stream, fmt.header_fmt, "WELLNAME"); - - fprintf(stream, fmt.sep); - fprintf(stream, fmt.header_fmt, "DAYS"); - - fprintf(stream, fmt.sep); - fprintf(stream, fmt.header_fmt, "DATES"); - - { - int ivar; - for (ivar = 0; ivar < stringlist_get_size(var_list); - ivar++) { - const char *var = stringlist_iget(var_list, ivar); - fprintf(stream, fmt.sep); - fprintf(stream, fmt.header_fmt, var); - } - fprintf(stream, "\n"); - } - - { - int iw; - for (iw = 0; iw < stringlist_get_size(well_list); iw++) { - const char *well = stringlist_iget(well_list, iw); - if (ecl_sum_is_oil_producer(ecl_sum, well)) { - int time_index; - for (time_index = 0; - time_index < ecl_sum_get_data_length(ecl_sum); - time_index++) - fprintf_line(ecl_sum, &fmt, well, time_index, - var_list, stream); - } - } - } - - stringlist_free(well_list); - stringlist_free(key_list); - ecl_sum_free(ecl_sum); - fclose(stream); - free(csv_file); - } else - fprintf(stderr, - "summary2csv2: No summary data found for case:%s\n", - data_file); - - stringlist_free(var_list); - } - } -} diff --git a/applications/ecl/view_restart.c b/applications/ecl/view_restart.c deleted file mode 100644 index c0d2b267d7..0000000000 --- a/applications/ecl/view_restart.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'view_restart.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include -#include -#include - -int main(int argc, char **argv) { - if (argc < 3) - util_exit("Usage: PRESSURE:10,5,17 SWAT:10,5,7 ...\n"); - { - // Broken ... ecl_grid_type * ecl_grid = NULL; - // Broken ... int num_restart_files; - // Broken ... char ** restart_files; - // Broken ... { - // Broken ... const char * first_arg = argv[1]; - // Broken ... char * base; - // Broken ... char * path; - // Broken ... ecl_file_enum file_type; - // Broken ... - // Broken ... ecl_util_get_file_type(first_arg , &file_type , NULL , NULL); - // Broken ... if (file_type == ecl_grid_file || file_type == ecl_egrid_file) - // Broken ... ecl_grid = ecl_grid_alloc( first_arg , true ); - // Broken ... - // Broken ... util_alloc_file_components(first_arg , &path , &base , NULL); - // Broken ... - // Broken ... ecl_util_alloc_restart_files(path , base , &restart_files , &num_restart_files , NULL , NULL); - // Broken ... ecl_util_get_file_type(restart_files[0] , &file_type , NULL , NULL); - // Broken ... { - // Broken ... const char ** arg_list = (const char **) &argv[2]; - // Broken ... char ** kw_list; - // Broken ... int * index_list; - // Broken ... int num_kw = argc - 2; - // Broken ... ecl_fstate_type * fstate = ecl_fstate_fread_alloc(num_restart_files , (const char **) restart_files , file_type , true , true); - // Broken ... int num_blocks = ecl_fstate_get_size(fstate); - // Broken ... int iblock; - // Broken ... - // Broken ... /* - // Broken ... Finding the indices ... - // Broken ... */ - // Broken ... kw_list = util_malloc(num_kw * sizeof * kw_list , __func__); - // Broken ... index_list = util_malloc(num_kw * sizeof * index_list , __func__); - // Broken ... { - // Broken ... char ** tokens; - // Broken ... int num_tokens; - // Broken ... for (int ikw = 0; ikw < num_kw; ikw++) { - // Broken ... util_split_string(arg_list[ikw] , ":" , &num_tokens , &tokens); - // Broken ... if (num_tokens != 2) - // Broken ... util_exit("Failed to parse \"%s\" as KEWYORD:INDEX \n", arg_list[ikw]); - // Broken ... kw_list[ikw] = util_alloc_string_copy( tokens[0] ); - // Broken ... { - // Broken ... int *ijk , num_coord; - // Broken ... ijk = util_sscanf_alloc_active_list( tokens[1] , &num_coord ); - // Broken ... if (ecl_grid == NULL) { - // Broken ... if (num_coord != 1) - // Broken ... util_exit("Failed to extract one integer from: %s \n",tokens[1]); - // Broken ... else - // Broken ... index_list[ikw] = ijk[0]; - // Broken ... } else { - // Broken ... if (num_coord == 1) - // Broken ... index_list[ikw] = ecl_grid_get_active_index_from_global(ecl_grid , ijk[0]); - // Broken ... else if (num_coord == 3) { - // Broken ... int i = ijk[0] - 1; - // Broken ... int j = ijk[1] - 1; - // Broken ... int k = ijk[2] - 1; - // Broken ... - // Broken ... index_list[ikw] = ecl_grid_get_active_index(ecl_grid , i,j,k); - // Broken ... } else - // Broken ... util_exit("Failed to parse \"%s\" as one or three integers.\n",tokens[1]); - // Broken ... } - // Broken ... free(ijk); - // Broken ... } - // Broken ... - // Broken ... - // Broken ... index_list[ikw] = 100; /* ... */ - // Broken ... util_free_stringlist(tokens , num_tokens); - // Broken ... } - // Broken ... } - // Broken ... - // Broken ... for (iblock = 0; iblock < num_blocks; iblock++) { - // Broken ... ecl_block_type * ecl_block = ecl_fstate_iget_block( fstate , iblock); - // Broken ... time_t sim_time = ecl_block_get_sim_time(ecl_block); - // Broken ... int day,month,year , report_step; - // Broken ... double sim_days; - // Broken ... - // Broken ... sim_days = ecl_block_get_sim_days(ecl_block); - // Broken ... report_step = ecl_block_get_report_nr( ecl_block ); - // Broken ... util_set_date_values( sim_time , &day , &month , &year); - // Broken ... printf("%04d %02d/%02d/%04d %9.3f ",report_step , day , month , year , sim_days ); - // Broken ... - // Broken ... for (int ikw = 0; ikw < num_kw; ikw++) { - // Broken ... ecl_kw_type * ecl_kw = ecl_block_iget_kw(ecl_block , kw_list[ikw] , 0); - // Broken ... printf(" %14.6f ", ecl_kw_iget_float(ecl_kw , index_list[ikw])); - // Broken ... } - // Broken ... printf("\n"); - // Broken ... } - // Broken ... ecl_fstate_free(fstate); - // Broken ... } - // Broken ... } - } -} diff --git a/applications/ecl/view_rft.c b/applications/ecl/view_rft.c deleted file mode 100644 index 7a43f08a1e..0000000000 --- a/applications/ecl/view_rft.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'view_rft.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#include -#include -#include -#include - -int main(int argc, char **argv) { - - if (argc != 2) - util_exit("Usage: rft.x BASENAME \n"); - { - char *input_file = argv[1]; - char *file_name = NULL; - ecl_file_enum input_type; - - ecl_rft_file_type *rft_file; - - input_type = ecl_util_get_file_type(input_file, NULL, NULL); - if (input_type == ECL_RFT_FILE) - file_name = util_alloc_string_copy(input_file); - else { - char *base; - char *path; - char *rft_file_formatted; - char *rft_file_unformatted; - - util_alloc_file_components(input_file, &path, &base, NULL); - rft_file_formatted = - ecl_util_alloc_filename(path, base, ECL_RFT_FILE, true, -1); - rft_file_unformatted = - ecl_util_alloc_filename(path, base, ECL_RFT_FILE, false, -1); - - if (util_file_exists(rft_file_formatted) && - util_file_exists(rft_file_unformatted)) - file_name = util_alloc_string_copy( - util_newest_file(rft_file_formatted, rft_file_unformatted)); - else if (util_file_exists(rft_file_formatted)) - file_name = util_alloc_string_copy(rft_file_formatted); - else if (util_file_exists(rft_file_unformatted)) - file_name = util_alloc_string_copy(rft_file_unformatted); - else - util_exit("Could not find RFT files: %s/%s \n", - rft_file_formatted, rft_file_unformatted); - - free(rft_file_formatted); - free(rft_file_unformatted); - free(base); - free(path); - } - - rft_file = ecl_rft_file_alloc(file_name); - ecl_rft_file_summarize(rft_file, true); - ecl_rft_file_free(rft_file); - } -} diff --git a/applications/ecl/vprofile.c b/applications/ecl/vprofile.c deleted file mode 100644 index cc673102c0..0000000000 --- a/applications/ecl/vprofile.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - Copyright (C) 2011 Equinor ASA, Norway. - - The file 'vprofile.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ -#include - -#include -#include -#include - -#include -#include -#include -#include - -static void usage() { - printf( - "-----------------------------------------------------------------\n"); - printf( - "This little program can be used to extract vertical properties of\n"); - printf("solution data from ECLIPSE restart files. The program needs the\n"); - printf("following input, from the commandline:\n"); - printf("\n"); - printf(" 1. The i,j coordinates you are interested in.\n"); - printf("\n"); - printf(" 2. The ECLIPSE basename - this can either be just the basename, " - "or an\n"); - printf(" arbitrary ECLIPSE file with the correct basename. (Can contain " - "a\n"); - printf(" leading path part).\n"); - printf("\n"); - printf(" 3. The keyword you want to extract, this will typically be SWAT, " - "SGAS\n"); - printf(" or PRESSURE.\n"); - printf("\n"); - printf(" 4. A filename (can contain a path component) for the profile\n"); - printf(" files. This filename MUST contain a %%d format specifier which " - "will\n"); - printf(" be replaced with the report step.\n"); - printf("\n"); - printf(" 5. The timesteps you want to consider.\n"); - printf("\n"); - printf("\n"); - printf("Example:\n"); - printf("--------\n"); - printf("\n"); - printf(" bash%% vprofile 10 5 MODEL1.DATA SWAT profiles/SWAT_%%04d 0 10 " - "20 30 40 50 60 \n"); - printf("\n"); - printf("This will load vertical profiles for i=10 and j=5. The results " - "will be\n"); - printf( - "loaded from a simulation with basename 'MODEL1'. It will load the\n"); - printf("keyword 'SWAT', the profiles will be written to the the files:\n"); - printf("\n"); - printf(" profiles/swat_0000\n"); - printf(" profiles/swat_0010\n"); - printf(" profiles/swat_0020\n"); - printf(" ....\n"); - printf(" profiles/swat_0060\n"); - printf("\n"); - printf( - "The profile files will contain two columns, the keyword you have\n"); - printf("have asked for and the depth. The i,j must be from the global " - "grid, but (if\n"); - printf("available) LGR information will be used for the profiles. The " - "program\n"); - printf("works roughly as follows:\n"); - printf("\n"); - printf(" 1. Based on the ECLIPSE basename the program will look for an " - "EGRID,\n"); - printf(" alternatively GRID file, and load this.\n"); - printf("\n"); - printf(" 2. Will load restart information based on the timesteps given by " - "the\n"); - printf(" user. The program will first look for a unified restart file, " - "and\n"); - printf(" then subsequently for non unified files.\n"); - printf("\n"); - printf(" 3. Scans thorough the timesteps/profiles and creates output " - "files. \n"); - printf(" \n"); - printf("Observe that the program ONLY looks for unformatted files.\n"); - printf( - "-----------------------------------------------------------------\n"); - exit(1); -} - -static void vprofile__(int i, int j, const ecl_grid_type *ecl_grid, - const ecl_file_type *ecl_file, const char *kw, - double_vector_type *depth, double_vector_type *profile) { - int k; - int nz = ecl_grid_get_nz(ecl_grid); - ecl_kw_type *ecl_kw = - ecl_file_iget_named_kw(ecl_file, kw, ecl_grid_get_grid_nr(ecl_grid)); - for (k = 0; k < nz; k++) { - int active_index = ecl_grid_get_active_index3(ecl_grid, i, j, k); - if (active_index >= 0) { - ecl_grid_type *lgr = ecl_grid_get_cell_lgr3(ecl_grid, i, j, k); - if (lgr != NULL) { - /* Recursive dive .. */ - double x, y, z; - int lgr_i, lgr_j, lgr_k, lgr_global; - - ecl_grid_get_xyz3(ecl_grid, i, j, k, &x, &y, &z); - lgr_global = - ecl_grid_get_global_index_from_xyz(lgr, x, y, z, 0); - if (lgr_global < 0) - util_exit( - "Hmmmm - could not locate point: %g,%g,%g in lgr:%s \n", - x, y, z, ecl_grid_get_name(lgr)); - - ecl_grid_get_ijk1(lgr, lgr_global, &lgr_i, &lgr_j, &lgr_k); - vprofile__(lgr_i, lgr_j, lgr, ecl_file, kw, depth, profile); - } - - double_vector_append(depth, - ecl_grid_get_cdepth3(ecl_grid, i, j, k)); - double_vector_append(profile, - ecl_kw_iget_as_double(ecl_kw, active_index)); - } - } -} - -static void vprofile(int i, int j, const ecl_grid_type *ecl_grid, - const ecl_file_type *ecl_file, const char *kw, int tstep, - path_fmt_type *output_fmt) { - if (ecl_file_has_kw(ecl_file, kw)) { - double_vector_type *depth = double_vector_alloc(0, 0); - double_vector_type *profile = double_vector_alloc(0, 0); - vprofile__(i, j, ecl_grid, ecl_file, kw, depth, profile); - - { - char *filename = path_fmt_alloc_file(output_fmt, true, tstep); - int *perm = double_vector_alloc_sort_perm(depth); - FILE *stream = util_fopen(filename, "w"); - int l; - double_vector_permute(depth, perm); - double_vector_permute(profile, perm); - for (l = 0; l < double_vector_size(depth); l++) - fprintf(stream, "%12.5f %12.5f\n", - double_vector_iget(profile, l), - -double_vector_iget(depth, l)); - - free(perm); - fclose(stream); - free(filename); - } - } -} - -int main(int argc, char **argv) { - if (argc < 6) - usage(); - { - const char *base_file = argv[3]; - const char *kw = argv[4]; - const char *fmt = argv[5]; - const char **tlist = (const char **)&argv[6]; - const int num_tstep = argc - 6; - int i, j; - - if (util_sscanf_int(argv[1], &i) && util_sscanf_int(argv[2], &j)) { - bool unified; - path_fmt_type *output_fmt; - char *restart_file; - char *path; - char *eclbase; - ecl_grid_type *ecl_grid; - - util_alloc_file_components(base_file, &path, &eclbase, NULL); - { - char *grid_file = ecl_util_alloc_filename( - path, eclbase, ECL_EGRID_FILE, false, -1); - if (util_file_exists(grid_file)) { - ecl_grid = ecl_grid_alloc(grid_file); - printf("Loading grid file: %s \n", grid_file); - } else { - free(grid_file); - grid_file = ecl_util_alloc_filename( - path, eclbase, ECL_GRID_FILE, false, -1); - if (util_file_exists(grid_file)) { - ecl_grid = ecl_grid_alloc(grid_file); - printf("Loading grid file: %s \n", grid_file); - } else { - fprintf(stderr, - "Could not locate %s.EGRID or %s.GRID file in " - "%s.\n", - eclbase, eclbase, path); - exit(1); - } - } - free(grid_file); - } - - restart_file = ecl_util_alloc_filename( - path, eclbase, ECL_UNIFIED_RESTART_FILE, false, -1); - if (util_file_exists(restart_file)) - unified = true; - else { - unified = false; - free(restart_file); - } - - output_fmt = path_fmt_alloc_path_fmt(fmt); - - { - int it; - for (it = 0; it < num_tstep; it++) { - int tstep; - if (util_sscanf_int(tlist[it], &tstep)) { - ecl_file_type *ecl_file = NULL; - - if (unified) { - ecl_file = ecl_file_open(restart_file); - if (!ecl_file_select_rstblock_report_step(ecl_file, - tstep)) { - fprintf(stderr, - "** Failed to load restart information " - "for step:%d \n", - tstep); - exit(1); - } else - printf("Loading report step:%d from:%s \n", - tstep, restart_file); - } else { - restart_file = ecl_util_alloc_exfilename( - path, eclbase, ECL_RESTART_FILE, false, tstep); - if (restart_file != NULL) { - ecl_file = ecl_file_open(restart_file); - printf("Loading report step:%d from:%s \n", - tstep, restart_file); - } - } - - vprofile(i - 1, j - 1, ecl_grid, ecl_file, kw, tstep, - output_fmt); - - if (!unified) - free(restart_file); - } else - fprintf(stderr, - "** The string: \'%s\' was not interpreted as " - "a time-step - ignored \n", - tlist[it]); - } - } - } else - fprintf(stderr, - "Failed to interpret \'%s\' and \'%s\' as integers.\n", - argv[1], argv[2]); - } -} diff --git a/applications/example_ens_plot_batch_file b/applications/example_ens_plot_batch_file deleted file mode 100644 index be8a88578d..0000000000 --- a/applications/example_ens_plot_batch_file +++ /dev/null @@ -1,48 +0,0 @@ -/project/idi/personlig/eism/sandbox/eclplot/Plotpath -c -hist -/project/idi/proj/HMprojects/gurbat/debug/Simulations/ROUND_1_NR_0 -_stop_ -c -post -/project/idi/proj/HMprojects/gurbat/debug/Simulations/ROUND_1_NR_0 -/project/idi/proj/HMprojects/gurbat/debug/Simulations/ROUND_1_NR_1 -/project/idi/proj/HMprojects/gurbat/debug/Simulations/ROUND_1_NR_2 -_stop_ -c -prior -/project/idi/proj/HMprojects/gurbat/debug/Simulations/PRIOR_DEBUG_0_0 -/project/idi/proj/HMprojects/gurbat/debug/Simulations/PRIOR_DEBUG_0_1 -/project/idi/proj/HMprojects/gurbat/debug/Simulations/PRIOR_DEBUG_0_2 -_stop_ -a -post -1 -a -hist -15 -p -BPR:15,28,1 -post -prior -_meas_points_ -xxy 1843.213203435596 1800.786796 300.05 -xyy 21/09/2002 100.3313 200.26064 -xy 21/09/2003 150.33 -_stop_ -_set_range_ -XMIN 01/01/2000 XMAX 01/01/2010 YMAX 100.0 YMAX 400.0 -_stop_ -p -RFT:WI_1:2/9/2000 -prior -post -_set_range_ -XMIN 300 XMAX 400 -_meas_points_ -rft 15 28 1 340.0 345.2 -rft 15 28 10 345 350 -rft 15 28 14 350 352 -_stop_ -_stop_ -q \ No newline at end of file diff --git a/applications/irap_test.c b/applications/irap_test.c deleted file mode 100644 index 5323c7a2c4..0000000000 --- a/applications/irap_test.c +++ /dev/null @@ -1,30 +0,0 @@ - - -#include -#include -#include -#include - -int main(int argc, char **argv) { - const char *irap_file = "surface.irap"; - { - geo_surface_type *surface = - geo_surface_fload_alloc_irap(irap_file, true); - geo_surface_fprintf_irap(surface, "surface2.irap"); - geo_surface_free(surface); - } - - { - geo_surface_type *surface = - geo_surface_fload_alloc_irap(irap_file, false); - - { - double *zlist = - util_calloc(geo_surface_get_size(surface), sizeof *zlist); - geo_surface_fload_irap_zcoord(surface, irap_file, zlist); - free(zlist); - } - - geo_surface_free(surface); - } -} diff --git a/applications/polygon_test.c b/applications/polygon_test.c deleted file mode 100644 index d9420ae9c2..0000000000 --- a/applications/polygon_test.c +++ /dev/null @@ -1,15 +0,0 @@ - - -#include -#include -#include -#include -#include - -int main(int argc, char **argv) { - const char *irap_file = "polygontest.irap"; - - geo_polygon_type *polygon = geo_polygon_fload_alloc_irap(irap_file); - - geo_polygon_free(polygon); -} diff --git a/applications/well/segment_info.c b/applications/well/segment_info.c index 0f8d192220..5eb1e77792 100644 --- a/applications/well/segment_info.c +++ b/applications/well/segment_info.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2013 Equinor ASA, Norway. - - The file 'segment_info.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2013 Equinor ASA, Norway. + + The file 'segment_info.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include #include diff --git a/applications/well/well_CF_dump.c b/applications/well/well_CF_dump.c index 30686c41a6..4daa7f5541 100644 --- a/applications/well/well_CF_dump.c +++ b/applications/well/well_CF_dump.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2013 Equinor ASA, Norway. - - The file 'well_CF_dump.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2013 Equinor ASA, Norway. + + The file 'well_CF_dump.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include diff --git a/cmake/Tests/test_have_sigbus.c b/cmake/Tests/test_have_sigbus.c index e8785a4947..16a1b1035a 100644 --- a/cmake/Tests/test_have_sigbus.c +++ b/cmake/Tests/test_have_sigbus.c @@ -1,7 +1,7 @@ #include void sigbus_handler(int signal) { - + } diff --git a/cmake/Tests/test_mktime_before1970.c b/cmake/Tests/test_mktime_before1970.c index 95feb71dfb..f493d3eeb8 100644 --- a/cmake/Tests/test_mktime_before1970.c +++ b/cmake/Tests/test_mktime_before1970.c @@ -15,7 +15,7 @@ int main(int argc, char ** argv) { ts.tm_isdst = -1; { time_t t = mktime( &ts ); - if (t == -1) + if (t == -1) exit(1); else exit(0); diff --git a/cmake/Tests/test_openmp.c b/cmake/Tests/test_openmp.c index 0c8c25e6cd..65ac48929e 100644 --- a/cmake/Tests/test_openmp.c +++ b/cmake/Tests/test_openmp.c @@ -6,6 +6,6 @@ int main(int argc, char ** argv) { #pragma omp parallel for for (int i=0; i < 100; i++) sum += i; - + } diff --git a/cmake/Tests/test_va_copy.c b/cmake/Tests/test_va_copy.c index 1a12b407b2..8f88ff533e 100644 --- a/cmake/Tests/test_va_copy.c +++ b/cmake/Tests/test_va_copy.c @@ -6,7 +6,7 @@ int func(int arg1 , ...) { va_list copy; va_start(ap , arg1); va_copy( copy , ap ); - + va_end(ap); return 1; } diff --git a/lib/ecl/ecl_grid.cpp b/lib/ecl/ecl_grid.cpp index b7c1410a16..f069fac50e 100644 --- a/lib/ecl/ecl_grid.cpp +++ b/lib/ecl/ecl_grid.cpp @@ -5137,7 +5137,7 @@ double ecl_grid_get_cell_dx1A(const ecl_grid_type *grid, int active_index) { reproduces the Eclipse results from the INIT file quite well, relative error on the order 1e-4 for DX and DY and 1e-3 for DZ. - Observe that the DX, DY and DZ values are not tied to the cell volume; i.e. + Observe that the DX, DY and DZ values are not tied to the cell volume; i.e. the relationship: DX * DY * DZ = V diff --git a/lib/ecl/smspec_node.cpp b/lib/ecl/smspec_node.cpp index 87bba3bad8..73c7d80c79 100644 --- a/lib/ecl/smspec_node.cpp +++ b/lib/ecl/smspec_node.cpp @@ -419,10 +419,10 @@ bool smspec_node_identify_rate(const char *keyword) { /* Identify vectors that are likely to be rate vectors. First input character is ignored (e.g. F, G, W and R for Field, Group, Well and Region) - Additional characters beyond the length of the listed elements are also ignored (To + Additional characters beyond the length of the listed elements are also ignored (To catch historical vectors with trailing H and completions with trailing L). Therefore also not necessary to list e.g. OPRF, which is covered by OPR. - Some of the more obscure keywords in the manual are skipped. + Some of the more obscure keywords in the manual are skipped. The listed rate variables are grouped per line as: Oil rates Gas rates @@ -487,10 +487,10 @@ bool smspec_node_identify_total(const char *keyword, /* Identify vectors that are likely to be cumulative vectors. First input character is ignored (e.g. F, G, W and R for Field, Group, Well and Region) - Additional characters beyond the length of the listed elements are also ignored (To + Additional characters beyond the length of the listed elements are also ignored (To catch historical vectors with trailing H and completions with trailing L). Therefore also not necessary to list e.g. OPTF, which is covered by OPT. - Some of the more obscure keywords in the manual are skipped. + Some of the more obscure keywords in the manual are skipped. The listed rate variables are grouped per line as: Oil totals Gas totals diff --git a/python/docs/code/python/index.rst b/python/docs/code/python/index.rst index 90946c557e..c48e272c63 100644 --- a/python/docs/code/python/index.rst +++ b/python/docs/code/python/index.rst @@ -3,7 +3,7 @@ The ert.ecl package .. contents:: :depth: 2 - :local: + :local: The :code:`ert.ecl` package for working with Eclipse files is quite extensive. There is some quite limited support for reading @@ -162,7 +162,7 @@ the permeability: from ert.ecl import EclFile, EclTypeEnum initfile_pattern = "/path/to/files/real*/CASE-*.INIT" - + kw_list = [] for init_file in glob.glob(initfile_pattern): ecl_file = EclFile(init_file) @@ -171,19 +171,19 @@ the permeability: mean = EclKW.create("AVG-PERMX" , len(kw_list[0]) , EclTypeEnum.ECL_FLOAT_TYPE) std = EclKW.create("STD-PERMX" , len(kw_list[0]) , EclTypeEnum.ECL_FLOAT_TYPE) - # Here we do normal arithmetic calculations with the EclKW instances + # Here we do normal arithmetic calculations with the EclKW instances for kw in kw_list: mean += kw std += kw * kw mean /= len(kw_list) std /= len(kw_list) - std -= mean * mean + std -= mean * mean # The sqrt() function can not be implemented in the object, so here # we must do it more explicitly. - std.apply( math.sqrt ) - + std.apply( math.sqrt ) + Observe that for the arithmetic operations you can also call the inplace methods (*without* leading 'i') :code:`add()`, :code:`mul()`, :code:`sub` and :code:`div()` directly - in this form the methods also @@ -328,7 +328,7 @@ cell is active(1) or inactive(0) [4]_. When working with the a specific cell - these are: 1. A triplet of :code:`(i,j,k)` values - in the example above - indicated with the :code:`(i,j)`. + indicated with the :code:`(i,j)`. 2. A *global index* in the range :code:`[0..nx*ny*nz)` which uniquely identifies a cell. This is indicated as the number with a trailing @@ -361,7 +361,7 @@ and then we print the (i,j,k) values for all the cells with init = EclFile( "CASE.INIT" ) permx_kw = init["PERMX"][0] - + for ai in range(len(permx_kw)): if permx_kw[ai] < permx_limit: ijk = grid.get_ijk( active_index = ai) @@ -385,12 +385,12 @@ associated to it. The purpose of this is to be able to use :code:`(i,j,k)` as index when looking up values. When :code:`(i,j,k)` is used to identify the cell the, :code:`Ecl3DKW` class can transparently handle the active/inactive cells issue - returning a -default value in the case of undefined inactive cells. +default value in the case of undefined inactive cells. When the :code:`[]` argument is a single integer the :code:`Ecl3DKW` class can not know whether the index supplied is an active or a global index, and it will be a simple index lookup - which properties are -determined by the length of the underlying data. +determined by the length of the underlying data. The :code:`Ecl3DKW` class is mainly convenience compared to the pure :code:`EclKW` class - for performance reasons it should probably not @@ -405,11 +405,11 @@ grid properties: 1. Many different methods for working with cell data like position, depth, size and location of cell corners. - + 2. Methods doing the reverse mapping :code:`(x,y,z) -> (i,j,k)`. 3. *Some* functionality for working with LGRs, coarse groups and - fractured grid. + fractured grid. 4. Methods for exporting a :code:`EclKW` defined over :code:`nactive` elements to a :code:`grdecl` formatted file with @@ -446,14 +446,14 @@ the :code:`(i,j,k) -> active_index` transformation: permx_kw = init["PERMX"][0] for ijk in cell_list: - print("permx : %g" % permx_kw[ijk]) - + print("permx : %g" % permx_kw[ijk]) + Time queries in EclRestartFile .............................. The :code:`EclRestartFile` class has many methods for queries on the -temporal content of a restart file [5]_. +temporal content of a restart file [5]_. Classmethods ,,,,,,,,,,,, @@ -477,9 +477,9 @@ file. report_list = EclRestartFile.file_report_list("ECLIPSE.UNRST") - print("The file: %s contains the following report steps: ") + print("The file: %s contains the following report steps: ") print( ", ".join(report_list)) - + EclRestartFile.contains_report_step *********************************** @@ -487,7 +487,7 @@ EclRestartFile.contains_report_step The classmethod :code:`contains_report_step` will check if the file *filename* contains the report_step *report_step*: - + if EclRestartFile.contains_report_step( "ECLIPSE.UNRST" , 100): print("The file has a section for report step=100") else: @@ -504,7 +504,7 @@ be given as a normal Python :code:`datetime`: .. code:: python from ert.ecl import EclRestartFile - import datetime + import datetime sim_time = datetime.datetime( 2010 , 6 , 15 ) if EclRestartFile.contains_sim_time( "ECLIPSE.UNRST" , sim_time ): @@ -539,7 +539,7 @@ apply is: from ert.ecl import EclGrid, EclRegion, EclKW, EclTypeEnum grid = EclGrid( "CASE.EGRID" ) - + with open("poro.grdecl") as f: poro = EclKW.read_grdecl( f , "PORO") @@ -582,7 +582,7 @@ EclRegion - selectors ..................... A region can be constructed in many different ways: - + 1. Based on slices of :code:`i,j,k` values. 2. Inside or outside a polygon; or alternatively "above" or "below" a line. @@ -617,7 +617,7 @@ form the union and intersection of regions. # Region reg3 will be the union reg1 and reg2, i.e. the cells # selected in reg3 is the set of all cells selected in either reg1 # or reg2. - reg3 = reg1 | reg2 + reg3 = reg1 | reg2 reg3 = reg1 + reg2 # Region reg3 will be set of cells which are *only* selected in reg1. @@ -626,7 +626,7 @@ form the union and intersection of regions. # Region reg3 will be the set of cells which are selected in *both* # reg1 and reg2. reg3 = reg1 & reg2 - + For further details, specially of the various select methods, please type :code:`pydoc ert.ecl.EclRegion` or browse the API documentation at :ref:`python_documentation`. @@ -641,20 +641,20 @@ files will generally contain results for several wells, and several times, the :code:`EclRFTFile` class will load them all - and then supplies an interface to query for individual RFT results based on wellname and/or date; the individual RFT results will be in the form -of :code:`EclRFT` instances. +of :code:`EclRFT` instances. .. code:: python - + from ert.ecl import EclRFTFile # Load the RFT file rft_file = EclRFTFile("ECLIPSE.RFT") - - # Extract the RFT results for well 'OP-X' at date 2010-01-15; + + # Extract the RFT results for well 'OP-X' at date 2010-01-15; # will return None if no such RFT exists - should probably raise an # exception. rft = rft_file.get("OP-X" , datetime.date(2010,1,15)) - + In addition to the main method: :code:`EclRFTFile.get()` the :code:`EclRFTFile` class has utility methods to list all the well and date values present in the RFT file, the number of wells and so on. @@ -665,10 +665,10 @@ EclRFT From the :code:`EclRFTFile.get()` method we get a :code:`EclRFT` instance. Observe that one RFT file can contain a lump of different data RFT types: - + RFT: This is old-fashioned RFT which contains measurements of saturations for each of the completed cells. - + PLT: This contains production and flow rates for each phase in each cell. @@ -684,7 +684,7 @@ will loop identify an RFT from a file and then loop through all the cells for that RFT. .. code:: python - + from ert.ecl import EclRFTFile rft_file = EclRFTFile("ECLIPSE.RFT") rft = rft_file.get("OP-X" , datetime.date(2010,1,15)) @@ -708,7 +708,7 @@ Summary files are loaded with the :code:`EclSum` class. The :code:`EclSum` class is a quite complete implementation for working with Eclipse summary data, but it should also be said the :code:`EclSum` class is one of the oldest classes in the -:code:`ert.ecl` package and the api could have been cleaner. +:code:`ert.ecl` package and the api could have been cleaner. Creating a :code:`EclSum` instance @@ -731,11 +731,11 @@ instance from this is as simple as: from ert.ecl import EclSum ecl_sum = EclSum("ECLIPSE") - + As is clear from the example the :code:`EclSum` instance is created based only on the basename of the simulation, you can optionally have an extension like :code:`ecl_sum = EclSum("ECLIPSE.UNSMRY")` - but -that is *mostly* [7]_ ignored. +that is *mostly* [7]_ ignored. If your case is restarted from an another case the :code:`EclSum` cconstructor will by default try to locate the historical case, and @@ -752,7 +752,7 @@ message if: simulations. -About summary keys +About summary keys .................. The header file :code:`CASE.SMSPEC` has all the information *about* @@ -764,23 +764,23 @@ which contains names of groups and wells, and :code:`NUMS` which contain extra numbers to characterize the variables. A small :code:`SMSPEC` file could look like this: -.. code:: +.. code:: - KEYWORDS WGNAMES NUMS | PARAM index Corresponding ERT key + KEYWORDS WGNAMES NUMS | PARAM index Corresponding ERT key ------------------------------------------------+-------------------------------------------------- - WGOR OP_1 0 | 0 WGOR:OP_1 - FOPT +-+-+-+- 0 | 1 FOPT - WWCT OP_1 0 | 2 WWCT:OP_1 - WIR OP_1 0 | 3 WIR:OP_1 - WGOR WI_1 0 | 4 WWCT:OP_1 - WWCT W1_1 0 | 5 WWCT:WI_1 - BPR +-+-+- 12675 | 6 BPR:12675, BPR:i,j,k - RPR +-+-+- 1 | 7 RPR:1 - FOPT +-+-+- 0 | 8 FOPT - GGPR NORTH 0 | 9 GGPR:NORTH - COPR OP_1 5628 | 10 COPR:OP_1:56286, COPR:OP_1:i,j,k - RXF +-+-+- 32768*R1(R2 + 10) | 11 RXF:2-3 - SOFX OP_1 12675 | 12 SOFX:OP_1:12675, SOFX:OP_1:i,j,jk + WGOR OP_1 0 | 0 WGOR:OP_1 + FOPT +-+-+-+- 0 | 1 FOPT + WWCT OP_1 0 | 2 WWCT:OP_1 + WIR OP_1 0 | 3 WIR:OP_1 + WGOR WI_1 0 | 4 WWCT:OP_1 + WWCT W1_1 0 | 5 WWCT:WI_1 + BPR +-+-+- 12675 | 6 BPR:12675, BPR:i,j,k + RPR +-+-+- 1 | 7 RPR:1 + FOPT +-+-+- 0 | 8 FOPT + GGPR NORTH 0 | 9 GGPR:NORTH + COPR OP_1 5628 | 10 COPR:OP_1:56286, COPR:OP_1:i,j,k + RXF +-+-+- 32768*R1(R2 + 10) | 11 RXF:2-3 + SOFX OP_1 12675 | 12 SOFX:OP_1:12675, SOFX:OP_1:i,j,jk ------------------------------------------------+-------------------------------------------------- As indicated above the ERT library combines elements from the @@ -821,7 +821,7 @@ following about the smspec index: -About the time direction +About the time direction ........................ As we can see from the table in "About summary keys" section the @@ -836,12 +836,12 @@ performance, in ECLIPSE parlance these are called ministeps. When the :code:`EclSum` class loads a summary all the ECLIPSE ministeps are stacked together in one long vector, observe that e.g. when the keyword RPTONLY is used in the ECLIPSE data file there can be "holes" -in the ministep sequence. +in the ministep sequence. The ert.ecl summary implementation works with four different concepts of time: -time_index +time_index ,,,,,,,,,,, This is a plain index in the range :code:`[0,..num_timestep)`. Observe @@ -862,23 +862,23 @@ restarted simulation the first ministeps might be missing completely, and there can also be holes in the series. Each block of summary data is tagged with a MINISTEP number by ECLIPSE. The ministep indices are arbitrary properties of the simulation, and are not exported by the -:code:`ert.ecl` API. +:code:`ert.ecl` API. -report_step +report_step ,,,,,,,,,,,, This is the ECLIPSE report step, there are functions to convert between report step and index, and you can use report step as time -value when querying for values. +value when querying for values. -True time +True time ,,,,,,,,,, It is possible to query the summary object for values interpolated to "true" time; the true time can eiether be specified in days since -simulation start, or as python datetime.date() instance. +simulation start, or as python datetime.date() instance. Some methods ............. @@ -891,7 +891,7 @@ The :code:`__contains__` method implements :code:`in` support. If you are uncertain whether the summary contains a key or not, you should use this function to check. In the example below a list of keys is read from the commandline, and we check whether they are in the -summary or not: +summary or not: .. code:: python @@ -921,7 +921,7 @@ variables for the group "NORTH" we can use the :code:`keys()` function as: from ert.ecl import EclSum sum = ecl.EclSum("ECLIPSE") - matching = sum.keys( "BPR:*" ) + sum.keys( "G*H:NORTH" ) + matching = sum.keys( "BPR:*" ) + sum.keys( "G*H:NORTH" ) iget_report( index ) @@ -936,13 +936,13 @@ following keywords: SEQHDR <--------. MINISTEP 0 | - PARAMS | + PARAMS | MINISTEP 1 | Report step 1 PARAMS | MINISTEP 2 | PARAMS | SEQHDR <---------+ - MINISTEP 3 | + MINISTEP 3 | PARAMS | Report step 2 MINISTEP 4 | PARAMS | @@ -1014,13 +1014,13 @@ every 6 months: date = sum.start_date date_list = [] while date < sum.end_date: - date_list.append( date ) + date_list.append( date ) if date.month < 7: date = datetime.date( date.year , 7 , 1) else: date = datetime.date( date.year + 1 , 1 , 1) - # Get the values + # Get the values FOPT_vector = sum.get_interp_vector( "FOPT" , date_list = date_list ) # Print the results @@ -1066,7 +1066,7 @@ end_date = sum.end_date print "Simulation started.............: %s" % start_date print "Simulation ended...............: %s" % end_date -print "The simulation spans %s days...: %s" % (end_date - start_date).days +print "The simulation spans %s days...: %s" % (end_date - start_date).days start_time / end_time ,,,,,,,,,,,,,,,,,,,,, @@ -1093,7 +1093,7 @@ call to an EclSum method, it will fail hard. gt_index = sum.first_gt( "WWCT:OP_3" , 0.30) if gt_index < 0: print "The water cut in well OP_3 never exceeds 0.30" - else: + else: print "WWCT:OP_3 exceeds 0.30 after %g days." % sum.iget_days( gt_index ) lt_index = sum.first_lt("RPR:2" , 210) @@ -1109,7 +1109,7 @@ This method will return a numpy vector with all the values for the key key. The numpy vector type can then be used e.g. to plot or do other manipulations. - + numpy_days ,,,,,,,,,, @@ -1117,7 +1117,7 @@ This property will return a numpy vector with the number of simulation days. mpl_dates This property is a numpy vector of "time-values" in matplotlib format. Suitable when plotting with matplotlib. In the example below we fetch two vectors, and the simulation days from a -summary, and then print it all to the screen: +summary, and then print it all to the screen: .. code:: python from ert.ecl import EclSum @@ -1206,7 +1206,7 @@ following fields: mini_step : The ministep days : Days since simulation start date : The simulation date - mpl_date : A date format suitable for matplotlib + mpl_date : A date format suitable for matplotlib When iterating over a EclSumVector the return values will be in the form EclSumNode instances. The EclSumNode instances are created on diff --git a/python/docs/index.rst.in b/python/docs/index.rst.in index 9d688b5183..3304f0ee9f 100644 --- a/python/docs/index.rst.in +++ b/python/docs/index.rst.in @@ -5,8 +5,8 @@ Contents: .. toctree:: :maxdepth: 1 - :numbered: - + :numbered: + code/index api/ecl diff --git a/python/ecl/eclfile/__init__.py b/python/ecl/eclfile/__init__.py index 33f7d207a0..ee2ea9f7a4 100644 --- a/python/ecl/eclfile/__init__.py +++ b/python/ecl/eclfile/__init__.py @@ -1,6 +1,6 @@ """ The eclfile package contains several classes for working directly with ECLIPSE -files. +files. fortio/FortIO: This is functionality to read and write binary fortran files. diff --git a/python/ecl/grid/ecl_grid.py b/python/ecl/grid/ecl_grid.py index e73edfee90..b29901b015 100644 --- a/python/ecl/grid/ecl_grid.py +++ b/python/ecl/grid/ecl_grid.py @@ -1452,17 +1452,17 @@ def export_position(self, index_frame): return data def export_corners(self, index_frame): - """Exports cell corner position coordinates to a numpy vector (matrix). - - Index_fram must be a pandas dataframe with the same structure - as obtained from export_index. + """Exports cell corner position coordinates to a numpy vector (matrix). + + Index_fram must be a pandas dataframe with the same structure + as obtained from export_index. Example of a row of the output matrix: 0 1 2 .... 21 22 23 x1 y1 z1 .... x8 y8 z8 In total there are eight 8 corners. They are described as follows: The corners in a cell are numbered 0 - 7, where corners 0-3 constitute - one layer and the corners 4-7 consitute the other layer. Observe + one layer and the corners 4-7 consitute the other layer. Observe that the numbering does not follow a consistent rotation around the face: diff --git a/python/tests/ecl_tests/test_layer.py b/python/tests/ecl_tests/test_layer.py index 69cba27546..028b02c34e 100644 --- a/python/tests/ecl_tests/test_layer.py +++ b/python/tests/ecl_tests/test_layer.py @@ -95,7 +95,7 @@ def test_fault_barrier(self): with open("faults.grdecl", "w") as f: f.write( """FAULTS -\'F\' 105 107 50 50 1 43 \'Y\' / +\'F\' 105 107 50 50 1 43 \'Y\' / \'F\' 108 108 50 50 1 43 \'X\' / \'F\' 108 108 50 50 22 43 \'Y\' / \'F\' 109 109 49 49 1 43 \'Y\' / diff --git a/python/txt-doc/devel.txt b/python/txt-doc/devel.txt index 0b72477791..4ac0fdd086 100644 --- a/python/txt-doc/devel.txt +++ b/python/txt-doc/devel.txt @@ -36,7 +36,7 @@ quite good system for transparently mapping between Python types and C types. More extensive documentation of ctypes is available at: http://www.python.org/org/library/ctypes.html -2.1 Loading the shared library +2.1 Loading the shared library In the ert Python wrapping loading the shared library is handled by the ert.util.clib function load(). When the shared library has been @@ -48,8 +48,8 @@ of shared libraries is through the ctypes.CDLL() call like: however in the ert py library this is wrapped by the function load() in the ert.util.clib module: - - import ert.util.clib as clib + + import ert.util.clib as clib lib_handle = clib.load("name1" , "name2" , "name3") The clib.load() function will only load one library, but it can take @@ -65,7 +65,7 @@ will be available as python function attributes of the library handle. I.e. if loading the standard library like: clib_handle = clib.load( "libc" ) - + The attribute clib_handle.getenv will be a pointer to a Python function object which wraps the standard library getenv() function. Before this is really usable we have to "tell" the function @@ -75,7 +75,7 @@ object, more details of the prototype process can be found in section 4.2 -2.2 Type mappings +2.2 Type mappings The ctypes library automagically handles conversion between common C-types and Python types, so for the example above we would be able to @@ -93,28 +93,28 @@ maintained in the CWrapper class in ert.cwrap.cwrap.py. During initialization of the ert Python code there are many calls associating the name of a C type you whish to use in the prototype process (as a string) and the corresponding Python type: - + CWrapper.registerType( "int" , ctypes.c_int ) - CWrapper.registerType( "double" , ctypes.c_double ) - CWrapper.registerType( "char*" , ctypes.c_char_p ) + CWrapper.registerType( "double" , ctypes.c_double ) + CWrapper.registerType( "char*" , ctypes.c_char_p ) CWrapper.registerType( "int*" , ctypes.POINTER( ctypes.c_int )) - + 2.2.1 Fundamental types All the fundamental C types are known to the ctypes library, and -transparently converted <-> the correct Python type. +transparently converted <-> the correct Python type. - C type ctypes Python type + C type ctypes Python type -------------------------------------------------------- int c_int int float c_float float - double c_double double + double c_double double ..... char * (NULL terminated) c_char_p string - -------------------------------------------------------- + -------------------------------------------------------- All these types can be created by calling them with an optional initializer of the correct type and value: @@ -152,7 +152,7 @@ return value: | The mapping of types generally works quite well, however | | observe that the return type of C functions which return | | an instance pointer is NOT the current class, but | - | c_void_p, that is because this return value is | + | c_void_p, that is because this return value is | | internalized in the c_ptr attribute of the object. | \----------------------------------------------------------/ @@ -202,8 +202,8 @@ to complete) follow roughly the same structure: 2.2. Create the Python class - based on the prototype functions from 2.1 above. - } - + } + The following excerpt from ecl_kw.y illustrates this: ------------------------------------------------------------ @@ -213,18 +213,18 @@ The following excerpt from ecl_kw.y illustrates this: Class EclKW: <-------------� # Pure Python code to implement the EclKW class, | # based on the functions prototyped below. | Step 3 - .... <-------------� - + .... <-------------� + # Create a wrapper instance which wraps the libecl library. <--------� cwrapper = CWrapper( libecl.lib ) | - | + | # Register the type mapping "ecl_kw" <-> EclKW | Step 2 cwrapper.registerType( "ecl_kw" , EclKW ) | | # Prototype the functions needed to implement the Python class | cfunc.alloc_new = cwrapper.prototype("long ecl_kw_alloc( char* , int , int )") - cfunc.free = cwrapper.prototype("void ecl_kw_free( ecl_kw )") | - .... <--------� + cfunc.free = cwrapper.prototype("void ecl_kw_free( ecl_kw )") | + .... <--------� ------------------------------------------------------------ These three steps are described in more detail in 4.1 - 4.3 below. @@ -255,14 +255,14 @@ which takes one (char *) input and returns a (char *) pointer this would be: clib_handle.getenv.restype = ctypes.c_char_p - clib_handle.getenv.argtypes = [ ctypes.c_char_p ] - + clib_handle.getenv.argtypes = [ ctypes.c_char_p ] + In the ert python code this is achieved with the helper class CWrapper implemented in the module ert.cwrap.cwrap: from ert.cwrap.cwrap import CWrapper - lib = clib.load( "libc" ) + lib = clib.load( "libc" ) wrapper = CWRapper( lib ) getenv = wrapper.prototype("char* getenv( char* )") @@ -275,7 +275,7 @@ All the calls to the prototype() method are typically assembled in the bottom of the file implementing a class defintion. E.g. the bottom of the ecl_kw.py file looks like this: - # 1: Load the shared library + # 1: Load the shared library cwrapper = CWrapper( libecl.lib ) # 2: Register type mapping ecl_kw <--> EclKW @@ -333,7 +333,7 @@ roughly the same structure: * The __del__ function is called when the Python object is garbage collected, then the corresponding C free function should be called, e.g. ecl_grid_free(). - + @@ -356,16 +356,16 @@ indeed be called. The EclKW class illustrates this quite well. Broadly speaking you can instantiate an EclKW instance in two ways: - * Through the EclwKW.new() function + * Through the EclwKW.new() function * As a reference to an existing ecl_kw through an EclFile instance. In the first case the c_ptr of the EclKW instance will point to fresh storage dedicated to this EclKW, and when the EclKW instance goes out of scope the memory should be freed with a call to the C function -ecl_kw_free(). +ecl_kw_free(). - EclKW (Python) ecl_kw (C) - c_ptr + EclKW (Python) ecl_kw (C) + c_ptr | --------- \--------------->| PORO | | REAL | @@ -373,7 +373,7 @@ ecl_kw_free(). |-------| | 0.15 | | 0.19 | - | ... | + | ... | --------- @@ -383,11 +383,11 @@ containing many ecl_kw instances. We can then query the EclFile instance to get reference to the various ecl_kw keywords, i.e. for a small restart file: - -EclFile (Python) ecl_file (C) EclKW (Python) + +EclFile (Python) ecl_file (C) EclKW (Python) c_ptr c_ptr | ------------ | - \---------------->| PRESSURE | | + \---------------->| PRESSURE | | | SGAS <---+------------------/ | SWAT | | .... | diff --git a/python/txt-doc/import.txt b/python/txt-doc/import.txt index f1d3ab0119..677b017880 100644 --- a/python/txt-doc/import.txt +++ b/python/txt-doc/import.txt @@ -6,7 +6,7 @@ importing in general, and the conventions used in ert python in special. Example module (file: example.py) -------------- - + def example_sum(a,b): return a+b @@ -15,7 +15,7 @@ Example module (file: example.py) class ExampleClass: def __init__(self , **kwargs): .... - + def method( self , arg1 , arg2 ) .... @@ -35,7 +35,7 @@ namespace prefix: import example - var = example.example_variable + var = example.example_variable sum = example.example_sum( 100 , 100) instance = example.ExampleClass() @@ -77,7 +77,7 @@ import: Here we have imported the example_variable symbol from the 'example' module and renamed it to 'EXAMPLE_VARIABLE' in the calling scope. - + 2. Packages @@ -139,7 +139,7 @@ instance we have to go through the following hoops: .... .... grid = ert.ecl.ecl_grid.EclGrid( "ECLIPSE.EGRID" ) - | | | | + | | | | | | | | Package--/ | | \-------- Symbol (Class definition) | | @@ -151,8 +151,8 @@ simplify this using the from import as: from ert.ecl.ecl_grid import EclGrid <-- Explicitly import symbol .... into current namespace. .... - grid = EclGrid( "ECLIPSE.EGRID" ) - + grid = EclGrid( "ECLIPSE.EGRID" ) + By convention the ert python distribution offers some limited simplifications of this procedure. @@ -204,7 +204,7 @@ they can of course be changed: grid = EclGrid("ECLIPSE.EGRID") To get all the symbols from the ecl package directly into the - current namespace, or alternatively you can use + current namespace, or alternatively you can use import ert.ecl.ecl as ecl .... @@ -214,14 +214,14 @@ they can of course be changed: common 'ecl' prefix. The functionality of the xxx module in the xxx package could have been achieved with the __init__.py - but then you would get it unconditionally. - + 3. The ert python distribution is organized with one subpackage per library in the ERT C distribution. In each subpackage there is a module with the same name as the library which this package wraps, i.e. the ecl package, which wraps the libecl library, contains a module libecl.py. This module again contains the ctypes trickery to actually load the libecl.so shared library. - + [1]: The big disclaimer here is that you can use the '__init__.py' to perform additional action when importing the 'ert' package. In diff --git a/python/txt-doc/install.txt b/python/txt-doc/install.txt index a762c7f01a..c93fa2e78d 100644 --- a/python/txt-doc/install.txt +++ b/python/txt-doc/install.txt @@ -67,7 +67,7 @@ ert-python: ImportError: No module named ert The ert/ directory is not located in the right place, or the - PYTHONPATH variable has not been updated correctly. + PYTHONPATH variable has not been updated correctly. 2. The runtime linker can not find one of the shared libraries: @@ -84,5 +84,5 @@ ert-python: raise ImportError( error_msg ) ImportError: Sorry - failed to load shared library:libg2c.so.0 - Tried in: + Tried in: You might need to update your LD_LIBRARY_PATH variable diff --git a/python/txt-doc/tips.txt b/python/txt-doc/tips.txt index ce4483e65d..bc01b31a7c 100644 --- a/python/txt-doc/tips.txt +++ b/python/txt-doc/tips.txt @@ -1,6 +1,6 @@ -Table of contents: +Table of contents: - 1. Static and shared libraries + 1. Static and shared libraries 2. About gen_data / gen_param and gen_obs. 3. Some tips for implementing a obs_script 4. About the ERT filesystem @@ -8,8 +8,8 @@ Table of contents: ********************************************************************** -1. Static and shared libraries ------------------------------- +1. Static and shared libraries +------------------------------ The ert application is based on the internal libraries libutil,libecl,librms,libsched,libconfig,libplot,libjob_queue and @@ -26,7 +26,7 @@ where to locate the internal libraries, but no further -dynamic / libraries can be found the resulting linking will be: * All the internal libraries are linked statically. - + * All standard libraries like libz, libpthread and liblapack are linked dynamically. @@ -107,9 +107,9 @@ there are some significant disdvantages: happens is that: - The user error is not discovered before long out in the - simulation, and when discovered possibly only as a + simulation, and when discovered possibly only as a util_abort(). - + - User error is not discovered at all - the user just gets other results than anticipated. @@ -168,7 +168,7 @@ is from september/october 2010 - and there are rumors to be a bug or two here, my first suspect is with save/restore functionality in the functions gen_data_config_update_active() and gen_data_config_load_active(). - + ********************************************************************** 3. Some tips for implementing a obs_script @@ -205,7 +205,7 @@ Concrete tips: 2. I suggest that the only "rule" for the script is that it should produce a stdout stream like: - + value1 value2 value3 @@ -214,7 +214,7 @@ Concrete tips: error2 error3 .... - + this can then be easily captured to a temporary file by setting the stdout redirection of the util_spawn() function, and then subsequently the 100% normal way of creating a gen_obs instance @@ -225,7 +225,7 @@ Concrete tips: ********************************************************************** 4. About the ERT filesystem ---------------------------- +--------------------------- The system for storing information in ert is quite large and complex. The top level system is implemented in the file enkf_fs.c, @@ -286,14 +286,14 @@ coordinate is handled differs for the different data types: dynamics the enkf_fs layer will use the enkf identity: Forecast( X(t) ) = Analyzed( X(t-1) ) - + so if you ask for the analyzed at step 't' the enkf_fs layer will query the database for (iens , 't'), whereas if you ask for the forecast at tstep 't' the enkf_fs layer will go looking for (iens , 't - 1'). When it comes to parameters the enkf_fs layer will continue looking for (t , t-1 , t-2 , ... , 0) all the way back to the initially sampled values. - + 4.3 Reading and writing enkf_node state. @@ -346,7 +346,7 @@ restart information. The story goes about like this: c) Keywords which can be ignored, e.g. SOMAX and RPORV. ERT uses the function ecl_config_include_static_kw() to - differentiate between cases b) and c). + differentiate between cases b) and c). 2. For the static keywords which ERT determines it needs to store, i.e. case b) above ERT will automatically create the corresponding @@ -357,17 +357,17 @@ restart information. The story goes about like this: enkf_node_store( "PRESSURE" ) enkf_node_store( "SWAT" ) - if (!has_node( "INTEHEAD")) + if (!has_node( "INTEHEAD")) create_node( "INTEHEAD" ) - enkf_node_store( "INTEHEAD" ) + enkf_node_store( "INTEHEAD" ) - if (!has_node( "DOUBHEAD")) + if (!has_node( "DOUBHEAD")) create_node( "DOUBHEAD" ) - enkf_node_store( "DOUBHEAD" ) + enkf_node_store( "DOUBHEAD" ) - if (!has_node( "SGRP")) + if (!has_node( "SGRP")) create_node( "SGRP" ) - enkf_node_store( "SGRP" ) + enkf_node_store( "SGRP" ) 3. When we want to create a corresponding restart files, we must reassemble the keywords: @@ -380,9 +380,9 @@ Now - the point is that when we store the nodes in the database we loose track of the ordering of the keywords - and then ECLIPSE goes belly up. I.e. we must keep track of the original order of the keywords, that is what the index/kw_list is used for. - -4.5 The different driver types + +4.5 The different driver types The enkf_fs layer does not directly store nodes to disk, instead that task is passed on to a driver. When the enkf_fs layer has completed @@ -399,7 +399,7 @@ changes whatsoever to the rest of the ERT code. The drivers are included in the enkf_fs structure as: - .... + .... fs_driver_type * dynamic_forecast; fs_driver_type * dynamic_analyzed; fs_driver_type * parameter; @@ -410,7 +410,7 @@ The drivers are included in the enkf_fs structure as: I.e. all the different variable types in section 4.1 have their own private driver. The index variable is used for storing the kw_list (see section 4.4). fs_driver_type is an abstract type without any -implementation (I think !). +implementation (I think !). 4.5.1 The plain driver @@ -479,7 +479,7 @@ with these files which can be used for various forms of crash recovery, problem inspection and so on. In addition an sqlite based driver has been written, it worked ok but -performance turned out to be quite poor. +performance turned out to be quite poor. 4.6 Filesystem metadata @@ -489,15 +489,15 @@ filesystem is contained in the file "enkf_mount_info"; this is a binary file with the following content: FS_MAGIC_ID /* A magic number */ - CURRENT_FS_VERSION /* The version of the filesystem; + CURRENT_FS_VERSION /* The version of the filesystem; has been 104 since september 2009. */ ------- / DRIVER_CATEGORY /* Element from fs_driver_enum in fs_types.h */ | DRIVER_IMPLEMENTATION /* Element from fs_driver_impl in fs_types.h \ Extra driver info /* Whatever information needed by the driver - ------- implementation given by DRIVER_IMPLEMENTATION. */ + ------- implementation given by DRIVER_IMPLEMENTATION. */ - CASES + CASES The block [DRIVER_CATEGORY, DRIVER_IMPLEMENTATION, Extra ..] is repeated five times to cover all the driver categories @@ -538,10 +538,10 @@ general guideline: /project/res/x86_64_RH_??/ directory. 3. Update the metadata on the files you copy: - + a) chgrp res b) chmod a+r g+w - c) For executables: chmod a+x + c) For executables: chmod a+x For the simple programs like the ECLIPSE programs summary.x & convert.x this can be easily achieved with the SDP_INSTALL of @@ -575,8 +575,8 @@ script. This script will do the following: 3. Update the symlink: - /project/res/x86_64_RH_??/bin/ert_latest_and_greatest - + /project/res/x86_64_RH_??/bin/ert_latest_and_greatest + to point to the newly installed file. @@ -592,9 +592,9 @@ are: These scripts will (should ??): 1. Install the ERT shared libraries like libecl.so and so on to - + /project/res/x86_64_RH_???/lib/python/lib - + These shared libraries are the same for both ERT Python and gert. 2. Install python files (with directories) to diff --git a/test-data/README.txt b/test-data/README.txt index 182de174d3..506ad500ad 100644 --- a/test-data/README.txt +++ b/test-data/README.txt @@ -1,6 +1,6 @@ This directory is meant as a holding place for test data for the ERT project. The local/ directory should contain test-data which is -checked in an distributed as part of the solution. +checked in an distributed as part of the solution. In addition many of the tests expect to find a Equinor/ subdirectory in the current directory. This directory should link to Equinor