New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 6041 for branches/2015/dev_r5776_UKMO2_OBS_efficiency_improvs/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90 – NEMO

Ignore:
Timestamp:
2015-12-14T10:06:06+01:00 (8 years ago)
Author:
timgraham
Message:

Merged head of trunk into branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5776_UKMO2_OBS_efficiency_improvs/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90

    r5332 r6041  
    2929   USE daymod          ! calendar 
    3030   USE eosbn2          ! eq. of state, Brunt Vaisala frequency (eos     routine) 
    31    USE ldftra_oce      ! ocean active tracers: lateral physics 
     31   USE ldftra          ! lateral physics: ocean active tracers 
    3232   USE zdf_oce         ! ocean vertical physics 
    3333   USE phycst          ! physical constants 
    3434   USE dtatsd          ! data temperature and salinity   (dta_tsd routine) 
    3535   USE dtauvd          ! data: U & V current             (dta_uvd routine) 
    36    USE zpshde          ! partial step: hor. derivative (zps_hde routine) 
    37    USE eosbn2          ! equation of state            (eos bn2 routine) 
    3836   USE domvvl          ! varying vertical mesh 
    39    USE dynspg_oce      ! pressure gradient schemes 
    40    USE dynspg_flt      ! filtered free surface 
    41    USE sol_oce         ! ocean solver variables 
    4237   ! 
    4338   USE in_out_manager  ! I/O manager 
     
    7671      ! 
    7772 
    78       IF(lwp) WRITE(numout,*) ' ' 
     73      IF(lwp) WRITE(numout,*) 
    7974      IF(lwp) WRITE(numout,*) 'istate_ini : Initialization of the dynamics and tracers' 
    8075      IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    8176 
    82       CALL dta_tsd_init                       ! Initialisation of T & S input data 
    83       IF( lk_c1d ) CALL dta_uvd_init          ! Initialization of U & V input data 
     77                     CALL dta_tsd_init        ! Initialisation of T & S input data 
     78      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data 
    8479 
    8580      rhd  (:,:,:  ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk 
     
    10398         ub   (:,:,:) = 0._wp   ;   un   (:,:,:) = 0._wp 
    10499         vb   (:,:,:) = 0._wp   ;   vn   (:,:,:) = 0._wp   
    105          rotb (:,:,:) = 0._wp   ;   rotn (:,:,:) = 0._wp 
    106          hdivb(:,:,:) = 0._wp   ;   hdivn(:,:,:) = 0._wp 
     100                                    hdivn(:,:,:) = 0._wp 
    107101         ! 
    108102         IF( cp_cfg == 'eel' ) THEN 
     
    119113            ENDIF 
    120114            IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
    121                CALL wrk_alloc( jpi, jpj, jpk, 2, zuvd ) 
     115               CALL wrk_alloc( jpi,jpj,jpk,2,  zuvd ) 
    122116               CALL dta_uvd( nit000, zuvd ) 
    123117               ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
    124118               vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
    125                CALL wrk_dealloc( jpi, jpj, jpk, 2, zuvd ) 
     119               CALL wrk_dealloc( jpi,jpj,jpk,2,  zuvd ) 
    126120            ENDIF 
    127121         ENDIF 
    128          ! 
    129          CALL eos( tsb, rhd, rhop, gdept_0(:,:,:) )        ! before potential and in situ densities 
    130 #if ! defined key_c1d 
    131          IF( ln_zps .AND. .NOT. ln_isfcav)                                 & 
    132             &            CALL zps_hde    ( nit000, jpts, tsb, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
    133             &                                            rhd, gru , grv    )  ! of t, s, rd at the last ocean level 
    134          IF( ln_zps .AND.       ln_isfcav)                                 & 
    135             &            CALL zps_hde_isf( nit000, jpts, tsb, gtsu, gtsv,  &    ! Partial steps for top cell (ISF) 
    136             &                                            rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
    137             &                                     gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level 
    138 #endif 
    139122         !    
    140123         ! - ML - sshn could be modified by istate_eel, so that initialization of fse3t_b is done here 
     
    142125            DO jk = 1, jpk 
    143126               fse3t_b(:,:,jk) = fse3t_n(:,:,jk) 
    144             ENDDO 
     127            END DO 
    145128         ENDIF 
    146129         !  
    147       ENDIF 
    148       ! 
    149       IF( lk_agrif ) THEN                  ! read free surface arrays in restart file 
    150          IF( ln_rstart ) THEN 
    151             IF( lk_dynspg_flt )  THEN      ! read or initialize the following fields 
    152                !                           ! gcx, gcxb for agrif_opa_init 
    153                IF( sol_oce_alloc()  > 0 )   CALL ctl_stop('agrif sol_oce_alloc: allocation of arrays failed') 
    154                CALL flt_rst( nit000, 'READ' ) 
    155             ENDIF 
    156          ENDIF                             ! explicit case not coded yet with AGRIF 
    157130      ENDIF 
    158131      ! 
     
    163136      ! 
    164137      ! 
    165       un_b(:,:) = 0._wp ; vn_b(:,:) = 0._wp 
    166       ub_b(:,:) = 0._wp ; vb_b(:,:) = 0._wp 
     138      un_b(:,:) = 0._wp   ;  vn_b(:,:) = 0._wp 
     139      ub_b(:,:) = 0._wp   ;  vb_b(:,:) = 0._wp 
    167140      ! 
    168141      DO jk = 1, jpkm1 
     
    202175      !! References :  Philander ??? 
    203176      !!---------------------------------------------------------------------- 
    204       INTEGER  :: ji, jj, jk 
    205       REAL(wp) ::   zsal = 35.50 
     177      INTEGER  ::   ji, jj, jk 
     178      REAL(wp) ::   zsal = 35.50_wp 
    206179      !!---------------------------------------------------------------------- 
    207180      ! 
     
    233206      !!                and relative vorticity fields 
    234207      !!---------------------------------------------------------------------- 
    235       USE divcur     ! hor. divergence & rel. vorticity      (div_cur routine) 
     208      USE divhor     ! hor. divergence      (div_hor routine) 
    236209      USE iom 
    237210      ! 
     
    282255            tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    283256            ! 
    284             ! set the dynamics: U,V, hdiv, rot (and ssh if necessary) 
     257            ! set the dynamics: U,V, hdiv (and ssh if necessary) 
    285258            ! ---------------- 
    286259            ! Start EEL5 configuration with barotropic geostrophic velocities  
     
    318291            ENDIF 
    319292            ! 
    320             CALL div_cur( nit000 )                  ! horizontal divergence and relative vorticity (curl) 
     293!!gm  Check  here call to div_hor should not be necessary 
     294!!gm         div_hor call runoffs  not sure they are defined at that level 
     295            CALL div_hor( nit000 )                  ! horizontal divergence and relative vorticity (curl) 
    321296            ! N.B. the vertical velocity will be computed from the horizontal divergence field 
    322297            ! in istate by a call to wzv routine 
     
    371346      !! 
    372347      !! ** Method  : - set temprature field 
    373       !!              - set salinity field 
     348      !!              - set salinity   field 
    374349      !!---------------------------------------------------------------------- 
    375350      INTEGER :: ji, jj, jk  ! dummy loop indices 
     
    457432      !!                 p=integral [ rau*g dz ] 
    458433      !!---------------------------------------------------------------------- 
    459       USE dynspg          ! surface pressure gradient             (dyn_spg routine) 
    460       USE divcur          ! hor. divergence & rel. vorticity      (div_cur routine) 
     434      USE divhor          ! hor. divergence                       (div_hor routine) 
    461435      USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
    462436      ! 
    463437      INTEGER ::   ji, jj, jk        ! dummy loop indices 
    464       INTEGER ::   indic             ! ??? 
    465438      REAL(wp) ::   zmsv, zphv, zmsu, zphu, zalfg     ! temporary scalars 
    466439      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprn 
    467440      !!---------------------------------------------------------------------- 
    468441      ! 
    469       CALL wrk_alloc( jpi, jpj, jpk, zprn) 
     442      CALL wrk_alloc( jpi,jpj,jpk,  zprn) 
    470443      ! 
    471444      IF(lwp) WRITE(numout,*)  
     
    529502      vb(:,:,:) = vn(:,:,:) 
    530503       
    531       ! WARNING !!!!! 
    532       ! after initializing u and v, we need to calculate the initial streamfunction bsf. 
    533       ! Otherwise, only the trend will be computed and the model will blow up (inconsistency). 
    534       ! to do that, we call dyn_spg with a special trick: 
    535       ! we fill ua and va with the velocities divided by dt, and the streamfunction will be brought to the 
    536       ! right value assuming the velocities have been set up in one time step. 
    537       ! we then set bsfd to zero (first guess for next step is d(psi)/dt = 0.) 
    538       !  sets up s false trend to calculate the barotropic streamfunction. 
    539  
    540       ua(:,:,:) = ub(:,:,:) / rdt 
    541       va(:,:,:) = vb(:,:,:) / rdt 
    542  
    543       ! calls dyn_spg. we assume euler time step, starting from rest. 
    544       indic = 0 
    545       CALL dyn_spg( nit000, indic )       ! surface pressure gradient 
    546  
    547       ! the new velocity is ua*rdt 
    548  
    549       CALL lbc_lnk( ua, 'U', -1. ) 
    550       CALL lbc_lnk( va, 'V', -1. ) 
    551  
    552       ub(:,:,:) = ua(:,:,:) * rdt 
    553       vb(:,:,:) = va(:,:,:) * rdt 
    554       ua(:,:,:) = 0.e0 
    555       va(:,:,:) = 0.e0 
    556       un(:,:,:) = ub(:,:,:) 
    557       vn(:,:,:) = vb(:,:,:) 
    558         
    559       ! Compute the divergence and curl 
    560  
    561       CALL div_cur( nit000 )            ! now horizontal divergence and curl 
    562  
    563       hdivb(:,:,:) = hdivn(:,:,:)       ! set the before to the now value 
    564       rotb (:,:,:) = rotn (:,:,:)       ! set the before to the now value 
    565       ! 
    566       CALL wrk_dealloc( jpi, jpj, jpk, zprn) 
     504      ! 
     505!!gm  Check  here call to div_hor should not be necessary 
     506!!gm         div_hor call runoffs  not sure they are defined at that level 
     507      CALL div_hor( nit000 )            ! now horizontal divergence 
     508      ! 
     509      CALL wrk_dealloc( jpi,jpj,jpk,   zprn) 
    567510      ! 
    568511   END SUBROUTINE istate_uvg 
Note: See TracChangeset for help on using the changeset viewer.