ert icon indicating copy to clipboard operation
ert copied to clipboard

Remove EclConfig

Open valentin-krasontovitsch opened this issue 2 years ago • 4 comments

It seems like we might be able to remove ecl config altogether, after all the dust has settled.

At the time of writing, it holds three data:

  • num cpu
  • grid (and its file)
  • refcase (and its file)

the files are only used to load grid and refcase. there is a PR ready for review right now which removes num cpu from ecl config. investigating uses of grid and refcase shows that, besides tests:

ecl config's grid is

  • passed to ensemble config in res config's init,
  • used to construct observations in enkfmain, and
  • mentioned in a comment about row scaling (which i sadly don't really understand)

while ecl config's refcase is

  • also used to construct observations in enkfmain, and
  • attached to the time map in storage if defined, and
  • used to extract data in libres facade
  • passed on to both ensemble and model config in res config's init

my idea is

  • to have the grid live only in ensemble config, and passed from there to construct observations in enkf main, and
  • to have refcase reside in ensemble config~~res config~~, and passed down from there to ~~ensemble and~~ model config as a boolean, as per its use described in a comment below.

~~but for the second point, i shall investigate usage of refcase in both ensemble and model config, and see if any of them can actually do without, and then adjust the plan accordingly.~~

valentin-krasontovitsch avatar Oct 10 '22 17:10 valentin-krasontovitsch

seems like ensemble config actually uses grid, to construct fields, based on values from the config option FIELD. and that one is used quite a bit, according to our logs from the last 3 months-ish.

it also uses refcase, to add "full" summaries for each element of the list given by the SUMMARY config option. and that config option is used a lot, again according to our logs.

so no dice there, these need to stay, ensemble config needs both grid and refcase.

valentin-krasontovitsch avatar Oct 10 '22 18:10 valentin-krasontovitsch

model config just gets / uses refcase. here, things get interesting - model config doesn't really use the structure of refcase, it ever just assigns to the respective struct field, and checks if it's not NULL

so we could substitute a simple boolean here, something along the lines of refcase_given.

in the python code, there is a check if the refcase is an instance of EclSum - not sure if there are historical reasons for that check, but it seems to me like it is a security redundancy, that can be scrapped.

in conclusion - we should be able to let refcase live in ensemble config, and just pass a boolean to model config that reflects whether ensemble config holds a ref case.

updated idea point two accordingly.

valentin-krasontovitsch avatar Oct 10 '22 18:10 valentin-krasontovitsch

actually as @andreas-el pointed out kindly, model config doesn't just use ref case as a pure exists or not boolean, but passes it on to some function residing in ecl connected to history / last report / something (ecl_sum_get_last_report_step)

valentin-krasontovitsch avatar Oct 17 '22 13:10 valentin-krasontovitsch

maybe we can still save the above considerations, and just pass the result of ecl_sum_get_last_report_step(refcase) to model config!

valentin-krasontovitsch avatar Oct 17 '22 13:10 valentin-krasontovitsch

reopening - we're only almost there, still need #4101 to be merged, which takes care of num cpu, then we can make a PR that actually just removes the no longer used ecl config.

valentin-krasontovitsch avatar Oct 25 '22 19:10 valentin-krasontovitsch

reopening - we're only almost there, still need #4101 to be merged, which takes care of num cpu, then we can make a PR that actually just removes the no longer used ecl config.

Yes, this makes sense. We also need to do some cleanup after num_cpu is resolved. Adds PR for that too. #4131

andreas-el avatar Oct 26 '22 06:10 andreas-el