


PGF90 (Version     12.8)          08/30/2020  00:27:45      page 1

Switches: -noasm -nodclchk -nodebug -nodlines -noline -list
          -idir ../include
          -inform warn -opt 1 -nosave -object -noonetrip
          -depchk on -nostandard     
          -nosymbol -noupcase    

Filename: etapost.f90

(    1)       program etapost
(    2) 
(    3)       USE  mod_vrbls
(    4)       USE  mod_extra
(    5)       USE  mod_masks
(    6)       USE  mod_pvrbls
(    7)       USE  mod_pvrbls_ll
(    8)       USE  mod_graph
(    9) 
(   10)       implicit none
(   11)       include 'param_o.h'
../include/param_o.h
(    1)*      integer,parameter  :: im0=401
(    2)*      integer, parameter :: nm=6
(    3)*      integer, parameter :: lm = 50
(    4)*      integer, parameter :: nsub = 10
(    5)*
(    6)*      integer, parameter :: im=im0, jm=im
(    7)*      integer, parameter :: im1=im-1, jm1=jm-1
(    8)*
(    9)*      integer, parameter :: lm1 = lm-1, lp1 =lm +1  
(   10)*
(   11)*      integer, parameter :: ixm = nsub, jym = ixm, nxy = ixm*jym
(   12)*      integer, parameter :: ildom = (im - 1)/ixm, jldom = (jm - 1)/jym
(   13)*      integer, parameter :: ilm = (im - 1)/ixm +1, jlm = (jm - 1)/jym +1 
(   14)*
(   15)*      logical,parameter::flat=.false.
(   16)*      logical,parameter::hstst=.false.
(   17)*
(   18)*!      integer,parameter::igm=360, jgm = 181
(   19)*      integer,parameter::igm=(im0-1)*4, jgm = (igm/2)+1      
(   20)*      real,parameter::alfa=0.0, beta=0.0, gamm=0.0
(   21)*!      real,parameter::alfa=0.*3.1415926/180.,beta=66.*3.1415926/180. &
(   22)*!	              ,gamm=175.*3.1415926/180.
(   23)*
(   24)*!GSM      integer,parameter::lsm=20
(   25)*      integer,parameter::lsm=31
(   26)*
(   27)*!RESTART
(   28)*
(   29)*      character(len=10):: restartdate='2020080412'    !restart date to create appropriate folder name
(   12)       include 'const.h'
../include/const.h
(    1)*      logical :: run, first, restrt, subpost
(    2)*      integer :: nfcst,nbc,list,ntsd,nddamp,nprec, &
(    3)*                 nboco,nshde,ncp,ntddmp
(    4)*      logical,parameter::lcornerm=.FALSE.
(    5)*      
(    6)*      real,parameter :: dt=40               ! length of each time step
(    7)*      logical,parameter:: sigma=.false.
(    8)*!GSM      integer,parameter::outnum=40            ! number of outputs






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 2

