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/2012/dev_r3438_LOCEAN15_PISLOB/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2012/dev_r3438_LOCEAN15_PISLOB/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90 @ 3556

Last change on this file since 3556 was 3556, checked in by cetlod, 11 years ago

branch:2012/dev_r3438_LOCEAN15_PISLOB add the Tropical Cyclones module

  • Property svn:keywords set to Id
File size: 54.5 KB
Line 
1MODULE sbcblk_core
2   !!======================================================================
3   !!                       ***  MODULE  sbcblk_core  ***
4   !! Ocean forcing:  momentum, heat and freshwater flux formulation
5   !!=====================================================================
6   !! History :  1.0  !  2004-08  (U. Schweckendiek)  Original code
7   !!            2.0  !  2005-04  (L. Brodeau, A.M. Treguier) additions:
8   !!                           -  new bulk routine for efficiency
9   !!                           -  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
14   !!            3.2  !  2009-04  (B. Lemaire)  Introduce iom_put
15   !!            3.3  !  2010-10  (S. Masson)  add diurnal cycle
16   !!            3.4  !  2011-11  (C. Harris) Fill arrays required by CICE
17   !!----------------------------------------------------------------------
18
19   !!----------------------------------------------------------------------
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
25   !!----------------------------------------------------------------------
26   USE oce             ! ocean dynamics and tracers
27   USE dom_oce         ! ocean space and time domain
28   USE phycst          ! physical constants
29   USE fldread         ! read input fields
30   USE sbc_oce         ! Surface boundary condition: ocean fields
31   USE cyclone         ! Cyclone 10m wind form trac of cyclone centres
32   USE sbcdcy          ! surface boundary condition: diurnal cycle
33   USE iom             ! I/O manager library
34   USE in_out_manager  ! I/O manager
35   USE lib_mpp         ! distribued memory computing library
36   USE wrk_nemo        ! work arrays
37   USE timing          ! Timing
38   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
39   USE prtctl          ! Print control
40   USE sbcwave,ONLY :  cdn_wave !wave module
41#if defined key_lim3 || defined key_cice
42   USE sbc_ice         ! Surface boundary condition: ice fields
43#endif
44
45   IMPLICIT NONE
46   PRIVATE
47
48   PUBLIC   sbc_blk_core         ! routine called in sbcmod module
49   PUBLIC   blk_ice_core         ! routine called in sbc_ice_lim module
50   PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module
51
52   INTEGER , PARAMETER ::   jpfld   = 9           ! maximum number of files to read
53   INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point
54   INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point
55   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( - )
56   INTEGER , PARAMETER ::   jp_qsr  = 4           ! index of solar heat                      (W/m2)
57   INTEGER , PARAMETER ::   jp_qlw  = 5           ! index of Long wave                       (W/m2)
58   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
59   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
60   INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s)
61   INTEGER , PARAMETER ::   jp_tdif = 9           ! index of tau diff associated to HF tau   (N/m2)   at T-point
62   
63   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
64         
65   !                                             !!! CORE bulk parameters
66   REAL(wp), PARAMETER ::   rhoa =    1.22        ! air density
67   REAL(wp), PARAMETER ::   cpa  = 1000.5         ! specific heat of air
68   REAL(wp), PARAMETER ::   Lv   =    2.5e6       ! latent heat of vaporization
69   REAL(wp), PARAMETER ::   Ls   =    2.839e6     ! latent heat of sublimation
70   REAL(wp), PARAMETER ::   Stef =    5.67e-8     ! Stefan Boltzmann constant
71   REAL(wp), PARAMETER ::   Cice =    1.63e-3     ! transfer coefficient over ice
72   REAL(wp), PARAMETER ::   albo =    0.066       ! ocean albedo assumed to be contant
73
74   !                                  !!* Namelist namsbc_core : CORE bulk parameters
75   LOGICAL  ::   ln_2m     = .FALSE.   ! logical flag for height of air temp. and hum
76   LOGICAL  ::   ln_taudif = .FALSE.   ! logical flag to use the "mean of stress module - module of mean stress" data
77   REAL(wp) ::   rn_pfac   = 1.        ! multiplication factor for precipitation
78
79   !! * Substitutions
80#  include "domzgr_substitute.h90"
81#  include "vectopt_loop_substitute.h90"
82   !!----------------------------------------------------------------------
83   !! NEMO/OPA 3.3 , NEMO-consortium (2010)
84   !! $Id$
85   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
86   !!----------------------------------------------------------------------
87CONTAINS
88
89   SUBROUTINE sbc_blk_core( kt )
90      !!---------------------------------------------------------------------
91      !!                    ***  ROUTINE sbc_blk_core  ***
92      !!                   
93      !! ** Purpose :   provide at each time step the surface ocean fluxes
94      !!      (momentum, heat, freshwater and runoff)
95      !!
96      !! ** Method  : (1) READ each fluxes in NetCDF files:
97      !!      the 10m wind velocity (i-component) (m/s)    at T-point
98      !!      the 10m wind velocity (j-component) (m/s)    at T-point
99      !!      the specific humidity               ( - )
100      !!      the solar heat                      (W/m2)
101      !!      the Long wave                       (W/m2)
102      !!      the 10m air temperature             (Kelvin)
103      !!      the total precipitation (rain+snow) (Kg/m2/s)
104      !!      the snow (solid prcipitation)       (kg/m2/s)
105      !!   OPTIONAL parameter (see ln_taudif namelist flag):
106      !!      the tau diff associated to HF tau   (N/m2)   at T-point
107      !!              (2) CALL blk_oce_core
108      !!
109      !!      C A U T I O N : never mask the surface stress fields
110      !!                      the stress is assumed to be in the mesh referential
111      !!                      i.e. the (i,j) referential
112      !!
113      !! ** Action  :   defined at each time-step at the air-sea interface
114      !!              - utau, vtau  i- and j-component of the wind stress
115      !!              - taum        wind stress module at T-point
116      !!              - wndm        10m wind module at T-point
117      !!              - qns, qsr    non-slor and solar heat flux
118      !!              - emp, emps   evaporation minus precipitation
119      !!----------------------------------------------------------------------
120      INTEGER, INTENT(in) ::   kt   ! ocean time step
121      !!
122      INTEGER  ::   ierror   ! return error code
123      INTEGER  ::   ifpr     ! dummy loop indice
124      INTEGER  ::   jfld     ! dummy loop arguments
125      !!
126      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
127      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
128      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr       ! informations about the fields to be read
129      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !   "                                 "
130      TYPE(FLD_N) ::   sn_tdif                                 !   "                                 "
131      NAMELIST/namsbc_core/ cn_dir , ln_2m  , ln_taudif, rn_pfac,           &
132         &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           &
133         &                  sn_qlw , sn_tair, sn_prec  , sn_snow, sn_tdif
134      !!---------------------------------------------------------------------
135
136      !                                         ! ====================== !
137      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
138         !                                      ! ====================== !
139         ! set file information (default values)
140         cn_dir = './'       ! directory in which the model is executed
141         !
142         ! (NB: frequency positive => hours, negative => months)
143         !            !    file    ! frequency ! variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
144         !            !    name    !  (hours)  !  name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
145         sn_wndi = FLD_N( 'uwnd10m',    24     , 'u_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
146         sn_wndj = FLD_N( 'vwnd10m',    24     , 'v_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
147         sn_qsr  = FLD_N( 'qsw'    ,    24     , 'qsw'    ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
148         sn_qlw  = FLD_N( 'qlw'    ,    24     , 'qlw'    ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
149         sn_tair = FLD_N( 'tair10m',    24     , 't_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
150         sn_humi = FLD_N( 'humi10m',    24     , 'q_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       )
151         sn_prec = FLD_N( 'precip' ,    -1     , 'precip' ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
152         sn_snow = FLD_N( 'snow'   ,    -1     , 'snow'   ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
153         sn_tdif = FLD_N( 'taudif' ,    24     , 'taudif' ,  .true.    , .false. ,   'yearly'  , ''       , ''       )
154         !
155         REWIND( numnam )                          ! read in namlist namsbc_core
156         READ  ( numnam, namsbc_core )
157         !                                         ! 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' ) 
160         IF( ln_dm2dc .AND. sn_qsr%ln_tint ) THEN
161            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' )
163            sn_qsr%ln_tint = .false.
164         ENDIF
165         !                                         ! store namelist information in an array
166         slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj
167         slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw
168         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
169         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow
170         slf_i(jp_tdif) = sn_tdif
171         !                 
172         lhftau = ln_taudif                        ! do we use HF tau information?
173         jfld = jpfld - COUNT( (/.NOT. lhftau/) )
174         !
175         ALLOCATE( sf(jfld), STAT=ierror )         ! set sf structure
176         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_core: unable to allocate sf structure' )
177         DO ifpr= 1, jfld
178            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
179            IF( slf_i(ifpr)%ln_tint )   ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
180         END DO
181         !                                         ! fill sf with slf_i and control print
182         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_core', 'flux formulation for ocean surface boundary condition', 'namsbc_core' )
183         !
184      ENDIF
185
186      CALL fld_read( kt, nn_fsbc, sf )        ! input fields provided at the current time-step
187
188      !                                                        ! surface ocean fluxes computed with CLIO bulk formulea
189      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m )
190
191#if defined key_cice
192      IF( MOD( kt - 1, nn_fsbc ) == 0 )   THEN
193         qlw_ice(:,:,1)   = sf(jp_qlw)%fnow(:,:,1) 
194         qsr_ice(:,:,1)   = sf(jp_qsr)%fnow(:,:,1)
195         tatm_ice(:,:)    = sf(jp_tair)%fnow(:,:,1)         
196         qatm_ice(:,:)    = sf(jp_humi)%fnow(:,:,1)
197         tprecip(:,:)     = sf(jp_prec)%fnow(:,:,1) * rn_pfac
198         sprecip(:,:)     = sf(jp_snow)%fnow(:,:,1) * rn_pfac
199         wndi_ice(:,:)    = sf(jp_wndi)%fnow(:,:,1)
200         wndj_ice(:,:)    = sf(jp_wndj)%fnow(:,:,1)
201      ENDIF
202#endif
203      !
204   END SUBROUTINE sbc_blk_core
205   
206   
207   SUBROUTINE blk_oce_core( kt, sf, pst, pu, pv )
208      !!---------------------------------------------------------------------
209      !!                     ***  ROUTINE blk_core  ***
210      !!
211      !! ** Purpose :   provide the momentum, heat and freshwater fluxes at
212      !!      the ocean surface at each time step
213      !!
214      !! ** Method  :   CORE bulk formulea for the ocean using atmospheric
215      !!      fields read in sbc_read
216      !!
217      !! ** Outputs : - utau    : i-component of the stress at U-point  (N/m2)
218      !!              - vtau    : j-component of the stress at V-point  (N/m2)
219      !!              - taum    : Wind stress module at T-point         (N/m2)
220      !!              - wndm    : Wind speed module at T-point          (m/s)
221      !!              - qsr     : Solar heat flux over the ocean        (W/m2)
222      !!              - qns     : Non Solar heat flux over the ocean    (W/m2)
223      !!              - evap    : Evaporation over the ocean            (kg/m2/s)
224      !!              - emp(s)  : evaporation minus precipitation       (kg/m2/s)
225      !!
226      !!  ** Nota  :   sf has to be a dummy argument for AGRIF on NEC
227      !!---------------------------------------------------------------------
228      INTEGER  , INTENT(in   )                 ::   kt    ! time step index
229      TYPE(fld), INTENT(inout), DIMENSION(:)   ::   sf    ! input data
230      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pst   ! surface temperature                      [Celcius]
231      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pu    ! surface current at U-point (i-component) [m/s]
232      REAL(wp) , INTENT(in)   , DIMENSION(:,:) ::   pv    ! surface current at V-point (j-component) [m/s]
233      !
234      INTEGER  ::   ji, jj               ! dummy loop indices
235      REAL(wp) ::   zcoef_qsatw, zztmp   ! local variable
236      REAL(wp), DIMENSION(:,:), POINTER ::   zwnd_i, zwnd_j    ! wind speed components at T-point
237#if defined key_cyclone
238      REAL(wp), DIMENSION(:,:), POINTER ::   ztmask_tc          ! mask = 1 where TC are added
239      REAL(wp), DIMENSION(:,:), POINTER ::   ztcmask_qns        ! total            non-solar heat flux within TC footprints
240      REAL(wp), DIMENSION(:,:), POINTER ::   ztcmask_qnsneg     ! negative part of non-solar heat flux within TC footprints
241#endif
242      REAL(wp), DIMENSION(:,:), POINTER ::   zqsatw            ! specific humidity at pst
243      REAL(wp), DIMENSION(:,:), POINTER ::   zqlw, zqsb        ! long wave and sensible heat fluxes
244      REAL(wp), DIMENSION(:,:), POINTER ::   zqla, zevap       ! latent heat fluxes and evaporation
245      REAL(wp), DIMENSION(:,:), POINTER ::   Cd                ! transfer coefficient for momentum      (tau)
246      REAL(wp), DIMENSION(:,:), POINTER ::   Ch                ! transfer coefficient for sensible heat (Q_sens)
247      REAL(wp), DIMENSION(:,:), POINTER ::   Ce                ! tansfert coefficient for evaporation   (Q_lat)
248      REAL(wp), DIMENSION(:,:), POINTER ::   zst               ! surface temperature in Kelvin
249      REAL(wp), DIMENSION(:,:), POINTER ::   zt_zu             ! air temperature at wind speed height
250      REAL(wp), DIMENSION(:,:), POINTER ::   zq_zu             ! air spec. hum.  at wind speed height
251      !!---------------------------------------------------------------------
252      !
253      IF( nn_timing == 1 )  CALL timing_start('blk_oce_core')
254      !
255      CALL wrk_alloc( jpi,jpj, zwnd_i, zwnd_j, zqsatw, zqlw, zqsb, zqla, zevap )
256      CALL wrk_alloc( jpi,jpj, Cd, Ch, Ce, zst, zt_zu, zq_zu )
257      !
258      ! local scalars ( place there for vector optimisation purposes)
259      zcoef_qsatw = 0.98 * 640380. / rhoa
260     
261      zst(:,:) = pst(:,:) + rt0      ! converte Celcius to Kelvin (and set minimum value far above 0 K)
262
263      ! ----------------------------------------------------------------------------- !
264      !      0   Wind components and module at T-point relative to the moving ocean   !
265      ! ----------------------------------------------------------------------------- !
266
267      ! ... components ( U10m - U_oce ) at T-point (unmasked)
268      zwnd_i(:,:) = 0.e0 
269      zwnd_j(:,:) = 0.e0
270
271#if defined key_cyclone
272     CALL wrk_alloc( jpi, jpj, ztmask_tc, ztcmask_qns, ztcmask_qnsneg )
273# if defined key_vectopt_loop
274!CDIR COLLAPSE
275# endif
276      CALL wnd_cyc( kt, zwnd_i, zwnd_j, ztmask_tc )    ! add Manu !
277      DO jj = 2, jpjm1
278         DO ji = fs_2, fs_jpim1   ! vect. opt.
279            sf(jp_wndi)%fnow(ji,jj,1) = sf(jp_wndi)%fnow(ji,jj,1) + zwnd_i(ji,jj)
280            sf(jp_wndj)%fnow(ji,jj,1) = sf(jp_wndj)%fnow(ji,jj,1) + zwnd_j(ji,jj)
281         END DO
282      END DO
283#endif
284
285#if defined key_vectopt_loop
286!CDIR COLLAPSE
287#endif
288      DO jj = 2, jpjm1
289         DO ji = fs_2, fs_jpim1   ! vect. opt.
290            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
291            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
292         END DO
293      END DO
294      CALL lbc_lnk( zwnd_i(:,:) , 'T', -1. )
295      CALL lbc_lnk( zwnd_j(:,:) , 'T', -1. )
296      ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked)
297!CDIR NOVERRCHK
298!CDIR COLLAPSE
299      wndm(:,:) = SQRT(  zwnd_i(:,:) * zwnd_i(:,:)   &
300         &             + zwnd_j(:,:) * zwnd_j(:,:)  ) * tmask(:,:,1)
301
302      ! ----------------------------------------------------------------------------- !
303      !      I   Radiative FLUXES                                                     !
304      ! ----------------------------------------------------------------------------- !
305   
306      ! ocean albedo assumed to be constant + modify now Qsr to include the diurnal cycle                    ! Short Wave
307      zztmp = 1. - albo
308      IF( ln_dm2dc ) THEN   ;   qsr(:,:) = zztmp * sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1)
309      ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
310      ENDIF
311!CDIR COLLAPSE
312      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
313      ! ----------------------------------------------------------------------------- !
314      !     II    Turbulent FLUXES                                                    !
315      ! ----------------------------------------------------------------------------- !
316
317      ! ... specific humidity at SST and IST
318!CDIR NOVERRCHK
319!CDIR COLLAPSE
320      zqsatw(:,:) = zcoef_qsatw * EXP( -5107.4 / zst(:,:) ) 
321
322      ! ... NCAR Bulk formulae, computation of Cd, Ch, Ce at T-point :
323      IF( ln_2m ) THEN
324         !! If air temp. and spec. hum. are given at different height (2m) than wind (10m) :
325         CALL TURB_CORE_2Z(2.,10., zst   , sf(jp_tair)%fnow,         &
326            &                      zqsatw, sf(jp_humi)%fnow, wndm,   &
327            &                      Cd    , Ch              , Ce  ,   &
328            &                      zt_zu , zq_zu                   )
329      ELSE
330         !! If air temp. and spec. hum. are given at same height than wind (10m) :
331!gm bug?  at the compiling phase, add a copy in temporary arrays...  ==> check perf
332!         CALL TURB_CORE_1Z( 10., zst   (:,:), sf(jp_tair)%fnow(:,:),              &
333!            &                    zqsatw(:,:), sf(jp_humi)%fnow(:,:), wndm(:,:),   &
334!            &                    Cd    (:,:),             Ch  (:,:), Ce  (:,:)  )
335!gm bug
336! ARPDBG - this won't compile with gfortran. Fix but check performance
337! as per comment above.
338         CALL TURB_CORE_1Z( 10., zst   , sf(jp_tair)%fnow(:,:,1),       &
339            &                    zqsatw, sf(jp_humi)%fnow(:,:,1), wndm, &
340            &                    Cd    , Ch              , Ce    )
341      ENDIF
342
343      ! ... tau module, i and j component
344      DO jj = 1, jpj
345         DO ji = 1, jpi
346            zztmp = rhoa * wndm(ji,jj) * Cd(ji,jj)
347            taum  (ji,jj) = zztmp * wndm  (ji,jj)
348            zwnd_i(ji,jj) = zztmp * zwnd_i(ji,jj)
349            zwnd_j(ji,jj) = zztmp * zwnd_j(ji,jj)
350         END DO
351      END DO
352
353      ! ... add the HF tau contribution to the wind stress module?
354      IF( lhftau ) THEN 
355!CDIR COLLAPSE
356         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1)
357      ENDIF
358      CALL iom_put( "taum_oce", taum )   ! output wind stress module
359
360      ! ... utau, vtau at U- and V_points, resp.
361      !     Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines
362      DO jj = 1, jpjm1
363         DO ji = 1, fs_jpim1
364            utau(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( zwnd_i(ji,jj) + zwnd_i(ji+1,jj  ) )
365            vtau(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( zwnd_j(ji,jj) + zwnd_j(ji  ,jj+1) )
366         END DO
367      END DO
368      CALL lbc_lnk( utau(:,:), 'U', -1. )
369      CALL lbc_lnk( vtau(:,:), 'V', -1. )
370
371      !  Turbulent fluxes over ocean
372      ! -----------------------------
373      IF( ln_2m ) THEN
374         ! Values of temp. and hum. adjusted to 10m must be used instead of 2m values
375         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - zq_zu(:,:) ) * wndm(:,:) )   ! Evaporation
376         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - zt_zu(:,:) ) * wndm(:,:)     ! Sensible Heat
377      ELSE
378!CDIR COLLAPSE
379         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) ) * wndm(:,:) )   ! Evaporation
380!CDIR COLLAPSE
381         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) ) * wndm(:,:)     ! Sensible Heat
382      ENDIF
383!CDIR COLLAPSE
384      zqla (:,:) = Lv * zevap(:,:)                                                              ! Latent Heat
385
386      IF(ln_ctl) THEN
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    : ')
395      ENDIF
396       
397      ! ----------------------------------------------------------------------------- !
398      !     III    Total FLUXES                                                       !
399      ! ----------------------------------------------------------------------------- !
400     
401!CDIR COLLAPSE
402      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
403!CDIR COLLAPSE
404      emp(:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)
405!CDIR COLLAPSE
406      emps(:,:) = emp(:,:)
407      !
408      CALL iom_put( "qlw_oce",   zqlw )                 ! output downward longwave heat over the ocean
409      CALL iom_put( "qsb_oce", - zqsb )                 ! output downward sensible heat over the ocean
410      CALL iom_put( "qla_oce", - zqla )                 ! output downward latent   heat over the ocean
411      CALL iom_put( "qns_oce",   qns  )                 ! output downward non solar heat over the ocean
412      !
413#if defined key_cyclone
414      ztcmask_qns(:,:) = qns(:,:) *  ztmask_tc(:,:)
415      ztcmask_qnsneg(:,:) = MIN( qns(:,:) ,  0.e0 ) *  ztmask_tc(:,:) ! MAX/MIN sur tableau 2D ??
416      CALL iom_put( "qns_tcmask",   ztcmask_qns  )       ! output downward non solar heat over the ocean within TC footprints
417      CALL iom_put( "qns_tcneg",   ztcmask_qnsneg  )     ! output downward non solar heat over the ocean negative part only
418      CALL wrk_dealloc( jpi, jpj, ztmask_tc, ztcmask_qns, ztcmask_qnsneg )
419#endif
420      IF(ln_ctl) THEN
421         CALL prt_ctl(tab2d_1=zqsb , clinfo1=' blk_oce_core: zqsb   : ', tab2d_2=zqlw , clinfo2=' zqlw  : ')
422         CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce_core: zqla   : ', tab2d_2=qsr  , clinfo2=' qsr   : ')
423         CALL prt_ctl(tab2d_1=pst  , clinfo1=' blk_oce_core: pst    : ', tab2d_2=emp  , clinfo2=' emp   : ')
424         CALL prt_ctl(tab2d_1=utau , clinfo1=' blk_oce_core: utau   : ', mask1=umask,   &
425            &         tab2d_2=vtau , clinfo2=              ' vtau  : ' , mask2=vmask )
426      ENDIF
427      !
428      CALL wrk_dealloc( jpi,jpj, zwnd_i, zwnd_j, zqsatw, zqlw, zqsb, zqla, zevap )
429      CALL wrk_dealloc( jpi,jpj, Cd, Ch, Ce, zst, zt_zu, zq_zu )
430      !
431      IF( nn_timing == 1 )  CALL timing_stop('blk_oce_core')
432      !
433   END SUBROUTINE blk_oce_core
434   
435   
436   SUBROUTINE blk_ice_core(  pst   , pui   , pvi   , palb ,   &
437      &                      p_taui, p_tauj, p_qns , p_qsr,   &
438      &                      p_qla , p_dqns, p_dqla,          &
439      &                      p_tpr , p_spr ,                  &
440      &                      p_fr1 , p_fr2 , cd_grid, pdim  ) 
441      !!---------------------------------------------------------------------
442      !!                     ***  ROUTINE blk_ice_core  ***
443      !!
444      !! ** Purpose :   provide the surface boundary condition over sea-ice
445      !!
446      !! ** Method  :   compute momentum, heat and freshwater exchanged
447      !!                between atmosphere and sea-ice using CORE bulk
448      !!                formulea, ice variables and read atmmospheric fields.
449      !!                NB: ice drag coefficient is assumed to be a constant
450      !!
451      !! caution : the net upward water flux has with mm/day unit
452      !!---------------------------------------------------------------------
453      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pst      ! ice surface temperature (>0, =rt0 over land) [Kelvin]
454      REAL(wp), DIMENSION(:,:)  , INTENT(in   ) ::   pui      ! ice surface velocity (i- and i- components      [m/s]
455      REAL(wp), DIMENSION(:,:)  , INTENT(in   ) ::   pvi      !    at I-point (B-grid) or U & V-point (C-grid)
456      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb     ! ice albedo (clear sky) (alb_ice_cs)               [%]
457      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_taui   ! i- & j-components of surface ice stress        [N/m2]
458      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_tauj   !   at I-point (B-grid) or U & V-point (C-grid)
459      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qns    ! non solar heat flux over ice (T-point)         [W/m2]
460      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qsr    !     solar heat flux over ice (T-point)         [W/m2]
461      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qla    ! latent    heat flux over ice (T-point)         [W/m2]
462      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_dqns   ! non solar heat sensistivity  (T-point)         [W/m2]
463      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_dqla   ! latent    heat sensistivity  (T-point)         [W/m2]
464      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_tpr    ! total precipitation          (T-point)      [Kg/m2/s]
465      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_spr    ! solid precipitation          (T-point)      [Kg/m2/s]
466      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_fr1    ! 1sr fraction of qsr penetration in ice (T-point)  [%]
467      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_fr2    ! 2nd fraction of qsr penetration in ice (T-point)  [%]
468      CHARACTER(len=1)          , INTENT(in   ) ::   cd_grid  ! ice grid ( C or B-grid)
469      INTEGER                   , INTENT(in   ) ::   pdim     ! number of ice categories
470      !!
471      INTEGER  ::   ji, jj, jl    ! dummy loop indices
472      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
473      REAL(wp) ::   zst2, zst3
474      REAL(wp) ::   zcoef_wnorm, zcoef_wnorm2, zcoef_dqlw, zcoef_dqla, zcoef_dqsb
475      REAL(wp) ::   zztmp                                        ! temporary variable
476      REAL(wp) ::   zcoef_frca                                   ! fractional cloud amount
477      REAL(wp) ::   zwnorm_f, zwndi_f , zwndj_f                  ! relative wind module and components at F-point
478      REAL(wp) ::             zwndi_t , zwndj_t                  ! relative wind components at T-point
479      !!
480      REAL(wp), DIMENSION(:,:)  , POINTER ::   z_wnds_t          ! wind speed ( = | U10m - U_ice | ) at T-point
481      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qlw             ! long wave heat flux over ice
482      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qsb             ! sensible  heat flux over ice
483      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqlw            ! long wave heat sensitivity over ice
484      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqsb            ! sensible  heat sensitivity over ice
485      !!---------------------------------------------------------------------
486      !
487      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core')
488      !
489      CALL wrk_alloc( jpi,jpj, z_wnds_t )
490      CALL wrk_alloc( jpi,jpj,pdim, z_qlw, z_qsb, z_dqlw, z_dqsb ) 
491
492      ijpl  = pdim                            ! number of ice categories
493
494      ! local scalars ( place there for vector optimisation purposes)
495      zcoef_wnorm  = rhoa * Cice
496      zcoef_wnorm2 = rhoa * Cice * 0.5
497      zcoef_dqlw   = 4.0 * 0.95 * Stef
498      zcoef_dqla   = -Ls * Cice * 11637800. * (-5897.8)
499      zcoef_dqsb   = rhoa * cpa * Cice
500      zcoef_frca   = 1.0  - 0.3
501
502!!gm brutal....
503      z_wnds_t(:,:) = 0.e0
504      p_taui  (:,:) = 0.e0
505      p_tauj  (:,:) = 0.e0
506!!gm end
507
508#if defined key_lim3
509      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)   ! LIM3: make Tair available in sea-ice. WARNING allocated after call to ice_init
510#endif
511      ! ----------------------------------------------------------------------------- !
512      !    Wind components and module relative to the moving ocean ( U10m - U_ice )   !
513      ! ----------------------------------------------------------------------------- !
514      SELECT CASE( cd_grid )
515      CASE( 'I' )                  ! B-grid ice dynamics :   I-point (i.e. F-point with sea-ice indexation)
516         !                           and scalar wind at T-point ( = | U10m - U_ice | ) (masked)
517!CDIR NOVERRCHK
518         DO jj = 2, jpjm1
519            DO ji = 2, jpim1   ! B grid : NO vector opt
520               ! ... scalar wind at I-point (fld being at T-point)
521               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ,1) + sf(jp_wndi)%fnow(ji  ,jj  ,1)   &
522                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) - pui(ji,jj)
523               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ,1) + sf(jp_wndj)%fnow(ji  ,jj  ,1)   &
524                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) - pvi(ji,jj)
525               zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
526               ! ... ice stress at I-point
527               p_taui(ji,jj) = zwnorm_f * zwndi_f
528               p_tauj(ji,jj) = zwnorm_f * zwndj_f
529               ! ... scalar wind at T-point (fld being at T-point)
530               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1) - 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
531                  &                                          + pui(ji,jj  ) + pui(ji+1,jj  )  )
532               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1) - 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
533                  &                                          + pvi(ji,jj  ) + pvi(ji+1,jj  )  )
534               z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
535            END DO
536         END DO
537         CALL lbc_lnk( p_taui  , 'I', -1. )
538         CALL lbc_lnk( p_tauj  , 'I', -1. )
539         CALL lbc_lnk( z_wnds_t, 'T',  1. )
540         !
541      CASE( 'C' )                  ! C-grid ice dynamics :   U & V-points (same as ocean)
542#if defined key_vectopt_loop
543!CDIR COLLAPSE
544#endif
545         DO jj = 2, jpj
546            DO ji = fs_2, jpi   ! vect. opt.
547               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
548               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
549               z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
550            END DO
551         END DO
552#if defined key_vectopt_loop
553!CDIR COLLAPSE
554#endif
555         DO jj = 2, jpjm1
556            DO ji = fs_2, fs_jpim1   ! vect. opt.
557               p_taui(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji+1,jj  ) + z_wnds_t(ji,jj) )                          &
558                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - pui(ji,jj) )
559               p_tauj(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji,jj+1  ) + z_wnds_t(ji,jj) )                          &
560                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - pvi(ji,jj) )
561            END DO
562         END DO
563         CALL lbc_lnk( p_taui  , 'U', -1. )
564         CALL lbc_lnk( p_tauj  , 'V', -1. )
565         CALL lbc_lnk( z_wnds_t, 'T',  1. )
566         !
567      END SELECT
568
569      zztmp = 1. / ( 1. - albo )
570      !                                     ! ========================== !
571      DO jl = 1, ijpl                       !  Loop over ice categories  !
572         !                                  ! ========================== !
573!CDIR NOVERRCHK
574!CDIR COLLAPSE
575         DO jj = 1 , jpj
576!CDIR NOVERRCHK
577            DO ji = 1, jpi
578               ! ----------------------------!
579               !      I   Radiative FLUXES   !
580               ! ----------------------------!
581               zst2 = pst(ji,jj,jl) * pst(ji,jj,jl)
582               zst3 = pst(ji,jj,jl) * zst2
583               ! Short Wave (sw)
584               p_qsr(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr(ji,jj)
585               ! Long  Wave (lw)
586               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj,1) - Stef * pst(ji,jj,jl) * zst3  ) * tmask(ji,jj,1)
587               ! lw sensitivity
588               z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3                                               
589
590               ! ----------------------------!
591               !     II    Turbulent FLUXES  !
592               ! ----------------------------!
593
594               ! ... turbulent heat fluxes
595               ! Sensible Heat
596               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
597               ! Latent Heat
598               p_qla(ji,jj,jl) = MAX( 0.e0, rhoa * Ls  * Cice * z_wnds_t(ji,jj)   &                           
599                  &                    * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
600               ! Latent heat sensitivity for ice (Dqla/Dt)
601               p_dqla(ji,jj,jl) = zcoef_dqla * z_wnds_t(ji,jj) / ( zst2 ) * EXP( -5897.8 / pst(ji,jj,jl) )
602               ! Sensible heat sensitivity (Dqsb_ice/Dtn_ice)
603               z_dqsb(ji,jj,jl) = zcoef_dqsb * z_wnds_t(ji,jj)
604
605               ! ----------------------------!
606               !     III    Total FLUXES     !
607               ! ----------------------------!
608               ! Downward Non Solar flux
609               p_qns (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - p_qla (ji,jj,jl)     
610               ! Total non solar heat flux sensitivity for ice
611               p_dqns(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + p_dqla(ji,jj,jl) )   
612            END DO
613            !
614         END DO
615         !
616      END DO
617      !
618      !--------------------------------------------------------------------
619      ! FRACTIONs of net shortwave radiation which is not absorbed in the
620      ! thin surface layer and penetrates inside the ice cover
621      ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 )
622   
623!CDIR COLLAPSE
624      p_fr1(:,:) = ( 0.18 * ( 1.0 - zcoef_frca ) + 0.35 * zcoef_frca )
625!CDIR COLLAPSE
626      p_fr2(:,:) = ( 0.82 * ( 1.0 - zcoef_frca ) + 0.65 * zcoef_frca )
627       
628!CDIR COLLAPSE
629      p_tpr(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
630!CDIR COLLAPSE
631      p_spr(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
632      CALL iom_put( 'snowpre', p_spr )                  ! Snow precipitation
633      !
634      IF(ln_ctl) THEN
635         CALL prt_ctl(tab3d_1=p_qla   , clinfo1=' blk_ice_core: p_qla  : ', tab3d_2=z_qsb   , clinfo2=' z_qsb  : ', kdim=ijpl)
636         CALL prt_ctl(tab3d_1=z_qlw   , clinfo1=' blk_ice_core: z_qlw  : ', tab3d_2=p_dqla  , clinfo2=' p_dqla : ', kdim=ijpl)
637         CALL prt_ctl(tab3d_1=z_dqsb  , clinfo1=' blk_ice_core: z_dqsb : ', tab3d_2=z_dqlw  , clinfo2=' z_dqlw : ', kdim=ijpl)
638         CALL prt_ctl(tab3d_1=p_dqns  , clinfo1=' blk_ice_core: p_dqns : ', tab3d_2=p_qsr   , clinfo2=' p_qsr  : ', kdim=ijpl)
639         CALL prt_ctl(tab3d_1=pst     , clinfo1=' blk_ice_core: pst    : ', tab3d_2=p_qns   , clinfo2=' p_qns  : ', kdim=ijpl)
640         CALL prt_ctl(tab2d_1=p_tpr   , clinfo1=' blk_ice_core: p_tpr  : ', tab2d_2=p_spr   , clinfo2=' p_spr  : ')
641         CALL prt_ctl(tab2d_1=p_taui  , clinfo1=' blk_ice_core: p_taui : ', tab2d_2=p_tauj  , clinfo2=' p_tauj : ')
642         CALL prt_ctl(tab2d_1=z_wnds_t, clinfo1=' blk_ice_core: z_wnds_t : ')
643      ENDIF
644
645      CALL wrk_dealloc( jpi,jpj, z_wnds_t )
646      CALL wrk_dealloc( jpi,jpj,pdim, z_qlw, z_qsb, z_dqlw, z_dqsb ) 
647      !
648      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core')
649      !
650   END SUBROUTINE blk_ice_core
651 
652
653   SUBROUTINE TURB_CORE_1Z(zu, sst, T_a, q_sat, q_a,   &
654      &                        dU , Cd , Ch   , Ce   )
655      !!----------------------------------------------------------------------
656      !!                      ***  ROUTINE  turb_core  ***
657      !!
658      !! ** Purpose :   Computes turbulent transfert coefficients of surface
659      !!                fluxes according to Large & Yeager (2004)
660      !!
661      !! ** 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
662      !!      Momentum, Latent and sensible heat exchange coefficients
663      !!      Caution: this procedure should only be used in cases when air
664      !!      temperature (T_air), air specific humidity (q_air) and wind (dU)
665      !!      are provided at the same height 'zzu'!
666      !!
667      !! References :   Large & Yeager, 2004 : ???
668      !!----------------------------------------------------------------------
669      REAL(wp)                , INTENT(in   ) ::   zu      ! altitude of wind measurement       [m]
670      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   sst     ! sea surface temperature         [Kelvin]
671      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   T_a     ! potential air temperature       [Kelvin]
672      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   q_sat   ! sea surface specific humidity   [kg/kg]
673      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   q_a     ! specific air humidity           [kg/kg]
674      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   dU      ! wind module |U(zu)-U(0)|        [m/s]
675      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Cd      ! transfert coefficient for momentum       (tau)
676      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Ch      ! transfert coefficient for temperature (Q_sens)
677      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   Ce      ! transfert coefficient for evaporation  (Q_lat)
678      !!
679      INTEGER :: j_itt
680      INTEGER , PARAMETER ::   nb_itt = 3
681      REAL(wp), PARAMETER ::   grav   = 9.8   ! gravity                       
682      REAL(wp), PARAMETER ::   kappa  = 0.4   ! von Karman s constant
683
684      REAL(wp), DIMENSION(:,:), POINTER  ::   dU10          ! dU                                   [m/s]
685      REAL(wp), DIMENSION(:,:), POINTER  ::   dT            ! air/sea temperature differeence      [K]
686      REAL(wp), DIMENSION(:,:), POINTER  ::   dq            ! air/sea humidity difference          [K]
687      REAL(wp), DIMENSION(:,:), POINTER  ::   Cd_n10        ! 10m neutral drag coefficient
688      REAL(wp), DIMENSION(:,:), POINTER  ::   Ce_n10        ! 10m neutral latent coefficient
689      REAL(wp), DIMENSION(:,:), POINTER  ::   Ch_n10        ! 10m neutral sensible coefficient
690      REAL(wp), DIMENSION(:,:), POINTER  ::   sqrt_Cd_n10   ! root square of Cd_n10
691      REAL(wp), DIMENSION(:,:), POINTER  ::   sqrt_Cd       ! root square of Cd
692      REAL(wp), DIMENSION(:,:), POINTER  ::   T_vpot        ! virtual potential temperature        [K]
693      REAL(wp), DIMENSION(:,:), POINTER  ::   T_star        ! turbulent scale of tem. fluct.
694      REAL(wp), DIMENSION(:,:), POINTER  ::   q_star        ! turbulent humidity of temp. fluct.
695      REAL(wp), DIMENSION(:,:), POINTER  ::   U_star        ! turb. scale of velocity fluct.
696      REAL(wp), DIMENSION(:,:), POINTER  ::   L             ! Monin-Obukov length                  [m]
697      REAL(wp), DIMENSION(:,:), POINTER  ::   zeta          ! stability parameter at height zu
698      REAL(wp), DIMENSION(:,:), POINTER  ::   U_n10         ! neutral wind velocity at 10m         [m]   
699      REAL(wp), DIMENSION(:,:), POINTER  ::   xlogt, xct, zpsi_h, zpsi_m
700     
701      INTEGER , DIMENSION(:,:), POINTER  ::   stab          ! 1st guess stability test integer
702      !!----------------------------------------------------------------------
703      !
704      IF( nn_timing == 1 )  CALL timing_start('TURB_CORE_1Z')
705      !
706      CALL wrk_alloc( jpi,jpj, stab )   ! integer
707      CALL wrk_alloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L )
708      CALL wrk_alloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta, U_n10, xlogt, xct, zpsi_h, zpsi_m )
709
710      !! * Start
711      !! Air/sea differences
712      dU10 = max(0.5, dU)     ! we don't want to fall under 0.5 m/s
713      dT = T_a - sst          ! assuming that T_a is allready the potential temp. at zzu
714      dq = q_a - q_sat
715      !!   
716      !! Virtual potential temperature
717      T_vpot = T_a*(1. + 0.608*q_a)
718      !!
719      !! Neutral Drag Coefficient
720      stab    = 0.5 + sign(0.5,dT)    ! stable : stab = 1 ; unstable : stab = 0
721      IF  ( ln_cdgw ) THEN
722        cdn_wave = cdn_wave - rsmall*(tmask(:,:,1)-1)
723        Cd_n10(:,:) =   cdn_wave
724      ELSE
725        Cd_n10  = 1E-3 * ( 2.7/dU10 + 0.142 + dU10/13.09 )    !   L & Y eq. (6a)
726      ENDIF
727      sqrt_Cd_n10 = sqrt(Cd_n10)
728      Ce_n10  = 1E-3 * ( 34.6 * sqrt_Cd_n10 )               !   L & Y eq. (6b)
729      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1-stab)) !   L & Y eq. (6c), (6d)
730      !!
731      !! Initializing transfert coefficients with their first guess neutral equivalents :
732      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
733
734      !! * Now starting iteration loop
735      DO j_itt=1, nb_itt
736         !! Turbulent scales :
737         U_star  = sqrt_Cd*dU10                !   L & Y eq. (7a)
738         T_star  = Ch/sqrt_Cd*dT               !   L & Y eq. (7b)
739         q_star  = Ce/sqrt_Cd*dq               !   L & Y eq. (7c)
740
741         !! Estimate the Monin-Obukov length :
742         L  = (U_star**2)/( kappa*grav*(T_star/T_vpot + q_star/(q_a + 1./0.608)) )
743
744         !! Stability parameters :
745         zeta  = zu/L ;  zeta   = sign( min(abs(zeta),10.0), zeta )
746         zpsi_h  = psi_h(zeta)
747         zpsi_m  = psi_m(zeta)
748
749         IF  ( ln_cdgw ) THEN
750           sqrt_Cd=kappa/((kappa/sqrt_Cd_n10) - zpsi_m) ; Cd=sqrt_Cd*sqrt_Cd;
751         ELSE
752           !! Shifting the wind speed to 10m and neutral stability :
753           U_n10 = dU10*1./(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)) !  L & Y eq. (9a)
754
755           !! Updating the neutral 10m transfer coefficients :
756           Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)              !  L & Y eq. (6a)
757           sqrt_Cd_n10 = sqrt(Cd_n10)
758           Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                           !  L & Y eq. (6b)
759           stab    = 0.5 + sign(0.5,zeta)
760           Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab))           !  L & Y eq. (6c), (6d)
761
762           !! Shifting the neutral  10m transfer coefficients to ( zu , zeta ) :
763           !!
764           xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10) - zpsi_m)
765           Cd  = Cd_n10/(xct*xct) ;  sqrt_Cd = sqrt(Cd)
766         ENDIF
767         !!
768         xlogt = log(zu/10.) - zpsi_h
769         !!
770         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
771         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
772         !!
773         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
774         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
775         !!
776      END DO
777      !!
778      CALL wrk_dealloc( jpi,jpj, stab )   ! integer
779      CALL wrk_dealloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L )
780      CALL wrk_dealloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta, U_n10, xlogt, xct, zpsi_h, zpsi_m )
781      !
782      IF( nn_timing == 1 )  CALL timing_stop('TURB_CORE_1Z')
783      !
784    END SUBROUTINE TURB_CORE_1Z
785
786
787    SUBROUTINE TURB_CORE_2Z(zt, zu, sst, T_zt, q_sat, q_zt, dU, Cd, Ch, Ce, T_zu, q_zu)
788      !!----------------------------------------------------------------------
789      !!                      ***  ROUTINE  turb_core  ***
790      !!
791      !! ** Purpose :   Computes turbulent transfert coefficients of surface
792      !!                fluxes according to Large & Yeager (2004).
793      !!
794      !! ** 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
795      !!      Momentum, Latent and sensible heat exchange coefficients
796      !!      Caution: this procedure should only be used in cases when air
797      !!      temperature (T_air) and air specific humidity (q_air) are at 2m
798      !!      whereas wind (dU) is at 10m.
799      !!
800      !! References :   Large & Yeager, 2004 : ???
801      !!----------------------------------------------------------------------
802      REAL(wp), INTENT(in   )                     ::   zt       ! height for T_zt and q_zt                   [m]
803      REAL(wp), INTENT(in   )                     ::   zu       ! height for dU                              [m]
804      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   sst      ! sea surface temperature              [Kelvin]
805      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   T_zt     ! potential air temperature            [Kelvin]
806      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_sat    ! sea surface specific humidity         [kg/kg]
807      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   q_zt     ! specific air humidity                 [kg/kg]
808      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   dU       ! relative wind module |U(zu)-U(0)|       [m/s]
809      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Cd       ! transfer coefficient for momentum         (tau)
810      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ch       ! transfer coefficient for sensible heat (Q_sens)
811      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   Ce       ! transfert coefficient for evaporation   (Q_lat)
812      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   T_zu     ! air temp. shifted at zu                     [K]
813      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   q_zu     ! spec. hum.  shifted at zu               [kg/kg]
814
815      INTEGER :: j_itt
816      INTEGER , PARAMETER :: nb_itt = 3              ! number of itterations
817      REAL(wp), PARAMETER ::   grav   = 9.8          ! gravity                       
818      REAL(wp), PARAMETER ::   kappa  = 0.4          ! von Karman's constant
819     
820      REAL(wp), DIMENSION(:,:), POINTER ::   dU10          ! dU                                [m/s]
821      REAL(wp), DIMENSION(:,:), POINTER ::   dT            ! air/sea temperature differeence   [K]
822      REAL(wp), DIMENSION(:,:), POINTER ::   dq            ! air/sea humidity difference       [K]
823      REAL(wp), DIMENSION(:,:), POINTER ::   Cd_n10        ! 10m neutral drag coefficient
824      REAL(wp), DIMENSION(:,:), POINTER ::   Ce_n10        ! 10m neutral latent coefficient
825      REAL(wp), DIMENSION(:,:), POINTER ::   Ch_n10        ! 10m neutral sensible coefficient
826      REAL(wp), DIMENSION(:,:), POINTER ::   sqrt_Cd_n10   ! root square of Cd_n10
827      REAL(wp), DIMENSION(:,:), POINTER ::   sqrt_Cd       ! root square of Cd
828      REAL(wp), DIMENSION(:,:), POINTER ::   T_vpot        ! virtual potential temperature        [K]
829      REAL(wp), DIMENSION(:,:), POINTER ::   T_star        ! turbulent scale of tem. fluct.
830      REAL(wp), DIMENSION(:,:), POINTER ::   q_star        ! turbulent humidity of temp. fluct.
831      REAL(wp), DIMENSION(:,:), POINTER ::   U_star        ! turb. scale of velocity fluct.
832      REAL(wp), DIMENSION(:,:), POINTER ::   L             ! Monin-Obukov length                  [m]
833      REAL(wp), DIMENSION(:,:), POINTER ::   zeta_u        ! stability parameter at height zu
834      REAL(wp), DIMENSION(:,:), POINTER ::   zeta_t        ! stability parameter at height zt
835      REAL(wp), DIMENSION(:,:), POINTER ::   U_n10         ! neutral wind velocity at 10m        [m]
836      REAL(wp), DIMENSION(:,:), POINTER ::   xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m
837
838      INTEGER , DIMENSION(:,:), POINTER ::   stab          ! 1st stability test integer
839      !!----------------------------------------------------------------------
840      !
841      IF( nn_timing == 1 )  CALL timing_start('TURB_CORE_2Z')
842      !
843      CALL wrk_alloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L )
844      CALL wrk_alloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta_u, zeta_t, U_n10 )
845      CALL wrk_alloc( jpi,jpj, xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m )
846      CALL wrk_alloc( jpi,jpj, stab )   ! interger
847
848      !! Initial air/sea differences
849      dU10 = max(0.5, dU)      !  we don't want to fall under 0.5 m/s
850      dT = T_zt - sst 
851      dq = q_zt - q_sat
852
853      !! Neutral Drag Coefficient :
854      stab = 0.5 + sign(0.5,dT)                 ! stab = 1  if dT > 0  -> STABLE
855      IF( ln_cdgw ) THEN
856        cdn_wave = cdn_wave - rsmall*(tmask(:,:,1)-1)
857        Cd_n10(:,:) =   cdn_wave
858      ELSE
859        Cd_n10  = 1E-3*( 2.7/dU10 + 0.142 + dU10/13.09 ) 
860      ENDIF
861      sqrt_Cd_n10 = sqrt(Cd_n10)
862      Ce_n10  = 1E-3*( 34.6 * sqrt_Cd_n10 )
863      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1 - stab))
864
865      !! Initializing transf. coeff. with their first guess neutral equivalents :
866      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
867
868      !! Initializing z_u values with z_t values :
869      T_zu = T_zt ;  q_zu = q_zt
870
871      !!  * Now starting iteration loop
872      DO j_itt=1, nb_itt
873         dT = T_zu - sst ;  dq = q_zu - q_sat ! Updating air/sea differences
874         T_vpot = T_zu*(1. + 0.608*q_zu)    ! Updating virtual potential temperature at zu
875         U_star = sqrt_Cd*dU10                ! Updating turbulent scales :   (L & Y eq. (7))
876         T_star  = Ch/sqrt_Cd*dT              !
877         q_star  = Ce/sqrt_Cd*dq              !
878         !!
879         L = (U_star*U_star) &                ! Estimate the Monin-Obukov length at height zu
880              & / (kappa*grav/T_vpot*(T_star*(1.+0.608*q_zu) + 0.608*T_zu*q_star))
881         !! Stability parameters :
882         zeta_u  = zu/L  ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u )
883         zeta_t  = zt/L  ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t )
884         zpsi_hu = psi_h(zeta_u)
885         zpsi_ht = psi_h(zeta_t)
886         zpsi_m  = psi_m(zeta_u)
887         !!
888         !! Shifting the wind speed to 10m and neutral stability : (L & Y eq.(9a))
889!        U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u)))
890         U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m))
891         !!
892         !! Shifting temperature and humidity at zu :          (L & Y eq. (9b-9c))
893!        T_zu = T_zt - T_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
894         T_zu = T_zt - T_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
895!        q_zu = q_zt - q_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
896         q_zu = q_zt - q_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
897         !!
898         !! q_zu cannot have a negative value : forcing 0
899         stab = 0.5 + sign(0.5,q_zu) ;  q_zu = stab*q_zu
900         !!
901         IF( ln_cdgw ) THEN
902            sqrt_Cd=kappa/((kappa/sqrt_Cd_n10) - zpsi_m) ; Cd=sqrt_Cd*sqrt_Cd;
903         ELSE
904           !! Updating the neutral 10m transfer coefficients :
905           Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)    ! L & Y eq. (6a)
906           sqrt_Cd_n10 = sqrt(Cd_n10)
907           Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                 ! L & Y eq. (6b)
908           stab    = 0.5 + sign(0.5,zeta_u)
909           Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab)) ! L & Y eq. (6c-6d)
910           !!
911           !!
912           !! Shifting the neutral 10m transfer coefficients to (zu,zeta_u) :
913           xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)
914           Cd = Cd_n10/(xct*xct) ; sqrt_Cd = sqrt(Cd)
915         ENDIF
916         !!
917         xlogt = log(zu/10.) - zpsi_hu
918         !!
919         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
920         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
921         !!
922         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
923         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
924         !!
925         !!
926      END DO
927      !!
928      CALL wrk_dealloc( jpi,jpj, dU10, dT, dq, Cd_n10, Ce_n10, Ch_n10, sqrt_Cd_n10, sqrt_Cd, L )
929      CALL wrk_dealloc( jpi,jpj, T_vpot, T_star, q_star, U_star, zeta_u, zeta_t, U_n10 )
930      CALL wrk_dealloc( jpi,jpj, xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m )
931      CALL wrk_dealloc( jpi,jpj, stab )   ! interger
932      !
933      IF( nn_timing == 1 )  CALL timing_stop('TURB_CORE_2Z')
934      !
935    END SUBROUTINE TURB_CORE_2Z
936
937
938    FUNCTION psi_m(zta)   !! Psis, L & Y eq. (8c), (8d), (8e)
939      !-------------------------------------------------------------------------------
940      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta
941
942      REAL(wp), PARAMETER :: pi = 3.141592653589793_wp
943      REAL(wp), DIMENSION(jpi,jpj)             :: psi_m
944      REAL(wp), DIMENSION(:,:), POINTER        :: X2, X, stabit
945      !-------------------------------------------------------------------------------
946
947      CALL wrk_alloc( jpi,jpj, X2, X, stabit )
948
949      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.0) ;  X  = sqrt(X2)
950      stabit    = 0.5 + sign(0.5,zta)
951      psi_m = -5.*zta*stabit  &                                                          ! Stable
952         &    + (1. - stabit)*(2*log((1. + X)/2) + log((1. + X2)/2) - 2*atan(X) + pi/2)  ! Unstable
953
954      CALL wrk_dealloc( jpi,jpj, X2, X, stabit )
955      !
956    END FUNCTION psi_m
957
958
959    FUNCTION psi_h( zta )    !! Psis, L & Y eq. (8c), (8d), (8e)
960      !-------------------------------------------------------------------------------
961      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   zta
962      !
963      REAL(wp), DIMENSION(jpi,jpj)             ::   psi_h
964      REAL(wp), DIMENSION(:,:), POINTER        :: X2, X, stabit
965      !-------------------------------------------------------------------------------
966
967      CALL wrk_alloc( jpi,jpj, X2, X, stabit )
968
969      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.) ;  X  = sqrt(X2)
970      stabit    = 0.5 + sign(0.5,zta)
971      psi_h = -5.*zta*stabit  &                                       ! Stable
972         &    + (1. - stabit)*(2.*log( (1. + X2)/2. ))                 ! Unstable
973
974      CALL wrk_dealloc( jpi,jpj, X2, X, stabit )
975      !
976    END FUNCTION psi_h
977 
978   !!======================================================================
979END MODULE sbcblk_core
Note: See TracBrowser for help on using the repository browser.