[MITgcm-devel] problem with exf_getffieldrec and obcs

Jean-Michel Campin jmc at ocean.mit.edu
Tue Jun 2 09:57:59 EDT 2009


Hi Martin,

Just a detail: obcsperiod is _RL or integer ?
could be more consistent to have the same type of comparaison:
in the 3 cases (with . _d 0 if _RL):
>>      if ( obcsperiod .eq. -12 ) then
>>       elseif ( obcsperiod .eq. 0. _d 0 ) then
>>       elseif ( obcsperiod .lt. 0 ) then

Otherwise, I don't know much about this EXF bit of code,
but may be a kind of safer way would be not to divide
by obcsperiod if it's zero (like we do in DIFFERENT_MULTIPLE
and DIFF_PHASE_MULTIPLE). But this could be changed later.

Jean-Michel

On Tue, Jun 02, 2009 at 02:50:31PM +0200, Martin Losch wrote:
> 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
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel



More information about the MITgcm-devel mailing list