(    9)*!GSM      integer,parameter::nday=10                ! number of days
(   10)*      integer,parameter:: ntstm=3600*24*10/dt      ! total time steps
(   11)*!      integer,parameter:: idtad=1
(   12)*!      integer,parameter:: ncnvc=45
(   13)*!test      integer,parameter::nphs=45
(   14)* 
(   15)*      integer,parameter:: idtad=2
(   16)*      integer,parameter:: ncnvc=6
(   17)*      integer,parameter::nphs=6
(   18)* 
(   19)* 
(   20)*      integer,parameter::nradsh=1
(   21)*!GSM      integer,parameter::nradlh=2
(   22)*      integer,parameter::nradlh=1
(   23)*      real,parameter::tsph=3600./dt
(   24)*      integer,parameter::nrads=tsph*nradsh
(   25)*      integer,parameter::nradl=tsph*nradlh
(   26)*      real,parameter::weig=0.25
(   27)*      
(   28)*!
(   29)*! parameters for diagnostics
(   30)*!
(   31)*      
(   32)*      integer,parameter::idgns=10
(   33)*      integer,parameter::dgnstr=24*3600*200/dt
(   34)*      integer,parameter::dgnnum=(ntstm-dgnstr)/idgns+1
(   35)*      integer,parameter::ickmm=1
(   36)*      
(   37)*!
(   38)*!  parameter for initial values
(   39)*!
(   40)*            real(KIND=4),parameter::pt = 2500.0
(   41)*!!!test Dragan 1dec2015
(   42)*!!            real,parameter::pt=1000
(   43)*      
(   44)*!
(   45)*!  date
(   46)*!
(   47)*           integer::idat(3)
(   48)*!GSM           data idat/07,21,2020/
(   49)*!GSM           integer::ihrst=0
(   50)*
(   51)*! variable sst
(   52)*          logical::lvsst
(   53)*
(   54)*! data assimilation constants
(   55)*        
(   56)*	  integer,parameter::ndassim=3*3600/dt
(   57)*!	  integer,parameter::ndassimm=8*ndassim
(   58)*	  integer,parameter::ndassimm=0
(   59)*      integer,parameter::outstr=ndassimm      ! step at which starts output
(   60)*       integer,parameter::outend=  ntstm+ndassimm       ! step at which ends output
(   61)*!GSM      integer,parameter::iout=(outend-outstr)/outnum   ! steps between two output
(   62)*
(   63)*!  data choice
(   64)*
(   65)*      integer,parameter::sstc=1         ! 1 is NCEP sst data
(   66)*                                             ! 2 is TMI sst data






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 3

(   67)*
(   68)*    
(   13)       integer::npes,nhstep
(   14)       parameter(npes=nsub*nsub*nm,nhstep=1) 
(   15)       integer :: nh,dd, mm, yyyy, hh, bb, ddmax, mmmax,outperiod,INDAY,IOUTNUM,IIOUT,IHRST,nday,outnum
(   16) !      integer::nh,dd, mm, yyyy, hh, bb, ddmax, mmmax,outperiod
(   17) !     ! character(len=3)::c_nh
(   18) 
(   19) !!!!!!!!RESTART  added 30/04/2019 
(   20)       integer :: day, mon, yr, utc, iutc, nhrs, hhzero
(   21) !!!!!!!!
(   22)   
(   23)       character(len=10)::c_nh
(   24) !      character(len=8)::date
(   25)       character(len=256)::fname1,fname2
(   26) 
(   27)       character(len=10):: Run_Date
(   28) 
(   29)       character(len=6):: c_nhrs   !RESTART
(   30)       
(   31) !character(len=4)::c_nh2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(   32) 
(   33) !!JNT Initilize old common variables 
(   34)       print *,'allocate  vrbls ...'
(   35)       call alloc_vrbls
(   36)       print *,'allocate  extra ...'
(   37)       call alloc_extra
(   38)       print *,'allocate  masks ...'
(   39)       call alloc_masks
(   40)       print *,'allocate  pvrbls ...'
(   41)       call alloc_pvrbls
(   42)       print *,'allocate  pvrbls_ll ...'
(   43)       call alloc_pvrbls_ll
(   44)       print *,'allocate  graph ...'
(   45)       call alloc_graph
(   46)       print *,'calling  initmap ...'
(   47) 
(   48)       call initmap
(   49) !!!!D july2015      fname1='../data_out/hgt500UG.dat'
(   50) !!!!      open(10,file=fname1,status='unknown',form='unformatted') 
(   51)        
(   52) !commented, Dragan, 25/06/2019, when restart option is introduced       
(   53)       NAMELIST /CNSTDATA/INDAY,IHRST,IDAT,IOUTNUM,IIOUT
(   54)       open(19,file='cnstdata',status='old')
(   55) !       open(19,file='/scratchin/grupos/grpeta/projetos/tempo/oper/GEF_v1.0.0-KF/gef_trunk/cnstdata',status='old') 
(   56)       READ(19,CNSTDATA)
(   57) 
(   58) 
(   59)        nday=INDAY
(   60)        outnum=IOUTNUM
(   61) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!       
(   62)        
(   63) 
(   64) !!!!!!!!RESTART  added 25/06/2019 
(   65) 
(   66)        open(27, file='restrt_nmlst.txt', STATUS='OLD')
(   67)        rewind 27
(   68)        read(27,*)restrt






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 4

