New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
sbcblk_core.F90 in branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90 @ 4827

Last change on this file since 4827 was 4827, checked in by charris, 9 years ago

Some demonstration code changes.

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