<div dir="ltr">Hi Mario,<div><br></div><div>Have you had a look at the "boxmean" options in the ecco package? There are tools in the ecco package for setting up generic cost function terms that can be switched on and off at runtime. It generally makes the process of defining the cost function much easier:<br><br><a href="https://mitgcm.readthedocs.io/en/latest/ocean_state_est/ocean_state_est.html#generic-integral-function">https://mitgcm.readthedocs.io/en/latest/ocean_state_est/ocean_state_est.html#generic-integral-function</a><br><br>Specifically, have a look at this table:<br><br><a href="https://mitgcm.readthedocs.io/en/latest/ocean_state_est/ocean_state_est.html#genint-ecco-barfile">https://mitgcm.readthedocs.io/en/latest/ocean_state_est/ocean_state_est.html#genint-ecco-barfile</a><br><br>I'm not sure if it will be helpful or not, but here is the setup that I have used for a few adjoint studies, using the generic integral approach:<br><br><a href="https://github.com/DanJonesOcean/ECCO_v4_r2_config">https://github.com/DanJonesOcean/ECCO_v4_r2_config</a><br><br>Thanks,<br>Dani<br><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:small"><div style="margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline">--<br><b>Dr Dan(i) Jones</b> • UKRI Future Leaders Fellow</div><div style="margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline"><a href="https://www.bas.ac.uk/team/science-teams/oceans/" title="https://www.bas.ac.uk/team/science-teams/oceans/" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline" target="_blank">Polar Oceans Team</a><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:inherit"><span style="margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:inherit"> </span>• </span><a href="https://www.bas.ac.uk/project/ai" title="https://www.bas.ac.uk/project/ai" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline" target="_blank">BAS AI Lab</a><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:inherit"> • </span><a href="https://www.bas.ac.uk/" title="https://www.bas.ac.uk/" style="margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline" target="_blank">British Antarctic Survey </a></div><div style="margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline"><a href="http://www.danjonesocean.com/" title="http://www.danjonesocean.com/" style="margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline" target="_blank">Website</a> • <a href="https://twitter.com/DanJonesOcean" title="https://twitter.com/DanJonesOcean" style="margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline" target="_blank">Twitter</a> • they/them</div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 8, 2023 at 1:18 PM mario wrk <<a href="mailto:wrkmario@gmail.com">wrkmario@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear MITgcm community,<div>Hi, May I ask a very general question, what is the easiest way to implement a cost function for adjoint study? As I find available cost functions in ecco package, can it be easier if I just call a cost function in pkg/ecco?</div><div><br></div><div>I was modifying the legacy code of my group, then I realized, even if I just want to change one variable, for example, Zonal Velocity to Temperature in the COST FUNCTION, I have to modify some other associated files (I did try and might not find all of them). Then I got TAF ERROR: code of function tbar not seen and no flow information set, cannot generate derivative common block variable to tbar</div><div><br></div><div>Best,</div><div>Mario</div></div>
_______________________________________________<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" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
</blockquote></div>