(   69)        read(27,*)nhrs
(   70) !!!!!!!!!
(   71)        
(   72)        yyyy=IDAT(3)  ! 
(   73)        mm  =IDAT(1)  ! initial date, day, month, year    !******uncomment!!!!!!!
(   74)        dd  =IDAT(2)  !
(   75)        hh  =ihrst
(   76)      
(   77) !GSM     
(   78)       write(Run_Date,'(BZ,i4.4,3i2.2)')yyyy,mm,dd,hh
(   79) !GSM  
(   80)      
(   81)       print*,'DATE=',dd,mm,yyyy,hh
(   82)      
(   83)      
(   84)        outperiod=outnum/nday
(   85)        
(   86)        
(   87)       !!!!!!!!!!!!!!! 
(   88) !      dd=29          
(   89) !      mm=3            
(   90) !      yyyy=1996            !!!! DRAGAN, 09.02.2011.  *****comment!!!!!!
(   91) !      hh=12           
(   92) !      hh=0 
(   93)      
(   94)      
(   95)                    
(   96)       mmmax=12      
(   97)       !!!!!!!!!!!!!!!
(   98)   
(   99)   
(  100)               !===================!
(  101)               !!!!!!!!!!!!!!!!!!!!!
(  102) !_ _ _ _ _ _ _!DO LOOP BEGINS HERE!  
(  103)               !!!!!!!!!!!!!!!!!!!!!  
(  104) 	      !===================!
(  105) 	       
(  106) !!JNT       
(  107) !RESTART      
(  108)     if(.not.restrt)then                   
(  109) 
(  110)      do nh = 0,outnum  !nhmax, nhstep     !DRAGAN, 17/07/2019  !test when first output is at 00 hs, 
(  111)                                                                !added another call to out2 in gef.f90, before do loop, and nhrs=-1 in init.f90
(  112) 
(  113) !!!     do nh = 1,outnum  !nhmax, nhstep     !DRAGAN, 13/02/2019  !test when first output is after 6hs
(  114) 
(  115) 
(  116) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DRAGAN, 09.02.2011.
(  117) !!!!!!!!===================================================!!!!!!!
(  118) !!!!!!!! RECOGNIZING THE OUTPUT PERIOD FROM CONFIGURE PART !!!!!!!
(  119) !!!!!!!!===================================================!!!!!!!
(  120) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     
(  121)      
(  122) !!!============!!! 
(  123) !!! 24h output !!!
(  124) !!!============!!!
(  125)     
(  126)       if(outperiod.eq.1)then






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 5

(  127)       bb=nh*24
(  128)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  129)           hh=hh+24
(  130)          endif  
(  131) 	 
(  132) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  133)           hh=0
(  134)           dd=dd+1
(  135)          endif 
(  136) 	 
(  137) 	 
(  138) 	 if(hh.gt.24) then
(  139) 	  hh=hh-24
(  140) 	  dd=dd+1
(  141)  	 endif 
(  142)       endif
(  143) 
(  144) !!!============!!! 
(  145) !!! 12h output !!!
(  146) !!!============!!!  
(  147)      
(  148)       if(outperiod.eq.2)then
(  149)       bb=nh*12
(  150)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  151)           hh=hh+12
(  152)          endif  
(  153) 	 
(  154) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  155)           hh=0
(  156)           dd=dd+1
(  157)          endif 
(  158) 	 
(  159) 	 
(  160) 	 if(hh.gt.24) then
(  161) 	  hh=hh-24
(  162) 	  dd=dd+1
(  163) 	 endif 
(  164)       endif
(  165) 
(  166) !!!============!!! 
(  167) !!!  8h output !!!
(  168) !!!============!!!     
(  169)     
(  170)       if(outperiod.eq.3)then
(  171)       bb=nh*8
(  172)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  173)           hh=hh+8
(  174)          endif  
(  175) 	 
(  176) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  177)           hh=0
(  178)           dd=dd+1
(  179)          endif 
(  180) 	 
(  181) 	 
(  182) 	 if(hh.gt.24) then
(  183) 	  hh=hh-24
(  184) 	  dd=dd+1






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 6

