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 10928 for NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/DOM/istate.F90 – NEMO

Ignore:
Timestamp:
2019-05-03T17:44:56+02:00 (5 years ago)
Author:
davestorkey
Message:

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps : Finish converting DYN module, including some updates to previously processed modules, but excluding dynnxt.F90 (which needs to be completely rewritten) and wet_dry.F90 - I need to talk to Enda about this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/DOM/istate.F90

    r10922 r10928  
    5151CONTAINS 
    5252 
    53    SUBROUTINE istate_init( Kbb, Kmm ) 
     53   SUBROUTINE istate_init( Kbb, Kmm, Kaa ) 
    5454      !!---------------------------------------------------------------------- 
    5555      !!                   ***  ROUTINE istate_init  *** 
     
    5757      !! ** Purpose :   Initialization of the dynamics and tracer fields. 
    5858      !!---------------------------------------------------------------------- 
    59       INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
     59      INTEGER, INTENT( in )  ::  Kbb, Kmm, Kaa   ! ocean time level indices 
     60      ! 
    6061      INTEGER ::   ji, jj, jk   ! dummy loop indices 
    6162!!gm see comment further down 
     
    7778      rhd  (:,:,:  ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk 
    7879      rn2b (:,:,:  ) = 0._wp   ;   rn2  (:,:,:  ) = 0._wp      ! set one for all to 0 at levels 1 and jpk 
    79       tsa  (:,:,:,:) = 0._wp                                   ! set one for all to 0 at level jpk 
     80      ts  (:,:,:,:,Kaa) = 0._wp                                   ! set one for all to 0 at level jpk 
    8081      rab_b(:,:,:,:) = 0._wp   ;   rab_n(:,:,:,:) = 0._wp      ! set one for all to 0 at level jpk 
    8182#if defined key_agrif 
    82       ua   (:,:,:  ) = 0._wp   ! used in agrif_oce_sponge at initialization 
    83       va   (:,:,:  ) = 0._wp   ! used in agrif_oce_sponge at initialization     
     83      uu   (:,:,:  ,Kaa) = 0._wp   ! used in agrif_oce_sponge at initialization 
     84      vv   (:,:,:  ,Kaa) = 0._wp   ! used in agrif_oce_sponge at initialization     
    8485#endif 
    8586 
     
    9899         ! 
    99100         IF( ln_tsd_init ) THEN                
    100             CALL dta_tsd( nit000, tsb )       ! read 3D T and S data at nit000 
     101            CALL dta_tsd( nit000, ts(:,:,:,:,Kbb) )       ! read 3D T and S data at nit000 
    101102            ! 
    102             sshb(:,:)   = 0._wp               ! set the ocean at rest 
     103            ssh(:,:,Kbb)   = 0._wp               ! set the ocean at rest 
    103104            IF( ll_wd ) THEN 
    104                sshb(:,:) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD  
     105               ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD  
    105106               ! 
    106107               ! Apply minimum wetdepth criterion 
     
    108109               DO jj = 1,jpj 
    109110                  DO ji = 1,jpi 
    110                      IF( ht_0(ji,jj) + sshb(ji,jj)  < rn_wdmin1 ) THEN 
    111                         sshb(ji,jj) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) 
     111                     IF( ht_0(ji,jj) + ssh(ji,jj,Kbb)  < rn_wdmin1 ) THEN 
     112                        ssh(ji,jj,Kbb) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) 
    112113                     ENDIF 
    113114                  END DO 
    114115               END DO  
    115116            ENDIF  
    116             ub  (:,:,:) = 0._wp 
    117             vb  (:,:,:) = 0._wp   
     117            uu  (:,:,:,Kbb) = 0._wp 
     118            vv  (:,:,:,Kbb) = 0._wp   
    118119            ! 
    119120         ELSE                                 ! user defined initial T and S 
    120             CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb  )          
     121            CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )          
    121122         ENDIF 
    122          tsn  (:,:,:,:) = tsb (:,:,:,:)       ! set now values from to before ones 
    123          sshn (:,:)     = sshb(:,:)    
    124          un   (:,:,:)   = ub  (:,:,:) 
    125          vn   (:,:,:)   = vb  (:,:,:) 
    126          hdivn(:,:,jpk) = 0._wp               ! bottom divergence set one for 0 to zero at jpk level 
    127          CALL div_hor( 0, Kmm )               ! compute interior hdivn value   
    128 !!gm                                    hdivn(:,:,:) = 0._wp 
     123         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
     124         ssh (:,:,Kmm)     = ssh(:,:,Kbb)    
     125         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb) 
     126         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb) 
     127         hdiv(:,:,jpk) = 0._wp               ! bottom divergence set one for 0 to zero at jpk level 
     128         CALL div_hor( 0, Kmm )              ! compute interior hdiv value   
     129!!gm                                    hdiv(:,:,:) = 0._wp 
    129130 
    130131!!gm POTENTIAL BUG : 
    131 !!gm  ISSUE :  if sshb /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed 
     132!!gm  ISSUE :  if ssh(:,:,Kbb) /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed 
    132133!!             as well as gdept and gdepw....   !!!!!  
    133134!!      ===>>>>   probably a call to domvvl initialisation here.... 
     
    139140!            ALLOCATE( zuvd(jpi,jpj,jpk,2) ) 
    140141!            CALL dta_uvd( nit000, zuvd ) 
    141 !            ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
    142 !            vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
     142!            uu(:,:,:,Kbb) = zuvd(:,:,:,1) ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb) 
     143!            vv(:,:,:,Kbb) = zuvd(:,:,:,2) ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb) 
    143144!            DEALLOCATE( zuvd ) 
    144145!         ENDIF 
    145146         ! 
    146147!!gm This is to be changed !!!! 
    147 !         ! - ML - sshn could be modified by istate_eel, so that initialization of e3t_b is done here 
     148!         ! - ML - ssh(:,:,Kmm) could be modified by istate_eel, so that initialization of e3t(:,:,:,Kbb) is done here 
    148149!         IF( .NOT.ln_linssh ) THEN 
    149150!            DO jk = 1, jpk 
    150 !               e3t_b(:,:,jk) = e3t_n(:,:,jk) 
     151!               e3t(:,:,jk,Kbb) = e3t(:,:,jk,Kmm) 
    151152!            END DO 
    152153!         ENDIF 
     
    158159      ! Do it whatever the free surface method, these arrays being eventually used 
    159160      ! 
    160       un_b(:,:) = 0._wp   ;   vn_b(:,:) = 0._wp 
    161       ub_b(:,:) = 0._wp   ;   vb_b(:,:) = 0._wp 
     161      uu_b(:,:,Kmm) = 0._wp   ;   vv_b(:,:,Kmm) = 0._wp 
     162      uu_b(:,:,Kbb) = 0._wp   ;   vv_b(:,:,Kbb) = 0._wp 
    162163      ! 
    163 !!gm  the use of umsak & vmask is not necessary below as un, vn, ub, vb are always masked 
     164!!gm  the use of umsak & vmask is not necessary below as uu(:,:,:,Kmm), vv(:,:,:,Kmm), uu(:,:,:,Kbb), vv(:,:,:,Kbb) are always masked 
    164165      DO jk = 1, jpkm1 
    165166         DO jj = 1, jpj 
    166167            DO ji = 1, jpi 
    167                un_b(ji,jj) = un_b(ji,jj) + e3u_n(ji,jj,jk) * un(ji,jj,jk) * umask(ji,jj,jk) 
    168                vn_b(ji,jj) = vn_b(ji,jj) + e3v_n(ji,jj,jk) * vn(ji,jj,jk) * vmask(ji,jj,jk) 
     168               uu_b(ji,jj,Kmm) = uu_b(ji,jj,Kmm) + e3u(ji,jj,jk,Kmm) * uu(ji,jj,jk,Kmm) * umask(ji,jj,jk) 
     169               vv_b(ji,jj,Kmm) = vv_b(ji,jj,Kmm) + e3v(ji,jj,jk,Kmm) * vv(ji,jj,jk,Kmm) * vmask(ji,jj,jk) 
    169170               ! 
    170                ub_b(ji,jj) = ub_b(ji,jj) + e3u_b(ji,jj,jk) * ub(ji,jj,jk) * umask(ji,jj,jk) 
    171                vb_b(ji,jj) = vb_b(ji,jj) + e3v_b(ji,jj,jk) * vb(ji,jj,jk) * vmask(ji,jj,jk) 
     171               uu_b(ji,jj,Kbb) = uu_b(ji,jj,Kbb) + e3u(ji,jj,jk,Kbb) * uu(ji,jj,jk,Kbb) * umask(ji,jj,jk) 
     172               vv_b(ji,jj,Kbb) = vv_b(ji,jj,Kbb) + e3v(ji,jj,jk,Kbb) * vv(ji,jj,jk,Kbb) * vmask(ji,jj,jk) 
    172173            END DO 
    173174         END DO 
    174175      END DO 
    175176      ! 
    176       un_b(:,:) = un_b(:,:) * r1_hu_n(:,:) 
    177       vn_b(:,:) = vn_b(:,:) * r1_hv_n(:,:) 
     177      uu_b(:,:,Kmm) = uu_b(:,:,Kmm) * r1_hu_n(:,:) 
     178      vv_b(:,:,Kmm) = vv_b(:,:,Kmm) * r1_hv_n(:,:) 
    178179      ! 
    179       ub_b(:,:) = ub_b(:,:) * r1_hu_b(:,:) 
    180       vb_b(:,:) = vb_b(:,:) * r1_hv_b(:,:) 
     180      uu_b(:,:,Kbb) = uu_b(:,:,Kbb) * r1_hu_b(:,:) 
     181      vv_b(:,:,Kbb) = vv_b(:,:,Kbb) * r1_hv_b(:,:) 
    181182      ! 
    182183   END SUBROUTINE istate_init 
Note: See TracChangeset for help on using the changeset viewer.