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 4898 for branches/2014 – NEMO

Changeset 4898 for branches/2014


Ignore:
Timestamp:
2014-11-27T16:14:11+01:00 (9 years ago)
Author:
cetlod
Message:

2014/dev_CNRS_2014 : merge the 2nd branch onto dev_CNRS_2014, see ticket #1415

Location:
branches/2014/dev_CNRS_2014/NEMOGCM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_CNRS_2014/NEMOGCM/CONFIG/SHARED/namelist_ref

    r4897 r4898  
    304304 
    305305   cn_dir      = './'      !  root directory for the location of the bulk files 
    306    ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F) 
    307306   ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data 
    308    ln_bulk2z   = .false.   !  Air temperature/humidity and wind vectors are referenced at heights rn_zqt and rn_zu 
    309    rn_zqt      = 3.        !  Air temperature and humidity reference height (m) (ln_bulk2z) 
    310    rn_zu       = 4.        !  Wind vector reference height (m)                  (ln_bulk2z) 
     307   rn_zqt      = 10.        !  Air temperature and humidity reference height (m) 
     308   rn_zu       = 10.        !  Wind vector reference height (m)                  
    311309   rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow) 
    312310   rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.) 
  • branches/2014/dev_CNRS_2014/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90

    r4897 r4898  
    55   !!===================================================================== 
    66   !! History :  1.0  !  2004-08  (U. Schweckendiek)  Original code 
    7    !!            2.0  !  2005-04  (L. Brodeau, A.M. Treguier) additions:  
     7   !!            2.0  !  2005-04  (L. Brodeau, A.M. Treguier) additions: 
    88   !!                           -  new bulk routine for efficiency 
    99   !!                           -  WINDS ARE NOW ASSUMED TO BE AT T POINTS in input files !!!! 
    10    !!                           -  file names and file characteristics in namelist  
    11    !!                           -  Implement reading of 6-hourly fields    
    12    !!            3.0  !  2006-06  (G. Madec) sbc rewritting    
    13    !!             -   !  2006-12  (L. Brodeau) Original code for TURB_CORE_2Z 
     10   !!                           -  file names and file characteristics in namelist 
     11   !!                           -  Implement reading of 6-hourly fields 
     12   !!            3.0  !  2006-06  (G. Madec) sbc rewritting 
     13   !!             -   !  2006-12  (L. Brodeau) Original code for turb_core_2z 
    1414   !!            3.2  !  2009-04  (B. Lemaire)  Introduce iom_put 
    1515   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle 
    1616   !!            3.4  !  2011-11  (C. Harris) Fill arrays required by CICE 
     17   !!            3.7  !  2014-06  (L. Brodeau) simplification and optimization of CORE bulk 
    1718   !!---------------------------------------------------------------------- 
    1819 
    1920   !!---------------------------------------------------------------------- 
    20    !!   sbc_blk_core  : bulk formulation as ocean surface boundary condition 
    21    !!                   (forced mode, CORE bulk formulea) 
    22    !!   blk_oce_core  : ocean: computes momentum, heat and freshwater fluxes 
    23    !!   blk_ice_core  : ice  : computes momentum, heat and freshwater fluxes 
    24    !!   turb_core     : computes the CORE turbulent transfer coefficients  
     21   !!   sbc_blk_core    : bulk formulation as ocean surface boundary condition (forced mode, CORE bulk formulea) 
     22   !!   blk_oce_core    : computes momentum, heat and freshwater fluxes over ocean 
     23   !!   blk_ice_core    : computes momentum, heat and freshwater fluxes over ice 
     24   !!   blk_bio_meanqsr : compute daily mean short wave radiation over the ocean 
     25   !!   blk_ice_meanqsr : compute daily mean short wave radiation over the ice 
     26   !!   turb_core_2z    : Computes turbulent transfert coefficients 
     27   !!   cd_neutral_10m  : Estimate of the neutral drag coefficient at 10m 
     28   !!   psi_m           : universal profile stability function for momentum 
     29   !!   psi_h           : universal profile stability function for temperature and humidity 
    2530   !!---------------------------------------------------------------------- 
    2631   USE oce             ! ocean dynamics and tracers 
     
    3843   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    3944   USE prtctl          ! Print control 
    40    USE sbcwave,ONLY :  cdn_wave !wave module  
     45   USE sbcwave, ONLY   :  cdn_wave ! wave module 
    4146#if defined key_lim3 || defined key_cice 
    4247   USE sbc_ice         ! Surface boundary condition: ice fields 
     
    5257   PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module 
    5358 
    54    INTEGER , PARAMETER ::   jpfld   = 9           ! maximum number of files to read  
     59   INTEGER , PARAMETER ::   jpfld   = 9           ! maximum number of files to read 
    5560   INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point 
    5661   INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point 
     
    6267   INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s) 
    6368   INTEGER , PARAMETER ::   jp_tdif = 9           ! index of tau diff associated to HF tau   (N/m2)   at T-point 
    64     
     69 
    6570   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read) 
    66           
     71 
    6772   !                                             !!! CORE bulk parameters 
    6873   REAL(wp), PARAMETER ::   rhoa =    1.22        ! air density 
     
    7580 
    7681   !                                  !!* Namelist namsbc_core : CORE bulk parameters 
    77    LOGICAL  ::   ln_2m       ! logical flag for height of air temp. and hum 
    7882   LOGICAL  ::   ln_taudif   ! logical flag to use the "mean of stress module - module of mean stress" data 
    7983   REAL(wp) ::   rn_pfac     ! multiplication factor for precipitation 
    8084   REAL(wp) ::   rn_efac     ! multiplication factor for evaporation (clem) 
    8185   REAL(wp) ::   rn_vfac     ! multiplication factor for ice/ocean velocity in the calculation of wind stress (clem) 
    82    LOGICAL  ::   ln_bulk2z   ! logical flag for case where z(q,t) and z(u) are specified in the namelist 
    8386   REAL(wp) ::   rn_zqt      ! z(q,t) : height of humidity and temperature measurements 
    8487   REAL(wp) ::   rn_zu       ! z(u)   : height of wind measurements 
     
    8891#  include "vectopt_loop_substitute.h90" 
    8992   !!---------------------------------------------------------------------- 
    90    !! NEMO/OPA 3.3 , NEMO-consortium (2010)  
     93   !! NEMO/OPA 3.7 , NEMO-consortium (2014) 
    9194   !! $Id$ 
    9295   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    97100      !!--------------------------------------------------------------------- 
    98101      !!                    ***  ROUTINE sbc_blk_core  *** 
    99       !!                    
     102      !! 
    100103      !! ** Purpose :   provide at each time step the surface ocean fluxes 
    101       !!      (momentum, heat, freshwater and runoff)  
     104      !!      (momentum, heat, freshwater and runoff) 
    102105      !! 
    103106      !! ** Method  : (1) READ each fluxes in NetCDF files: 
     
    123126      !!              - sfx         salt flux due to freezing/melting (non-zero only if ice is present) 
    124127      !!                            (set in limsbc(_2).F90) 
     128      !! 
     129      !! ** References :   Large & Yeager, 2004 / Large & Yeager, 2008 
     130      !!                   Brodeau et al. Ocean Modelling 2010 
    125131      !!---------------------------------------------------------------------- 
    126132      INTEGER, INTENT(in) ::   kt   ! ocean time step 
    127       !! 
     133      ! 
    128134      INTEGER  ::   ierror   ! return error code 
    129135      INTEGER  ::   ifpr     ! dummy loop indice 
    130136      INTEGER  ::   jfld     ! dummy loop arguments 
    131137      INTEGER  ::   ios      ! Local integer output status for namelist read 
    132       !! 
     138      ! 
    133139      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files 
    134140      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read 
     
    136142      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !   "                                 " 
    137143      TYPE(FLD_N) ::   sn_tdif                                 !   "                                 " 
    138       NAMELIST/namsbc_core/ cn_dir , ln_2m  , ln_taudif, rn_pfac, rn_efac, rn_vfac,  & 
     144      NAMELIST/namsbc_core/ cn_dir , ln_taudif, rn_pfac, rn_efac, rn_vfac,  & 
    139145         &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           & 
    140146         &                  sn_qlw , sn_tair, sn_prec  , sn_snow,           & 
    141          &                  sn_tdif, rn_zqt , ln_bulk2z, rn_zu 
    142       !!--------------------------------------------------------------------- 
    143  
     147         &                  sn_tdif, rn_zqt, rn_zu 
     148      !!--------------------------------------------------------------------- 
     149      ! 
    144150      !                                         ! ====================== ! 
    145151      IF( kt == nit000 ) THEN                   !  First call kt=nit000  ! 
     
    149155         READ  ( numnam_ref, namsbc_core, IOSTAT = ios, ERR = 901) 
    150156901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_core in reference namelist', lwp ) 
    151  
     157         ! 
    152158         REWIND( numnam_cfg )              ! Namelist namsbc_core in configuration namelist : CORE bulk parameters 
    153159         READ  ( numnam_cfg, namsbc_core, IOSTAT = ios, ERR = 902 ) 
    154160902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_core in configuration namelist', lwp ) 
    155161 
    156          IF(lwm) WRITE ( numond, namsbc_core ) 
     162         WRITE ( numond, namsbc_core ) 
    157163         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing? 
    158          IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   &  
    159             &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )  
     164         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   & 
     165            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) 
    160166         IF( ln_dm2dc .AND. sn_qsr%ln_tint ) THEN 
    161167            CALL ctl_warn( 'sbc_blk_core: ln_dm2dc is taking care of the temporal interpolation of daily qsr',   & 
    162                  &         '              ==> We force time interpolation = .false. for qsr' ) 
     168               &         '              ==> We force time interpolation = .false. for qsr' ) 
    163169            sn_qsr%ln_tint = .false. 
    164170         ENDIF 
     
    169175         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow 
    170176         slf_i(jp_tdif) = sn_tdif 
    171          !                  
     177         ! 
    172178         lhftau = ln_taudif                        ! do we use HF tau information? 
    173179         jfld = jpfld - COUNT( (/.NOT. lhftau/) ) 
     
    191197      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m ) 
    192198 
    193       ! If diurnal cycle is activated, compute a daily mean short waves flux for biogeochemistery  
     199      ! If diurnal cycle is activated, compute a daily mean short waves flux for biogeochemistery 
    194200      IF( ltrcdm2dc )   CALL blk_bio_meanqsr 
    195201 
     
    269275      zwnd_j(:,:) = 0.e0 
    270276#if defined key_cyclone 
    271       CALL wnd_cyc( kt, zwnd_i, zwnd_j ) 
     277      CALL wnd_cyc( kt, zwnd_i, zwnd_j )    ! add analytical tropical cyclone (Vincent et al. JGR 2012) 
    272278      DO jj = 2, jpjm1 
    273279         DO ji = fs_2, fs_jpim1   ! vect. opt. 
     
    292298      !      I   Radiative FLUXES                                                     ! 
    293299      ! ----------------------------------------------------------------------------- ! 
    294      
     300 
    295301      ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave 
    296302      zztmp = 1. - albo 
     
    298304      ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1) 
    299305      ENDIF 
    300 !CDIR COLLAPSE 
    301306      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave 
    302307      ! ----------------------------------------------------------------------------- ! 
     
    305310 
    306311      ! ... specific humidity at SST and IST 
    307 !CDIR NOVERRCHK 
    308 !CDIR COLLAPSE 
    309       zqsatw(:,:) = zcoef_qsatw * EXP( -5107.4 / zst(:,:) )  
     312      zqsatw(:,:) = zcoef_qsatw * EXP( -5107.4 / zst(:,:) ) 
    310313 
    311314      ! ... NCAR Bulk formulae, computation of Cd, Ch, Ce at T-point : 
    312       IF( ln_2m ) THEN 
    313          !! If air temp. and spec. hum. are given at different height (2m) than wind (10m) : 
    314          CALL TURB_CORE_2Z(2.,10., zst   , sf(jp_tair)%fnow,         & 
    315             &                      zqsatw, sf(jp_humi)%fnow, wndm,   & 
    316             &                      Cd    , Ch              , Ce  ,   & 
    317             &                      zt_zu , zq_zu                   ) 
    318       ELSE IF( ln_bulk2z ) THEN 
    319          !! If the height of the air temp./spec. hum. and wind are to be specified by hand : 
    320          IF( rn_zqt == rn_zu ) THEN 
    321             !! If air temp. and spec. hum. are at the same height as wind : 
    322             CALL TURB_CORE_1Z( rn_zu, zst   , sf(jp_tair)%fnow(:,:,1),       & 
    323                &                      zqsatw, sf(jp_humi)%fnow(:,:,1), wndm, & 
    324                &                      Cd    , Ch                     , Ce  ) 
    325          ELSE 
    326             !! If air temp. and spec. hum. are at a different height to wind : 
    327             CALL TURB_CORE_2Z(rn_zqt, rn_zu , zst   , sf(jp_tair)%fnow,         & 
    328                &                              zqsatw, sf(jp_humi)%fnow, wndm,   & 
    329                &                              Cd    , Ch              , Ce  ,   & 
    330                &                              zt_zu , zq_zu                 ) 
    331          ENDIF 
    332       ELSE 
    333          !! If air temp. and spec. hum. are given at same height than wind (10m) : 
    334 !gm bug?  at the compiling phase, add a copy in temporary arrays...  ==> check perf 
    335 !         CALL TURB_CORE_1Z( 10., zst   (:,:), sf(jp_tair)%fnow(:,:),              & 
    336 !            &                    zqsatw(:,:), sf(jp_humi)%fnow(:,:), wndm(:,:),   & 
    337 !            &                    Cd    (:,:),             Ch  (:,:), Ce  (:,:)  ) 
    338 !gm bug 
    339 ! ARPDBG - this won't compile with gfortran. Fix but check performance 
    340 ! as per comment above. 
    341          CALL TURB_CORE_1Z( 10., zst   , sf(jp_tair)%fnow(:,:,1),       & 
    342             &                    zqsatw, sf(jp_humi)%fnow(:,:,1), wndm, & 
    343             &                    Cd    , Ch              , Ce    ) 
    344       ENDIF 
    345  
     315      CALL turb_core_2z( rn_zqt, rn_zu, zst, sf(jp_tair)%fnow, zqsatw, sf(jp_humi)%fnow, wndm,   & 
     316         &               Cd, Ch, Ce, zt_zu, zq_zu ) 
     317     
    346318      ! ... tau module, i and j component 
    347319      DO jj = 1, jpj 
     
    355327 
    356328      ! ... add the HF tau contribution to the wind stress module? 
    357       IF( lhftau ) THEN  
    358 !CDIR COLLAPSE 
     329      IF( lhftau ) THEN 
    359330         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1) 
    360331      ENDIF 
     
    372343      CALL lbc_lnk( vtau(:,:), 'V', -1. ) 
    373344 
     345     
    374346      !  Turbulent fluxes over ocean 
    375347      ! ----------------------------- 
    376       IF( ln_2m .OR. ( ln_bulk2z .AND. rn_zqt /= rn_zu ) ) THEN 
    377          ! Values of temp. and hum. adjusted to height of wind must be used 
    378          zevap(:,:) = rn_efac * MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - zq_zu(:,:) ) * wndm(:,:) )  ! Evaporation 
    379          zqsb (:,:) =                      rhoa*cpa*Ch(:,:)*( zst   (:,:) - zt_zu(:,:) ) * wndm(:,:)     ! Sensible Heat 
     348      IF( ABS( rn_zu - rn_zqt) < 0.01_wp ) THEN 
     349         !! q_air and t_air are (or "are almost") given at 10m (wind reference height) 
     350         zevap(:,:) = rn_efac*MAX( 0._wp,     rhoa*Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) )*wndm(:,:) ) ! Evaporation 
     351         zqsb (:,:) =                     cpa*rhoa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) )*wndm(:,:)   ! Sensible Heat 
    380352      ELSE 
    381 !CDIR COLLAPSE 
    382          zevap(:,:) = rn_efac * MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) ) * wndm(:,:) )   ! Evaporation 
    383 !CDIR COLLAPSE 
    384          zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) ) * wndm(:,:)     ! Sensible Heat 
     353         !! q_air and t_air are not given at 10m (wind reference height) 
     354         ! Values of temp. and hum. adjusted to height of wind during bulk algorithm iteration must be used!!! 
     355         zevap(:,:) = rn_efac*MAX( 0.e0,     rhoa*Ce(:,:)*( zqsatw(:,:) - zq_zu(:,:) )*wndm(:,:) )   ! Evaporation 
     356         zqsb (:,:) =                    cpa*rhoa*Ch(:,:)*( zst   (:,:) - zt_zu(:,:) )*wndm(:,:)     ! Sensible Heat 
    385357      ENDIF 
    386 !CDIR COLLAPSE 
    387358      zqla (:,:) = Lv * zevap(:,:)                                                              ! Latent Heat 
    388359 
     
    401372      !     III    Total FLUXES                                                       ! 
    402373      ! ----------------------------------------------------------------------------- ! 
    403       
    404 !CDIR COLLAPSE 
     374      ! 
    405375      emp (:,:) = (  zevap(:,:)                                          &   ! mass flux (evap. - precip.) 
    406376         &         - sf(jp_prec)%fnow(:,:,1) * rn_pfac  ) * tmask(:,:,1) 
    407 !CDIR COLLAPSE 
    408377      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                &   ! Downward Non Solar flux 
    409378         &     - sf(jp_snow)%fnow(:,:,1) * rn_pfac * lfus                         &   ! remove latent melting heat for solid precip 
    410379         &     - zevap(:,:) * pst(:,:) * rcp                                      &   ! remove evap heat content at SST 
    411380         &     + ( sf(jp_prec)%fnow(:,:,1) - sf(jp_snow)%fnow(:,:,1) ) * rn_pfac  &   ! add liquid precip heat content at Tair 
    412          &     * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp                          &    
     381         &     * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp                          & 
    413382         &     + sf(jp_snow)%fnow(:,:,1) * rn_pfac                                &   ! add solid  precip heat content at min(Tair,Tsnow) 
    414383         &     * ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic  
     
    434403      ! 
    435404   END SUBROUTINE blk_oce_core 
    436    
    437    
    438    SUBROUTINE blk_bio_meanqsr 
    439       !!--------------------------------------------------------------------- 
    440       !!                     ***  ROUTINE blk_bio_meanqsr 
    441       !!                      
    442       !! ** Purpose :   provide daily qsr_mean for PISCES when 
    443       !!                analytic diurnal cycle is applied in physic 
    444       !!                 
    445       !! ** Method  :   add part where there is no ice 
    446       !!  
    447       !!--------------------------------------------------------------------- 
    448       IF( nn_timing == 1 )   CALL timing_start('blk_bio_meanqsr') 
    449       ! 
    450       qsr_mean(:,:) = (1. - albo ) * sf(jp_qsr)%fnow(:,:,1) 
    451       ! 
    452       IF( nn_timing == 1 )   CALL timing_stop('blk_bio_meanqsr') 
    453       ! 
    454    END SUBROUTINE blk_bio_meanqsr 
    455   
    456   
    457    SUBROUTINE blk_ice_meanqsr(palb,p_qsr_mean,pdim) 
    458       !!--------------------------------------------------------------------- 
    459       !! 
    460       !! ** Purpose :   provide the daily qsr_mean over sea_ice for PISCES when 
    461       !!                analytic diurnal cycle is applied in physic 
    462       !! 
    463       !! ** Method  :   compute qsr 
    464       !!  
    465       !!--------------------------------------------------------------------- 
    466       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb       ! ice albedo (clear sky) (alb_ice_cs)               [%] 
    467       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qsr_mean !     solar heat flux over ice (T-point)         [W/m2] 
    468       INTEGER                   , INTENT(in   ) ::   pdim       ! number of ice categories 
    469       !! 
    470       INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays) 
    471       INTEGER  ::   ji, jj, jl    ! dummy loop indices 
    472       REAL(wp) ::   zztmp         ! temporary variable 
    473       !!--------------------------------------------------------------------- 
    474       IF( nn_timing == 1 )  CALL timing_start('blk_ice_meanqsr') 
    475       ! 
    476       ijpl  = pdim                            ! number of ice categories 
    477       zztmp = 1. / ( 1. - albo ) 
    478       !                                     ! ========================== ! 
    479       DO jl = 1, ijpl                       !  Loop over ice categories  ! 
    480          !                                  ! ========================== ! 
    481          DO jj = 1 , jpj 
    482             DO ji = 1, jpi 
    483                   p_qsr_mean(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr_mean(ji,jj) 
    484             END DO 
    485          END DO 
    486       END DO 
    487       ! 
    488       IF( nn_timing == 1 )  CALL timing_stop('blk_ice_meanqsr') 
    489       ! 
    490    END SUBROUTINE blk_ice_meanqsr   
    491405  
    492406    
     
    572486      CASE( 'I' )                  ! B-grid ice dynamics :   I-point (i.e. F-point with sea-ice indexation) 
    573487         !                           and scalar wind at T-point ( = | U10m - U_ice | ) (masked) 
    574 !CDIR NOVERRCHK 
    575488         DO jj = 2, jpjm1 
    576489            DO ji = 2, jpim1   ! B grid : NO vector opt 
     
    660573               ! ----------------------------! 
    661574               ! Downward Non Solar flux 
    662                p_qns (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - p_qla (ji,jj,jl)       
     575               p_qns (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - p_qla (ji,jj,jl) 
    663576               ! Total non solar heat flux sensitivity for ice 
    664                p_dqns(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + p_dqla(ji,jj,jl) )     
     577               p_dqns(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + p_dqla(ji,jj,jl) ) 
    665578            END DO 
    666579            ! 
     
    673586      ! thin surface layer and penetrates inside the ice cover 
    674587      ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 ) 
    675      
    676 !CDIR COLLAPSE 
     588 
    677589      p_fr1(:,:) = ( 0.18 * ( 1.0 - zcoef_frca ) + 0.35 * zcoef_frca ) 
    678 !CDIR COLLAPSE 
    679590      p_fr2(:,:) = ( 0.82 * ( 1.0 - zcoef_frca ) + 0.65 * zcoef_frca ) 
    680         
    681 !CDIR COLLAPSE 
     591 
    682592      p_tpr(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s] 
    683 !CDIR COLLAPSE 
    684593      p_spr(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s] 
    685       CALL iom_put( 'snowpre', p_spr * 86400. )                  ! Snow precipitation  
    686       CALL iom_put( 'precip' , p_tpr * 86400. )                  ! Total precipitation  
     594      CALL iom_put( 'snowpre', p_spr * 86400. )                  ! Snow precipitation 
     595      CALL iom_put( 'precip' , p_tpr * 86400. )                  ! Total precipitation 
    687596      ! 
    688597      IF(ln_ctl) THEN 
     
    698607 
    699608      CALL wrk_dealloc( jpi,jpj, z_wnds_t ) 
    700       CALL wrk_dealloc( jpi,jpj,pdim, z_qlw, z_qsb, z_dqlw, z_dqsb )  
     609      CALL wrk_dealloc( jpi,jpj,pdim, z_qlw, z_qsb, z_dqlw, z_dqsb ) 
    701610      ! 
    702611      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core') 
    703612      ! 
    704613   END SUBROUTINE blk_ice_core 
    705    
    706  
    707    SUBROUTINE TURB_CORE_1Z(zu, sst, T_a, q_sat, q_a,   & 
    708       &                        dU , Cd , Ch   , Ce   ) 
     614 
     615 
     616   SUBROUTINE blk_bio_meanqsr 
     617      !!--------------------------------------------------------------------- 
     618      !!                     ***  ROUTINE blk_bio_meanqsr 
     619      !!                      
     620      !! ** Purpose :   provide daily qsr_mean for PISCES when 
     621      !!                analytic diurnal cycle is applied in physic 
     622      !!                 
     623      !! ** Method  :   add part where there is no ice 
     624      !!  
     625      !!--------------------------------------------------------------------- 
     626      IF( nn_timing == 1 )  CALL timing_start('blk_bio_meanqsr') 
     627      ! 
     628      qsr_mean(:,:) = (1. - albo ) *  sf(jp_qsr)%fnow(:,:,1) 
     629      ! 
     630      IF( nn_timing == 1 )  CALL timing_stop('blk_bio_meanqsr') 
     631      ! 
     632   END SUBROUTINE blk_bio_meanqsr 
     633  
     634  
     635   SUBROUTINE blk_ice_meanqsr( palb, p_qsr_mean, pdim ) 
     636      !!--------------------------------------------------------------------- 
     637      !! 
     638      !! ** Purpose :   provide the daily qsr_mean over sea_ice for PISCES when 
     639      !!                analytic diurnal cycle is applied in physic 
     640      !! 
     641      !! ** Method  :   compute qsr 
     642      !!  
     643      !!--------------------------------------------------------------------- 
     644      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb       ! ice albedo (clear sky) (alb_ice_cs)               [%] 
     645      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qsr_mean !     solar heat flux over ice (T-point)         [W/m2] 
     646      INTEGER                   , INTENT(in   ) ::   pdim       ! number of ice categories 
     647      ! 
     648      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays) 
     649      INTEGER  ::   ji, jj, jl    ! dummy loop indices 
     650      REAL(wp) ::   zztmp         ! temporary variable 
     651      !!--------------------------------------------------------------------- 
     652      IF( nn_timing == 1 )  CALL timing_start('blk_ice_meanqsr') 
     653      ! 
     654      ijpl  = pdim                            ! number of ice categories 
     655      zztmp = 1. / ( 1. - albo ) 
     656      !                                     ! ========================== ! 
     657      DO jl = 1, ijpl                       !  Loop over ice categories  ! 
     658         !                                  ! ========================== ! 
     659         DO jj = 1 , jpj 
     660            DO ji = 1, jpi 
     661                  p_qsr_mean(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr_mean(ji,jj) 
     662            END DO 
     663         END DO 
     664      END DO 
     665      ! 
     666      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_meanqsr') 
     667      ! 
     668   END SUBROUTINE blk_ice_meanqsr   
     669 
     670 
     671   SUBROUTINE turb_core_2z( zt, zu, sst, T_zt, q_sat, q_zt, dU,    & 
     672      &                      Cd, Ch, Ce , T_zu, q_zu ) 
    709673      !!---------------------------------------------------------------------- 
    710674      !!                      ***  ROUTINE  turb_core  *** 
    711675      !! 
    712676      !! ** Purpose :   Computes turbulent transfert coefficients of surface 
    713       !!                fluxes according to Large & Yeager (2004) 
    714       !! 
    715       !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D 
    716       !!      Momentum, Latent and sensible heat exchange coefficients 
    717       !!      Caution: this procedure should only be used in cases when air 
    718       !!      temperature (T_air), air specific humidity (q_air) and wind (dU) 
    719       !!      are provided at the same height 'zzu'! 
    720       !! 
    721       !! References :   Large & Yeager, 2004 : ??? 
    722       !!---------------------------------------------------------------------- 
    723       REAL(wp)                , INTENT(in   ) ::   zu      ! altitude of wind measurement       [m] 
    724       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   sst     ! sea surface temperature         [Kelvin] 
    725       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   T_a     ! potential air temperature       [Kelvin] 
    726       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   q_sat   ! sea surface specific humidity   [kg/kg] 
    727       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   q_a     ! specific air humidity           [kg/kg] 
    728       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   dU      ! wind module |U(zu)-U(0)|        [m/s] 
    729       REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Cd      ! transfert coefficient for momentum       (tau) 
    730       REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Ch      ! transfert coefficient for temperature (Q_sens) 
    731       REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Ce      ! transfert coefficient for evaporation  (Q_lat) 
    732       !! 
    733       INTEGER :: j_itt 
    734       INTEGER , PARAMETER ::   nb_itt = 3 
    735       REAL(wp), PARAMETER ::   grav   = 9.8   ! gravity                        
    736       REAL(wp), PARAMETER ::   kappa  = 0.4   ! von Karman s constant 
    737  
    738       REAL(wp), DIMENSION(:,:), POINTER  ::   dU10          ! dU                                   [m/s] 
    739       REAL(wp), DIMENSION(:,:), POINTER  ::   dT            ! air/sea temperature differeence      [K] 
    740       REAL(wp), DIMENSION(:,:), POINTER  ::   dq            ! air/sea humidity difference          [K] 
    741       REAL(wp), DIMENSION(:,:), POINTER  ::   Cd_n10        ! 10m neutral drag coefficient 
    742       REAL(wp), DIMENSION(:,:), POINTER  ::   Ce_n10        ! 10m neutral latent coefficient 
    743       REAL(wp), DIMENSION(:,:), POINTER  ::   Ch_n10        ! 10m neutral sensible coefficient 
    744       REAL(wp), DIMENSION(:,:), POINTER  ::   sqrt_Cd_n10   ! root square of Cd_n10 
    745       REAL(wp), DIMENSION(:,:), POINTER  ::   sqrt_Cd       ! root square of Cd 
    746       REAL(wp), DIMENSION(:,:), POINTER  ::   T_vpot        ! virtual potential temperature        [K] 
    747       REAL(wp), DIMENSION(:,:), POINTER  ::   T_star        ! turbulent scale of tem. fluct. 
    748       REAL(wp), DIMENSION(:,:), POINTER  ::   q_star        ! turbulent humidity of temp. fluct. 
    749       REAL(wp), DIMENSION(:,:), POINTER  ::   U_star        ! turb. scale of velocity fluct. 
    750       REAL(wp), DIMENSION(:,:), POINTER  ::   L             ! Monin-Obukov length                  [m] 
    751       REAL(wp), DIMENSION(:,:), POINTER  ::   zeta          ! stability parameter at height zu 
    752       REAL(wp), DIMENSION(:,:), POINTER  ::   U_n10         ! neutral wind velocity at 10m         [m]    
    753       REAL(wp), DIMENSION(:,:), POINTER  ::   xlogt, xct, zpsi_h, zpsi_m 
    754        
    755       INTEGER , DIMENSION(:,:), POINTER  ::   stab          ! 1st guess stability test integer 
    756       !!---------------------------------------------------------------------- 
    757       ! 
    758       IF( nn_timing == 1 )  CALL timing_start('TURB_CORE_1Z') 
    759       ! 
    760       CALL wrk_alloc( jpi,jpj, stab )   ! integer 
    761       CALL wrk_alloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L ) 
    762       CALL wrk_alloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta, U_n10, xlogt, xct, zpsi_h, zpsi_m ) 
    763  
    764       !! * Start 
    765       !! Air/sea differences 
    766       dU10 = max(0.5, dU)     ! we don't want to fall under 0.5 m/s 
    767       dT = T_a - sst          ! assuming that T_a is allready the potential temp. at zzu 
    768       dq = q_a - q_sat 
    769       !!     
    770       !! Virtual potential temperature 
    771       T_vpot = T_a*(1. + 0.608*q_a) 
    772       !! 
    773       !! Neutral Drag Coefficient 
    774       stab    = 0.5 + sign(0.5,dT)    ! stable : stab = 1 ; unstable : stab = 0  
    775       IF  ( ln_cdgw ) THEN 
    776         cdn_wave = cdn_wave - rsmall*(tmask(:,:,1)-1) 
    777         Cd_n10(:,:) =   cdn_wave 
    778       ELSE 
    779         Cd_n10  = 1.e-3 * ( 2.7/dU10 + 0.142 + dU10/13.09 )    !   L & Y eq. (6a) 
    780       ENDIF 
    781       sqrt_Cd_n10 = sqrt(Cd_n10) 
    782       Ce_n10  = 1.e-3 * ( 34.6 * sqrt_Cd_n10 )               !   L & Y eq. (6b) 
    783       Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1.-stab)) !   L & Y eq. (6c), (6d) 
    784       !! 
    785       !! Initializing transfert coefficients with their first guess neutral equivalents : 
    786       Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd) 
    787  
    788       !! * Now starting iteration loop 
    789       DO j_itt=1, nb_itt 
    790          !! Turbulent scales : 
    791          U_star  = sqrt_Cd*dU10                !   L & Y eq. (7a) 
    792          T_star  = Ch/sqrt_Cd*dT               !   L & Y eq. (7b) 
    793          q_star  = Ce/sqrt_Cd*dq               !   L & Y eq. (7c) 
    794  
    795          !! Estimate the Monin-Obukov length : 
    796          L = U_star*U_star / ( kappa*grav*(T_star/T_vpot + q_star/(q_a + 1./0.608)) ) 
    797 !!gm  !lolo  suggestion ......   TO BE TAKEN  ? 
    798 !!         L = U_star*U_star / ( kappa*grav/T_vpot*(T_star*(1. + 0.608*q_a) + 0.608*T_a*q_star) ) 
    799 !!gm     !lolo. 
    800  
    801          !! Stability parameters : 
    802          zeta  = zu/L ;  zeta   = sign( min(abs(zeta),10.0), zeta ) 
    803          zpsi_h  = psi_h(zeta) 
    804          zpsi_m  = psi_m(zeta) 
    805  
    806          IF  ( ln_cdgw ) THEN 
    807            sqrt_Cd=kappa/((kappa/sqrt_Cd_n10) - zpsi_m) ; Cd=sqrt_Cd*sqrt_Cd; 
    808          ELSE 
    809            !! Shifting the wind speed to 10m and neutral stability : 
    810            U_n10 = dU10*1./(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)) !  L & Y eq. (9a) 
    811  
    812            !! Updating the neutral 10m transfer coefficients : 
    813            Cd_n10  = 1.e-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)              !  L & Y eq. (6a) 
    814            sqrt_Cd_n10 = sqrt(Cd_n10) 
    815            Ce_n10  = 1.e-3 * (34.6 * sqrt_Cd_n10)                           !  L & Y eq. (6b) 
    816            stab    = 0.5 + sign(0.5,zeta) 
    817            Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1.-stab))           !  L & Y eq. (6c), (6d) 
    818  
    819            !! Shifting the neutral  10m transfer coefficients to ( zu , zeta ) : 
    820            !! 
    821            xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10) - zpsi_m) 
    822            Cd  = Cd_n10/(xct*xct) ;  sqrt_Cd = sqrt(Cd) 
    823          ENDIF 
    824          !! 
    825          xlogt = log(zu/10.) - zpsi_h 
    826          !! 
    827          xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10 
    828          Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct 
    829          !! 
    830          xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10 
    831          Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct 
    832          !! 
    833       END DO 
    834       !! 
    835       CALL wrk_dealloc( jpi,jpj, stab )   ! integer 
    836       CALL wrk_dealloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L ) 
    837       CALL wrk_dealloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta, U_n10, xlogt, xct, zpsi_h, zpsi_m ) 
    838       ! 
    839       IF( nn_timing == 1 )  CALL timing_stop('TURB_CORE_1Z') 
    840       ! 
    841     END SUBROUTINE TURB_CORE_1Z 
    842  
    843  
    844     SUBROUTINE TURB_CORE_2Z(zt, zu, sst, T_zt, q_sat, q_zt, dU, Cd, Ch, Ce, T_zu, q_zu) 
    845       !!---------------------------------------------------------------------- 
    846       !!                      ***  ROUTINE  turb_core  *** 
    847       !! 
    848       !! ** Purpose :   Computes turbulent transfert coefficients of surface  
    849       !!                fluxes according to Large & Yeager (2004). 
    850       !! 
    851       !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D 
    852       !!      Momentum, Latent and sensible heat exchange coefficients 
    853       !!      Caution: this procedure should only be used in cases when air 
    854       !!      temperature (T_air) and air specific humidity (q_air) are at a 
    855       !!      different height to wind (dU). 
    856       !! 
    857       !! References :   Large & Yeager, 2004 : ??? 
     677      !!                fluxes according to Large & Yeager (2004) and Large & Yeager (2008) 
     678      !!                If relevant (zt /= zu), adjust temperature and humidity from height zt to zu 
     679      !! 
     680      !! ** Method : Monin Obukhov Similarity Theory  
     681      !!             + Large & Yeager (2004,2008) closure: CD_n10 = f(U_n10) 
     682      !! 
     683      !! ** References :   Large & Yeager, 2004 / Large & Yeager, 2008 
     684      !! 
     685      !! ** Last update: Laurent Brodeau, June 2014: 
     686      !!    - handles both cases zt=zu and zt/=zu 
     687      !!    - optimized: less 2D arrays allocated and less operations 
     688      !!    - better first guess of stability by checking air-sea difference of virtual temperature 
     689      !!       rather than temperature difference only... 
     690      !!    - added function "cd_neutral_10m" that uses the improved parametrization of  
     691      !!      Large & Yeager 2008. Drag-coefficient reduction for Cyclone conditions! 
     692      !!    - using code-wide physical constants defined into "phycst.mod" rather than redifining them 
     693      !!      => 'vkarmn' and 'grav' 
    858694      !!---------------------------------------------------------------------- 
    859695      REAL(wp), INTENT(in   )                     ::   zt       ! height for T_zt and q_zt                   [m] 
     
    863699      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_sat    ! sea surface specific humidity         [kg/kg] 
    864700      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity                 [kg/kg] 
    865       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   dU       ! relative wind module |U(zu)-U(0)|       [m/s] 
     701      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   dU       ! relative wind module at zu            [m/s] 
    866702      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cd       ! transfer coefficient for momentum         (tau) 
    867703      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ch       ! transfer coefficient for sensible heat (Q_sens) 
     
    869705      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   T_zu     ! air temp. shifted at zu                     [K] 
    870706      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   q_zu     ! spec. hum.  shifted at zu               [kg/kg] 
    871  
    872       INTEGER :: j_itt 
    873       INTEGER , PARAMETER :: nb_itt = 5              ! number of itterations 
    874       REAL(wp), PARAMETER ::   grav   = 9.8          ! gravity                        
    875       REAL(wp), PARAMETER ::   kappa  = 0.4          ! von Karman's constant 
    876        
    877       REAL(wp), DIMENSION(:,:), POINTER ::   dU10          ! dU                                [m/s] 
    878       REAL(wp), DIMENSION(:,:), POINTER ::   dT            ! air/sea temperature differeence   [K] 
    879       REAL(wp), DIMENSION(:,:), POINTER ::   dq            ! air/sea humidity difference       [K] 
    880       REAL(wp), DIMENSION(:,:), POINTER ::   Cd_n10        ! 10m neutral drag coefficient 
     707      ! 
     708      INTEGER ::   j_itt 
     709      INTEGER , PARAMETER ::   nb_itt = 5       ! number of itterations 
     710      LOGICAL ::   l_zt_equal_zu = .FALSE.      ! if q and t are given at different height than U 
     711      ! 
     712      REAL(wp), DIMENSION(:,:), POINTER ::   U_zu          ! relative wind at zu                            [m/s] 
    881713      REAL(wp), DIMENSION(:,:), POINTER ::   Ce_n10        ! 10m neutral latent coefficient 
    882714      REAL(wp), DIMENSION(:,:), POINTER ::   Ch_n10        ! 10m neutral sensible coefficient 
    883715      REAL(wp), DIMENSION(:,:), POINTER ::   sqrt_Cd_n10   ! root square of Cd_n10 
    884716      REAL(wp), DIMENSION(:,:), POINTER ::   sqrt_Cd       ! root square of Cd 
    885       REAL(wp), DIMENSION(:,:), POINTER ::   T_vpot        ! virtual potential temperature        [K] 
    886       REAL(wp), DIMENSION(:,:), POINTER ::   T_star        ! turbulent scale of tem. fluct. 
    887       REAL(wp), DIMENSION(:,:), POINTER ::   q_star        ! turbulent humidity of temp. fluct. 
    888       REAL(wp), DIMENSION(:,:), POINTER ::   U_star        ! turb. scale of velocity fluct. 
    889       REAL(wp), DIMENSION(:,:), POINTER ::   L             ! Monin-Obukov length                  [m] 
    890717      REAL(wp), DIMENSION(:,:), POINTER ::   zeta_u        ! stability parameter at height zu 
    891718      REAL(wp), DIMENSION(:,:), POINTER ::   zeta_t        ! stability parameter at height zt 
    892       REAL(wp), DIMENSION(:,:), POINTER ::   U_n10         ! neutral wind velocity at 10m        [m] 
    893       REAL(wp), DIMENSION(:,:), POINTER ::   xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m 
    894  
    895       INTEGER , DIMENSION(:,:), POINTER ::   stab          ! 1st stability test integer 
     719      REAL(wp), DIMENSION(:,:), POINTER ::   zpsi_h_u, zpsi_m_u 
     720      REAL(wp), DIMENSION(:,:), POINTER ::   ztmp0, ztmp1, ztmp2 
     721      REAL(wp), DIMENSION(:,:), POINTER ::   stab          ! 1st stability test integer 
    896722      !!---------------------------------------------------------------------- 
    897       ! 
    898       IF( nn_timing == 1 )  CALL timing_start('TURB_CORE_2Z') 
    899       ! 
    900       CALL wrk_alloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L ) 
    901       CALL wrk_alloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta_u, zeta_t, U_n10 ) 
    902       CALL wrk_alloc( jpi,jpj, xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m ) 
    903       CALL wrk_alloc( jpi,jpj, stab )   ! interger 
    904  
    905       !! Initial air/sea differences 
    906       dU10 = max(0.5, dU)      !  we don't want to fall under 0.5 m/s 
    907       dT = T_zt - sst  
    908       dq = q_zt - q_sat 
    909  
    910       !! Neutral Drag Coefficient : 
    911       stab = 0.5 + sign(0.5,dT)                 ! stab = 1  if dT > 0  -> STABLE 
    912       IF( ln_cdgw ) THEN 
    913         cdn_wave = cdn_wave - rsmall*(tmask(:,:,1)-1) 
    914         Cd_n10(:,:) =   cdn_wave 
     723 
     724      IF( nn_timing == 1 )  CALL timing_start('turb_core_2z') 
     725     
     726      CALL wrk_alloc( jpi,jpj, U_zu, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd ) 
     727      CALL wrk_alloc( jpi,jpj, zeta_u, stab ) 
     728      CALL wrk_alloc( jpi,jpj, zpsi_h_u, zpsi_m_u, ztmp0, ztmp1, ztmp2 ) 
     729 
     730      l_zt_equal_zu = .FALSE. 
     731      IF( ABS(zu - zt) < 0.01 ) l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision 
     732 
     733      IF( .NOT. l_zt_equal_zu )   CALL wrk_alloc( jpi,jpj, zeta_t ) 
     734 
     735      U_zu = MAX( 0.5 , dU )   !  relative wind speed at zu (normally 10m), we don't want to fall under 0.5 m/s 
     736 
     737      !! First guess of stability:  
     738      ztmp0 = T_zt*(1. + 0.608*q_zt) - sst*(1. + 0.608*q_sat) ! air-sea difference of virtual pot. temp. at zt 
     739      stab  = 0.5 + sign(0.5,ztmp0)                           ! stab = 1 if dTv > 0  => STABLE, 0 if unstable 
     740 
     741      !! Neutral coefficients at 10m: 
     742      IF( ln_cdgw ) THEN      ! wave drag case 
     743         cdn_wave(:,:) = cdn_wave(:,:) + rsmall * ( 1._wp - tmask(:,:,1) ) 
     744         ztmp0   (:,:) = cdn_wave(:,:) 
    915745      ELSE 
    916         Cd_n10  = 1.e-3*( 2.7/dU10 + 0.142 + dU10/13.09 )  
     746         ztmp0 = cd_neutral_10m( U_zu ) 
    917747      ENDIF 
    918       sqrt_Cd_n10 = sqrt(Cd_n10) 
     748      sqrt_Cd_n10 = SQRT( ztmp0 ) 
    919749      Ce_n10  = 1.e-3*( 34.6 * sqrt_Cd_n10 ) 
    920750      Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab)) 
    921  
     751     
    922752      !! Initializing transf. coeff. with their first guess neutral equivalents : 
    923       Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd) 
    924  
    925       !! Initializing z_u values with z_t values : 
    926       T_zu = T_zt ;  q_zu = q_zt 
     753      Cd = ztmp0   ;   Ce = Ce_n10   ;   Ch = Ch_n10   ;   sqrt_Cd = sqrt_Cd_n10 
     754 
     755      !! Initializing values at z_u with z_t values: 
     756      T_zu = T_zt   ;   q_zu = q_zt 
    927757 
    928758      !!  * Now starting iteration loop 
    929759      DO j_itt=1, nb_itt 
    930          dT = T_zu - sst ;  dq = q_zu - q_sat ! Updating air/sea differences 
    931          T_vpot = T_zu*(1. + 0.608*q_zu)    ! Updating virtual potential temperature at zu 
    932          U_star = sqrt_Cd*dU10                ! Updating turbulent scales :   (L & Y eq. (7)) 
    933          T_star  = Ch/sqrt_Cd*dT              ! 
    934          q_star  = Ce/sqrt_Cd*dq              ! 
    935          !! 
    936          L = (U_star*U_star) &                ! Estimate the Monin-Obukov length at height zu 
    937               & / (kappa*grav/T_vpot*(T_star*(1.+0.608*q_zu) + 0.608*T_zu*q_star)) 
     760         ! 
     761         ztmp1 = T_zu - sst   ! Updating air/sea differences 
     762         ztmp2 = q_zu - q_sat  
     763 
     764         ! Updating turbulent scales :   (L&Y 2004 eq. (7)) 
     765         ztmp1  = Ch/sqrt_Cd*ztmp1    ! theta* 
     766         ztmp2  = Ce/sqrt_Cd*ztmp2    ! q* 
     767        
     768         ztmp0 = T_zu*(1. + 0.608*q_zu) ! virtual potential temperature at zu 
     769 
     770         ! Estimate the inverse of Monin-Obukov length (1/L) at height zu: 
     771         ztmp0 =  (vkarmn*grav/ztmp0*(ztmp1*(1.+0.608*q_zu) + 0.608*T_zu*ztmp2)) / (Cd*U_zu*U_zu)  
     772         !                                                                     ( Cd*U_zu*U_zu is U*^2 at zu) 
     773 
    938774         !! Stability parameters : 
    939          zeta_u  = zu/L  ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u ) 
    940          zeta_t  = zt/L  ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t ) 
    941          zpsi_hu = psi_h(zeta_u) 
    942          zpsi_ht = psi_h(zeta_t) 
    943          zpsi_m  = psi_m(zeta_u) 
    944          !! 
    945          !! Shifting the wind speed to 10m and neutral stability : (L & Y eq.(9a)) 
    946 !        U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u))) 
    947          U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)) 
    948          !! 
    949          !! Shifting temperature and humidity at zu :          (L & Y eq. (9b-9c)) 
    950 !        T_zu = T_zt - T_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t)) 
    951          T_zu = T_zt - T_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht) 
    952 !        q_zu = q_zt - q_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t)) 
    953          q_zu = q_zt - q_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht) 
    954          !! 
    955          !! q_zu cannot have a negative value : forcing 0 
    956          stab = 0.5 + sign(0.5,q_zu) ;  q_zu = stab*q_zu 
    957          !! 
    958          IF( ln_cdgw ) THEN 
    959             sqrt_Cd=kappa/((kappa/sqrt_Cd_n10) - zpsi_m) ; Cd=sqrt_Cd*sqrt_Cd; 
     775         zeta_u   = zu*ztmp0   ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u ) 
     776         zpsi_h_u = psi_h( zeta_u ) 
     777         zpsi_m_u = psi_m( zeta_u ) 
     778        
     779         !! Shifting temperature and humidity at zu (L&Y 2004 eq. (9b-9c)) 
     780         IF ( .NOT. l_zt_equal_zu ) THEN 
     781            zeta_t = zt*ztmp0 ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t ) 
     782            stab = LOG(zu/zt) - zpsi_h_u + psi_h(zeta_t)  ! stab just used as temp array!!! 
     783            T_zu = T_zt + ztmp1/vkarmn*stab    ! ztmp1 is still theta* 
     784            q_zu = q_zt + ztmp2/vkarmn*stab    ! ztmp2 is still q* 
     785            q_zu = max(0., q_zu) 
     786         END IF 
     787        
     788         IF( ln_cdgw ) THEN      ! surface wave case 
     789            sqrt_Cd = vkarmn / ( vkarmn / sqrt_Cd_n10 - zpsi_m_u )  
     790            Cd      = sqrt_Cd * sqrt_Cd 
    960791         ELSE 
    961            !! Updating the neutral 10m transfer coefficients : 
    962            Cd_n10  = 1.e-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)    ! L & Y eq. (6a) 
    963            sqrt_Cd_n10 = sqrt(Cd_n10) 
    964            Ce_n10  = 1.e-3 * (34.6 * sqrt_Cd_n10)                 ! L & Y eq. (6b) 
    965            stab    = 0.5 + sign(0.5,zeta_u) 
    966            Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1.-stab)) ! L & Y eq. (6c-6d) 
    967            !! 
    968            !! 
    969            !! Shifting the neutral 10m transfer coefficients to (zu,zeta_u) : 
    970            xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)   ! L & Y eq. (10a) 
    971            Cd = Cd_n10/(xct*xct) ; sqrt_Cd = sqrt(Cd) 
     792           ! Update neutral wind speed at 10m and neutral Cd at 10m (L&Y 2004 eq. 9a)... 
     793           !   In very rare low-wind conditions, the old way of estimating the 
     794           !   neutral wind speed at 10m leads to a negative value that causes the code 
     795           !   to crash. To prevent this a threshold of 0.25m/s is imposed. 
     796           ztmp0 = MAX( 0.25 , U_zu/(1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - zpsi_m_u)) ) !  U_n10 
     797           ztmp0 = cd_neutral_10m(ztmp0)                                                 ! Cd_n10 
     798           sqrt_Cd_n10 = sqrt(ztmp0) 
     799        
     800           Ce_n10  = 1.e-3 * (34.6 * sqrt_Cd_n10)                     ! L&Y 2004 eq. (6b) 
     801           stab    = 0.5 + sign(0.5,zeta_u)                           ! update stability 
     802           Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab))  ! L&Y 2004 eq. (6c-6d) 
     803 
     804           !! Update of transfer coefficients: 
     805           ztmp1 = 1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - zpsi_m_u)   ! L&Y 2004 eq. (10a) 
     806           Cd      = ztmp0 / ( ztmp1*ztmp1 )    
     807           sqrt_Cd = SQRT( Cd ) 
    972808         ENDIF 
    973          !! 
    974          xlogt = log(zu/10.) - zpsi_hu 
    975          !! 
    976          xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10               ! L & Y eq. (10b) 
    977          Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct 
    978          !! 
    979          xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10               ! L & Y eq. (10c) 
    980          Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct 
    981          !! 
    982          !! 
     809         ! 
     810         ztmp0 = (LOG(zu/10.) - zpsi_h_u) / vkarmn / sqrt_Cd_n10 
     811         ztmp2 = sqrt_Cd / sqrt_Cd_n10 
     812         ztmp1 = 1. + Ch_n10*ztmp0                
     813         Ch  = Ch_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10b) 
     814         ! 
     815         ztmp1 = 1. + Ce_n10*ztmp0                
     816         Ce  = Ce_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10c) 
     817         ! 
    983818      END DO 
    984       !! 
    985       CALL wrk_dealloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L ) 
    986       CALL wrk_dealloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta_u, zeta_t, U_n10 ) 
    987       CALL wrk_dealloc( jpi,jpj, xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m ) 
    988       CALL wrk_dealloc( jpi,jpj, stab )   ! interger 
    989       ! 
    990       IF( nn_timing == 1 )  CALL timing_stop('TURB_CORE_2Z') 
    991       ! 
    992     END SUBROUTINE TURB_CORE_2Z 
    993  
    994  
    995     FUNCTION psi_m(zta)   !! Psis, L & Y eq. (8c), (8d), (8e) 
     819 
     820      CALL wrk_dealloc( jpi,jpj, U_zu, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd ) 
     821      CALL wrk_dealloc( jpi,jpj, zeta_u, stab ) 
     822      CALL wrk_dealloc( jpi,jpj, zpsi_h_u, zpsi_m_u, ztmp0, ztmp1, ztmp2 ) 
     823 
     824      IF( .NOT. l_zt_equal_zu ) CALL wrk_dealloc( jpi,jpj, zeta_t ) 
     825 
     826      IF( nn_timing == 1 )  CALL timing_stop('turb_core_2z') 
     827      ! 
     828   END SUBROUTINE turb_core_2z 
     829 
     830 
     831   FUNCTION cd_neutral_10m( zw10 ) 
     832      !!---------------------------------------------------------------------- 
     833      !! Estimate of the neutral drag coefficient at 10m as a function  
     834      !! of neutral wind  speed at 10m 
     835      !! 
     836      !! Origin: Large & Yeager 2008 eq.(11a) and eq.(11b) 
     837      !! 
     838      !! Author: L. Brodeau, june 2014 
     839      !!----------------------------------------------------------------------     
     840      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   zw10           ! scalar wind speed at 10m (m/s) 
     841      REAL(wp), DIMENSION(jpi,jpj)             ::   cd_neutral_10m 
     842      ! 
     843      REAL(wp), DIMENSION(:,:), POINTER ::   rgt33 
     844      !!----------------------------------------------------------------------     
     845      ! 
     846      CALL wrk_alloc( jpi,jpj, rgt33 ) 
     847      ! 
     848      !! When wind speed > 33 m/s => Cyclone conditions => special treatment 
     849      rgt33 = 0.5_wp + SIGN( 0.5_wp, (zw10 - 33._wp) )   ! If zw10 < 33. => 0, else => 1   
     850      cd_neutral_10m = 1.e-3 * ( & 
     851         &       (rgt33 + 1._wp)*( 2.7_wp/zw10 + 0.142_wp + zw10/13.09_wp - 3.14807E-10*zw10**6) & ! zw10< 33. 
     852         &      + rgt33         *      2.34   )                                                    ! zw10 >= 33. 
     853      ! 
     854      CALL wrk_dealloc( jpi,jpj, rgt33) 
     855      ! 
     856   END FUNCTION cd_neutral_10m 
     857 
     858 
     859   FUNCTION psi_m(pta)   !! Psis, L&Y 2004 eq. (8c), (8d), (8e) 
    996860      !------------------------------------------------------------------------------- 
    997       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta 
    998  
    999       REAL(wp), PARAMETER :: pi = 3.141592653589793_wp 
     861      ! universal profile stability function for momentum 
     862      !------------------------------------------------------------------------------- 
     863      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta 
     864      ! 
    1000865      REAL(wp), DIMENSION(jpi,jpj)             :: psi_m 
    1001866      REAL(wp), DIMENSION(:,:), POINTER        :: X2, X, stabit 
    1002867      !------------------------------------------------------------------------------- 
    1003  
     868      ! 
    1004869      CALL wrk_alloc( jpi,jpj, X2, X, stabit ) 
    1005  
    1006       X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.0) ;  X  = sqrt(X2) 
    1007       stabit    = 0.5 + sign(0.5,zta) 
    1008       psi_m = -5.*zta*stabit  &                                                          ! Stable 
    1009          &    + (1. - stabit)*(2*log((1. + X)/2) + log((1. + X2)/2) - 2*atan(X) + pi/2)  ! Unstable  
    1010  
     870      ! 
     871      X2 = SQRT( ABS( 1. - 16.*pta ) )  ;  X2 = MAX( X2 , 1. )   ;   X = SQRT( X2 ) 
     872      stabit = 0.5 + SIGN( 0.5 , pta ) 
     873      psi_m = -5.*pta*stabit  &                                                          ! Stable 
     874         &    + (1. - stabit)*(2.*LOG((1. + X)*0.5) + LOG((1. + X2)*0.5) - 2.*ATAN(X) + rpi*0.5)  ! Unstable 
     875      ! 
    1011876      CALL wrk_dealloc( jpi,jpj, X2, X, stabit ) 
    1012877      ! 
    1013     END FUNCTION psi_m 
    1014  
    1015  
    1016     FUNCTION psi_h( zta )    !! Psis, L & Y eq. (8c), (8d), (8e) 
     878   END FUNCTION psi_m 
     879 
     880 
     881   FUNCTION psi_h( pta )    !! Psis, L&Y 2004 eq. (8c), (8d), (8e) 
    1017882      !------------------------------------------------------------------------------- 
    1018       REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   zta 
     883      ! universal profile stability function for temperature and humidity 
     884      !------------------------------------------------------------------------------- 
     885      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pta 
    1019886      ! 
    1020887      REAL(wp), DIMENSION(jpi,jpj)             ::   psi_h 
    1021       REAL(wp), DIMENSION(:,:), POINTER        :: X2, X, stabit 
     888      REAL(wp), DIMENSION(:,:), POINTER        ::   X2, X, stabit 
    1022889      !------------------------------------------------------------------------------- 
    1023890      ! 
    1024891      CALL wrk_alloc( jpi,jpj, X2, X, stabit ) 
    1025892      ! 
    1026       X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.) ;  X  = sqrt(X2) 
    1027       stabit    = 0.5 + sign(0.5,zta) 
    1028       psi_h = -5.*zta*stabit   &                                       ! Stable 
    1029          &    + (1. - stabit)*(2.*log( (1. + X2)/2. ))                 ! Unstable 
    1030          ! 
     893      X2 = SQRT( ABS( 1. - 16.*pta ) )   ;   X2 = MAX( X2 , 1. )   ;   X = SQRT( X2 ) 
     894      stabit = 0.5 + SIGN( 0.5 , pta ) 
     895      psi_h = -5.*pta*stabit   &                                       ! Stable 
     896         &    + (1. - stabit)*(2.*LOG( (1. + X2)*0.5 ))                ! Unstable 
     897      ! 
    1031898      CALL wrk_dealloc( jpi,jpj, X2, X, stabit ) 
    1032899      ! 
    1033     END FUNCTION psi_h 
    1034    
     900   END FUNCTION psi_h 
     901 
    1035902   !!====================================================================== 
    1036903END MODULE sbcblk_core 
Note: See TracChangeset for help on using the changeset viewer.