(  185) 	 endif 
(  186)       endif
(  187) 
(  188) !!!============!!! 
(  189) !!!  6h output !!!
(  190) !!!============!!!     
(  191)      
(  192)       if(outperiod.eq.4)then
(  193)       bb=nh*6
(  194)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  195) 	  hh=hh+6
(  196)       endif  
(  197) 	 
(  198)      if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  199) 	  hh=0
(  200) 	  dd=dd+1
(  201)      endif 
(  202) 	 
(  203) 	 
(  204)      if(hh.gt.24) then
(  205)       hh=hh-24
(  206)       dd=dd+1
(  207)      endif 
(  208) 
(  209) !12Z      if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  210) !12Z          hh=hh+6
(  211) !12Z      endif
(  212)          
(  213) !12Z      if(hh.ge.24) then
(  214) !12Z	  hh=hh-24
(  215) !12Z	  dd=dd+1
(  216) !12Z      endif
(  217) 
(  218)       endif
(  219) 
(  220) !!!============!!! 
(  221) !!!  4h output !!!
(  222) !!!============!!!     
(  223)      
(  224)       if(outperiod.eq.6)then
(  225)       bb=nh*4
(  226)          
(  227) 	 if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  228)           hh=hh+4
(  229)          endif  
(  230) 	 
(  231) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  232)           hh=0
(  233)           dd=dd+1
(  234)          endif 
(  235) 	 
(  236) 	 
(  237) 	 if(hh.gt.24) then
(  238) 	  hh=hh-24
(  239) 	  dd=dd+1
(  240) 	 endif 
(  241)     
(  242)       endif






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 7

(  243) 
(  244) !!!============!!! 
(  245) !!!  3h output !!!
(  246) !!!============!!!    
(  247)     
(  248)       if(outperiod.eq.8)then
(  249)       bb=nh*3
(  250)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  251)           hh=hh+3
(  252)          endif  
(  253) 	 
(  254) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  255)           hh=0
(  256)           dd=dd+1
(  257)          endif 
(  258) 	 
(  259) 	 
(  260) 	 if(hh.gt.24) then
(  261) 	  hh=hh-24
(  262) 	  dd=dd+1
(  263) 	 endif 
(  264)       endif
(  265) 
(  266) !!!============!!! 
(  267) !!!  2h output !!!
(  268) !!!============!!!    
(  269)      
(  270)       if(outperiod.eq.12)then
(  271)       bb=nh*2
(  272)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  273)           hh=hh+2
(  274)          endif  
(  275) 	 
(  276) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  277)           hh=0
(  278)           dd=dd+1
(  279)          endif 
(  280) 	 
(  281) 	 
(  282) 	 if(hh.gt.24) then
(  283) 	  hh=hh-24
(  284) 	  dd=dd+1
(  285) 	 endif 
(  286)       endif
(  287) 
(  288) !!!============!!! 
(  289) !!!  1h output !!!
(  290) !!!============!!!     
(  291)      
(  292)       if(outperiod.eq.24)then
(  293)       bb=nh*1
(  294)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  295)           hh=hh+1
(  296)          endif  
(  297) 	 
(  298) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  299)           hh=0
(  300)           dd=dd+1






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 8

