[MITgcm-devel] ctrl
Patrick Heimbach
heimbach at MIT.EDU
Tue May 3 14:37:46 EDT 2011
Hi Martin,
not sure.
Have you checked whether your run does (or does not)
do what it's supposed to do in ctrl_init_ctrlvar
(namely initialize fname(2)=adxx...)
Alternatively, are you using DIVA,
and have some old "costfinal" files lying around which
are meant to *prevent* (re-!) initialization?
-p.
On May 3, 2011, at 8:13 AM, Martin Losch wrote:
> Dear ctrl-ers,
>
> I am having trouble with my control variables and while trying to debug my problem I learned a few things:
>
> 1. At the beginning of an adjoint simulation both xx_* and adxx_* files are initialized with zeros (ctrl_init/ctrl_init_ctrlvar/ctrl_set_globfld_*). Then ctrl_unpack unpacks the ctrl-vector and writes it to xx_*. xx_* are the control variables, adxx_* are files to be filled with the gradient fields (I thought).
> 2. The gradients (with respect to initial conditions) adxx_theta and adxx_salt are written at the very end of the adjoint simulation (in adctrl_map_ini[_ecco]), by calling adactive_read_xyz
> 3. adactive_read_xyz (active_file_ad.F) creates fname=adxx_theta from active_var_file (xx_theta) fname=adxx_theta and calls
> call active_read_rl( fname, adactive_var,
> & doglobalread, lAdInit, irec, mynr,
> & REVERSE_SIMULATION, myiter, mythid )
> 4. active_read_rl (active_file_control.F) in REVERSE_SIMULATION mode reads from file active_var_file (=fname=adxx_theta in my example) the variable active_data_t, then add the current gradient field (active_var = adtheta in my example) to active_data_t and then writes active_data_t back to active_var_file (= adxx_theta )
>
> Step 4 is necessary in some cases (e.g. when mean forcing is a control variable), but it requires that the adxx_* files contain only zeros when they are initialised/written at the beginning of the simulation. The latter does not seem to be the case in my experiments. I observe, that adxx_theta (and adxx_salt) contain nonzero values, that look like the gradient of the previous iteration, before the end of the adjoint simulation is reached (in fact from the beginning of the simulation when they are written, but I cannot figure out where this happens exactly), so that with iterations the gradient in adxx_theta accumulates. To my mind, this cannot be correct.
>
> Here's my question: Where do I go wrong? Do I misunderstand what's going on? Do I have to set a particular flag to make the model write zeros when it initialises adxx_*?
>
> Martin
>
>
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel
---
Patrick Heimbach | heimbach at mit.edu | http://www.mit.edu/~heimbach
MIT | EAPS 54-1518 | 77 Massachusetts Ave | Cambridge MA 02139 USA
FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach
More information about the MITgcm-devel
mailing list