[MITgcm-support] easier ways to implement cost function

Dani Jones dcjones.work at gmail.com
Wed Mar 8 10:50:48 EST 2023


Hi Mario,

Yes, the scripts demonstrate different approaches for constructing masks
that are built on the ECCOv4 grid. I hope they're helpful!

Regarding your question on averaging over the last day of your run, you
will need to create a maskT file of length 2*N, where N is the number of
days in your model run. To average over the last day, set the Nth entry of
the maskT vector to 1.0, and the rest of the values to 0.0. Additionally,
ensure that gencost_avgperiod is set to 'day'.

If you want to average over a longer period, such as five days, each day
that you want to include in the average should have a value of 0.2 in the
maskT file. The weights are not automatically normalized.

It's worth mentioning that although the documentation suggests that the
maskT file should be of length N, I've found that using length 2*N avoids
"end of file" errors. This is probably because the gencost machinery
continues to read the mask file after the forward integration, but I've
never done a full investigation.

Thanks!
Dani


On Wed, Mar 8, 2023 at 3:00 PM mario wrk <wrkmario at gmail.com> wrote:

> Hi, Dani,
> A further step I am not sure is how to specify time and space/volume,
> which will be averaged in the cost function. Can I just use your script
> here https://github.com/DanJonesOcean/ECCO_v4_r2_config/tree/main/masks
> and then replace these lines?
> For instance, if I need to average over the last day of my run, do I need
> a time mask file? or just specify gencost_avgperiod(1) = 'day'?
> &ECCO_GENCOST_NML
> # SST
> gencost_avgperiod(1) = 'day',
> gencost_barfile(1) = 'm_sst_day',
> gencost_datafile(1) = 'lev_clim_temp.bin',
> gencost_errfile(1) = 'ones_32b.bin',
> gencost_name(1) = 'sst-MW',
> gencost_spmin(1) = -1.8,
> gencost_spmax(1) = 40.,
> gencost_spzero(1) = 0.,
> gencost_outputlevel(1)=1,
> mult_gencost(1) = 0.1,
> #
> &
> Best,
> Mario
>
> On Wed, Mar 8, 2023 at 5:30 PM mario wrk <wrkmario at gmail.com> wrote:
>
>> Thank you, Dani, it is indeed much easier, I just need to compile once
>> without explicitly specifying the cost function. It will definitely save a
>> lot of time!
>>
>> Best,
>> Mario
>>
>>
>> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20230308/1fc25092/attachment.html>


More information about the MITgcm-support mailing list