(  301)          endif 
(  302) 	 
(  303) 	 
(  304) 	 if(hh.gt.24) then
(  305) 	  hh=hh-24
(  306) 	  dd=dd+1
(  307) 	 endif 
(  308)       endif
(  309)      
(  310)      
(  311) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
(  312) 
(  313) 
(  314)       
(  315)       if ((mm.eq.1.).or.(mm.eq.3).or.(mm.eq.5).or.(mm.eq.7).or.(mm.eq.8).or.(mm.eq.10).or.(mm.eq.12)) then
(  316)       ddmax=31
(  317)       endif
(  318)       
(  319)       if ((mm.eq.4.).or.(mm.eq.6).or.(mm.eq.9).or.(mm.eq.11)) then
(  320)       ddmax=30
(  321)       endif
(  322)       
(  323)       if (mm.eq.2) then
(  324)       ddmax=28
(  325)       endif
(  326)       
(  327)       if ((mm.eq.2.).and.(mod(yyyy,4).eq.0)) then
(  328)       ddmax=29
(  329)       endif
(  330)       
(  331)       if (dd.gt.ddmax) then
(  332)       dd=1
(  333)       mm=mm+1
(  334)       endif
(  335)       
(  336)       if (mm.gt.mmmax) then
(  337)       mm=1
(  338)       yyyy=yyyy+1
(  339)       endif
(  340)         
(  341) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DRAGAN, 09.02.2011.
(  342) 
(  343)       !write(c_nh,'(i3.3)')nh   !!!
(  344)       
(  345)       write(c_nh,'(i2.2,i2.2,i4.4,i2.2)')dd,mm,yyyy,hh  !!!!!!!!!!!! DRAGAN, 09.02.2011.
(  346) 
(  347) !      write(date,'(i4.4,i2.2,i2.2)')yyyy,mm,dd   !DRAGAN aug 2017  
(  348) 	
(  349) 	
(  350)        fname2='../GLOBRUN/'//Run_Date//'/globrun'//c_nh//'.dat'
(  351)       
(  352) !!!DRAGAN 03/07/2019      fname2='/scratchout/grupos/grpeta/projetos/tempo/oper/GEF_v1.0.0-KF/GLOBRUN/'//Run_Date//'/globrun'//c_nh//'.dat'
(  353) 
(  354)       print *,fname2
(  355)       open(9, file=fname2, status='unknown',form = 'unformatted') 
(  356)                                               
(  357)        print *,nh 
(  358)        print *, "reading input data in initpost .... "






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 9

(  359)         call initpost(nh)
(  360)        print *, "calling etafld .... "
(  361)         call etafld
(  362)        print *, "calling slp .... "
(  363)         call slp
(  364)         if(sigma) then
(  365)        print *, "calling sig2p .... "
(  366)           call sig2p
(  367)         else 
(  368)        print *, "calling eta2p .... "
(  369) 	  call eta2p
(  370)         endif
(  371)        print *, "calling surfce .... "
(  372) 	call surfce
(  373)        print *, "calling qu2ll2  .... "
(  374) !        call qu2ll
(  375)         call qu2ll2
(  376)        print *, ' back to etapost enddo .. '
(  377)       close(9)
(  378)      
(  379)      
(  380)      
(  381)                    enddo
(  382) 
(  383) 
(  384)               else
(  385) 
(  386) 
(  387)          print*,'RESTRT=',restrt, 'NHRS=',nhrs 
(  388)          
(  389) 	 
(  390)  
(  391)          ntsd=(nhrs*((24/outperiod)*3600))/dt
(  392)  
(  393)          print*, 'NTSD_calculated=',ntsd 
(  394)      
(  395) 	 iutc=NTSD*DT/3600     
(  396)          
(  397) 	 CALL getdate(yyyy,mm,dd,iutc,yr,mon,day,utc)     
(  398)       
(  399)          yyyy=yr
(  400) 	 mm=mon
(  401) 	 dd=day
(  402) !	 hh=utc
(  403) 	 
(  404) 	 outperiod=outnum/nday
(  405) 	 
(  406) 	 print*,'RESTART_DATE=',dd,mm,yyyy,hh, 'ntsd=',ntsd, 'outperiod=',outperiod
(  407)            
(  408)          	 
(  409) !!!!!!==================================!!!!!!!!!!!!!!!!!!!!!	 
(  410)       do nh = (nhrs+1),outnum  !RESTART
(  411) !!!!!!==================================!!!!!!!!!!!!!!!!!!!!!
(  412) 
(  413) 
(  414) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DRAGAN, 09.02.2011.
(  415) !!!!!!!!===================================================!!!!!!!
(  416) !!!!!!!! RECOGNIZING THE OUTPUT PERIOD FROM CONFIGURE PART !!!!!!!






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 10

