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.
sbcblk_core.F90 in branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90 @ 13320

Last change on this file since 13320 was 13191, checked in by jwhile, 4 years ago

Updates for 1d runnig

File size: 51.5 KB
RevLine 
[888]1MODULE sbcblk_core
2   !!======================================================================
3   !!                       ***  MODULE  sbcblk_core  ***
4   !! Ocean forcing:  momentum, heat and freshwater flux formulation
5   !!=====================================================================
[1482]6   !! History :  1.0  !  2004-08  (U. Schweckendiek)  Original code
[4990]7   !!            2.0  !  2005-04  (L. Brodeau, A.M. Treguier) additions:
[1482]8   !!                           -  new bulk routine for efficiency
9   !!                           -  WINDS ARE NOW ASSUMED TO BE AT T POINTS in input files !!!!
[4990]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
[1482]14   !!            3.2  !  2009-04  (B. Lemaire)  Introduce iom_put
[2528]15   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle
[3294]16   !!            3.4  !  2011-11  (C. Harris) Fill arrays required by CICE
[4990]17   !!            3.7  !  2014-06  (L. Brodeau) simplification and optimization of CORE bulk
[888]18   !!----------------------------------------------------------------------
19
20   !!----------------------------------------------------------------------
[4990]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   !!   turb_core_2z    : Computes turbulent transfert coefficients
25   !!   cd_neutral_10m  : Estimate of the neutral drag coefficient at 10m
26   !!   psi_m           : universal profile stability function for momentum
27   !!   psi_h           : universal profile stability function for temperature and humidity
[888]28   !!----------------------------------------------------------------------
29   USE oce             ! ocean dynamics and tracers
30   USE dom_oce         ! ocean space and time domain
31   USE phycst          ! physical constants
32   USE fldread         ! read input fields
33   USE sbc_oce         ! Surface boundary condition: ocean fields
[3680]34   USE cyclone         ! Cyclone 10m wind form trac of cyclone centres
[2528]35   USE sbcdcy          ! surface boundary condition: diurnal cycle
[888]36   USE iom             ! I/O manager library
37   USE in_out_manager  ! I/O manager
38   USE lib_mpp         ! distribued memory computing library
[3294]39   USE wrk_nemo        ! work arrays
40   USE timing          ! Timing
[888]41   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
42   USE prtctl          ! Print control
[4990]43   USE sbcwave, ONLY   :  cdn_wave ! wave module
[1465]44   USE sbc_ice         ! Surface boundary condition: ice fields
[4161]45   USE lib_fortran     ! to use key_nosignedzero
[5407]46#if defined key_lim3
47   USE ice, ONLY       : u_ice, v_ice, jpl, pfrld, a_i_b
48   USE limthd_dh       ! for CALL lim_thd_snwblow
49#elif defined key_lim2
50   USE ice_2, ONLY     : u_ice, v_ice
51   USE par_ice_2
52#endif
[11442]53   USE stopack
[888]54
55   IMPLICIT NONE
56   PRIVATE
57
[2715]58   PUBLIC   sbc_blk_core         ! routine called in sbcmod module
[5407]59#if defined key_lim2 || defined key_lim3
60   PUBLIC   blk_ice_core_tau     ! routine called in sbc_ice_lim module
61   PUBLIC   blk_ice_core_flx     ! routine called in sbc_ice_lim module
62#endif
[3294]63   PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module
[2715]64
[4990]65   INTEGER , PARAMETER ::   jpfld   = 9           ! maximum number of files to read
[888]66   INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point
67   INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point
[3625]68   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( % )
[888]69   INTEGER , PARAMETER ::   jp_qsr  = 4           ! index of solar heat                      (W/m2)
70   INTEGER , PARAMETER ::   jp_qlw  = 5           ! index of Long wave                       (W/m2)
71   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
72   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
73   INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s)
[1705]74   INTEGER , PARAMETER ::   jp_tdif = 9           ! index of tau diff associated to HF tau   (N/m2)   at T-point
[4990]75
[888]76   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
[4990]77
[1601]78   !                                             !!! CORE bulk parameters
[888]79   REAL(wp), PARAMETER ::   rhoa =    1.22        ! air density
80   REAL(wp), PARAMETER ::   cpa  = 1000.5         ! specific heat of air
81   REAL(wp), PARAMETER ::   Lv   =    2.5e6       ! latent heat of vaporization
82   REAL(wp), PARAMETER ::   Ls   =    2.839e6     ! latent heat of sublimation
83   REAL(wp), PARAMETER ::   Stef =    5.67e-8     ! Stefan Boltzmann constant
[4161]84   REAL(wp), PARAMETER ::   Cice =    1.4e-3      ! iovi 1.63e-3     ! transfer coefficient over ice
[3625]85   REAL(wp), PARAMETER ::   albo =    0.066       ! ocean albedo assumed to be constant
[888]86
[2528]87   !                                  !!* Namelist namsbc_core : CORE bulk parameters
[4147]88   LOGICAL  ::   ln_taudif   ! logical flag to use the "mean of stress module - module of mean stress" data
89   REAL(wp) ::   rn_pfac     ! multiplication factor for precipitation
[4161]90   REAL(wp) ::   rn_efac     ! multiplication factor for evaporation (clem)
91   REAL(wp) ::   rn_vfac     ! multiplication factor for ice/ocean velocity in the calculation of wind stress (clem)
[11442]92   REAL(wp), ALLOCATABLE, SAVE ::   rn_vfac0(:,:) ! multiplication factor for ice/ocean velocity in the calculation of wind stress (clem)
[4245]93   REAL(wp) ::   rn_zqt      ! z(q,t) : height of humidity and temperature measurements
94   REAL(wp) ::   rn_zu       ! z(u)   : height of wind measurements
[9288]95   REAL(wp), PUBLIC :: rn_sfac ! multiplication factor for snow precipitation over sea-ice
[888]96
97   !! * Substitutions
98#  include "domzgr_substitute.h90"
99#  include "vectopt_loop_substitute.h90"
100   !!----------------------------------------------------------------------
[4990]101   !! NEMO/OPA 3.7 , NEMO-consortium (2014)
[1156]102   !! $Id$
[2528]103   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[888]104   !!----------------------------------------------------------------------
105CONTAINS
106
107   SUBROUTINE sbc_blk_core( kt )
108      !!---------------------------------------------------------------------
109      !!                    ***  ROUTINE sbc_blk_core  ***
[4990]110      !!
[888]111      !! ** Purpose :   provide at each time step the surface ocean fluxes
[4990]112      !!      (momentum, heat, freshwater and runoff)
[888]113      !!
[1695]114      !! ** Method  : (1) READ each fluxes in NetCDF files:
115      !!      the 10m wind velocity (i-component) (m/s)    at T-point
116      !!      the 10m wind velocity (j-component) (m/s)    at T-point
[3625]117      !!      the 10m or 2m specific humidity     ( % )
[1695]118      !!      the solar heat                      (W/m2)
119      !!      the Long wave                       (W/m2)
[3625]120      !!      the 10m or 2m air temperature       (Kelvin)
[1695]121      !!      the total precipitation (rain+snow) (Kg/m2/s)
122      !!      the snow (solid prcipitation)       (kg/m2/s)
[3625]123      !!      the tau diff associated to HF tau   (N/m2)   at T-point   (ln_taudif=T)
[1695]124      !!              (2) CALL blk_oce_core
[888]125      !!
126      !!      C A U T I O N : never mask the surface stress fields
[3625]127      !!                      the stress is assumed to be in the (i,j) mesh referential
[888]128      !!
129      !! ** Action  :   defined at each time-step at the air-sea interface
[1695]130      !!              - utau, vtau  i- and j-component of the wind stress
[4990]131      !!              - taum        wind stress module at T-point
132      !!              - wndm        wind speed  module at T-point over free ocean or leads in presence of sea-ice
[3625]133      !!              - qns, qsr    non-solar and solar heat fluxes
134      !!              - emp         upward mass flux (evapo. - precip.)
135      !!              - sfx         salt flux due to freezing/melting (non-zero only if ice is present)
136      !!                            (set in limsbc(_2).F90)
[4990]137      !!
138      !! ** References :   Large & Yeager, 2004 / Large & Yeager, 2008
139      !!                   Brodeau et al. Ocean Modelling 2010
[888]140      !!----------------------------------------------------------------------
[2715]141      INTEGER, INTENT(in) ::   kt   ! ocean time step
[4990]142      !
[888]143      INTEGER  ::   ierror   ! return error code
[1200]144      INTEGER  ::   ifpr     ! dummy loop indice
[1705]145      INTEGER  ::   jfld     ! dummy loop arguments
[4147]146      INTEGER  ::   ios      ! Local integer output status for namelist read
[4990]147      !
[888]148      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
149      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
[4161]150      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr       ! informations about the fields to be read
151      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !   "                                 "
152      TYPE(FLD_N) ::   sn_tdif                                 !   "                                 "
[4990]153      NAMELIST/namsbc_core/ cn_dir , ln_taudif, rn_pfac, rn_efac, rn_vfac,  &
[1705]154         &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           &
[4245]155         &                  sn_qlw , sn_tair, sn_prec  , sn_snow,           &
[9288]156         &                  sn_tdif, rn_zqt,  rn_zu, rn_sfac
[888]157      !!---------------------------------------------------------------------
[4990]158      !
[888]159      !                                         ! ====================== !
160      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
161         !                                      ! ====================== !
[1601]162         !
[13191]163         rn_sfac = 1._wp       ! Default to one if missing from namelist
[4147]164         REWIND( numnam_ref )              ! Namelist namsbc_core in reference namelist : CORE bulk parameters
165         READ  ( numnam_ref, namsbc_core, IOSTAT = ios, ERR = 901)
166901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_core in reference namelist', lwp )
[4990]167         !
[4147]168         REWIND( numnam_cfg )              ! Namelist namsbc_core in configuration namelist : CORE bulk parameters
169         READ  ( numnam_cfg, namsbc_core, IOSTAT = ios, ERR = 902 )
170902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_core in configuration namelist', lwp )
171
[4990]172         IF(lwm) WRITE( numond, namsbc_core )
[2528]173         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing?
[4990]174         IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   &
175            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )
[2528]176         IF( ln_dm2dc .AND. sn_qsr%ln_tint ) THEN
177            CALL ctl_warn( 'sbc_blk_core: ln_dm2dc is taking care of the temporal interpolation of daily qsr',   &
[4990]178               &         '              ==> We force time interpolation = .false. for qsr' )
[2528]179            sn_qsr%ln_tint = .false.
180         ENDIF
181         !                                         ! store namelist information in an array
[888]182         slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj
183         slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw
184         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
185         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow
[1705]186         slf_i(jp_tdif) = sn_tdif
[4990]187         !
[2528]188         lhftau = ln_taudif                        ! do we use HF tau information?
[1705]189         jfld = jpfld - COUNT( (/.NOT. lhftau/) )
190         !
[2528]191         ALLOCATE( sf(jfld), STAT=ierror )         ! set sf structure
[2715]192         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_core: unable to allocate sf structure' )
[1705]193         DO ifpr= 1, jfld
[2528]194            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
[2715]195            IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
[1200]196         END DO
[2528]197         !                                         ! fill sf with slf_i and control print
198         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_core', 'flux formulation for ocean surface boundary condition', 'namsbc_core' )
[1601]199         !
[3625]200         sfx(:,:) = 0._wp                          ! salt flux; zero unless ice is present (computed in limsbc(_2).F90)
201         !
[11442]202         ALLOCATE ( rn_vfac0(jpi,jpj) )
203         rn_vfac0(:,:) = rn_vfac
204         !
[888]205      ENDIF
206
[13191]207#if defined key_traldf_c2d || key_traldf_c3d
[11442]208      IF( ln_stopack .AND. nn_spp_relw > 0 ) THEN
209         rn_vfac0(:,:) = rn_vfac
210         CALL spp_gen(kt, rn_vfac0, nn_spp_relw, rn_relw_sd, jk_spp_relw )
211      ENDIF
[13191]212#else
213      IF ( ln_stopack .AND. nn_spp_relw > 0 ) &
214         & CALL ctl_stop( 'sbc_blk_core: parameter perturbation will only work with '// &
215                          'key_traldf_c2d or key_traldf_c3d')
216#endif
[11442]217
[3625]218      CALL fld_read( kt, nn_fsbc, sf )             ! input fields provided at the current time-step
[888]219
[3625]220      !                                            ! compute the surface ocean fluxes using CORE bulk formulea
[3680]221      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m )
[3294]222
223#if defined key_cice
224      IF( MOD( kt - 1, nn_fsbc ) == 0 )   THEN
[13191]225         qlw_ice(:,:,1)   = sf(jp_qlw)%fnow(:,:,1)
[6823]226         IF( ln_dm2dc ) THEN ; qsr_ice(:,:,1) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) )
227         ELSE                ; qsr_ice(:,:,1) =          sf(jp_qsr)%fnow(:,:,1)
228         ENDIF
[13191]229         tatm_ice(:,:)    = sf(jp_tair)%fnow(:,:,1)
[3294]230         qatm_ice(:,:)    = sf(jp_humi)%fnow(:,:,1)
231         tprecip(:,:)     = sf(jp_prec)%fnow(:,:,1) * rn_pfac
232         sprecip(:,:)     = sf(jp_snow)%fnow(:,:,1) * rn_pfac
233         wndi_ice(:,:)    = sf(jp_wndi)%fnow(:,:,1)
234         wndj_ice(:,:)    = sf(jp_wndj)%fnow(:,:,1)
235      ENDIF
236#endif
[2528]237      !
[888]238   END SUBROUTINE sbc_blk_core
[13191]239
240
[3680]241   SUBROUTINE blk_oce_core( kt, sf, pst, pu, pv )
[888]242      !!---------------------------------------------------------------------
243      !!                     ***  ROUTINE blk_core  ***
244      !!
245      !! ** Purpose :   provide the momentum, heat and freshwater fluxes at
246      !!      the ocean surface at each time step
247      !!
248      !! ** Method  :   CORE bulk formulea for the ocean using atmospheric
249      !!      fields read in sbc_read
[13191]250      !!
[888]251      !! ** Outputs : - utau    : i-component of the stress at U-point  (N/m2)
252      !!              - vtau    : j-component of the stress at V-point  (N/m2)
[1695]253      !!              - taum    : Wind stress module at T-point         (N/m2)
254      !!              - wndm    : Wind speed module at T-point          (m/s)
[888]255      !!              - qsr     : Solar heat flux over the ocean        (W/m2)
256      !!              - qns     : Non Solar heat flux over the ocean    (W/m2)
[3625]257      !!              - emp     : evaporation minus precipitation       (kg/m2/s)
[1242]258      !!
259      !!  ** Nota  :   sf has to be a dummy argument for AGRIF on NEC
[888]260      !!---------------------------------------------------------------------
[3680]261      INTEGER  , INTENT(in   )                 ::   kt    ! time step index
262      TYPE(fld), INTENT(inout), DIMENSION(:)   ::   sf    ! input data
263      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius]
264      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pu    ! surface current at U-point (i-component) [m/s]
265      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pv    ! surface current at V-point (j-component) [m/s]
[2715]266      !
267      INTEGER  ::   ji, jj               ! dummy loop indices
268      REAL(wp) ::   zcoef_qsatw, zztmp   ! local variable
[3294]269      REAL(wp), DIMENSION(:,:), POINTER ::   zwnd_i, zwnd_j    ! wind speed components at T-point
270      REAL(wp), DIMENSION(:,:), POINTER ::   zqsatw            ! specific humidity at pst
271      REAL(wp), DIMENSION(:,:), POINTER ::   zqlw, zqsb        ! long wave and sensible heat fluxes
272      REAL(wp), DIMENSION(:,:), POINTER ::   zqla, zevap       ! latent heat fluxes and evaporation
273      REAL(wp), DIMENSION(:,:), POINTER ::   Cd                ! transfer coefficient for momentum      (tau)
274      REAL(wp), DIMENSION(:,:), POINTER ::   Ch                ! transfer coefficient for sensible heat (Q_sens)
275      REAL(wp), DIMENSION(:,:), POINTER ::   Ce                ! tansfert coefficient for evaporation   (Q_lat)
276      REAL(wp), DIMENSION(:,:), POINTER ::   zst               ! surface temperature in Kelvin
277      REAL(wp), DIMENSION(:,:), POINTER ::   zt_zu             ! air temperature at wind speed height
278      REAL(wp), DIMENSION(:,:), POINTER ::   zq_zu             ! air spec. hum.  at wind speed height
[888]279      !!---------------------------------------------------------------------
[2715]280      !
[3294]281      IF( nn_timing == 1 )  CALL timing_start('blk_oce_core')
282      !
283      CALL wrk_alloc( jpi,jpj, zwnd_i, zwnd_j, zqsatw, zqlw, zqsb, zqla, zevap )
284      CALL wrk_alloc( jpi,jpj, Cd, Ch, Ce, zst, zt_zu, zq_zu )
285      !
[888]286      ! local scalars ( place there for vector optimisation purposes)
287      zcoef_qsatw = 0.98 * 640380. / rhoa
[13191]288
[3625]289      zst(:,:) = pst(:,:) + rt0      ! convert SST from Celcius to Kelvin (and set minimum value far above 0 K)
[888]290
291      ! ----------------------------------------------------------------------------- !
292      !      0   Wind components and module at T-point relative to the moving ocean   !
293      ! ----------------------------------------------------------------------------- !
[1000]294
[888]295      ! ... components ( U10m - U_oce ) at T-point (unmasked)
[13191]296      zwnd_i(:,:) = 0.e0
[888]297      zwnd_j(:,:) = 0.e0
[3680]298#if defined key_cyclone
[4990]299      CALL wnd_cyc( kt, zwnd_i, zwnd_j )    ! add analytical tropical cyclone (Vincent et al. JGR 2012)
[3680]300      DO jj = 2, jpjm1
301         DO ji = fs_2, fs_jpim1   ! vect. opt.
302            sf(jp_wndi)%fnow(ji,jj,1) = sf(jp_wndi)%fnow(ji,jj,1) + zwnd_i(ji,jj)
303            sf(jp_wndj)%fnow(ji,jj,1) = sf(jp_wndj)%fnow(ji,jj,1) + zwnd_j(ji,jj)
304         END DO
305      END DO
306#endif
[888]307      DO jj = 2, jpjm1
308         DO ji = fs_2, fs_jpim1   ! vect. opt.
[11442]309            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac0(ji,jj) * 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
310            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac0(ji,jj) * 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
[888]311         END DO
312      END DO
313      CALL lbc_lnk( zwnd_i(:,:) , 'T', -1. )
314      CALL lbc_lnk( zwnd_j(:,:) , 'T', -1. )
315      ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked)
[1025]316      wndm(:,:) = SQRT(  zwnd_i(:,:) * zwnd_i(:,:)   &
317         &             + zwnd_j(:,:) * zwnd_j(:,:)  ) * tmask(:,:,1)
[888]318
319      ! ----------------------------------------------------------------------------- !
320      !      I   Radiative FLUXES                                                     !
321      ! ----------------------------------------------------------------------------- !
[4990]322
[2528]323      ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave
324      zztmp = 1. - albo
325      IF( ln_dm2dc ) THEN   ;   qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1)
326      ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
327      ENDIF
[5385]328
[2528]329      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
[888]330      ! ----------------------------------------------------------------------------- !
331      !     II    Turbulent FLUXES                                                    !
332      ! ----------------------------------------------------------------------------- !
333
334      ! ... specific humidity at SST and IST
[4990]335      zqsatw(:,:) = zcoef_qsatw * EXP( -5107.4 / zst(:,:) )
[888]336
337      ! ... NCAR Bulk formulae, computation of Cd, Ch, Ce at T-point :
[4990]338      CALL turb_core_2z( rn_zqt, rn_zu, zst, sf(jp_tair)%fnow, zqsatw, sf(jp_humi)%fnow, wndm,   &
339         &               Cd, Ch, Ce, zt_zu, zq_zu )
[13191]340
[1695]341      ! ... tau module, i and j component
342      DO jj = 1, jpj
343         DO ji = 1, jpi
344            zztmp = rhoa * wndm(ji,jj) * Cd(ji,jj)
345            taum  (ji,jj) = zztmp * wndm  (ji,jj)
346            zwnd_i(ji,jj) = zztmp * zwnd_i(ji,jj)
347            zwnd_j(ji,jj) = zztmp * zwnd_j(ji,jj)
348         END DO
349      END DO
[1705]350
351      ! ... add the HF tau contribution to the wind stress module?
[4990]352      IF( lhftau ) THEN
[2528]353         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1)
[1705]354      ENDIF
355      CALL iom_put( "taum_oce", taum )   ! output wind stress module
356
[888]357      ! ... utau, vtau at U- and V_points, resp.
358      !     Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines
[4990]359      !     Note the use of MAX(tmask(i,j),tmask(i+1,j) is to mask tau over ice shelves
[888]360      DO jj = 1, jpjm1
361         DO ji = 1, fs_jpim1
[4990]362            utau(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( zwnd_i(ji,jj) + zwnd_i(ji+1,jj  ) ) &
363               &          * MAX(tmask(ji,jj,1),tmask(ji+1,jj,1))
364            vtau(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( zwnd_j(ji,jj) + zwnd_j(ji  ,jj+1) ) &
365               &          * MAX(tmask(ji,jj,1),tmask(ji,jj+1,1))
[888]366         END DO
367      END DO
368      CALL lbc_lnk( utau(:,:), 'U', -1. )
369      CALL lbc_lnk( vtau(:,:), 'V', -1. )
370
[13191]371
[888]372      !  Turbulent fluxes over ocean
373      ! -----------------------------
[4990]374      IF( ABS( rn_zu - rn_zqt) < 0.01_wp ) THEN
375         !! q_air and t_air are (or "are almost") given at 10m (wind reference height)
376         zevap(:,:) = rn_efac*MAX( 0._wp,     rhoa*Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) )*wndm(:,:) ) ! Evaporation
377         zqsb (:,:) =                     cpa*rhoa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) )*wndm(:,:)   ! Sensible Heat
[888]378      ELSE
[4990]379         !! q_air and t_air are not given at 10m (wind reference height)
380         ! Values of temp. and hum. adjusted to height of wind during bulk algorithm iteration must be used!!!
381         zevap(:,:) = rn_efac*MAX( 0._wp,     rhoa*Ce(:,:)*( zqsatw(:,:) - zq_zu(:,:) )*wndm(:,:) )   ! Evaporation
382         zqsb (:,:) =                     cpa*rhoa*Ch(:,:)*( zst   (:,:) - zt_zu(:,:) )*wndm(:,:)     ! Sensible Heat
[888]383      ENDIF
384      zqla (:,:) = Lv * zevap(:,:)                                                              ! Latent Heat
385
386      IF(ln_ctl) THEN
[1025]387         CALL prt_ctl( tab2d_1=zqla  , clinfo1=' blk_oce_core: zqla   : ', tab2d_2=Ce , clinfo2=' Ce  : ' )
388         CALL prt_ctl( tab2d_1=zqsb  , clinfo1=' blk_oce_core: zqsb   : ', tab2d_2=Ch , clinfo2=' Ch  : ' )
389         CALL prt_ctl( tab2d_1=zqlw  , clinfo1=' blk_oce_core: zqlw   : ', tab2d_2=qsr, clinfo2=' qsr : ' )
390         CALL prt_ctl( tab2d_1=zqsatw, clinfo1=' blk_oce_core: zqsatw : ', tab2d_2=zst, clinfo2=' zst : ' )
391         CALL prt_ctl( tab2d_1=utau  , clinfo1=' blk_oce_core: utau   : ', mask1=umask,   &
392            &          tab2d_2=vtau  , clinfo2=              ' vtau : '  , mask2=vmask )
393         CALL prt_ctl( tab2d_1=wndm  , clinfo1=' blk_oce_core: wndm   : ')
394         CALL prt_ctl( tab2d_1=zst   , clinfo1=' blk_oce_core: zst    : ')
[888]395      ENDIF
[13191]396
[888]397      ! ----------------------------------------------------------------------------- !
398      !     III    Total FLUXES                                                       !
399      ! ----------------------------------------------------------------------------- !
[4990]400      !
[3625]401      emp (:,:) = (  zevap(:,:)                                          &   ! mass flux (evap. - precip.)
402         &         - sf(jp_prec)%fnow(:,:,1) * rn_pfac  ) * tmask(:,:,1)
[5407]403      !
[13191]404      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                &   ! Downward Non Solar
[3772]405         &     - sf(jp_snow)%fnow(:,:,1) * rn_pfac * lfus                         &   ! remove latent melting heat for solid precip
406         &     - zevap(:,:) * pst(:,:) * rcp                                      &   ! remove evap heat content at SST
407         &     + ( sf(jp_prec)%fnow(:,:,1) - sf(jp_snow)%fnow(:,:,1) ) * rn_pfac  &   ! add liquid precip heat content at Tair
[4990]408         &     * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp                          &
[3772]409         &     + sf(jp_snow)%fnow(:,:,1) * rn_pfac                                &   ! add solid  precip heat content at min(Tair,Tsnow)
[4990]410         &     * ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1)
[888]411      !
[5407]412#if defined key_lim3
413      qns_oce(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                ! non solar without emp (only needed by LIM3)
414      qsr_oce(:,:) = qsr(:,:)
415#endif
[1482]416      !
[5407]417      IF ( nn_ice == 0 ) THEN
418         CALL iom_put( "qlw_oce" ,   zqlw )                 ! output downward longwave heat over the ocean
419         CALL iom_put( "qsb_oce" , - zqsb )                 ! output downward sensible heat over the ocean
420         CALL iom_put( "qla_oce" , - zqla )                 ! output downward latent   heat over the ocean
421         CALL iom_put( "qemp_oce",   qns-zqlw+zqsb+zqla )   ! output downward heat content of E-P over the ocean
422         CALL iom_put( "qns_oce" ,   qns  )                 ! output downward non solar heat over the ocean
423         CALL iom_put( "qsr_oce" ,   qsr  )                 ! output downward solar heat over the ocean
424         CALL iom_put( "qt_oce"  ,   qns+qsr )              ! output total downward heat over the ocean
[6487]425         tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac   ! output total precipitation [kg/m2/s]
426         sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac   ! output solid precipitation [kg/m2/s]
427         CALL iom_put( 'snowpre', sprecip * 86400. )        ! Snow
428         CALL iom_put( 'precip' , tprecip * 86400. )        ! Total precipitation
[5407]429      ENDIF
430      !
[1482]431      IF(ln_ctl) THEN
432         CALL prt_ctl(tab2d_1=zqsb , clinfo1=' blk_oce_core: zqsb   : ', tab2d_2=zqlw , clinfo2=' zqlw  : ')
433         CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce_core: zqla   : ', tab2d_2=qsr  , clinfo2=' qsr   : ')
434         CALL prt_ctl(tab2d_1=pst  , clinfo1=' blk_oce_core: pst    : ', tab2d_2=emp  , clinfo2=' emp   : ')
435         CALL prt_ctl(tab2d_1=utau , clinfo1=' blk_oce_core: utau   : ', mask1=umask,   &
436            &         tab2d_2=vtau , clinfo2=              ' vtau  : ' , mask2=vmask )
437      ENDIF
438      !
[3294]439      CALL wrk_dealloc( jpi,jpj, zwnd_i, zwnd_j, zqsatw, zqlw, zqsb, zqla, zevap )
440      CALL wrk_dealloc( jpi,jpj, Cd, Ch, Ce, zst, zt_zu, zq_zu )
[2715]441      !
[3294]442      IF( nn_timing == 1 )  CALL timing_stop('blk_oce_core')
443      !
[888]444   END SUBROUTINE blk_oce_core
[13191]445
446
[5407]447#if defined key_lim2 || defined key_lim3
448   SUBROUTINE blk_ice_core_tau
[888]449      !!---------------------------------------------------------------------
[5407]450      !!                     ***  ROUTINE blk_ice_core_tau  ***
[888]451      !!
452      !! ** Purpose :   provide the surface boundary condition over sea-ice
453      !!
[5407]454      !! ** Method  :   compute momentum using CORE bulk
455      !!                formulea, ice variables and read atmospheric fields.
[888]456      !!                NB: ice drag coefficient is assumed to be a constant
457      !!---------------------------------------------------------------------
[5407]458      INTEGER  ::   ji, jj    ! dummy loop indices
459      REAL(wp) ::   zcoef_wnorm, zcoef_wnorm2
460      REAL(wp) ::   zwnorm_f, zwndi_f , zwndj_f               ! relative wind module and components at F-point
461      REAL(wp) ::             zwndi_t , zwndj_t               ! relative wind components at T-point
[888]462      !!---------------------------------------------------------------------
[3294]463      !
[5407]464      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core_tau')
[3294]465      !
[888]466      ! local scalars ( place there for vector optimisation purposes)
[2528]467      zcoef_wnorm  = rhoa * Cice
[888]468      zcoef_wnorm2 = rhoa * Cice * 0.5
469
470!!gm brutal....
[5407]471      utau_ice  (:,:) = 0._wp
472      vtau_ice  (:,:) = 0._wp
473      wndm_ice  (:,:) = 0._wp
[888]474!!gm end
475
476      ! ----------------------------------------------------------------------------- !
477      !    Wind components and module relative to the moving ocean ( U10m - U_ice )   !
478      ! ----------------------------------------------------------------------------- !
[5407]479      SELECT CASE( cp_ice_msh )
[2528]480      CASE( 'I' )                  ! B-grid ice dynamics :   I-point (i.e. F-point with sea-ice indexation)
[888]481         !                           and scalar wind at T-point ( = | U10m - U_ice | ) (masked)
482         DO jj = 2, jpjm1
[2528]483            DO ji = 2, jpim1   ! B grid : NO vector opt
[888]484               ! ... scalar wind at I-point (fld being at T-point)
[11442]485               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ,1) + sf(jp_wndi)%fnow(ji  ,jj  ,1)    &
486                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) &
487                  &      - rn_vfac0(ji,jj) * u_ice(ji,jj)
488               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ,1) + sf(jp_wndj)%fnow(ji  ,jj  ,1)    &
489                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) &
490                  &      - rn_vfac0(ji,jj) * v_ice(ji,jj)
[888]491               zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
492               ! ... ice stress at I-point
[5407]493               utau_ice(ji,jj) = zwnorm_f * zwndi_f
494               vtau_ice(ji,jj) = zwnorm_f * zwndj_f
[888]495               ! ... scalar wind at T-point (fld being at T-point)
[11442]496               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1)                                         &
497                  &      - rn_vfac0(ji,jj) * 0.25 * (  u_ice(ji,jj+1) + u_ice(ji+1,jj+1)   &
498                  &                                  + u_ice(ji,jj  ) + u_ice(ji+1,jj  )  )
499               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1)                                         &
500                  &      - rn_vfac0(ji,jj) * 0.25 * (  v_ice(ji,jj+1) + v_ice(ji+1,jj+1)   &
501                  &                                  + v_ice(ji,jj  ) + v_ice(ji+1,jj  )  )
[5407]502               wndm_ice(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
[888]503            END DO
504         END DO
[5407]505         CALL lbc_lnk( utau_ice, 'I', -1. )
506         CALL lbc_lnk( vtau_ice, 'I', -1. )
507         CALL lbc_lnk( wndm_ice, 'T',  1. )
[888]508         !
509      CASE( 'C' )                  ! C-grid ice dynamics :   U & V-points (same as ocean)
510         DO jj = 2, jpj
511            DO ji = fs_2, jpi   ! vect. opt.
[11442]512               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac0(ji,jj) * 0.5 * ( u_ice(ji-1,jj  ) + u_ice(ji,jj) )  )
513               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac0(ji,jj) * 0.5 * ( v_ice(ji  ,jj-1) + v_ice(ji,jj) )  )
[5407]514               wndm_ice(ji,jj) = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
[888]515            END DO
516         END DO
517         DO jj = 2, jpjm1
518            DO ji = fs_2, fs_jpim1   ! vect. opt.
[11442]519               utau_ice(ji,jj) = zcoef_wnorm2 * ( wndm_ice(ji+1,jj  ) + wndm_ice(ji,jj) )             &
520                  &              * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) &
521                  &                  - rn_vfac0(ji,jj) * u_ice(ji,jj) )
522               vtau_ice(ji,jj) = zcoef_wnorm2 * ( wndm_ice(ji,jj+1  ) + wndm_ice(ji,jj) )             &
523                  &              * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) &
524                  &                  - rn_vfac0(ji,jj) * v_ice(ji,jj) )
[888]525            END DO
526         END DO
[5407]527         CALL lbc_lnk( utau_ice, 'U', -1. )
528         CALL lbc_lnk( vtau_ice, 'V', -1. )
529         CALL lbc_lnk( wndm_ice, 'T',  1. )
[888]530         !
531      END SELECT
532
[5407]533      IF(ln_ctl) THEN
534         CALL prt_ctl(tab2d_1=utau_ice  , clinfo1=' blk_ice_core: utau_ice : ', tab2d_2=vtau_ice  , clinfo2=' vtau_ice : ')
535         CALL prt_ctl(tab2d_1=wndm_ice  , clinfo1=' blk_ice_core: wndm_ice : ')
536      ENDIF
537
538      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core_tau')
[13191]539
[5407]540   END SUBROUTINE blk_ice_core_tau
541
542
543   SUBROUTINE blk_ice_core_flx( ptsu, palb )
544      !!---------------------------------------------------------------------
545      !!                     ***  ROUTINE blk_ice_core_flx  ***
546      !!
547      !! ** Purpose :   provide the surface boundary condition over sea-ice
548      !!
549      !! ** Method  :   compute heat and freshwater exchanged
550      !!                between atmosphere and sea-ice using CORE bulk
551      !!                formulea, ice variables and read atmmospheric fields.
[13191]552      !!
[5407]553      !! caution : the net upward water flux has with mm/day unit
554      !!---------------------------------------------------------------------
555      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   ptsu          ! sea ice surface temperature
556      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   palb          ! ice albedo (all skies)
557      !!
558      INTEGER  ::   ji, jj, jl    ! dummy loop indices
559      REAL(wp) ::   zst2, zst3
560      REAL(wp) ::   zcoef_dqlw, zcoef_dqla, zcoef_dqsb
561      REAL(wp) ::   zztmp, z1_lsub                               ! temporary variable
562      !!
563      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qlw             ! long wave heat flux over ice
564      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qsb             ! sensible  heat flux over ice
565      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqlw            ! long wave heat sensitivity over ice
566      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqsb            ! sensible  heat sensitivity over ice
567      REAL(wp), DIMENSION(:,:)  , POINTER ::   zevap, zsnw       ! evaporation and snw distribution after wind blowing (LIM3)
568      !!---------------------------------------------------------------------
569      !
570      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core_flx')
571      !
[13191]572      CALL wrk_alloc( jpi,jpj,jpl, z_qlw, z_qsb, z_dqlw, z_dqsb )
[5407]573
574      ! local scalars ( place there for vector optimisation purposes)
575      zcoef_dqlw   = 4.0 * 0.95 * Stef
576      zcoef_dqla   = -Ls * Cice * 11637800. * (-5897.8)
577      zcoef_dqsb   = rhoa * cpa * Cice
578
[2528]579      zztmp = 1. / ( 1. - albo )
[888]580      !                                     ! ========================== !
[5407]581      DO jl = 1, jpl                        !  Loop over ice categories  !
[888]582         !                                  ! ========================== !
583         DO jj = 1 , jpj
584            DO ji = 1, jpi
585               ! ----------------------------!
586               !      I   Radiative FLUXES   !
587               ! ----------------------------!
[5407]588               zst2 = ptsu(ji,jj,jl) * ptsu(ji,jj,jl)
589               zst3 = ptsu(ji,jj,jl) * zst2
[888]590               ! Short Wave (sw)
[5407]591               qsr_ice(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr(ji,jj)
[888]592               ! Long  Wave (lw)
[5407]593               z_qlw(ji,jj,jl) = 0.95 * ( sf(jp_qlw)%fnow(ji,jj,1) - Stef * ptsu(ji,jj,jl) * zst3 ) * tmask(ji,jj,1)
[888]594               ! lw sensitivity
[13191]595               z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3
[888]596
597               ! ----------------------------!
598               !     II    Turbulent FLUXES  !
599               ! ----------------------------!
600
601               ! ... turbulent heat fluxes
602               ! Sensible Heat
[5407]603               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * wndm_ice(ji,jj) * ( ptsu(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
[888]604               ! Latent Heat
[13191]605               qla_ice(ji,jj,jl) = rn_efac * MAX( 0.e0, rhoa * Ls  * Cice * wndm_ice(ji,jj)   &
[5407]606                  &                         * (  11637800. * EXP( -5897.8 / ptsu(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
607              ! Latent heat sensitivity for ice (Dqla/Dt)
608               IF( qla_ice(ji,jj,jl) > 0._wp ) THEN
609                  dqla_ice(ji,jj,jl) = rn_efac * zcoef_dqla * wndm_ice(ji,jj) / ( zst2 ) * EXP( -5897.8 / ptsu(ji,jj,jl) )
[4689]610               ELSE
[5407]611                  dqla_ice(ji,jj,jl) = 0._wp
[4689]612               ENDIF
[4990]613
[888]614               ! Sensible heat sensitivity (Dqsb_ice/Dtn_ice)
[5407]615               z_dqsb(ji,jj,jl) = zcoef_dqsb * wndm_ice(ji,jj)
[888]616
617               ! ----------------------------!
618               !     III    Total FLUXES     !
619               ! ----------------------------!
620               ! Downward Non Solar flux
[5407]621               qns_ice (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - qla_ice (ji,jj,jl)
[888]622               ! Total non solar heat flux sensitivity for ice
[5407]623               dqns_ice(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + dqla_ice(ji,jj,jl) )
[888]624            END DO
625            !
626         END DO
627         !
628      END DO
629      !
[5407]630      tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
631      sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
632      CALL iom_put( 'snowpre', sprecip * 86400. )                  ! Snow precipitation
633      CALL iom_put( 'precip' , tprecip * 86400. )                  ! Total precipitation
634
635#if defined  key_lim3
[13191]636      CALL wrk_alloc( jpi,jpj, zevap, zsnw )
[5407]637
638      ! --- evaporation --- !
639      z1_lsub = 1._wp / Lsub
[6498]640      evap_ice (:,:,:) = rn_efac * qla_ice (:,:,:) * z1_lsub    ! sublimation
641      devap_ice(:,:,:) = rn_efac * dqla_ice(:,:,:) * z1_lsub    ! d(sublimation)/dT
642      zevap    (:,:)   = rn_efac * ( emp(:,:) + tprecip(:,:) )  ! evaporation over ocean
[5407]643
644      ! --- evaporation minus precipitation --- !
[5487]645      zsnw(:,:) = 0._wp
[13191]646      CALL lim_thd_snwblow( pfrld, zsnw )  ! snow distribution over ice after wind blowing
[5407]647      emp_oce(:,:) = pfrld(:,:) * zevap(:,:) - ( tprecip(:,:) - sprecip(:,:) ) - sprecip(:,:) * (1._wp - zsnw )
648      emp_ice(:,:) = SUM( a_i_b(:,:,:) * evap_ice(:,:,:), dim=3 ) - sprecip(:,:) * zsnw
649      emp_tot(:,:) = emp_oce(:,:) + emp_ice(:,:)
650
651      ! --- heat flux associated with emp --- !
652      qemp_oce(:,:) = - pfrld(:,:) * zevap(:,:) * sst_m(:,:) * rcp                               & ! evap at sst
653         &          + ( tprecip(:,:) - sprecip(:,:) ) * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp  & ! liquid precip at Tair
654         &          +   sprecip(:,:) * ( 1._wp - zsnw ) *                                        & ! solid precip at min(Tair,Tsnow)
655         &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
656      qemp_ice(:,:) =   sprecip(:,:) * zsnw *                                                    & ! solid precip (only)
657         &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
658
659      ! --- total solar and non solar fluxes --- !
660      qns_tot(:,:) = pfrld(:,:) * qns_oce(:,:) + SUM( a_i_b(:,:,:) * qns_ice(:,:,:), dim=3 ) + qemp_ice(:,:) + qemp_oce(:,:)
661      qsr_tot(:,:) = pfrld(:,:) * qsr_oce(:,:) + SUM( a_i_b(:,:,:) * qsr_ice(:,:,:), dim=3 )
662
663      ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- !
664      qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
665
[6498]666      ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- !
667      DO jl = 1, jpl
668         qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * cpic * tmask(:,:,1) )
[13191]669                                   ! But we do not have Tice => consider it at 0 degC => evap=0
[6498]670      END DO
671
[13191]672      CALL wrk_dealloc( jpi,jpj, zevap, zsnw )
[5407]673#endif
674
[888]675      !--------------------------------------------------------------------
676      ! FRACTIONs of net shortwave radiation which is not absorbed in the
677      ! thin surface layer and penetrates inside the ice cover
678      ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 )
[4990]679      !
[5407]680      fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice )
681      fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice )
[4990]682      !
[888]683      !
684      IF(ln_ctl) THEN
[5407]685         CALL prt_ctl(tab3d_1=qla_ice , clinfo1=' blk_ice_core: qla_ice  : ', tab3d_2=z_qsb   , clinfo2=' z_qsb    : ', kdim=jpl)
686         CALL prt_ctl(tab3d_1=z_qlw   , clinfo1=' blk_ice_core: z_qlw    : ', tab3d_2=dqla_ice, clinfo2=' dqla_ice : ', kdim=jpl)
687         CALL prt_ctl(tab3d_1=z_dqsb  , clinfo1=' blk_ice_core: z_dqsb   : ', tab3d_2=z_dqlw  , clinfo2=' z_dqlw   : ', kdim=jpl)
688         CALL prt_ctl(tab3d_1=dqns_ice, clinfo1=' blk_ice_core: dqns_ice : ', tab3d_2=qsr_ice , clinfo2=' qsr_ice  : ', kdim=jpl)
689         CALL prt_ctl(tab3d_1=ptsu    , clinfo1=' blk_ice_core: ptsu     : ', tab3d_2=qns_ice , clinfo2=' qns_ice  : ', kdim=jpl)
690         CALL prt_ctl(tab2d_1=tprecip , clinfo1=' blk_ice_core: tprecip  : ', tab2d_2=sprecip , clinfo2=' sprecip  : ')
[888]691      ENDIF
692
[5407]693      CALL wrk_dealloc( jpi,jpj,jpl, z_qlw, z_qsb, z_dqlw, z_dqsb )
[2715]694      !
[5407]695      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core_flx')
[13191]696
[5407]697   END SUBROUTINE blk_ice_core_flx
698#endif
[888]699
[4990]700   SUBROUTINE turb_core_2z( zt, zu, sst, T_zt, q_sat, q_zt, dU,    &
701      &                      Cd, Ch, Ce , T_zu, q_zu )
[888]702      !!----------------------------------------------------------------------
703      !!                      ***  ROUTINE  turb_core  ***
704      !!
[4990]705      !! ** Purpose :   Computes turbulent transfert coefficients of surface
706      !!                fluxes according to Large & Yeager (2004) and Large & Yeager (2008)
707      !!                If relevant (zt /= zu), adjust temperature and humidity from height zt to zu
[888]708      !!
[13191]709      !! ** Method : Monin Obukhov Similarity Theory
[4990]710      !!             + Large & Yeager (2004,2008) closure: CD_n10 = f(U_n10)
[888]711      !!
[4990]712      !! ** References :   Large & Yeager, 2004 / Large & Yeager, 2008
713      !!
714      !! ** Last update: Laurent Brodeau, June 2014:
715      !!    - handles both cases zt=zu and zt/=zu
716      !!    - optimized: less 2D arrays allocated and less operations
717      !!    - better first guess of stability by checking air-sea difference of virtual temperature
718      !!       rather than temperature difference only...
[13191]719      !!    - added function "cd_neutral_10m" that uses the improved parametrization of
[4990]720      !!      Large & Yeager 2008. Drag-coefficient reduction for Cyclone conditions!
721      !!    - using code-wide physical constants defined into "phycst.mod" rather than redifining them
722      !!      => 'vkarmn' and 'grav'
[888]723      !!----------------------------------------------------------------------
[3294]724      REAL(wp), INTENT(in   )                     ::   zt       ! height for T_zt and q_zt                   [m]
725      REAL(wp), INTENT(in   )                     ::   zu       ! height for dU                              [m]
726      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   sst      ! sea surface temperature              [Kelvin]
727      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   T_zt     ! potential air temperature            [Kelvin]
728      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_sat    ! sea surface specific humidity         [kg/kg]
729      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity                 [kg/kg]
[4990]730      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   dU       ! relative wind module at zu            [m/s]
[3294]731      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cd       ! transfer coefficient for momentum         (tau)
732      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ch       ! transfer coefficient for sensible heat (Q_sens)
733      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ce       ! transfert coefficient for evaporation   (Q_lat)
734      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   T_zu     ! air temp. shifted at zu                     [K]
735      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   q_zu     ! spec. hum.  shifted at zu               [kg/kg]
[4990]736      !
737      INTEGER ::   j_itt
738      INTEGER , PARAMETER ::   nb_itt = 5       ! number of itterations
739      LOGICAL ::   l_zt_equal_zu = .FALSE.      ! if q and t are given at different height than U
740      !
741      REAL(wp), DIMENSION(:,:), POINTER ::   U_zu          ! relative wind at zu                            [m/s]
[3294]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 ::   zeta_u        ! stability parameter at height zu
747      REAL(wp), DIMENSION(:,:), POINTER ::   zeta_t        ! stability parameter at height zt
[4990]748      REAL(wp), DIMENSION(:,:), POINTER ::   zpsi_h_u, zpsi_m_u
749      REAL(wp), DIMENSION(:,:), POINTER ::   ztmp0, ztmp1, ztmp2
750      REAL(wp), DIMENSION(:,:), POINTER ::   stab          ! 1st stability test integer
[2528]751      !!----------------------------------------------------------------------
[888]752
[4990]753      IF( nn_timing == 1 )  CALL timing_start('turb_core_2z')
[13191]754
[4990]755      CALL wrk_alloc( jpi,jpj, U_zu, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd )
756      CALL wrk_alloc( jpi,jpj, zeta_u, stab )
757      CALL wrk_alloc( jpi,jpj, zpsi_h_u, zpsi_m_u, ztmp0, ztmp1, ztmp2 )
[888]758
[4990]759      l_zt_equal_zu = .FALSE.
760      IF( ABS(zu - zt) < 0.01 ) l_zt_equal_zu = .TRUE.    ! testing "zu == zt" is risky with double precision
761
762      IF( .NOT. l_zt_equal_zu )   CALL wrk_alloc( jpi,jpj, zeta_t )
763
764      U_zu = MAX( 0.5 , dU )   !  relative wind speed at zu (normally 10m), we don't want to fall under 0.5 m/s
765
[13191]766      !! First guess of stability:
[4990]767      ztmp0 = T_zt*(1. + 0.608*q_zt) - sst*(1. + 0.608*q_sat) ! air-sea difference of virtual pot. temp. at zt
768      stab  = 0.5 + sign(0.5,ztmp0)                           ! stab = 1 if dTv > 0  => STABLE, 0 if unstable
769
770      !! Neutral coefficients at 10m:
771      IF( ln_cdgw ) THEN      ! wave drag case
772         cdn_wave(:,:) = cdn_wave(:,:) + rsmall * ( 1._wp - tmask(:,:,1) )
773         ztmp0   (:,:) = cdn_wave(:,:)
[3294]774      ELSE
[4990]775         ztmp0 = cd_neutral_10m( U_zu )
[3294]776      ENDIF
[4990]777      sqrt_Cd_n10 = SQRT( ztmp0 )
[4333]778      Ce_n10  = 1.e-3*( 34.6 * sqrt_Cd_n10 )
779      Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab))
[13191]780
[888]781      !! Initializing transf. coeff. with their first guess neutral equivalents :
[4990]782      Cd = ztmp0   ;   Ce = Ce_n10   ;   Ch = Ch_n10   ;   sqrt_Cd = sqrt_Cd_n10
[888]783
[4990]784      !! Initializing values at z_u with z_t values:
785      T_zu = T_zt   ;   q_zu = q_zt
[888]786
787      !!  * Now starting iteration loop
788      DO j_itt=1, nb_itt
[4990]789         !
790         ztmp1 = T_zu - sst   ! Updating air/sea differences
[13191]791         ztmp2 = q_zu - q_sat
[4990]792
793         ! Updating turbulent scales :   (L&Y 2004 eq. (7))
794         ztmp1  = Ch/sqrt_Cd*ztmp1    ! theta*
795         ztmp2  = Ce/sqrt_Cd*ztmp2    ! q*
[13191]796
[4990]797         ztmp0 = T_zu*(1. + 0.608*q_zu) ! virtual potential temperature at zu
798
799         ! Estimate the inverse of Monin-Obukov length (1/L) at height zu:
[13191]800         ztmp0 =  (vkarmn*grav/ztmp0*(ztmp1*(1.+0.608*q_zu) + 0.608*T_zu*ztmp2)) / (Cd*U_zu*U_zu)
[4990]801         !                                                                     ( Cd*U_zu*U_zu is U*^2 at zu)
802
[888]803         !! Stability parameters :
[4990]804         zeta_u   = zu*ztmp0   ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u )
805         zpsi_h_u = psi_h( zeta_u )
806         zpsi_m_u = psi_m( zeta_u )
[13191]807
[4990]808         !! Shifting temperature and humidity at zu (L&Y 2004 eq. (9b-9c))
809         IF ( .NOT. l_zt_equal_zu ) THEN
810            zeta_t = zt*ztmp0 ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t )
811            stab = LOG(zu/zt) - zpsi_h_u + psi_h(zeta_t)  ! stab just used as temp array!!!
812            T_zu = T_zt + ztmp1/vkarmn*stab    ! ztmp1 is still theta*
813            q_zu = q_zt + ztmp2/vkarmn*stab    ! ztmp2 is still q*
814            q_zu = max(0., q_zu)
815         END IF
[13191]816
[4990]817         IF( ln_cdgw ) THEN      ! surface wave case
[13191]818            sqrt_Cd = vkarmn / ( vkarmn / sqrt_Cd_n10 - zpsi_m_u )
[4990]819            Cd      = sqrt_Cd * sqrt_Cd
[3294]820         ELSE
[4990]821           ! Update neutral wind speed at 10m and neutral Cd at 10m (L&Y 2004 eq. 9a)...
822           !   In very rare low-wind conditions, the old way of estimating the
823           !   neutral wind speed at 10m leads to a negative value that causes the code
824           !   to crash. To prevent this a threshold of 0.25m/s is imposed.
825           ztmp0 = MAX( 0.25 , U_zu/(1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - zpsi_m_u)) ) !  U_n10
826           ztmp0 = cd_neutral_10m(ztmp0)                                                 ! Cd_n10
827           sqrt_Cd_n10 = sqrt(ztmp0)
[13191]828
[4990]829           Ce_n10  = 1.e-3 * (34.6 * sqrt_Cd_n10)                     ! L&Y 2004 eq. (6b)
830           stab    = 0.5 + sign(0.5,zeta_u)                           ! update stability
831           Ch_n10  = 1.e-3*sqrt_Cd_n10*(18.*stab + 32.7*(1. - stab))  ! L&Y 2004 eq. (6c-6d)
832
833           !! Update of transfer coefficients:
834           ztmp1 = 1. + sqrt_Cd_n10/vkarmn*(LOG(zu/10.) - zpsi_m_u)   ! L&Y 2004 eq. (10a)
[13191]835           Cd      = ztmp0 / ( ztmp1*ztmp1 )
[4990]836           sqrt_Cd = SQRT( Cd )
[3294]837         ENDIF
[4990]838         !
839         ztmp0 = (LOG(zu/10.) - zpsi_h_u) / vkarmn / sqrt_Cd_n10
840         ztmp2 = sqrt_Cd / sqrt_Cd_n10
[13191]841         ztmp1 = 1. + Ch_n10*ztmp0
[4990]842         Ch  = Ch_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10b)
843         !
[13191]844         ztmp1 = 1. + Ce_n10*ztmp0
[4990]845         Ce  = Ce_n10*ztmp2 / ztmp1  ! L&Y 2004 eq. (10c)
846         !
[888]847      END DO
[4990]848
849      CALL wrk_dealloc( jpi,jpj, U_zu, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd )
850      CALL wrk_dealloc( jpi,jpj, zeta_u, stab )
851      CALL wrk_dealloc( jpi,jpj, zpsi_h_u, zpsi_m_u, ztmp0, ztmp1, ztmp2 )
852
853      IF( .NOT. l_zt_equal_zu ) CALL wrk_dealloc( jpi,jpj, zeta_t )
854
855      IF( nn_timing == 1 )  CALL timing_stop('turb_core_2z')
856      !
857   END SUBROUTINE turb_core_2z
858
859
860   FUNCTION cd_neutral_10m( zw10 )
861      !!----------------------------------------------------------------------
[13191]862      !! Estimate of the neutral drag coefficient at 10m as a function
[4990]863      !! of neutral wind  speed at 10m
[888]864      !!
[4990]865      !! Origin: Large & Yeager 2008 eq.(11a) and eq.(11b)
866      !!
867      !! Author: L. Brodeau, june 2014
[13191]868      !!----------------------------------------------------------------------
[4990]869      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   zw10           ! scalar wind speed at 10m (m/s)
870      REAL(wp), DIMENSION(jpi,jpj)             ::   cd_neutral_10m
[2715]871      !
[4990]872      REAL(wp), DIMENSION(:,:), POINTER ::   rgt33
[13191]873      !!----------------------------------------------------------------------
[3294]874      !
[4990]875      CALL wrk_alloc( jpi,jpj, rgt33 )
876      !
877      !! When wind speed > 33 m/s => Cyclone conditions => special treatment
[13191]878      rgt33 = 0.5_wp + SIGN( 0.5_wp, (zw10 - 33._wp) )   ! If zw10 < 33. => 0, else => 1
[4990]879      cd_neutral_10m = 1.e-3 * ( &
[5065]880         &       (1._wp - rgt33)*( 2.7_wp/zw10 + 0.142_wp + zw10/13.09_wp - 3.14807E-10*zw10**6) & ! zw10< 33.
[4990]881         &      + rgt33         *      2.34   )                                                    ! zw10 >= 33.
882      !
883      CALL wrk_dealloc( jpi,jpj, rgt33)
884      !
885   END FUNCTION cd_neutral_10m
[888]886
887
[4990]888   FUNCTION psi_m(pta)   !! Psis, L&Y 2004 eq. (8c), (8d), (8e)
[2715]889      !-------------------------------------------------------------------------------
[4990]890      ! universal profile stability function for momentum
891      !-------------------------------------------------------------------------------
892      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pta
893      !
[888]894      REAL(wp), DIMENSION(jpi,jpj)             :: psi_m
[3294]895      REAL(wp), DIMENSION(:,:), POINTER        :: X2, X, stabit
[2715]896      !-------------------------------------------------------------------------------
[4990]897      !
[3294]898      CALL wrk_alloc( jpi,jpj, X2, X, stabit )
[4990]899      !
900      X2 = SQRT( ABS( 1. - 16.*pta ) )  ;  X2 = MAX( X2 , 1. )   ;   X = SQRT( X2 )
901      stabit = 0.5 + SIGN( 0.5 , pta )
902      psi_m = -5.*pta*stabit  &                                                          ! Stable
903         &    + (1. - stabit)*(2.*LOG((1. + X)*0.5) + LOG((1. + X2)*0.5) - 2.*ATAN(X) + rpi*0.5)  ! Unstable
904      !
[3294]905      CALL wrk_dealloc( jpi,jpj, X2, X, stabit )
[2715]906      !
[4990]907   END FUNCTION psi_m
[888]908
909
[4990]910   FUNCTION psi_h( pta )    !! Psis, L&Y 2004 eq. (8c), (8d), (8e)
[2715]911      !-------------------------------------------------------------------------------
[4990]912      ! universal profile stability function for temperature and humidity
913      !-------------------------------------------------------------------------------
914      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pta
[2715]915      !
916      REAL(wp), DIMENSION(jpi,jpj)             ::   psi_h
[4990]917      REAL(wp), DIMENSION(:,:), POINTER        ::   X2, X, stabit
[2715]918      !-------------------------------------------------------------------------------
[4990]919      !
[3294]920      CALL wrk_alloc( jpi,jpj, X2, X, stabit )
[4990]921      !
922      X2 = SQRT( ABS( 1. - 16.*pta ) )   ;   X2 = MAX( X2 , 1. )   ;   X = SQRT( X2 )
923      stabit = 0.5 + SIGN( 0.5 , pta )
924      psi_h = -5.*pta*stabit   &                                       ! Stable
925         &    + (1. - stabit)*(2.*LOG( (1. + X2)*0.5 ))                ! Unstable
926      !
[3294]927      CALL wrk_dealloc( jpi,jpj, X2, X, stabit )
[2715]928      !
[4990]929   END FUNCTION psi_h
930
[888]931   !!======================================================================
932END MODULE sbcblk_core
Note: See TracBrowser for help on using the repository browser.