# Cycling dates in chem_surfvals_nl fails when data is yearly

2 posts / 0 new
raeder
Cycling dates in chem_surfvals_nl fails when data is yearly

I'm running a standard CAM, but trying to use cyclical dates for the chemistry:
&chem_surfvals_nl
flbc_type              = 'CYCLICAL'
flbc_cycle_yr          = 2014

There are 266 dates (yearly) in that file.
The last is 20150702.
It fails in mo_flbc.F90 because it finds the first year (2014)
then searches for the next date which has a different year,
but then subtracts 1 from that index (~ line 297),
which yields the index of the first date.

The indices need to differ by at least 2,
so it seems to be assuming that, after the first date,
there will be multiple dates with the same year.
Is that necessary for the rest of the interpolation(?)
algorithm?

Even if it didn't subtract 1, it would still fail in my case.

case( 'CYCLICAL' )
yr = flbc_timing%cycle_yr
do n = 1,ntimes
if( yr == dates(n)/10000 ) then
exit
end if
end do
tim_ndx(1) = n

do n = tim_ndx(1),ntimes
if( yr /= dates(n)/10000 ) then
exit
end if
end do
tim_ndx(2) = n - 1
if( (tim_ndx(2) - tim_ndx(1)) < 2 ) then
write(iulog,*) 'flbc_inti: cyclical lb conds require at least two time points'
write(iulog,*) '   tim_ndx = ',tim_ndx(1),tim_ndx(2),' dates = ',dates(n-1),dates(n),' ntimes = ',ntimes
call endrun
end if

1:    tim_ndx =          265         265  dates =     20140702  20150702    ntimes =          266

If yearly data is not usable, there should be a note in the namelist html page about that.

Thanks for any insight.

Kevin

raeder

I 'fixed' the problem by changing

tim_ndx(2) = n - 1
if( (tim_ndx(2) - tim_ndx(1)) < 2 ) then
to

tim_ndx(2) = n
if( (tim_ndx(2) - tim_ndx(1)) < 1 ) then

CAM ran, but I didn't analyse the output to see whether this degrades any physics.

Then I searched through the files in

I found that

LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc

has monthly data and the right variables.   It also enables CAM to run in CYCLICAL mode.

So I'll use this instead of the code fix.

I consider this issue resolved (if not perfectly fixed).