[MITgcm-devel] problem with exf_getffieldrec and obcs
Martin Losch
Martin.Losch at awi.de
Tue Jun 2 08:50:31 EDT 2009
Hi all,
exf_getffieldrec divides by fldperiod. That means, if it is called
with fldperiod=0, it produces nonsense for count1/count2. Originally
it's not called with fldperiod=0, because in that case exf_set_gen is
never called, but only exf_init_gen, where this case is handled.
However, now this function is also used in obcs_prescribe_exf_yz/xz
(obcs_prescribe_read.F) where it is possible to have fldperiod=0. I
have fixed this by including this code:
> if ( obcsperiod .eq. -12 ) then
> c obcsperiod=-12 means input file contains 12 monthly means
> c record numbers are assumed 1 to 12 corresponding to
> c Jan. through Dec.
> call cal_GetMonthsRec(
> O fac, first, changed,
> O count0, count1,
> I mycurrenttime, mycurrentiter, mythid
> & )
> elseif ( obcsperiod .eq. 0. _d 0 ) then
> c this is clearly a hack: we set the values of fac, first,
> changed,
> c etc. to read only the first record and only if
> mycurrentiter=niter0
> fac = 1. _d 0
> first = ((mycurrenttime - modelstart) .lt. 0.5*modelstep)
> changed = .false.
> count0 = 1
> count1 = count0
> elseif ( obcsperiod .lt. 0 ) then
> print *, 'obcsperiod is out of range'
> STOP 'ABNORMAL END: S/R OBCS_PRESCIBE_EXF_XZ'
> else
> c get record numbers and interpolation factor
> call exf_GetFFieldRec(
> I obcsstartdate, obcsperiod,
> I useYearlyFields,
> O fac, first, changed,
> O count0, count1, year0, year1,
> I mycurrenttime, mycurrentiter, mythid
> & )
> endif
>
which works for me, but I wonder if there is a better, and more
elegant way of doing this, maybe within exf_getffieldrec (otherwise I
am going to check in this hack, because I need this feature).
Martin
More information about the MITgcm-devel
mailing list