(  417) !!!!!!!!===================================================!!!!!!!
(  418) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!     
(  419)      
(  420) !!!============!!! 
(  421) !!! 24h output !!!
(  422) !!!============!!!
(  423)     
(  424)       if(outperiod.eq.1)then
(  425)       bb=nh*24
(  426)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  427)           hh=hh+24
(  428)          endif  
(  429) 	 
(  430) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  431)           hh=0
(  432)           dd=dd+1
(  433)          endif 
(  434) 	 
(  435) 	 
(  436) 	 if(hh.gt.24) then
(  437) 	  hh=hh-24
(  438) 	  dd=dd+1
(  439)  	 endif 
(  440)       endif
(  441) 
(  442) !!!============!!! 
(  443) !!! 12h output !!!
(  444) !!!============!!!  
(  445)      
(  446)       if(outperiod.eq.2)then
(  447)       bb=nh*12
(  448)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  449)           hh=hh+12
(  450)          endif  
(  451) 	 
(  452) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  453)           hh=0
(  454)           dd=dd+1
(  455)          endif 
(  456) 	 
(  457) 	 
(  458) 	 if(hh.gt.24) then
(  459) 	  hh=hh-24
(  460) 	  dd=dd+1
(  461) 	 endif 
(  462)       endif
(  463) 
(  464) !!!============!!! 
(  465) !!!  8h output !!!
(  466) !!!============!!!     
(  467)     
(  468)       if(outperiod.eq.3)then
(  469)       bb=nh*8
(  470)          if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  471)           hh=hh+8
(  472)          endif  
(  473) 	 
(  474) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 11

(  475)           hh=0
(  476)           dd=dd+1
(  477)          endif 
(  478) 	 
(  479) 	 
(  480) 	 if(hh.gt.24) then
(  481) 	  hh=hh-24
(  482) 	  dd=dd+1
(  483) 	 endif 
(  484)       endif
(  485) 
(  486) !!!============!!! 
(  487) !!!  6h output !!!
(  488) !!!============!!!     
(  489)      
(  490)       if(outperiod.eq.4)then
(  491)       bb=nh*6
(  492)         
(  493)       if (    (   (mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)    ).and.   (nh.ne.0)   ) then
(  494)           hh=hh+6
(  495)          endif  
(  496) 	 
(  497) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  498)           hh=0
(  499)           dd=dd+1
(  500)          endif 
(  501) 	  
(  502) 	 
(  503) 	 if(hh.gt.24) then
(  504) 	  hh=hh-24
(  505) 	  dd=dd+1
(  506) 	 endif 
(  507)       endif
(  508) 
(  509) !!!============!!! 
(  510) !!!  4h output !!!
(  511) !!!============!!!     
(  512)      
(  513)       if(outperiod.eq.6)then
(  514)       bb=nh*4
(  515)          
(  516) 	 if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  517)           hh=hh+4
(  518)          endif  
(  519) 	 
(  520) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  521)           hh=0
(  522)           dd=dd+1
(  523)          endif 
(  524) 	 
(  525) 	 
(  526) 	 if(hh.gt.24) then
(  527) 	  hh=hh-24
(  528) 	  dd=dd+1
(  529) 	 endif 
(  530)     
(  531)       endif
(  532) 






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 12

(  533) !!!============!!! 
(  534) !!!  3h output !!!
(  535) !!!============!!!    
(  536)     
(  537)       if(outperiod.eq.8)then
(  538)       bb=nh*3
(  539)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  540)           hh=hh+3
(  541)          endif  
(  542) 	 
(  543) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  544)           hh=0
(  545)           dd=dd+1
(  546)          endif 
(  547) 	 
(  548) 	 
(  549) 	 if(hh.gt.24) then
(  550) 	  hh=hh-24
(  551) 	  dd=dd+1
(  552) 	 endif 
(  553)       endif
(  554) 
(  555) !!!============!!! 
(  556) !!!  2h output !!!
(  557) !!!============!!!    
(  558)      
(  559)       if(outperiod.eq.12)then
(  560)       bb=nh*2
(  561)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  562)           hh=hh+2
(  563)          endif  
(  564) 	 
(  565) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  566)           hh=0
(  567)           dd=dd+1
(  568)          endif 
(  569) 	 
(  570) 	 
(  571) 	 if(hh.gt.24) then
(  572) 	  hh=hh-24
(  573) 	  dd=dd+1
(  574) 	 endif 
(  575)       endif
(  576) 
(  577) !!!============!!! 
(  578) !!!  1h output !!!
(  579) !!!============!!!     
(  580)      
(  581)       if(outperiod.eq.24)then
(  582)       bb=nh*1
(  583)       if (((mod(bb,24).ne.0).or.(mod(bb,24).eq.0.and.hh.lt.24)).and.(nh.ne.0)) then
(  584)           hh=hh+1
(  585)          endif  
(  586) 	 
(  587) 	 if ((mod(bb,24).eq.0).and.(nh.ne.0).and.(hh.eq.24)) then
(  588)           hh=0
(  589)           dd=dd+1
(  590)          endif 






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 13

