mjlosch / optim_m1qn3

optimisation package for MITgcm based on m1qn3 with proper reverse control
MIT License
8 stars 4 forks source link

Iteration is oblivious to state of m1qn3_offline #4

Open mjlosch opened 3 years ago

mjlosch commented 3 years ago

the state of m1qn3_offline is saved to a file OPWARM.opt${iter} after each call to m1qn3_offline. This can lead to a situation where the optimization terminates with a defined state (e.g. omode = 1, 4, 5, or 6), but when optim_m1qn3 is called again (because the controlling loop does not pay attention to this) a new iteration will begin that starts with values of nsim, niter, epsg, that were not intended, as reported by @dngoldberg

This can lead to some confusion.

mjlosch commented 3 years ago

the latest change to optim_m1qn3_store.F (11ed1c6a99446ed6091f61b67ea179e802d81690) makes the code stop with an error message, if the restart file does not exist, but we still write restart files, even if the optimization has terminated with reverse=-1. Currently, the way to look for a terminated optimization is to grep the output of optim.x for "ABNORMAL in S/R OPTIM_SUB".

ifenty commented 3 years ago

@mjlosch Is this bug fixed, I can't tell from your last comment! :)

mjlosch commented 3 years ago

@ifenty I don't think that this is a bug. I don't see a way to control the user from within the fortran routine. The program cannot determine if a certain set of values of nsim, inter, or epsg makes sense or not. In my opinion, this was a (albeit subtle) user error and I tried to explain the usage a little better.