83d82 < integer ibdd0sst ! date of SST file start 86,95c85,86 < c new work variables for SST timing SPdeS < integer JD ! function JD for Julian date < integer jdmodel0 ! Julian date of model start integration < integer jdsst0 ! JD of SST data start < real sstoffset ! diff between model start and SST start (const. days) < real modeltime ! current time from model start (days) < real ssttime ! current time from SST start (days) < real sstotime ! time of older SST read < real dayfracmodel0 ! fractional days of model start from yymmdd 00Z < real dayfracsst0 ! frac. days of SST start from yymmdd 00Z --- > c > real day0sst ! day offset for SST file start (like ibyy0sst) 98,100c89,91 < c real aday0 ! < c real aday_model ! < c real akss ! --- > real aday0 ! > real aday_model ! > real akss ! 369,371d359 < < dayfracmodel0=real(ibhh)/24.0 < 373,381c361,367 < ibyy0sst=1990 < ibmm0sst=1 < ibdd0sst=3 < dayfracsst0=0.5 ! corresponds to 3 Jan 12:00 < else ! TMI < ibyy0sst=2001 < ibmm0sst=1 < ibdd0sst=1 < dayfracsst0=0.5 ! SST data centered at noon of Jan 1 --- > ibyy0sst=1990 > ibmm0sst=1 > day0sst =2.5 ! corresponds to 3 Jan 12:00 > else ! TMI > ibyy0sst=2001 > ibmm0sst=1 > day0sst =0.5 ! SST data centered at noon of Jan 1 467,488c453,460 < c some constants for the sst timing < jdmodel0= JD(ibyy ,ibmm ,ibdd ) < jdsst0= JD(ibyy0sst,ibmm0sst,ibdd0sst) < sstoffset= jdmodel0+dayfracmodel0 < & -(jdsst0 +dayfracsst0 ) < c check for model start before SST data < if ( sstoffset .le. -nday_sst ) then < write(6,*) 'Error: model start leads SST data by >= nday_sst.' < stop < elseif ( sstoffset .lt. 0.0 ) then < write(6,*) 'Warning: model starts before SST data.' < end if < c the following times are modified each timestep nt < modeltime= real(nt)*dt/daysec < ssttime=modeltime+sstoffset < c set ksst and dt_sst this way for the first time < ksst= 1+max(0,int(ssttime/nday_sst)) < sstotime= nday_sst*(ksst-1) < dt_sst= (ssttime-sstotime)/nday_sst < dt_ssto=dt_sst < write(6,*) 'KSST,dt_sst ', < + ksst,dt_sst --- > nyear90=ibyy-ibyy0sst > kday_year=nyear90*365 > kday_month=0 > if(ibmm.gt.ibmm0sst) then > do i=ibmm0sst,ibmm-1 > kday_month=kday_month+mdat(i) > enddo > endif 490,517c462,466 < ccc comment this out... < c nyear90=ibyy-ibyy0sst < c kday_year=nyear90*365 < c kday_month=0 < c if(ibmm.gt.ibmm0sst) then < c do i=ibmm0sst,ibmm-1 < c kday_month=kday_month+mdat(i) < c enddo < c endif < c < cc Reynolds SST elapsed time lags model time by 2.5 days, because this algorithm < cc assumes the Reynolds SST data starts on 1 Jan 1990 midnight, but it < cc actually starts on Jan 3, 1990 at noon (the first center of a time < cc window). For TMI daily OI, the time interval is centered at noon, < cc so day0sst=0.5 -SPdeS < c < c aday_model=-day0sst+real(ibhh+mtime)/24.0 < c kday_model=int(aday_model) < c kdayt=kday_year+kday_month+kday_model+ibdd+nyear90/4 < c akss=real(kdayt)/real(nday_sst) + 1 ! SPdeS +1 changes to fort(1:n) subscript, rather than c(0:n-1) subscripts < c ksst=int(akss) < c aday0=(akss-ksst)*nday_sst+(aday_model-kday_model) < c nday0=int(aday0) < c dt_sst=aday0/real(nday_sst) < c dt_ssto=dt_sst < c write(6,*) 'KSST, nday0,aday0,dt_sst ', < c + ksst,nday0,aday0,dt_sst < ccc ...comment out to here --- > c Reynolds SST elapsed time lags model time by 2.5 days, because this algorithm > c assumes the Reynolds SST data starts on 1 Jan 1990 midnight, but it > c actually starts on Jan 3, 1990 at noon (the first center of a time > c window). For TMI daily OI, the time interval is centered at noon, > c so day0sst=0.5 -SPdeS 518a468,478 > aday_model=-day0sst+real(ibhh+mtime)/24.0 > kday_model=int(aday_model) > kdayt=kday_year+kday_month+kday_model+ibdd+nyear90/4 > akss=real(kdayt)/real(nday_sst) + 1 ! SPdeS +1 changes to fort(1:n) subscript, rather than c(0:n-1) subscripts > ksst=int(akss) > aday0=(akss-ksst)*nday_sst+(aday_model-kday_model) > nday0=int(aday0) > dt_sst=aday0/real(nday_sst) > dt_ssto=dt_sst > write(6,*) 'KSST, nday0,aday0,dt_sst ', > + ksst,nday0,aday0,dt_sst 829,853c789 < < c SST read after NCEP read and possible output, before integration core < modeltime= real(nt)*dt/daysec < ssttime=modeltime+sstoffset < c Cray compiler requires these type conversions: < dt_sst=amod(ssttime,real(nday_sst))/real(nday_sst) < c but the following is sufficient on Sun compiler < c dt_sst=mod(ssttime,nday_sst)/nday_sst < c Read a new SST record when dt_sst wraps around to near zero < c update ssto, sstn < if( dt_sst .lt. dt_ssto) then < ssto=sstn < if ( sst_source .eq. 'REY' ) then < call sst_set_rey(sstn,lnd,lq,lp,dx,dy,79,1 ,1) < else < kssti=kssti+1 < call sst_set_tmi(sstn,lnd,lq,lp,dx,dy,39,kssti,0) < end if < endif < c Interpolate SST B.C. every timestep, update sst < sst=ssto+(sstn-ssto)*dt_sst ! rely on compiler to vectorize < c write(6,*) sst, dt_sst ! test diagnostic < sstm=sstm+sst*asum_sec < dt_ssto=dt_sst < --- > c 1034c970,992 < --- > dt_sst=amod(aday0*daysec+real(nt-nt0)*dt, > + real(nday_sst)*daysec)/(real(nday_sst)*daysec) > write(6,*) 'dt_sst = ', dt_sst > c Read a new SST record when dt_sst wraps around to near zero > if( dt_sst .lt. dt_ssto) then > write(6,*) 'dt_sst=',dt_sst, 'dt_ssto=',dt_ssto > ssto=sstn ! relies on f90 compiler to vectorize > if( sst_source .eq. 'REY' ) then > call sst_set_rey(sstn,lnd,lq,lp,dx,dy,79,1,1) > else ! TMI > kssti=kssti+1 > call sst_set_tmi(sstn,lnd,lq,lp,dx,dy,39,kssti,0) > endif > endif > c if(dt_sst.lt.1.0e-20) dt_sst=1.0 ! don't need this anymore SPdeS > do 203 i=1,lp > do 203 j=1,lq > if(lnd(j,i).eq.0) then > sst(j,i)=ssto(j,i)+(sstn(j,i)-ssto(j,i))*dt_sst > endif > sstm(j,i)=sstm(j,i)+sst(j,i)*asum_sec > 203 continue > dt_ssto=dt_sst