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 5168 for branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/DOM – NEMO

Ignore:
Timestamp:
2015-03-25T10:01:32+01:00 (9 years ago)
Author:
pabouttier
Message:

Fixed several bugs described in Ticket #1360

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90

    r3711 r5168  
    1010   !!            8.0  !  2001-09  (M. Levy, M. Ben Jelloul)  istate_uvg 
    1111   !!   NEMO     1.0  !  2003-08  (G. Madec, C. Talandier)  F90: Free form, modules + EEL R5 
    12    !!             -   !  2004-05  (A. Koch-Larrouy)  istate_gyre  
     12   !!             -   !  2004-05  (A. Koch-Larrouy)  istate_gyre 
    1313   !!            2.0  !  2006-07  (S. Masson)  distributed restart using iom 
    1414   !!            3.3  !  2010-10  (C. Ethe) merge TRC-TRA 
    15    !!            3.4  !  2011-04  (G. Madec) Merge of dtatem and dtasal & suppression of tb,tn/sb,sn  
     15   !!            3.4  !  2011-04  (G. Madec) Merge of dtatem and dtasal & suppression of tb,tn/sb,sn 
    1616   !!---------------------------------------------------------------------- 
    1717 
     
    2424   !!   istate_uvg    : initial velocity in geostropic balance 
    2525   !!---------------------------------------------------------------------- 
    26    USE oce             ! ocean dynamics and active tracers  
    27    USE dom_oce         ! ocean space and time domain  
     26   USE oce             ! ocean dynamics and active tracers 
     27   USE dom_oce         ! ocean space and time domain 
    2828   USE daymod          ! calendar 
    2929   USE eosbn2          ! eq. of state, Brunt Vaisala frequency (eos     routine) 
     
    4646   USE wrk_nemo        ! Memory allocation 
    4747   USE timing          ! Timing 
     48   USE asminc 
    4849 
    4950   IMPLICIT NONE 
     
    6566      !!---------------------------------------------------------------------- 
    6667      !!                   ***  ROUTINE istate_init  *** 
    67       !!  
     68      !! 
    6869      !! ** Purpose :   Initialization of the dynamics and tracer fields. 
    6970      !!---------------------------------------------------------------------- 
     
    8384      rhd  (:,:,:  ) = 0.e0 
    8485      rhop (:,:,:  ) = 0.e0 
    85       rn2  (:,:,:  ) = 0.e0  
    86       tsa  (:,:,:,:) = 0.e0     
     86      rn2  (:,:,:  ) = 0.e0 
     87      tsa  (:,:,:,:) = 0.e0 
    8788 
    8889      IF( ln_rstart ) THEN                    ! Restart from a file 
     
    100101         CALL day_init                           ! model calendar (using both namelist and restart infos) 
    101102         !                                       ! Initialization of ocean to zero 
    102          !   before fields      !       now fields      
     103         !   before fields      !       now fields 
    103104         sshb (:,:)   = 0._wp   ;   sshn (:,:)   = 0._wp 
    104105         ub   (:,:,:) = 0._wp   ;   un   (:,:,:) = 0._wp 
    105          vb   (:,:,:) = 0._wp   ;   vn   (:,:,:) = 0._wp   
     106         vb   (:,:,:) = 0._wp   ;   vn   (:,:,:) = 0._wp 
    106107         rotb (:,:,:) = 0._wp   ;   rotn (:,:,:) = 0._wp 
    107108         hdivb(:,:,:) = 0._wp   ;   hdivn(:,:,:) = 0._wp 
     
    109110         IF( cp_cfg == 'eel' ) THEN 
    110111            CALL istate_eel                      ! EEL   configuration : start from pre-defined U,V T-S fields 
    111          ELSEIF( cp_cfg == 'gyre' ) THEN          
     112         ELSEIF( cp_cfg == 'gyre' ) THEN 
    112113            CALL istate_gyre                     ! GYRE  configuration : start from pre-defined T-S fields 
    113114         ELSEIF( ln_tsd_init      ) THEN         ! Initial T-S fields read in files 
     
    124125            &                                       rhd, gru , grv  )   ! of t,s,rd at ocean bottom 
    125126#endif 
    126          !    
     127         ! 
    127128         ! - ML - sshn could be modified by istate_eel, so that initialization of fse3t_b is done here 
    128129         IF( lk_vvl ) THEN 
     
    133134         !                                       ! define e3u_b, e3v_b from e3t_b initialized in domzgr 
    134135         CALL dom_vvl_2( nit000, fse3u_b(:,:,:), fse3v_b(:,:,:) ) 
    135          !  
     136         ! 
    136137      ENDIF 
    137138      ! 
     
    146147      ENDIF 
    147148      ! 
     149      IF ( lk_asminc .AND. ln_asmdin ) THEN 
     150         neuler = 0            ! restart with an euler from the corrected background 
     151      ENDIF 
     152 
    148153      IF( nn_timing == 1 )  CALL timing_stop('istate_init') 
    149154      ! 
     
    153158      !!--------------------------------------------------------------------- 
    154159      !!                  ***  ROUTINE istate_t_s  *** 
    155       !!    
    156       !! ** Purpose :   Intialization of the temperature field with an  
     160      !! 
     161      !! ** Purpose :   Intialization of the temperature field with an 
    157162      !!      analytical profile or a file (i.e. in EEL configuration) 
    158163      !! 
     
    184189      !!---------------------------------------------------------------------- 
    185190      !!                   ***  ROUTINE istate_eel  *** 
    186       !!  
     191      !! 
    187192      !! ** Purpose :   Initialization of the dynamics and tracers for EEL R5 
    188193      !!      configuration (channel with or without a topographic bump) 
     
    195200      USE divcur     ! hor. divergence & rel. vorticity      (div_cur routine) 
    196201      USE iom 
    197   
     202 
    198203      INTEGER  ::   inum              ! temporary logical unit 
    199204      INTEGER  ::   ji, jj, jk        ! dummy loop indices 
     
    207212      !!---------------------------------------------------------------------- 
    208213 
    209       SELECT CASE ( jp_cfg )  
     214      SELECT CASE ( jp_cfg ) 
    210215         !                                              ! ==================== 
    211216         CASE ( 5 )                                     ! EEL R5 configuration 
     
    244249            ! set the dynamics: U,V, hdiv, rot (and ssh if necessary) 
    245250            ! ---------------- 
    246             ! Start EEL5 configuration with barotropic geostrophic velocities  
     251            ! Start EEL5 configuration with barotropic geostrophic velocities 
    247252            ! according the sshb and sshn SSH imposed. 
    248253            ! we assume a uniform grid (hence the use of e1t(1,1) for delta_y) 
    249             ! we use the Coriolis frequency at mid-channel.    
     254            ! we use the Coriolis frequency at mid-channel. 
    250255            ub(:,:,:) = zueel * umask(:,:,:) 
    251256            un(:,:,:) = ub(:,:,:) 
     
    254259            ! 
    255260            DO jj = 1, jpjglo 
    256                zssh(:,jj) = - (FLOAT(jj)- FLOAT(jpjglo-1)/2.)*zueel*e1t(1,1)*zfcor/grav  
     261               zssh(:,jj) = - (FLOAT(jj)- FLOAT(jpjglo-1)/2.)*zueel*e1t(1,1)*zfcor/grav 
    257262            END DO 
    258263            ! 
     
    273278            sshn(:,:) = sshb(:,:)                   ! set now ssh to the before value 
    274279            ! 
    275             IF( nn_rstssh /= 0 ) THEN   
    276                nn_rstssh = 0                        ! hand-made initilization of ssh  
     280            IF( nn_rstssh /= 0 ) THEN 
     281               nn_rstssh = 0                        ! hand-made initilization of ssh 
    277282               CALL ctl_warn( 'istate_eel: force nn_rstssh = 0' ) 
    278283            ENDIF 
     
    326331      !!---------------------------------------------------------------------- 
    327332      !!                   ***  ROUTINE istate_gyre  *** 
    328       !!  
     333      !! 
    329334      !! ** Purpose :   Initialization of the dynamics and tracers for GYRE 
    330335      !!      configuration (double gyre with rotated domain) 
     
    351356                       &           * (-TANH( (500-fsdept(ji,jj,jk)) / 150 ) + 1) / 2               & 
    352357                       &       + (      15. * ( 1. - TANH( (fsdept(ji,jj,jk)-50.) / 1500.) )       & 
    353                        &                - 1.4 * TANH((fsdept(ji,jj,jk)-100.) / 100.)               &     
    354                        &                + 7.  * (1500. - fsdept(ji,jj,jk)) / 1500.             )   &  
     358                       &                - 1.4 * TANH((fsdept(ji,jj,jk)-100.) / 100.)               & 
     359                       &                + 7.  * (1500. - fsdept(ji,jj,jk)) / 1500.             )   & 
    355360                       &           * (-TANH( (fsdept(ji,jj,jk) - 500) / 150) + 1) / 2 
    356361                  tsn(ji,jj,jk,jp_tem) = tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
     
    363368                     &                + 0.2  * TANH( (fsdept(ji,jj,jk) - 35.  ) / 100. )       & 
    364369                     &                + 0.2  * TANH( (fsdept(ji,jj,jk) - 1000.) / 5000.)    )  & 
    365                      &              * (-TANH((fsdept(ji,jj,jk) - 500) / 150) + 1) / 2  
     370                     &              * (-TANH((fsdept(ji,jj,jk) - 500) / 150) + 1) / 2 
    366371                  tsn(ji,jj,jk,jp_sal) = tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk) 
    367372                  tsb(ji,jj,jk,jp_sal) = tsn(ji,jj,jk,jp_sal) 
     
    379384         ! ---------------------- 
    380385         CALL iom_open ( 'data_tem', inum ) 
    381          CALL iom_get ( inum, jpdom_data, 'votemper', tsn(:,:,:,jp_tem) )  
     386         CALL iom_get ( inum, jpdom_data, 'votemper', tsn(:,:,:,jp_tem) ) 
    382387         CALL iom_close( inum ) 
    383388 
    384          tsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) * tmask(:,:,:)  
     389         tsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) * tmask(:,:,:) 
    385390         tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) 
    386391 
     
    388393         ! ------------------- 
    389394         CALL iom_open ( 'data_sal', inum ) 
    390          CALL iom_get ( inum, jpdom_data, 'vosaline', tsn(:,:,:,jp_sal) )  
     395         CALL iom_get ( inum, jpdom_data, 'vosaline', tsn(:,:,:,jp_sal) ) 
    391396         CALL iom_close( inum ) 
    392397 
    393          tsn(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) * tmask(:,:,:)  
     398         tsn(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) * tmask(:,:,:) 
    394399         tsb(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) 
    395400 
     
    412417      !! ** Purpose :   Compute the geostrophic velocities from (tn,sn) fields 
    413418      !! 
    414       !! ** Method  :   Using the hydrostatic hypothesis the now hydrostatic  
     419      !! ** Method  :   Using the hydrostatic hypothesis the now hydrostatic 
    415420      !!      pressure is computed by integrating the in-situ density from the 
    416421      !!      surface to the bottom. 
     
    429434      CALL wrk_alloc( jpi, jpj, jpk, zprn) 
    430435      ! 
    431       IF(lwp) WRITE(numout,*)  
     436      IF(lwp) WRITE(numout,*) 
    432437      IF(lwp) WRITE(numout,*) 'istate_uvg : Start from Geostrophy' 
    433438      IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     
    437442 
    438443      zalfg = 0.5 * grav * rau0 
    439        
     444 
    440445      zprn(:,:,1) = zalfg * fse3w(:,:,1) * ( 1 + rhd(:,:,1) )       ! Surface value 
    441446 
     
    443448         zprn(:,:,jk) = zprn(:,:,jk-1)   & 
    444449            &         + zalfg * fse3w(:,:,jk) * ( 2. + rhd(:,:,jk) + rhd(:,:,jk-1) ) 
    445       END DO   
     450      END DO 
    446451 
    447452      ! Compute geostrophic balance 
     
    485490      CALL lbc_lnk( un, 'U', -1. ) 
    486491      CALL lbc_lnk( vn, 'V', -1. ) 
    487        
     492 
    488493      ub(:,:,:) = un(:,:,:) 
    489494      vb(:,:,:) = vn(:,:,:) 
    490        
     495 
    491496      ! WARNING !!!!! 
    492497      ! after initializing u and v, we need to calculate the initial streamfunction bsf. 
     
    516521      un(:,:,:) = ub(:,:,:) 
    517522      vn(:,:,:) = vb(:,:,:) 
    518         
     523 
    519524      ! Compute the divergence and curl 
    520525 
Note: See TracChangeset for help on using the changeset viewer.