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/2011/dev_MERCATOR_INGV_2011_MERGE/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2011/dev_MERCATOR_INGV_2011_MERGE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90 @ 3085

Last change on this file since 3085 was 3085, checked in by cbricaud, 12 years ago

commit changes from dev_INGV_2011

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