Updated to ERT version fix for amalgamated-nnc-bug

e47dfe0ee4
p4#: 22363
This commit is contained in:
Magne Sjaastad
2013-09-09 12:13:33 +02:00
parent 303f832fac
commit d3ef53285a
186 changed files with 6376 additions and 3838 deletions

View File

@@ -24,6 +24,7 @@
#include <time.h>
#include <ert/util/double_vector.h>
#include <ert/util/int_vector.h>
#include <ert/util/util.h>
#include <ert/util/menu.h>
#include <ert/util/arg_pack.h>
@@ -31,6 +32,7 @@
#include <ert/util/bool_vector.h>
#include <ert/util/msg.h>
#include <ert/util/vector.h>
#include <ert/util/type_vector_functions.h>
#include <ert/plot/plot.h>
#include <ert/plot/plot_dataset.h>
@@ -62,12 +64,18 @@ void enkf_tui_QC_plot_get_PC( enkf_main_type * enkf_main , int step1 , int step2
double truncation , int ncomp ,
matrix_type * PC , matrix_type * PC_obs) {
int ens_size = enkf_main_get_ensemble_size( enkf_main );
bool_vector_type * ens_mask = bool_vector_alloc(0 , false);
obs_data_type * obs_data = obs_data_alloc();
meas_data_type * meas_data = meas_data_alloc( ens_size );
analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
int_vector_type * step_list = int_vector_alloc(0,0);
enkf_fs_type * source_fs = enkf_main_get_fs( enkf_main);
state_map_type * state_map = enkf_fs_get_state_map(source_fs);
int_vector_type * ens_active_list;
meas_data_type * meas_data;
state_map_select_matching(state_map , ens_mask , STATE_HAS_DATA);
ens_active_list = bool_vector_alloc_active_list(ens_mask);
meas_data = meas_data_alloc(ens_active_list);
{
for (int step =step1; step <= step2; step++)
int_vector_append( step_list , step );
@@ -81,10 +89,10 @@ void enkf_tui_QC_plot_get_PC( enkf_main_type * enkf_main , int step1 , int step2
double alpha = analysis_config_get_alpha( analysis_config );
enkf_obs_get_obs_and_measure(enkf_main_get_obs( enkf_main ),
enkf_main_get_fs( enkf_main ),
source_fs ,
step_list ,
state,
ens_size,
ens_active_list ,
(const enkf_state_type **) enkf_main_get_ensemble( enkf_main ),
meas_data ,
obs_data ,
@@ -105,6 +113,7 @@ void enkf_tui_QC_plot_get_PC( enkf_main_type * enkf_main , int step1 , int step2
matrix_free( dObs );
}
bool_vector_free(ens_mask);
int_vector_free( step_list );
obs_data_free( obs_data );
meas_data_free( meas_data );

View File

@@ -35,8 +35,6 @@
#include <ert/enkf/ensemble_config.h>
#include <ert/enkf/enkf_analysis.h>
#include <ert/enkf/ecl_config.h>
#include <ert/enkf/analysis_config.h>
#include <ert/enkf/analysis_iter_config.h>
#include <enkf_tui_util.h>
#include <enkf_tui_fs.h>
@@ -116,76 +114,29 @@ void enkf_tui_run_smoother(void * arg) {
void enkf_tui_run_iterated_ES(void * enkf_main) {
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
void enkf_tui_run_iterated_ES(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
const int last_report = enkf_main_get_history_length( enkf_main );
{
model_config_type * model_config = enkf_main_get_model_config( enkf_main );
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
analysis_iter_config_type * iter_config = analysis_config_get_iter_config( analysis_config );
int step1 = 0;
int step2 ;
int_vector_type * step_list = int_vector_alloc(0,0);
bool_vector_type * iactive = bool_vector_alloc(0 , true);
int iter = 0;
int num_iter = analysis_iter_config_get_num_iterations( iter_config );
stringlist_type * node_list = ensemble_config_alloc_keylist_from_var_type( enkf_main_get_ensemble_config(enkf_main) , PARAMETER );
if (ecl_config_has_schedule( ecl_config ))
step2 = util_scanf_int_with_limits("Last report",PROMPT_LEN , 0 , last_report);
else
step2 = last_report;
{
for (int step=step1; step <= step2; step++)
int_vector_append( step_list , step );
}
bool_vector_iset( iactive , ens_size - 1 , true );
while (true) {
{
const char * runpath_fmt = analysis_iter_config_iget_runpath_fmt( iter_config , iter);
if (runpath_fmt != NULL) {
char * runpath_key = util_alloc_sprintf( "runpath-%d" , iter);
model_config_add_runpath( model_config , runpath_key , runpath_fmt);
model_config_select_runpath( model_config , runpath_key );
free( runpath_key );
}
}
enkf_main_run_exp(enkf_main , iactive , true , step1 , step1 , FORECAST);
{
const char * target_fs_name = analysis_iter_config_iget_case( iter_config , iter );
enkf_fs_type * target_fs = enkf_main_get_alt_fs(enkf_main , target_fs_name , false , true );
enkf_main_smoother_update(enkf_main , step_list , target_fs);
enkf_main_copy_ensemble( enkf_main ,
enkf_main_get_current_fs( enkf_main ),
0 , // Smoother update will write on step 0
ANALYZED ,
target_fs_name ,
step1 ,
FORECAST ,
iactive ,
NULL ,
node_list );
enkf_main_set_fs(enkf_main , target_fs , enkf_fs_get_case_name( target_fs ));
}
//iter = analysis_module_get_int(module, "ITER");
iter++;
if (iter == num_iter)
break;
}
int_vector_free( step_list );
bool_vector_free( iactive );
}
int step2;
if (ecl_config_has_schedule( ecl_config ))
step2 = util_scanf_int_with_limits("Last report",PROMPT_LEN , 0 , last_report);
else
step2 = last_report;
enkf_main_run_iterated_ES(enkf_main, step2);
}
void enkf_tui_run_one_more_iteration(void * arg){
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
const int last_report = enkf_main_get_history_length( enkf_main );
int step2;
if (ecl_config_has_schedule( ecl_config ))
step2 = util_scanf_int_with_limits("Last report",PROMPT_LEN , 0 , last_report);
else
step2 = last_report;
enkf_main_run_one_more_iteration(enkf_main, step2);
}
@@ -221,7 +172,7 @@ void enkf_tui_run_exp(void * enkf_main) {
free( prompt );
}
if (bool_vector_count_equal(iactive , true))
enkf_main_run_exp(enkf_main , iactive , true , init_step_parameters , start_report , init_state);
enkf_main_run_exp(enkf_main , iactive , true , init_step_parameters , start_report , init_state, true);
bool_vector_free(iactive);
}
@@ -247,7 +198,7 @@ void enkf_tui_run_create_runpath__(void * __enkf_main) {
util_safe_free( select_string );
free( prompt );
}
enkf_main_run_exp(enkf_main , iactive , false , init_step_parameters , start_report , init_state);
enkf_main_run_exp(enkf_main , iactive , false , init_step_parameters , start_report , init_state, true);
bool_vector_free(iactive);
}
@@ -372,11 +323,15 @@ void enkf_tui_run_menu(void * arg) {
menu_item_type * restart_enkf_item = menu_add_item(menu , "Restart EnKF run from arbitrary state" , "rR" , enkf_tui_run_restart__ , enkf_main , NULL);
menu_item_type * ES_item = menu_add_item(menu , "Integrated smoother update" , "iI" , enkf_tui_run_smoother , enkf_main , NULL);
menu_item_type * it_ES_item = menu_add_item(menu , "Iterated smoother [RML-EnKF]" , "tT" , enkf_tui_run_iterated_ES , enkf_main , NULL);
menu_item_type * one_more_item = menu_add_item(menu , "One more iteration" , "mM" , enkf_tui_run_one_more_iteration , enkf_main , NULL);
if (!ecl_config_has_schedule( ecl_config )) {
menu_item_disable( enkf_item );
menu_item_disable( restart_enkf_item );
}
if (!ecl_config_has_init_section( ecl_config ))
menu_item_disable( enkf_item );
if (!model_config_has_history( model_config )) {
menu_item_disable( it_ES_item );