<div dir="ltr"><div>Okay, just a small comment that this error seems to be guaranteed at the first iteration.<br></div><div><br></div><div>The arrays gg and gold are declared in lsopt_top.</div><div><br></div><div>If "cold start" (first iteration), gg gets read in from the ecco_cost file when simul is called at line 263 of lsopt_top.F</div><div></div><div><br></div><div>The loop at 405-407 makes gold a copy of gg.</div><div><br></div><div>The call to optline at line 436 then 'modifies' gg when it calls simul, which loads gg from ecco_cost again.</div><div><br></div><div>At this point, gg and gold are identical, so the subtraction at lines 497-499 gives the zero vector, which is used in a dot product at line 501, ...</div><div><br></div><div>(For a warm start, gg is first read in from OPWARMD, which will contain the previous gradient. This is copied into gold. Then gg is read from ecco_cost, which will contain the new gradient, so won't be identical to gold.)<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 April 2018 at 17:57, Matthew Mazloff <span dir="ltr"><<a href="mailto:mmazloff@ucsd.edu" target="_blank">mmazloff@ucsd.edu</a>></span> wrote:<br><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">
Hello
<div><br>
</div>
<div>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><br>
</div>
<div>I think it worked correctly. lsopt/optim are just confusing…but I think its working. I think all is good!</div>
<div><br>
</div>
<div>Matt</div>
<div><br>
</div>
<div><br>
<div><br>
<blockquote type="cite"><div><div class="h5">
<div>On Apr 27, 2018, at 8:25 AM, Andrew McRae <<a href="mailto:andrew.mcrae@physics.ox.ac.uk" target="_blank">andrew.mcrae@physics.ox.ac.uk</a><wbr>> wrote:</div>
<br class="m_-2801225539773214264Apple-interchange-newline">
</div></div><div><div><div class="h5">
<div dir="ltr">
<div>
<div>
<div>Just separating this from the <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2018-April/011521.html" target="_blank">
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">
these changes</a>, based on <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2010-September/006825.html" target="_blank">
this</a> thread from 2010 and <a href="http://mailman.mitgcm.org/pipermail/mitgcm-support/2016-July/010527.html" target="_blank">
this</a> one from 2016).<br>
<br>
</div>
I use OpenAD to create the adjoint.<br>
<br>
</div>
My steps are:<br>
</div>
<div>1) in the build directory, run ../../../tools/genmake2 -oad -mods=../code_oad<br>
</div>
<div>2) run make depend and make adAll<br>
3) copy input_oad/ into a new folder scratch/<br>
</div>
<div>4) within scratch/, run ./prepare_run<br>
</div>
<div>5) copy mitgcmuv_ad from build/ into scratch/, copy optim.x into scratch/OPTIM/<br>
</div>
<div>6) run ./mitgcmuv_ad<br>
</div>
<div>7) in scratch/OPTIM, create symlinks to ../data.optim and ../data.ctrl<br>
</div>
<div>8) copy the files ecco_cost_MIT_CE_000.opt0000 and ecco_ctrl_MIT_CE_000.opt0000 into the OPTIM subdirectory<br>
</div>
<div>9) run ./optim.x within the subdirectory<br>
<br>
</div>
<div>The full output is attached, but I assume the optimisation failed since the last lines are<br>
</div>
<div>
<div>
<div><br>
optimization stopped because :<br>
ifail = 4 the search direction is not a descent one<br>
<br>
</div>
<div>Any ideas? (I guess this isn't something that is tested in the daily builds?)<br>
<br>
</div>
<div>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>
<br>
</div>
<div>Andrew<br>
</div>
</div>
</div>
</div>
</div></div><span id="m_-2801225539773214264cid:9D33FD64-1548-462F-99BA-72879C96702C@ucsd.edu"><out.txt></span>_____________________<wbr>__________________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" target="_blank">http://mailman.mitgcm.org/<wbr>mailman/listinfo/mitgcm-<wbr>support</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote></div><br></div>