              PROGRAM EBU
C  MAIN PROGRAM 
C ------------------------------------------------
C             17.11.97      My version
C             19.11.97
C             16/04/98
C             20/04/98
C             14/05/98      New version for float1
C             12/08/98
C             20/10/98
C             22/05/2001
C ------------------------------------------------
C
                             L O G I C A L
     & RUN,FIRST,RESTRT,SIGMA
      REAL*8 t1,t2,t3
C----------------------------------------------------------------------
      INCLUDE "CTLBLK"      
      PARAMETER (IM=111,JM=221)
      PARAMETER (IMJM=IM*JM-JM/2)
      
      DIMENSION PDWORK(IMJM)
      
C--------INITIALIZE CONSTANTS AND VARIABLES-----------------------------
      call clock(t1)
                   CALL INIT
                   
         WRITE(66,*)'  NTSTM=',NTSTM     
         WRITE(66,*)'EBU PROGRAM START'
         WRITE(66,*)'IDTAD=',IDTAD,' #/'
         WRITE(66,*)'NRADS=',NRADS,' #/'
         WRITE(66,*)'NPHS =',NPHS, ' #/'
         WRITE(66,*)'TRANSPORT MODEL START (TM1)'                   

         CALL TM1(NTSD,IDAT,DT)
         
C--------JUMP INTO THE TIME LOOP FOR PRELIMINARY CALCULATIONS----------
                   G O   T O  1200
C********ENTRY INTO THE TIME LOOP***************************************
 2000 NTSD=NTSD+1
      IF(MOD(NTSD,225).EQ.0)THEN 
      WRITE(6,2001) NTSD,(NTSD-1)*DT,(NTSD-1)*DT/3600.
      ENDIF      
 2001 FORMAT('EBU(float1):  TIMESTEP NTSD=',I5,'  FCST TIME=',F8.1,
     * ' sec ',F8.1,' hrs')
C
C***********************************************************************
C
C--------PRESS. TEND.,ETA DOT & VERTICAL OMEGA-ALPHA--------------------
                   CALL PDTE                    
C--------IS IT TIME FOR A CHECK POINT ON THE MODEL HISTORY FILE?--------
                   CALL CHKOMG
C--------IS IT TIME FOR ADVECTION?--------------------------------------
      IF(MOD(NTSD-1,IDTAD).EQ.0)THEN
                   CALL VTADV
                   CALL HZADV
      ENDIF
C--------UPDATING PRESSURE DIFFERENCE-----------------------------------
                   CALL PDNEW
C--------RADIATION------------------------------------------------------
      IF(MOD(NTSD-1,NRADS).EQ.0.OR.MOD(NTSD-1,NRADL).EQ.0)
     1             CALL RADTN
C--------APPLY TEMPERATURE TENDENCY DUE TO RADIATION--------------------
                   CALL RDTEMP
C--------TURBULENT PROCESSES AND PRECIPITATION--------------------------
      IF(MOD(NTSD-1,NPHS).EQ.0)        T H E N
                   CALL PROFQ2
                   CALL SURFCE
                   CALL PROFS
      ENDIF
      IF(MOD(NTSD-1,NPHS).EQ.0)       T H E N
                   CALL GSCOND
      ENDIF
      IF(MOD(NTSD-1,NCNVC).EQ.0)        T H E N
                   CALL CUCNVC
      ENDIF
      IF(MOD(NTSD-1,NPHS).EQ.0)       T H E N
                   CALL PRECPD
      ENDIF
C--------LATERAL DIFFUSION---------------------------------------------
                   CALL HDIFF
C--------UPDATING BOUNDARY VALUES AT HEIGHT POINTS----------------------
                   CALL BOCOH
C--------IS IT TIME FOR A CHECK POINT ON THE MODEL HISTORY FILE?-------
 1200              CALL CHKOUT 
C--------PGF,CORIOLIS,DIVERGENCE & HORIZONTAL PART OF OMEGA-ALPHA-------
                   CALL PFDHT
C--------CLEAN UP AFTER 1ST STEP PRELIMINARY CALCULATIONS---------------
      IF(FIRST.AND..NOT.RESTRT)        T H E N
                   FIRST=.FALSE.
                   
      call clock(t2)
      write(6,1001) t2-t1
      
      call clock(t1)      
1001  format('CPU TIME for initiallization: ',f10.4,' sec')
C                     
                   GO TO 2000
      ENDIF
C -----------------------------------------------------------------

      CALL EXCHAN(NTSD,IDAT)
     
C--------DIVERGENCE DAMPING---------------------------------------------
                   CALL DDAMP
C--------UPDATING BOUNDARY VALUES AT VELOCITY POINTS--------------------
                   CALL BOCOV
C--------CLEAN UP AFTER RESTART-----------------------------------------
      IF(RESTRT)                       T H E N
                   FIRST=.FALSE.
                   RESTRT=.FALSE.
      ENDIF
C***********************************************************************
      IF(NTSD.LT.NTSTM)                GO TO 2000
C********EXIT FROM THE TIME LOOP****************************************
      call clock(t2)
      write(6,1002) t2-t1     
1002  format('CPU TIME for calculation: ',f10.4,' sec')  
                            STOP1
      END
      