<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Well you are correct that its not actually taking a step because the dot product of the control is 0:<div class=""><blockquote type="cite" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class="h5"><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">norm of x................... 0.00000000E+00</div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></blockquote>meaning the controls are all 0 still.</div><div class=""><br class=""></div><div class="">However the gradients are non-zero</div><div class=""><blockquote type="cite" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class="h5"><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">norm of g................... 0.12730927E-01</div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></blockquote>so the linesearch should step and </div><div class="">ecco_ctrl_MIT_CE_000.opt0001 </div><div class="">should not be all zero. </div><div class=""><br class=""></div><div class="">To debug this you could put a print statement in optim_writedata.F to see what it is writing…..</div><div class=""><br class=""></div><div class="">I don’t know enough about this tutorial to be a bigger help, sorry</div><div class=""><br class=""></div><div class="">Matt</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 30, 2018, at 2:50 PM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" class="">andrew.mcrae@physics.ox.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yes, I did.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 30 April 2018 at 22:42, Matthew Mazloff <span dir="ltr" class=""><<a href="mailto:mmazloff@ucsd.edu" target="_blank" class="">mmazloff@ucsd.edu</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;line-break:after-white-space" class="">
This is still iteration 0. You have to update data.optim to tell it you are now at iteration 1
<div class=""><br class="">
</div>
<div class="">Matt</div><div class=""><div class="h5">
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Apr 30, 2018, at 2:38 PM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank" class="">andrew.mcrae@physics.ox.ac.uk</a><wbr class="">> wrote:</div>
<br class="m_5573198295039926652Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">I tried a few steps of this, but the output of optim.x always has<br class="">
<br class="">
  cost function............... 0.62002323E+01<br class="">
  norm of x................... 0.00000000E+00<br class="">
  norm of g................... 0.12730927E-01<br class="">
<br class="">
</div>
near the end, with no decrease in the cost function.  So I guess it's not actually taking the step?<br class="">
<br class="">
</div>
Andrew</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On 27 April 2018 at 18:04, Andrew McRae <span dir="ltr" class="">
<<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank" class="">andrew.mcrae@physics.ox.ac.uk</a><wbr class="">></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr" class="">
<div class="">
<div class="">!!!  Okay...<br class="">
<br class="">
</div>
Yes, it produced the .opt0001 file.  I'll see how this goes.<br class="">
<br class="">
</div>
Thanks,<br class="">
Andrew<br class="">
</div>
<div class="m_5573198295039926652HOEnZb">
<div class="m_5573198295039926652h5">
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On 27 April 2018 at 17:57, Matthew Mazloff <span dir="ltr" class="">
<<a href="mailto:mmazloff@ucsd.edu" target="_blank" class="">mmazloff@ucsd.edu</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space" class="">Hello
<div class=""><br class="">
</div>
<div class="">Its been awhile, but I am pretty sure that is the normal output. It says “fail", but it did give you a new and ecco_ctrl_MIT_CE_000.opt0001 (correct?) and if you unpack and run likely the cost will descend.</div>
<div class=""><br class="">
</div>
<div class="">I think it worked correctly. lsopt/optim are just confusing…but I think its working. I think all is good!</div>
<div class=""><br class="">
</div>
<div class="">Matt</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">
<div class="m_5573198295039926652m_-7216922944695548211h5">
<div class="">On Apr 27, 2018, at 8:25 AM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank" class="">andrew.mcrae@physics.ox.ac.uk</a><wbr class="">> wrote:</div>
<br class="m_5573198295039926652m_-7216922944695548211m_769995241832615540Apple-interchange-newline">
</div>
</div>
<div class="">
<div class="">
<div class="m_5573198295039926652m_-7216922944695548211h5">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">Just separating this from the <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2018-April/011521.html" target="_blank" class="">
other thread</a>, I got the bundled MITgcm optim routine built (having made <a href="https://github.com/MITgcm/MITgcm/compare/master...dorugeber:optim_fix" target="_blank" class="">
these changes</a>, based on <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2010-September/006825.html" target="_blank" class="">
this</a> thread from 2010 and <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2016-July/010527.html" target="_blank" class="">
this</a> one from 2016).<br class="">
<br class="">
</div>
I use OpenAD to create the adjoint.<br class="">
<br class="">
</div>
My steps are:<br class="">
</div>
<div class="">1) in the build directory, run ../../../tools/genmake2 -oad -mods=../code_oad<br class="">
</div>
<div class="">2) run make depend and make adAll<br class="">
3) copy input_oad/ into a new folder scratch/<br class="">
</div>
<div class="">4) within scratch/, run ./prepare_run<br class="">
</div>
<div class="">5) copy mitgcmuv_ad from build/ into scratch/, copy optim.x into scratch/OPTIM/<br class="">
</div>
<div class="">6) run ./mitgcmuv_ad<br class="">
</div>
<div class="">7) in scratch/OPTIM, create symlinks to ../data.optim and ../data.ctrl<br class="">
</div>
<div class="">8) copy the files ecco_cost_MIT_CE_000.opt0000 and ecco_ctrl_MIT_CE_000.opt0000 into the OPTIM subdirectory<br class="">
</div>
<div class="">9) run ./optim.x within the subdirectory<br class="">
<br class="">
</div>
<div class="">The full output is attached, but I assume the optimisation failed since the last lines are<br class="">
</div>
<div class="">
<div class="">
<div class=""><br class="">
  optimization stopped because :<br class="">
  ifail =   4    the search direction is not a descent one<br class="">
<br class="">
</div>
<div class="">Any ideas?  (I guess this isn't something that is tested in the daily builds?)<br class="">
<br class="">
</div>
<div class="">In the meantime, I'll try the m1qn3 routine as in the other thread, which should help distinguish between a problem with the optimisation routine or the gradient generated by mitgcmuv_ad.<br class="">
<br class="">
</div>
<div class="">Andrew<br class="">
</div>
</div>
</div>
</div>
</div>
</div>
<span id="m_5573198295039926652m_-7216922944695548211m_769995241832615540cid:9D33FD64-1548-462F-99BA-72879C96702C@ucsd.edu" class=""><out.txt></span>_____________________<wbr class="">__________________________<br class="">
MITgcm-support mailing list<br class="">
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank" class="">MITgcm-support@mitgcm.org</a><br class="">
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank" class="">http://mailman.mitgcm.org/mail<wbr class="">man/listinfo/mitgcm-support</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
______________________________<wbr class="">_________________<br class="">
MITgcm-support mailing list<br class="">
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank" class="">MITgcm-support@mitgcm.org</a><br class="">
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank" class="">http://mailman.mitgcm.org/<wbr class="">mailman/listinfo/mitgcm-<wbr class="">support</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div></div></div>

</blockquote></div><br class=""></div>
_______________________________________________<br class="">MITgcm-support mailing list<br class=""><a href="mailto:MITgcm-support@mitgcm.org" class="">MITgcm-support@mitgcm.org</a><br class="">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br class=""></div></blockquote></div><br class=""></div></body></html>