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 6579 for branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM – NEMO

Ignore:
Timestamp:
2016-05-19T16:12:37+02:00 (8 years ago)
Author:
flavoni
Message:

add module for istate in usr_def module , see ticket #1692

Location:
branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90

    r6484 r6579  
    290290            ! 
    291291            IF( ie1e2u_v == 0 ) THEN   ! e1e2u and e1e2v have not been read: compute them 
    292                !                          ! e2u and e1v does not include a 
    293                !                          reduction in some strait: apply reduction 
     292               !                       ! e2u and e1v does not include a reduction in some strait: apply reduction 
    294293               e1e2u (:,:) = e1u(:,:) * e2u(:,:) 
    295294               e1e2v (:,:) = e1v(:,:) * e2v(:,:) 
     
    301300            &                 gphit  , gphiu , gphiv , gphif ,    & 
    302301            &                 e1t    , e1u   , e1v   , e1f   ,    & 
    303             &                 e2t    , e2u   , e2v   , e2f   ,    &  
     302            &                 e2t    , e2u   , e2v   , e2f   ,    & 
    304303            &                 ie1e2u_v  ) 
    305304         ! 
     
    331330      e2_e1u(:,:) = e2u(:,:) / e1u(:,:) 
    332331      e1_e2v(:,:) = e1v(:,:) / e2v(:,:) 
    333  
    334       IF( lwp .AND. nn_print >=1 .AND. .NOT.ln_rstart ) THEN      ! Control print : Grid informations (if not restart) 
    335          WRITE(numout,*) 
    336          WRITE(numout,*) '          longitude and e1 scale factors' 
    337          WRITE(numout,*) '          ------------------------------' 
    338          WRITE(numout,9300) ( ji, glamt(ji,1), glamu(ji,1),   & 
    339             glamv(ji,1), glamf(ji,1),   & 
    340             e1t(ji,1), e1u(ji,1),   & 
    341             e1v(ji,1), e1f(ji,1), ji = 1, jpi,10) 
    342 9300     FORMAT( 1x, i4, f8.2,1x, f8.2,1x, f8.2,1x, f8.2, 1x,    & 
    343             f19.10, 1x, f19.10, 1x, f19.10, 1x, f19.10 ) 
    344             ! 
    345          WRITE(numout,*) 
    346          WRITE(numout,*) '          latitude and e2 scale factors' 
    347          WRITE(numout,*) '          -----------------------------' 
    348          WRITE(numout,9300) ( jj, gphit(1,jj), gphiu(1,jj),   & 
    349             &                     gphiv(1,jj), gphif(1,jj),   & 
    350             &                     e2t  (1,jj), e2u  (1,jj),   & 
    351             &                     e2v  (1,jj), e2f  (1,jj), jj = 1, jpj, 10 ) 
    352       ENDIF 
    353332 
    354333 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90

    r5836 r6579  
    7171      ! 
    7272      !                                                         ! horizontal mesh (inum3) 
    73       CALL iom_rstput( 0, 0, inum0, 'glamt', glamt, ktype = jp_r4 )     !    ! latitude 
    74       CALL iom_rstput( 0, 0, inum0, 'glamu', glamu, ktype = jp_r4 ) 
    75       CALL iom_rstput( 0, 0, inum0, 'glamv', glamv, ktype = jp_r4 ) 
    76       CALL iom_rstput( 0, 0, inum0, 'glamf', glamf, ktype = jp_r4 ) 
    77        
    78       CALL iom_rstput( 0, 0, inum0, 'gphit', gphit, ktype = jp_r4 )     !    ! longitude 
    79       CALL iom_rstput( 0, 0, inum0, 'gphiu', gphiu, ktype = jp_r4 ) 
    80       CALL iom_rstput( 0, 0, inum0, 'gphiv', gphiv, ktype = jp_r4 ) 
    81       CALL iom_rstput( 0, 0, inum0, 'gphif', gphif, ktype = jp_r4 ) 
     73      CALL iom_rstput( 0, 0, inum0, 'glamt', glamt, ktype = jp_r8 )     !    ! latitude 
     74      CALL iom_rstput( 0, 0, inum0, 'glamu', glamu, ktype = jp_r8 ) 
     75      CALL iom_rstput( 0, 0, inum0, 'glamv', glamv, ktype = jp_r8 ) 
     76      CALL iom_rstput( 0, 0, inum0, 'glamf', glamf, ktype = jp_r8 ) 
     77       
     78      CALL iom_rstput( 0, 0, inum0, 'gphit', gphit, ktype = jp_r8 )     !    ! longitude 
     79      CALL iom_rstput( 0, 0, inum0, 'gphiu', gphiu, ktype = jp_r8 ) 
     80      CALL iom_rstput( 0, 0, inum0, 'gphiv', gphiv, ktype = jp_r8 ) 
     81      CALL iom_rstput( 0, 0, inum0, 'gphif', gphif, ktype = jp_r8 ) 
    8282       
    8383      CALL iom_rstput( 0, 0, inum0, 'e1t', e1t, ktype = jp_r8 )         !    ! e1 scale factors 
     
    229229 
    230230      !                                                         ! horizontal mesh (inum3) 
    231       CALL iom_rstput( 0, 0, inum3, 'glamt', glamt, ktype = jp_r4 )     !    ! latitude 
    232       CALL iom_rstput( 0, 0, inum3, 'glamu', glamu, ktype = jp_r4 ) 
    233       CALL iom_rstput( 0, 0, inum3, 'glamv', glamv, ktype = jp_r4 ) 
    234       CALL iom_rstput( 0, 0, inum3, 'glamf', glamf, ktype = jp_r4 ) 
    235        
    236       CALL iom_rstput( 0, 0, inum3, 'gphit', gphit, ktype = jp_r4 )     !    ! longitude 
    237       CALL iom_rstput( 0, 0, inum3, 'gphiu', gphiu, ktype = jp_r4 ) 
    238       CALL iom_rstput( 0, 0, inum3, 'gphiv', gphiv, ktype = jp_r4 ) 
    239       CALL iom_rstput( 0, 0, inum3, 'gphif', gphif, ktype = jp_r4 ) 
     231      CALL iom_rstput( 0, 0, inum3, 'glamt', glamt, ktype = jp_r8 )     !    ! latitude 
     232      CALL iom_rstput( 0, 0, inum3, 'glamu', glamu, ktype = jp_r8 ) 
     233      CALL iom_rstput( 0, 0, inum3, 'glamv', glamv, ktype = jp_r8 ) 
     234      CALL iom_rstput( 0, 0, inum3, 'glamf', glamf, ktype = jp_r8 ) 
     235       
     236      CALL iom_rstput( 0, 0, inum3, 'gphit', gphit, ktype = jp_r8 )     !    ! longitude 
     237      CALL iom_rstput( 0, 0, inum3, 'gphiu', gphiu, ktype = jp_r8 ) 
     238      CALL iom_rstput( 0, 0, inum3, 'gphiv', gphiv, ktype = jp_r8 ) 
     239      CALL iom_rstput( 0, 0, inum3, 'gphif', gphif, ktype = jp_r8 ) 
    240240       
    241241      CALL iom_rstput( 0, 0, inum3, 'e1t', e1t, ktype = jp_r8 )         !    ! e1 scale factors 
     
    253253      ! note that mbkt is set to 1 over land ==> use surface tmask 
    254254      zprt(:,:) = ssmask(:,:) * REAL( mbkt(:,:) , wp ) 
    255       CALL iom_rstput( 0, 0, inum4, 'mbathy', zprt, ktype = jp_i2 )     !    ! nb of ocean T-points 
     255      CALL iom_rstput( 0, 0, inum4, 'mbathy', zprt, ktype = jp_i4 )     !    ! nb of ocean T-points 
    256256      zprt(:,:) = ssmask(:,:) * REAL( mikt(:,:) , wp ) 
    257       CALL iom_rstput( 0, 0, inum4, 'misf', zprt, ktype = jp_i2 )       !    ! nb of ocean T-points 
     257      CALL iom_rstput( 0, 0, inum4, 'misf', zprt, ktype = jp_i4 )       !    ! nb of ocean T-points 
    258258      zprt(:,:) = ssmask(:,:) * REAL( risfdep(:,:) , wp ) 
    259       CALL iom_rstput( 0, 0, inum4, 'isfdraft', zprt, ktype = jp_r4 )       !    ! nb of ocean T-points 
     259      CALL iom_rstput( 0, 0, inum4, 'isfdraft', zprt, ktype = jp_r8 )       !    ! nb of ocean T-points 
    260260             
    261261      IF( ln_sco ) THEN                                         ! s-coordinate 
     
    279279         CALL iom_rstput( 0, 0, inum4, 'gdept_1d' , gdept_1d )  !    ! stretched system 
    280280         CALL iom_rstput( 0, 0, inum4, 'gdepw_1d' , gdepw_1d ) 
    281          CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r4 )      
    282          CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r4 ) 
     281         CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r8 ) 
     282         CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r8 ) 
    283283      ENDIF 
    284284       
     
    302302         ! 
    303303         IF( nmsh <= 3 ) THEN                                   !    ! 3D depth 
    304             CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r4 )      
     304            CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r8 ) 
    305305            DO jk = 1,jpk    
    306306               DO jj = 1, jpjm1    
     
    308308                     zdepu(ji,jj,jk) = MIN( gdept_0(ji,jj,jk) , gdept_0(ji+1,jj  ,jk) ) 
    309309                     zdepv(ji,jj,jk) = MIN( gdept_0(ji,jj,jk) , gdept_0(ji  ,jj+1,jk) ) 
    310                   END DO    
    311                END DO    
     310                  END DO 
     311               END DO 
    312312            END DO 
    313             CALL lbc_lnk( zdepu, 'U', 1. )   ;   CALL lbc_lnk( zdepv, 'V', 1. )  
    314             CALL iom_rstput( 0, 0, inum4, 'gdepu', zdepu, ktype = jp_r4 ) 
    315             CALL iom_rstput( 0, 0, inum4, 'gdepv', zdepv, ktype = jp_r4 ) 
    316             CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r4 ) 
     313            CALL lbc_lnk( zdepu, 'U', 1. )   ;   CALL lbc_lnk( zdepv, 'V', 1. ) 
     314            CALL iom_rstput( 0, 0, inum4, 'gdepu', zdepu, ktype = jp_r8 ) 
     315            CALL iom_rstput( 0, 0, inum4, 'gdepv', zdepv, ktype = jp_r8 ) 
     316            CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r8 ) 
    317317         ELSE                                                   !    ! 2D bottom depth 
    318318            DO jj = 1,jpj    
     
    322322               END DO 
    323323            END DO 
    324             CALL iom_rstput( 0, 0, inum4, 'hdept', zprt, ktype = jp_r4 )      
    325             CALL iom_rstput( 0, 0, inum4, 'hdepw', zprw, ktype = jp_r4 )  
     324            CALL iom_rstput( 0, 0, inum4, 'hdept', zprt, ktype = jp_r8 ) 
     325            CALL iom_rstput( 0, 0, inum4, 'hdepw', zprw, ktype = jp_r8 ) 
    326326         ENDIF 
    327327         ! 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90

    r6140 r6579  
    102102      IF(  ln_tsd_init .OR. ln_tsd_tradmp  ) THEN 
    103103         ! 
     104IF(lwp) WRITE(numout,*) ' sto dentro if ln_tsd_init prima di allocate if necessary riga 104 ' 
    104105         ALLOCATE( sf_tsd(jpts), STAT=ierr0 ) 
    105106         IF( ierr0 > 0 ) THEN 
     
    107108         ENDIF 
    108109         ! 
     110IF(lwp) WRITE(numout,*) ' riga 110 : allocate jp_temp jpk ' 
    109111                                ALLOCATE( sf_tsd(jp_tem)%fnow(jpi,jpj,jpk)   , STAT=ierr0 ) 
    110112         IF( sn_tem%ln_tint )   ALLOCATE( sf_tsd(jp_tem)%fdta(jpi,jpj,jpk,2) , STAT=ierr1 ) 
     113IF(lwp) WRITE(numout,*) ' riga 113 : dopo allocate jp_temp jpk, 2 ' 
    111114                                ALLOCATE( sf_tsd(jp_sal)%fnow(jpi,jpj,jpk)   , STAT=ierr2 ) 
    112115         IF( sn_sal%ln_tint )   ALLOCATE( sf_tsd(jp_sal)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 ) 
     
    117120         !                         ! fill sf_tsd with sn_tem & sn_sal and control print 
    118121         slf_i(jp_tem) = sn_tem   ;   slf_i(jp_sal) = sn_sal 
     122IF(lwp) WRITE(numout,*) ' riga 122 : prima di fld_fill' 
    119123         CALL fld_fill( sf_tsd, slf_i, cn_dir, 'dta_tsd', 'Temperature & Salinity data', 'namtsd' ) 
     124IF(lwp) WRITE(numout,*) ' riga 124 : dopo di fld_fill' 
    120125         ! 
    121126      ENDIF 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90

    r6140 r6579  
    1414   !!            3.3  !  2010-10  (C. Ethe) merge TRC-TRA 
    1515   !!            3.4  !  2011-04  (G. Madec) Merge of dtatem and dtasal & suppression of tb,tn/sb,sn  
     16   !!            3.7  !  2016-04  (S. Flavoni) change configuration's interface: 
     17   !!                              read file or CALL usr_def module to compute initial state (example given for GYRE) 
    1618   !!---------------------------------------------------------------------- 
    1719 
    1820   !!---------------------------------------------------------------------- 
    1921   !!   istate_init   : initial state setting 
    20    !!   istate_tem    : analytical profile for initial Temperature 
    21    !!   istate_sal    : analytical profile for initial Salinity 
    22    !!   istate_eel    : initial state setting of EEL R5 configuration 
    23    !!   istate_gyre   : initial state setting of GYRE configuration 
    2422   !!   istate_uvg    : initial velocity in geostropic balance 
    2523   !!---------------------------------------------------------------------- 
     
    4341   USE wrk_nemo        ! Memory allocation 
    4442   USE timing          ! Timing 
     43   USE usrdef          ! User defined routine 
     44 
     45 
    4546 
    4647   IMPLICIT NONE 
     
    4849 
    4950   PUBLIC   istate_init   ! routine called by step.F90 
     51   !SF PUBLIC   ini_read      ! subroutine ini_read  
    5052 
    5153   !! * Substitutions 
     
    7577      IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    7678 
     79     !SF initialisation of T & S with data file 
    7780                     CALL dta_tsd_init        ! Initialisation of T & S input data 
    7881      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data 
     
    9194         !                                    ! Start from rest 
    9295         !                                    ! --------------- 
    93          numror = 0                              ! define numror = 0 -> no restart file to read 
    94          neuler = 0                              ! Set time-step indicator at nit000 (euler forward) 
    95          CALL day_init                           ! model calendar (using both namelist and restart infos) 
    96          !                                       ! Initialization of ocean to zero 
     96         numror = 0                           ! define numror = 0 -> no restart file to read 
     97         neuler = 0                           ! Set time-step indicator at nit000 (euler forward) 
     98         CALL day_init                        ! model calendar (using both namelist and restart infos) 
     99         !                                    ! Initialization of ocean to zero 
    97100         !   before fields      !       now fields      
    98101         sshb (:,:)   = 0._wp   ;   sshn (:,:)   = 0._wp 
     
    101104                                    hdivn(:,:,:) = 0._wp 
    102105         ! 
    103          IF( cp_cfg == 'eel' ) THEN 
    104             CALL istate_eel                      ! EEL   configuration : start from pre-defined U,V T-S fields 
    105          ELSEIF( cp_cfg == 'gyre' ) THEN          
    106             CALL istate_gyre                     ! GYRE  configuration : start from pre-defined T-S fields 
    107          ELSE                                    ! Initial T-S, U-V fields read in files 
    108             IF ( ln_tsd_init ) THEN              ! read 3D T and S data at nit000 
    109                CALL dta_tsd( nit000, tsb )   
    110                tsn(:,:,:,:) = tsb(:,:,:,:) 
    111                ! 
    112             ELSE                                 ! Initial T-S fields defined analytically 
    113                CALL istate_t_s 
    114             ENDIF 
    115             IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
    116                CALL wrk_alloc( jpi,jpj,jpk,2,   zuvd ) 
    117                CALL dta_uvd( nit000, zuvd ) 
    118                ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
    119                vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
    120                CALL wrk_dealloc( jpi,jpj,jpk,2,   zuvd ) 
    121             ENDIF 
     106         IF( ln_tsd_init ) THEN               ! read 3D T and S data at nit000 
     107            CALL dta_tsd( nit000, tsb )   
     108         ELSE                                 ! user defined initial T and S 
     109            CALL usr_def_ini( tsb )                 
     110         ENDIF 
     111         tsn(:,:,:,:) = tsb(:,:,:,:)          ! set now to before values 
     112         ! 
     113         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
     114            CALL wrk_alloc( jpi,jpj,jpk,2,   zuvd ) 
     115            CALL dta_uvd( nit000, zuvd ) 
     116            ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
     117            vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
     118            CALL wrk_dealloc( jpi,jpj,jpk,2,   zuvd ) 
    122119         ENDIF 
    123120         ! 
     
    131128!!gm  
    132129         !  
    133       ENDIF 
     130      ENDIF  
    134131      !  
    135132      ! Initialize "now" and "before" barotropic velocities: 
     
    162159   END SUBROUTINE istate_init 
    163160 
    164  
    165    SUBROUTINE istate_t_s 
    166       !!--------------------------------------------------------------------- 
    167       !!                  ***  ROUTINE istate_t_s  *** 
    168       !!    
    169       !! ** Purpose :   Intialization of the temperature field with an  
    170       !!      analytical profile or a file (i.e. in EEL configuration) 
    171       !! 
    172       !! ** Method  : - temperature: use Philander analytic profile 
    173       !!              - salinity   : use to a constant value 35.5 
    174       !! 
    175       !! References :  Philander ??? 
    176       !!---------------------------------------------------------------------- 
    177       INTEGER  ::   ji, jj, jk 
    178       REAL(wp) ::   zsal = 35.50_wp 
    179       !!---------------------------------------------------------------------- 
    180       ! 
    181       IF(lwp) WRITE(numout,*) 
    182       IF(lwp) WRITE(numout,*) 'istate_t_s : Philander s initial temperature profile' 
    183       IF(lwp) WRITE(numout,*) '~~~~~~~~~~   and constant salinity (',zsal,' psu)' 
    184       ! 
    185       DO jk = 1, jpk 
    186          tsn(:,:,jk,jp_tem) = (  ( ( 7.5 - 0. * ABS( gphit(:,:) )/30. ) * ( 1.-TANH((gdept_n(:,:,jk)-80.)/30.) )   & 
    187             &                + 10. * ( 5000. - gdept_n(:,:,jk) ) /5000.)  ) * tmask(:,:,jk) 
    188          tsb(:,:,jk,jp_tem) = tsn(:,:,jk,jp_tem) 
    189       END DO 
    190       tsn(:,:,:,jp_sal) = zsal * tmask(:,:,:) 
    191       tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    192       ! 
    193    END SUBROUTINE istate_t_s 
    194  
    195  
    196    SUBROUTINE istate_eel 
    197       !!---------------------------------------------------------------------- 
    198       !!                   ***  ROUTINE istate_eel  *** 
    199       !!  
    200       !! ** Purpose :   Initialization of the dynamics and tracers for EEL R5 
    201       !!      configuration (channel with or without a topographic bump) 
    202       !! 
    203       !! ** Method  : - set temprature field 
    204       !!              - set salinity field 
    205       !!              - set velocity field including horizontal divergence 
    206       !!                and relative vorticity fields 
    207       !!---------------------------------------------------------------------- 
    208       USE divhor     ! hor. divergence      (div_hor routine) 
    209       USE iom 
    210       ! 
    211       INTEGER  ::   inum              ! temporary logical unit 
    212       INTEGER  ::   ji, jj, jk        ! dummy loop indices 
    213       INTEGER  ::   ijloc 
    214       REAL(wp) ::   zh1, zh2, zslope, zcst, zfcor   ! temporary scalars 
    215       REAL(wp) ::   zt1  = 15._wp                   ! surface temperature value (EEL R5) 
    216       REAL(wp) ::   zt2  =  5._wp                   ! bottom  temperature value (EEL R5) 
    217       REAL(wp) ::   zsal = 35.0_wp                  ! constant salinity (EEL R2, R5 and R6) 
    218       REAL(wp) ::   zueel = 0.1_wp                  ! constant uniform zonal velocity (EEL R5) 
    219       REAL(wp), DIMENSION(jpiglo,jpjglo) ::   zssh  ! initial ssh over the global domain 
    220       !!---------------------------------------------------------------------- 
    221       ! 
    222       SELECT CASE ( jp_cfg )  
    223          !                                              ! ==================== 
    224          CASE ( 5 )                                     ! EEL R5 configuration 
    225             !                                           ! ==================== 
    226             ! 
    227             ! set temperature field with a linear profile 
    228             ! ------------------------------------------- 
    229             IF(lwp) WRITE(numout,*) 
    230             IF(lwp) WRITE(numout,*) 'istate_eel : EEL R5: linear temperature profile' 
    231             IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    232             ! 
    233             zh1 = gdept_1d(  1  ) 
    234             zh2 = gdept_1d(jpkm1) 
    235             ! 
    236             zslope = ( zt1 - zt2 ) / ( zh1 - zh2 ) 
    237             zcst   = ( zt1 * ( zh1 - zh2) - ( zt1 - zt2 ) * zh1 ) / ( zh1 - zh2 ) 
    238             ! 
    239             DO jk = 1, jpk 
    240                tsn(:,:,jk,jp_tem) = ( zt2 + zt1 * exp( - gdept_n(:,:,jk) / 1000 ) ) * tmask(:,:,jk) 
    241                tsb(:,:,jk,jp_tem) = tsn(:,:,jk,jp_tem) 
    242             END DO 
    243             ! 
    244             ! set salinity field to a constant value 
    245             ! -------------------------------------- 
    246             IF(lwp) WRITE(numout,*) 
    247             IF(lwp) WRITE(numout,*) 'istate_eel : EEL R5: constant salinity field, S = ', zsal 
    248             IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    249             ! 
    250             tsn(:,:,:,jp_sal) = zsal * tmask(:,:,:) 
    251             tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    252             ! 
    253             ! set the dynamics: U,V, hdiv (and ssh if necessary) 
    254             ! ---------------- 
    255             ! Start EEL5 configuration with barotropic geostrophic velocities  
    256             ! according the sshb and sshn SSH imposed. 
    257             ! we assume a uniform grid (hence the use of e1t(1,1) for delta_y) 
    258             ! we use the Coriolis frequency at mid-channel.    
    259             ub(:,:,:) = zueel * umask(:,:,:) 
    260             un(:,:,:) = ub(:,:,:) 
    261             ijloc = mj0(INT(jpjglo-1)/2) 
    262             zfcor = ff(1,ijloc) 
    263             ! 
    264             DO jj = 1, jpjglo 
    265                zssh(:,jj) = - (FLOAT(jj)- FLOAT(jpjglo-1)/2.)*zueel*e1t(1,1)*zfcor/grav  
    266             END DO 
    267             ! 
    268             IF(lwp) THEN 
    269                WRITE(numout,*) ' Uniform zonal velocity for EEL R5:',zueel 
    270                WRITE(numout,*) ' Geostrophic SSH profile as a function of y:' 
    271                WRITE(numout,'(12(1x,f6.2))') zssh(1,:) 
    272             ENDIF 
    273             ! 
    274             DO jj = 1, nlcj 
    275                DO ji = 1, nlci 
    276                   sshb(ji,jj) = zssh( mig(ji) , mjg(jj) ) * tmask(ji,jj,1) 
    277                END DO 
    278             END DO 
    279             sshb(nlci+1:jpi,      :   ) = 0.e0      ! set to zero extra mpp columns 
    280             sshb(      :   ,nlcj+1:jpj) = 0.e0      ! set to zero extra mpp rows 
    281             ! 
    282             sshn(:,:) = sshb(:,:)                   ! set now ssh to the before value 
    283             ! 
    284             IF( nn_rstssh /= 0 ) THEN   
    285                nn_rstssh = 0                        ! hand-made initilization of ssh  
    286                CALL ctl_warn( 'istate_eel: force nn_rstssh = 0' ) 
    287             ENDIF 
    288             ! 
    289 !!gm  Check  here call to div_hor should not be necessary 
    290 !!gm         div_hor call runoffs  not sure they are defined at that level 
    291             CALL div_hor( nit000 )                  ! horizontal divergence and relative vorticity (curl) 
    292             ! N.B. the vertical velocity will be computed from the horizontal divergence field 
    293             ! in istate by a call to wzv routine 
    294  
    295  
    296             !                                     ! ========================== 
    297          CASE ( 2 , 6 )                           ! EEL R2 or R6 configuration 
    298             !                                     ! ========================== 
    299             ! 
    300             ! set temperature field with a NetCDF file 
    301             ! ---------------------------------------- 
    302             IF(lwp) WRITE(numout,*) 
    303             IF(lwp) WRITE(numout,*) 'istate_eel : EEL R2 or R6: read initial temperature in a NetCDF file' 
    304             IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    305             ! 
    306             CALL iom_open ( 'eel.initemp', inum ) 
    307             CALL iom_get ( inum, jpdom_data, 'initemp', tsb(:,:,:,jp_tem) ) ! read before temprature (tb) 
    308             CALL iom_close( inum ) 
    309             ! 
    310             tsn(:,:,:,jp_tem) = tsb(:,:,:,jp_tem)                            ! set nox temperature to tb 
    311             ! 
    312             ! set salinity field to a constant value 
    313             ! -------------------------------------- 
    314             IF(lwp) WRITE(numout,*) 
    315             IF(lwp) WRITE(numout,*) 'istate_eel : EEL R5: constant salinity field, S = ', zsal 
    316             IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    317             ! 
    318             tsn(:,:,:,jp_sal) = zsal * tmask(:,:,:) 
    319             tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    320             ! 
    321             !                                    ! =========================== 
    322          CASE DEFAULT                            ! NONE existing configuration 
    323             !                                    ! =========================== 
    324             WRITE(ctmp1,*) 'EEL with a ', jp_cfg,' km resolution is not coded' 
    325             CALL ctl_stop( ctmp1 ) 
    326             ! 
    327       END SELECT 
    328       ! 
    329    END SUBROUTINE istate_eel 
    330  
    331  
    332    SUBROUTINE istate_gyre 
    333       !!---------------------------------------------------------------------- 
    334       !!                   ***  ROUTINE istate_gyre  *** 
    335       !!  
    336       !! ** Purpose :   Initialization of the dynamics and tracers for GYRE 
    337       !!      configuration (double gyre with rotated domain) 
    338       !! 
    339       !! ** Method  : - set temprature field 
    340       !!              - set salinity   field 
    341       !!---------------------------------------------------------------------- 
    342       INTEGER :: ji, jj, jk  ! dummy loop indices 
    343       INTEGER            ::   inum          ! temporary logical unit 
    344       INTEGER, PARAMETER ::   ntsinit = 0   ! (0/1) (analytical/input data files) T&S initialization 
    345       !!---------------------------------------------------------------------- 
    346       ! 
    347       SELECT CASE ( ntsinit) 
    348       ! 
    349       CASE ( 0 )                  ! analytical T/S profil deduced from LEVITUS 
    350          IF(lwp) WRITE(numout,*) 
    351          IF(lwp) WRITE(numout,*) 'istate_gyre : initial analytical T and S profil deduced from LEVITUS ' 
    352          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    353          ! 
    354          DO jk = 1, jpk 
    355             DO jj = 1, jpj 
    356                DO ji = 1, jpi 
    357                   tsn(ji,jj,jk,jp_tem) = (  16. - 12. * TANH( (gdept_n(ji,jj,jk) - 400) / 700 )         )   & 
    358                        &           * (-TANH( (500-gdept_n(ji,jj,jk)) / 150 ) + 1) / 2               & 
    359                        &       + (      15. * ( 1. - TANH( (gdept_n(ji,jj,jk)-50.) / 1500.) )       & 
    360                        &                - 1.4 * TANH((gdept_n(ji,jj,jk)-100.) / 100.)               &     
    361                        &                + 7.  * (1500. - gdept_n(ji,jj,jk)) / 1500.             )   &  
    362                        &           * (-TANH( (gdept_n(ji,jj,jk) - 500) / 150) + 1) / 2 
    363                   tsn(ji,jj,jk,jp_tem) = tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
    364                   tsb(ji,jj,jk,jp_tem) = tsn(ji,jj,jk,jp_tem) 
    365  
    366                   tsn(ji,jj,jk,jp_sal) =  (  36.25 - 1.13 * TANH( (gdept_n(ji,jj,jk) - 305) / 460 )  )  & 
    367                      &              * (-TANH((500 - gdept_n(ji,jj,jk)) / 150) + 1) / 2          & 
    368                      &          + (  35.55 + 1.25 * (5000. - gdept_n(ji,jj,jk)) / 5000.         & 
    369                      &                - 1.62 * TANH( (gdept_n(ji,jj,jk) - 60.  ) / 650. )       & 
    370                      &                + 0.2  * TANH( (gdept_n(ji,jj,jk) - 35.  ) / 100. )       & 
    371                      &                + 0.2  * TANH( (gdept_n(ji,jj,jk) - 1000.) / 5000.)    )  & 
    372                      &              * (-TANH((gdept_n(ji,jj,jk) - 500) / 150) + 1) / 2  
    373                   tsn(ji,jj,jk,jp_sal) = tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
    374                   tsb(ji,jj,jk,jp_sal) = tsn(ji,jj,jk,jp_sal) 
    375                END DO 
    376             END DO 
    377          END DO 
    378          ! 
    379       CASE ( 1 )                  ! T/S data fields read in dta_tem.nc/data_sal.nc files 
    380          IF(lwp) WRITE(numout,*) 
    381          IF(lwp) WRITE(numout,*) 'istate_gyre : initial T and S read from dta_tem.nc/data_sal.nc files' 
    382          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    383          IF(lwp) WRITE(numout,*) '              NetCDF FORMAT' 
    384  
    385          ! Read temperature field 
    386          ! ---------------------- 
    387          CALL iom_open ( 'data_tem', inum ) 
    388          CALL iom_get ( inum, jpdom_data, 'votemper', tsn(:,:,:,jp_tem) )  
    389          CALL iom_close( inum ) 
    390  
    391          tsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) * tmask(:,:,:)  
    392          tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) 
    393  
    394          ! Read salinity field 
    395          ! ------------------- 
    396          CALL iom_open ( 'data_sal', inum ) 
    397          CALL iom_get ( inum, jpdom_data, 'vosaline', tsn(:,:,:,jp_sal) )  
    398          CALL iom_close( inum ) 
    399  
    400          tsn(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) * tmask(:,:,:)  
    401          tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    402          ! 
    403       END SELECT 
    404       ! 
    405       IF(lwp) THEN 
    406          WRITE(numout,*) 
    407          WRITE(numout,*) '              Initial temperature and salinity profiles:' 
    408          WRITE(numout, "(9x,' level   gdept_1d   temperature   salinity   ')" ) 
    409          WRITE(numout, "(10x, i4, 3f10.2)" ) ( jk, gdept_1d(jk), tsn(2,2,jk,jp_tem), tsn(2,2,jk,jp_sal), jk = 1, jpk ) 
    410       ENDIF 
    411       ! 
    412    END SUBROUTINE istate_gyre 
    413  
    414  
    415    SUBROUTINE istate_uvg 
    416       !!---------------------------------------------------------------------- 
    417       !!                  ***  ROUTINE istate_uvg  *** 
    418       !! 
    419       !! ** Purpose :   Compute the geostrophic velocities from (tn,sn) fields 
    420       !! 
    421       !! ** Method  :   Using the hydrostatic hypothesis the now hydrostatic  
    422       !!      pressure is computed by integrating the in-situ density from the 
    423       !!      surface to the bottom. 
    424       !!                 p=integral [ rau*g dz ] 
    425       !!---------------------------------------------------------------------- 
    426       USE divhor          ! hor. divergence                       (div_hor routine) 
    427       USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
    428       ! 
    429       INTEGER ::   ji, jj, jk        ! dummy loop indices 
    430       REAL(wp) ::   zmsv, zphv, zmsu, zphu, zalfg     ! temporary scalars 
    431       REAL(wp), POINTER, DIMENSION(:,:,:) :: zprn 
    432       !!---------------------------------------------------------------------- 
    433       ! 
    434       CALL wrk_alloc( jpi,jpj,jpk,   zprn) 
    435       ! 
    436       IF(lwp) WRITE(numout,*)  
    437       IF(lwp) WRITE(numout,*) 'istate_uvg : Start from Geostrophy' 
    438       IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    439  
    440       ! Compute the now hydrostatic pressure 
    441       ! ------------------------------------ 
    442  
    443       zalfg = 0.5 * grav * rau0 
    444        
    445       zprn(:,:,1) = zalfg * e3w_n(:,:,1) * ( 1 + rhd(:,:,1) )       ! Surface value 
    446  
    447       DO jk = 2, jpkm1                                              ! Vertical integration from the surface 
    448          zprn(:,:,jk) = zprn(:,:,jk-1)   & 
    449             &         + zalfg * e3w_n(:,:,jk) * ( 2. + rhd(:,:,jk) + rhd(:,:,jk-1) ) 
    450       END DO   
    451  
    452       ! Compute geostrophic balance 
    453       ! --------------------------- 
    454       DO jk = 1, jpkm1 
    455          DO jj = 2, jpjm1 
    456             DO ji = fs_2, fs_jpim1   ! vertor opt. 
    457                zmsv = 1. / MAX(  umask(ji-1,jj+1,jk) + umask(ji  ,jj+1,jk)   & 
    458                                + umask(ji-1,jj  ,jk) + umask(ji  ,jj  ,jk) , 1.  ) 
    459                zphv = ( zprn(ji  ,jj+1,jk) - zprn(ji-1,jj+1,jk) ) * umask(ji-1,jj+1,jk) / e1u(ji-1,jj+1)   & 
    460                     + ( zprn(ji+1,jj+1,jk) - zprn(ji  ,jj+1,jk) ) * umask(ji  ,jj+1,jk) / e1u(ji  ,jj+1)   & 
    461                     + ( zprn(ji  ,jj  ,jk) - zprn(ji-1,jj  ,jk) ) * umask(ji-1,jj  ,jk) / e1u(ji-1,jj  )   & 
    462                     + ( zprn(ji+1,jj  ,jk) - zprn(ji  ,jj  ,jk) ) * umask(ji  ,jj  ,jk) / e1u(ji  ,jj  ) 
    463                zphv = 1. / rau0 * zphv * zmsv * vmask(ji,jj,jk) 
    464  
    465                zmsu = 1. / MAX(  vmask(ji+1,jj  ,jk) + vmask(ji  ,jj  ,jk)   & 
    466                                + vmask(ji+1,jj-1,jk) + vmask(ji  ,jj-1,jk) , 1.  ) 
    467                zphu = ( zprn(ji+1,jj+1,jk) - zprn(ji+1,jj  ,jk) ) * vmask(ji+1,jj  ,jk) / e2v(ji+1,jj  )   & 
    468                     + ( zprn(ji  ,jj+1,jk) - zprn(ji  ,jj  ,jk) ) * vmask(ji  ,jj  ,jk) / e2v(ji  ,jj  )   & 
    469                     + ( zprn(ji+1,jj  ,jk) - zprn(ji+1,jj-1,jk) ) * vmask(ji+1,jj-1,jk) / e2v(ji+1,jj-1)   & 
    470                     + ( zprn(ji  ,jj  ,jk) - zprn(ji  ,jj-1,jk) ) * vmask(ji  ,jj-1,jk) / e2v(ji  ,jj-1) 
    471                zphu = 1. / rau0 * zphu * zmsu * umask(ji,jj,jk) 
    472  
    473                ! Compute the geostrophic velocities 
    474                un(ji,jj,jk) = -2. * zphu / ( ff(ji,jj) + ff(ji  ,jj-1) ) 
    475                vn(ji,jj,jk) =  2. * zphv / ( ff(ji,jj) + ff(ji-1,jj  ) ) 
    476             END DO 
    477          END DO 
    478       END DO 
    479  
    480       IF(lwp) WRITE(numout,*) '         we force to zero bottom velocity' 
    481  
    482       ! Susbtract the bottom velocity (level jpk-1 for flat bottom case) 
    483       ! to have a zero bottom velocity 
    484  
    485       DO jk = 1, jpkm1 
    486          un(:,:,jk) = ( un(:,:,jk) - un(:,:,jpkm1) ) * umask(:,:,jk) 
    487          vn(:,:,jk) = ( vn(:,:,jk) - vn(:,:,jpkm1) ) * vmask(:,:,jk) 
    488       END DO 
    489  
    490       CALL lbc_lnk( un, 'U', -1. ) 
    491       CALL lbc_lnk( vn, 'V', -1. ) 
    492        
    493       ub(:,:,:) = un(:,:,:) 
    494       vb(:,:,:) = vn(:,:,:) 
    495        
    496       ! 
    497 !!gm  Check  here call to div_hor should not be necessary 
    498 !!gm         div_hor call runoffs  not sure they are defined at that level 
    499       CALL div_hor( nit000 )            ! now horizontal divergence 
    500       ! 
    501       CALL wrk_dealloc( jpi,jpj,jpk,   zprn) 
    502       ! 
    503    END SUBROUTINE istate_uvg 
    504  
    505    !!===================================================================== 
    506161END MODULE istate 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/usrdef.F90

    r6484 r6579  
    22   !!============================================================================== 
    33   !!                       ***  MODULE usrdef   *** 
    4    !! User defined module:  set analytically the minimum information needed to 
    5    !!       define a configuration (domain, initial state, forcing) 
    6    !! 
    7    !!              ===  GYRE configuration given as an example  === 
    8    !!  
    9    !!        This module is given as an example, it can be modified 
    10    !!      following the user's desiderata.  
    11    !!      second order accuracy schemes. 
     4   !! User defined module: used like example to define init, sbc, bathy, ... 
    125   !!============================================================================== 
    13    !! History :  NEMO ! 2016-03  (S. Flavoni)  Original code  
     6   !! History :  NEMO ! 2016-03  (S. Flavoni)  
    147   !!---------------------------------------------------------------------- 
    158 
    169   !!---------------------------------------------------------------------- 
    17    !!   usr_def_hgr       : compute the horizontal mesh  
    18    !!   usr_def_zgr       : compute the vertical mesh  
    19    !!  to be defined: 
     10   !!   usr_def_hgr       : initialize the horizontal mesh  
    2011   !!   usr_def_ini       : initial state  
    21    !!   usr_def_sbc       : compute the surface bounday conditions 
    22    !!   usr_def_xxx       : initialize the xxx 
     12   !!   usr_def_sbc       : initialize the surface bounday conditions 
    2313   !!---------------------------------------------------------------------- 
    2414   USE step_oce       ! module used in the ocean time stepping module (step.F90) 
    25    USE mppini         ! shared/distributed memory setting (mpp_init routine) 
    26    USE phycst         ! physical constants 
     15   USE mppini         ! shared/distributed memory setting (mpp_init routine)              
     16   USE phycst         ! physical constants  
    2717   IMPLICIT NONE 
    2818   PRIVATE 
     
    3020 
    3121   PUBLIC usr_def_hgr 
    32    PUBLIC usr_def_zgr 
     22   PUBLIC usr_def_ini 
    3323 
    3424   !!---------------------------------------------------------------------- 
    35    !! NEMO/OPA 3.7 , NEMO Consortium (2016) 
    36    !! $Id: $  
     25   !! NEMO/OPA 3.7 , NEMO Consortium (2014) 
     26   !! $Id:$  
    3727   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    3828   !!---------------------------------------------------------------------- 
    3929CONTAINS 
    4030 
    41  
    42    SUBROUTINE usr_def_hgr( nbench, jp_cfg, kff, pff,       & ! Coriolis parameter  (if domain not on the sphere) 
     31   SUBROUTINE usr_def_hgr( nbench, jp_cfg, kff    , pff   , & ! Coriolis parameter  (if domain not on the sphere) 
    4332           &               pglamt, pglamu, pglamv , pglamf, & ! gridpoints position (required) 
    4433           &               pgphit, pgphiu, pgphiv , pgphif, & !          
    4534           &               pe1t  , pe1u  , pe1v   , pe1f  , & ! scale factors (required) 
    4635           &               pe2t  , pe2u  , pe2v   , pe2f  , & ! 
    47            &               ke1e2u_v                       )! u- & v-surfaces (if gridsize reduction is used in strait(s)) 
     36           &               ke1e2u_v                       )   ! u- & v-surfaces (if gridsize reduction is used in strait(s)) 
    4837      !!------------------------------------------------------------------------------------------------- 
    4938      !!                  ***  ROUTINE usr_def_hgr  *** 
     
    7665      !!------------------------------------------------------------------------------- 
    7766      INTEGER  ::   ji, jj               ! dummy loop indices 
    78       REAL(wp) ::   zlam1, zlam0, zcos_alpha, zim1 , zjm1 , ze1  , ze1deg, zf0   ! local scalars 
    79       REAL(wp) ::   zphi1, zphi0, zsin_alpha, zim05, zjm05, zbeta, znorme        ! local scalars 
     67      REAL(wp) ::   zlam1, zlam0, zcos_alpha, zim1 , zjm1 , ze1  , ze1deg, zf0 ! local scalars 
     68      REAL(wp) ::   zphi1, zphi0, zsin_alpha, zim05, zjm05, zbeta, znorme      ! local scalars 
    8069      !!------------------------------------------------------------------------------- 
    8170      ! 
     
    9180      zphi1 =  29._wp 
    9281      ! resolution in meters 
    93       ze1 = 106000. / REAL( jp_cfg , wp )             
     82      ze1 = 106000. / REAL( jp_cfg , wp ) 
    9483      ! benchmark: forced the resolution to be about 100 km 
    95       IF( nbench /= 0 )   ze1 = 106000._wp    
    96       zsin_alpha = - SQRT( 2._wp ) * 0.5_wp 
    97       zcos_alpha =   SQRT( 2._wp ) * 0.5_wp 
    98       ze1deg = ze1 / (ra * rad) 
    99       IF( nbench /= 0 )   ze1deg = ze1deg / REAL( jp_cfg , wp )   ! benchmark: keep the lat/+lon 
    100       !                                                           ! at the right jp_cfg resolution 
    101       zlam0 = zlam1 + zcos_alpha * ze1deg * REAL( jpjglo-2 , wp ) 
    102       zphi0 = zphi1 + zsin_alpha * ze1deg * REAL( jpjglo-2 , wp ) 
    103       ! 
    104       IF( nprint==1 .AND. lwp )   THEN 
    105          WRITE(numout,*) '          ze1', ze1, 'cosalpha', zcos_alpha, 'sinalpha', zsin_alpha 
    106          WRITE(numout,*) '          ze1deg', ze1deg, 'zlam0', zlam0, 'zphi0', zphi0 
    107       ENDIF 
    108       ! 
    109       DO jj = 1, jpj 
    110          DO ji = 1, jpi 
    111             zim1 = REAL( ji + nimpp - 1 ) - 1.   ;   zim05 = REAL( ji + nimpp - 1 ) - 1.5 
    112             zjm1 = REAL( jj + njmpp - 1 ) - 1.   ;   zjm05 = REAL( jj + njmpp - 1 ) - 1.5 
    113             ! 
    114             !glamt(i,j) longitude at T-point 
    115             !gphit(i,j) latitude at T-point   
    116             pglamt(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha 
    117             pgphit(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha 
    118             ! 
    119             !glamu(i,j) longitude at U-point 
    120             !gphiu(i,j) latitude at U-point 
    121             pglamu(ji,jj) = zlam0 + zim1  * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha 
    122             pgphiu(ji,jj) = zphi0 - zim1  * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha 
    123             ! 
    124             !glamv(i,j) longitude at V-point 
    125             !gphiv(i,j) latitude at V-point 
    126             pglamv(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm1  * ze1deg * zsin_alpha 
    127             pgphiv(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm1  * ze1deg * zcos_alpha 
    128             ! 
    129             !glamf(i,j) longitude at F-point 
    130             !gphif(i,j) latitude at F-point  
    131             pglamf(ji,jj) = zlam0 + zim1  * ze1deg * zcos_alpha + zjm1  * ze1deg * zsin_alpha 
    132             pgphif(ji,jj) = zphi0 - zim1  * ze1deg * zsin_alpha + zjm1  * ze1deg * zcos_alpha 
    133          END DO 
    134       END DO 
    135       ! 
    136       !       !== Horizontal scale factors ==! (in meters) 
    137       !                      
    138       !                             ! constant grid spacing 
    139       pe1t(:,:) =  ze1     ;      pe2t(:,:) = ze1 
    140       pe1u(:,:) =  ze1     ;      pe2u(:,:) = ze1 
    141       pe1v(:,:) =  ze1     ;      pe2v(:,:) = ze1 
    142       pe1f(:,:) =  ze1     ;      pe2f(:,:) = ze1 
    143       !                             ! NO reduction of grid size in some straits  
    144       ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_ghr routine 
    145       ! 
    146       ! 
    147  
    148       !                      !==  Coriolis parameter  ==! 
    149       kff = 1                                                           !  indicate not to compute ff afterward 
    150       ! 
    151       zbeta = 2. * omega * COS( rad * zphi1 ) / ra                      ! beta at latitude zphi1 
    152       !SF we overwrite zphi0 (south point in latitude) used just above to define pgphif (value of zphi0=15.5190567531966) 
    153       !SF for computation of coriolis we keep the parameter of XXXX 
    154       zphi0 = 15._wp                                                     !  latitude of the most southern grid point   
    155       zf0   = 2. * omega * SIN( rad * zphi0 )                            !  compute f0 1st point south 
    156       ! 
    157       pff(:,:) = ( zf0 + zbeta * ABS( gphif(:,:) - zphi0 ) * rad * ra )   ! f = f0 +beta* y ( y=0 at south) 
    158       ! 
    159       IF(lwp) WRITE(numout,*) '                           beta-plane used. beta = ', zbeta, ' 1/(s.m)' 
    160       ! 
    161       IF( nn_timing == 1 )  CALL timing_stop('usr_def_hgr') 
    16284      ! 
    16385   END SUBROUTINE usr_def_hgr 
    164    
     86 
     87 
    16588   SUBROUTINE usr_def_zgr()           ! Coriolis parameter  (if domain not on the sphere) 
    16689       ! subroutine for vertical grid 
    16790   END SUBROUTINE usr_def_zgr 
    16891 
     92  
     93   SUBROUTINE usr_def_ini( pts ) 
     94      !!---------------------------------------------------------------------- 
     95      !!                   ***  ROUTINE usr_def_ini  *** 
     96      !!  
     97      !! ** Purpose :   Initialization of the dynamics and tracers 
     98      !!                Here GYRE configuration example : (double gyre with rotated domain) 
     99      !! 
     100      !! ** Method  : - set temprature field 
     101      !!              - set salinity   field 
     102      !!---------------------------------------------------------------------- 
     103      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   ptsd   ! T & S data 
     104      ! 
     105      INTEGER :: ji, jj, jk  ! dummy loop indices 
     106      !!---------------------------------------------------------------------- 
     107      ! 
     108      IF(lwp) WRITE(numout,*) 
     109      IF(lwp) WRITE(numout,*) 'usr_def_ini : analytical definition of initial state ' 
     110      IF(lwp) WRITE(numout,*) '              T and S profiles deduced from LEVITUS ' 
     111      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
     112      ! 
     113      DO jk = 1, jpk 
     114         DO jj = 1, jpj 
     115            DO ji = 1, jpi 
     116               pts(ji,jj,jk,jp_tem) =  (  (  16. - 12. * TANH( (gdept_n(ji,jj,jk) - 400) / 700 ) )   & 
     117                    &           * (-TANH( (500-gdept_n(ji,jj,jk)) / 150 ) + 1) / 2               & 
     118                    &           + ( 15. * ( 1. - TANH( (gdept_n(ji,jj,jk)-50.) / 1500.) )        & 
     119                    &           - 1.4 * TANH((gdept_n(ji,jj,jk)-100.) / 100.)                    & 
     120                    &           + 7.  * (1500. - gdept_n(ji,jj,jk)) / 1500.)                     & 
     121                    &           * (-TANH( (gdept_n(ji,jj,jk) - 500) / 150) + 1) / 2  ) * tmask(ji,jj,jk) 
     122 
     123               pts(ji,jj,jk,jp_sal) =  (  (  36.25 - 1.13 * TANH( (gdept_n(ji,jj,jk) - 305) / 460 ) )  & 
     124                    &         * (-TANH((500 - gdept_n(ji,jj,jk)) / 150) + 1) / 2              & 
     125                    &         + ( 35.55 + 1.25 * (5000. - gdept_n(ji,jj,jk)) / 5000.          & 
     126                    &         - 1.62 * TANH( (gdept_n(ji,jj,jk) - 60.  ) / 650. )             & 
     127                    &         + 0.2  * TANH( (gdept_n(ji,jj,jk) - 35.  ) / 100. )             & 
     128                    &         + 0.2  * TANH( (gdept_n(ji,jj,jk) - 1000.) / 5000.) )           & 
     129                    &         * (-TANH((gdept_n(ji,jj,jk) - 500) / 150) + 1) / 2  ) * tmask(ji,jj,jk) 
     130            END DO 
     131         END DO 
     132      END DO 
     133      !    
     134   END SUBROUTINE usr_def_ini 
     135 
    169136   !!====================================================================== 
    170137END MODULE usrdef 
Note: See TracChangeset for help on using the changeset viewer.