def ensembleExperiment(self, line): simulation_runner = EnkfSimulationRunner(self.ert()) now = time.time() print("Ensemble Experiment started at: %s" % datetime.now().isoformat(sep=" ")) iteration_count = 0 active_realization_mask = BoolVector( default_value=True, initial_size=self.ert().getEnsembleSize()) simulation_runner.createRunPath(active_realization_mask, iteration_count) simulation_runner.runWorkflows(HookRuntime.PRE_SIMULATION) print("Start simulations!") num_successful_realizations = simulation_runner.runEnsembleExperiment() success = self.ert().analysisConfig().haveEnoughRealisations( num_successful_realizations, self.ert().getEnsembleSize()) if not success: print( "Error: Number of successful realizations is too low.\nYou can allow more failed realizations by setting / changing the MIN_REALIZATIONS configuration element!" ) return print("Ensemble Experiment post processing!") simulation_runner.runWorkflows(HookRuntime.POST_SIMULATION) print("Ensemble Experiment completed at: %s" % datetime.now().isoformat(sep=" ")) diff = time.time() - now print("Running time: %d seconds" % int(diff))
def __init__(self, config, strict=True, verbose=True): """ Initializes an instance of EnkfMain. Note: @config ought to be the ResConfig instance holding the configuration. It also accepts that config is the name of a configuration file, this is however deprecated. """ res_config = self._init_res_config(config) if res_config is None: raise TypeError("Failed to construct EnKFMain instance due to invalid res_config.") c_ptr = self._alloc(res_config, strict, verbose) if c_ptr: super(EnKFMain, self).__init__(c_ptr) else: raise ValueError('Failed to construct EnKFMain instance from config %s.' % res_config) if config is None: self.__simulation_runner = None self.__fs_manager = None self.__es_update = None else: self.__simulation_runner = EnkfSimulationRunner(self) self.__fs_manager = EnkfFsManager(self) self.__es_update = ESUpdate(self) self.__key_manager = KeyManager(self)
def __init__(self, model_config, res_config=None, strict=True, verbose=True): if model_config is not None and not isfile(model_config): raise IOError('No such configuration file "%s".' % model_config) if res_config is None: res_config = ResConfig(model_config) res_config.convertToCReference(self) if res_config is None or not isinstance(res_config, ResConfig): raise TypeError("Failed to construct EnKFMain instance due to invalid res_config.") c_ptr = self._alloc(model_config, res_config, strict, verbose) if c_ptr: super(EnKFMain, self).__init__(c_ptr) else: raise ValueError('Failed to construct EnKFMain instance from config %s.' % model_config) # The model_config argument can be None; the only reason to # allow that possibility is to be able to test that the # site-config loads correctly. if model_config is None: self.__simulation_runner = None self.__fs_manager = None self.__es_update = None else: self.__simulation_runner = EnkfSimulationRunner(self) self.__fs_manager = EnkfFsManager(self) self.__es_update = ESUpdate(self) self.__key_manager = KeyManager(self)
def _init_from_real_enkf_main(self, real_enkf_main): super(EnKFMain, self).__init__(real_enkf_main.from_param(real_enkf_main).value, parent=real_enkf_main, is_reference=True) self.__simulation_runner = EnkfSimulationRunner(self) self.__fs_manager = EnkfFsManager(self) self.__es_update = ESUpdate(self)
def createCReference(cls, c_pointer, parent=None): obj = super(EnKFMain, cls).createCReference(c_pointer, parent) obj.__simulation_runner = EnkfSimulationRunner(obj) obj.__fs_manager = EnkfFsManager(obj) return obj