(  591) 	 
(  592) 	 
(  593) 	 if(hh.gt.24) then
(  594) 	  hh=hh-24
(  595) 	  dd=dd+1
(  596) 	 endif 
(  597)       endif
(  598)      
(  599)      
(  600) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
(  601) 
(  602) 
(  603)       
(  604)       if ((mm.eq.1.).or.(mm.eq.3).or.(mm.eq.5).or.(mm.eq.7).or.(mm.eq.8).or.(mm.eq.10).or.(mm.eq.12)) then
(  605)       ddmax=31
(  606)       endif
(  607)       
(  608)       if ((mm.eq.4.).or.(mm.eq.6).or.(mm.eq.9).or.(mm.eq.11)) then
(  609)       ddmax=30
(  610)       endif
(  611)       
(  612)       if (mm.eq.2) then
(  613)       ddmax=28
(  614)       endif
(  615)       
(  616)       if ((mm.eq.2.).and.(mod(yyyy,4).eq.0)) then
(  617)       ddmax=29
(  618)       endif
(  619)       
(  620)       if (dd.gt.ddmax) then
(  621)       dd=1
(  622)       mm=mm+1
(  623)       endif
(  624)       
(  625)       if (mm.gt.mmmax) then
(  626)       mm=1
(  627)       yyyy=yyyy+1
(  628)       endif
(  629)         
(  630) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DRAGAN, 09.02.2011.
(  631) 
(  632)       
(  633)       write(c_nh,'(i2.2,i2.2,i4.4,i2.2)')dd,mm,yyyy,hh  !!!!!!!!!!!! DRAGAN, 09.02.2011.
(  634) 
(  635) 
(  636)       write(c_nhrs,'(i6)')nhrs
(  637) 
(  638) 
(  639)       fname2='../GLOBRUN/RESTART_'//restartdate//'/globrun'//c_nh//'.dat'
(  640) 
(  641)       print *,fname2
(  642)       open(9, file=fname2, status='unknown',form = 'unformatted') 
(  643)                                               
(  644)        print *,nh 
(  645)        print *, "reading input data in initpost .... "
(  646)         call initpost(nh)
(  647)        print *, "calling etafld .... "
(  648)         call etafld






PGF90 (Version     12.8)          08/30/2020  00:27:45      page 14

(  649)        print *, "calling slp .... "
(  650)         call slp
(  651)         if(sigma) then
(  652)        print *, "calling sig2p .... "
(  653)           call sig2p
(  654)         else 
(  655)        print *, "calling eta2p .... "
(  656) 	  call eta2p
(  657)         endif
(  658)        print *, "calling surfce .... "
(  659) 	call surfce
(  660)        print *, "calling qu2ll2  .... "
(  661) !        call qu2ll
(  662)         call qu2ll2
(  663)        print *, ' back to etapost enddo .. '
(  664)       close(9)
(  665)      
(  666)      
(  667)       enddo
(  668)  
(  669)  
(  670)       endif 
(  671)       
(  672)  !!!!!!!! added 25/06/2019, Dragan
(  673) 
(  674) 
(  675) 
(  676)       
(  677)                !=====================!
(  678)                !!!!!!!!!!!!!!!!!!!!!!!
(  679)  !_ _ _ _ _ _ _!DO LOOP FINISHES HERE!  
(  680)                !!!!!!!!!!!!!!!!!!!!!!!   
(  681)                !=====================!
(  682) 	       
(  683)   
(  684)       close(10)
(  685) 
(  686)       !! call heat_budget
(  687)       print *,'etapost finished'
(  688) 
(  689)       call grid_prop
(  690) 
(  691)       call dealloc_vrbls
(  692)       call dealloc_extra
(  693)       call dealloc_masks
(  694)       call dealloc_pvrbls
(  695)       call dealloc_pvrbls_ll
(  696)       call dealloc_graph
(  697) 
(  698)       end program etapost
