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_clio.F90 in branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90 @ 3432

Last change on this file since 3432 was 3432, checked in by trackstand2, 12 years ago

Merge branch 'ksection_partition'

  • Property svn:keywords set to Id
File size: 54.6 KB
Line 
1MODULE sbcblk_clio
2   !!======================================================================
3   !!                   ***  MODULE  sbcblk_clio  ***
4   !! Ocean forcing:  bulk thermohaline forcing of the ocean (or ice)
5   !!=====================================================================
6   !! History :  OPA  !  1997-06 (Louvain-La-Neuve)  Original code
7   !!                 !  2001-04 (C. Ethe) add flx_blk_declin
8   !!   NEMO     2.0  !  2002-08 (C. Ethe, G. Madec) F90: Free form and module
9   !!            3.0  !  2008-03 (C. Talandier, G. Madec) surface module + LIM3
10   !!            3.2  !  2009-04 (B. Lemaire) Introduce iom_put
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   sbc_blk_clio   : CLIO bulk formulation: read and update required input fields
15   !!   blk_clio_oce   : ocean CLIO bulk formulea: compute momentum, heat and freswater fluxes for the ocean
16   !!   blk_ice_clio   : ice   CLIO bulk formulea: compute momentum, heat and freswater fluxes for the sea-ice
17   !!   blk_clio_qsr_oce : shortwave radiation for ocean computed from the cloud cover
18   !!   blk_clio_qsr_ice : shortwave radiation for ice   computed from the cloud cover
19   !!   flx_blk_declin : solar declinaison
20   !!----------------------------------------------------------------------
21   USE oce             ! ocean dynamics and tracers
22   USE dom_oce         ! ocean space and time domain
23   USE phycst          ! physical constants
24   USE fldread         ! read input fields
25   USE sbc_oce         ! Surface boundary condition: ocean fields
26   USE iom             ! I/O manager library
27   USE in_out_manager  ! I/O manager
28   USE lib_mpp         ! distribued memory computing library
29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
30
31   USE albedo
32   USE prtctl          ! Print control
33#if defined key_lim3
34   USE ice
35   USE sbc_ice         ! Surface boundary condition: ice fields
36#elif defined key_lim2
37   USE ice_2
38#endif
39
40   IMPLICIT NONE
41   PRIVATE
42
43   PUBLIC sbc_blk_clio        ! routine called by sbcmod.F90
44   PUBLIC blk_ice_clio        ! routine called by sbcice_lim.F90
45
46   INTEGER , PARAMETER ::   jpfld   = 7           ! maximum number of files to read
47   INTEGER , PARAMETER ::   jp_utau = 1           ! index of wind stress (i-component)      (N/m2)    at U-point
48   INTEGER , PARAMETER ::   jp_vtau = 2           ! index of wind stress (j-component)      (N/m2)    at V-point
49   INTEGER , PARAMETER ::   jp_wndm = 3           ! index of 10m wind module                 (m/s)    at T-point
50   INTEGER , PARAMETER ::   jp_humi = 4           ! index of specific humidity               ( - )
51   INTEGER , PARAMETER ::   jp_ccov = 5           ! index of cloud cover                     ( - )
52   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
53   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
54
55   TYPE(FLD),ALLOCATABLE,DIMENSION(:) :: sf  ! structure of input fields (file informations, fields read)
56
57   INTEGER, PARAMETER  ::   jpintsr = 24          ! number of time step between sunrise and sunset
58   !                                              ! uses for heat flux computation
59   LOGICAL ::   lbulk_init = .TRUE.               ! flag, bulk initialization done or not)
60
61#if ! defined key_lim3                         
62   ! in namicerun with LIM3
63   REAL(wp) ::   cai = 1.40e-3 ! best estimate of atm drag in order to get correct FS export in ORCA2-LIM
64   REAL(wp) ::   cao = 1.00e-3 ! chosen by default  ==> should depends on many things...  !!gmto be updated
65#endif
66
67   REAL(wp) ::   rdtbs2      !:   
68   
69   REAL(wp), DIMENSION(19)  ::  budyko            ! BUDYKO's coefficient (cloudiness effect on LW radiation)
70   DATA budyko / 1.00, 0.98, 0.95, 0.92, 0.89, 0.86, 0.83, 0.80, 0.78, 0.75,   &
71      &          0.72, 0.69, 0.67, 0.64, 0.61, 0.58, 0.56, 0.53, 0.50 /
72   REAL(wp), DIMENSION(20)  :: tauco              ! cloud optical depth coefficient
73   DATA tauco / 6.6, 6.6, 7.0, 7.2, 7.1, 6.8, 6.5, 6.6, 7.1, 7.6,   &
74      &         6.6, 6.1, 5.6, 5.5, 5.8, 5.8, 5.6, 5.6, 5.6, 5.6 /
75   !!
76   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sbudyko      ! cloudiness effect on LW radiation
77   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   stauc        ! cloud optical depth
78   
79   REAL(wp) ::   eps20  = 1.e-20   ! constant values
80   
81   !! * Control permutation of array indices
82#  include "oce_ftrans.h90"
83#  include "dom_oce_ftrans.h90"
84#  include "sbc_oce_ftrans.h90"
85
86   !! * Substitutions
87#  include "vectopt_loop_substitute.h90"
88   !!----------------------------------------------------------------------
89   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
90   !! $Id$
91   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
92   !!----------------------------------------------------------------------
93CONTAINS
94
95   SUBROUTINE sbc_blk_clio( kt )
96      !!---------------------------------------------------------------------
97      !!                    ***  ROUTINE sbc_blk_clio  ***
98      !!                   
99      !! ** Purpose :   provide at each time step the surface ocean fluxes
100      !!      (momentum, heat, freshwater and runoff)
101      !!
102      !! ** Method  : (1) READ each fluxes in NetCDF files:
103      !!      the i-component of the stress                (N/m2)
104      !!      the j-component of the stress                (N/m2)
105      !!      the 10m wind pseed module                    (m/s)
106      !!      the 10m air temperature                      (Kelvin)
107      !!      the 10m specific humidity                    (-)
108      !!      the cloud cover                              (-)
109      !!      the total precipitation (rain+snow)          (Kg/m2/s)
110      !!              (2) CALL blk_oce_clio
111      !!
112      !!      C A U T I O N : never mask the surface stress fields
113      !!                      the stress is assumed to be in the mesh referential
114      !!                      i.e. the (i,j) referential
115      !!
116      !! ** Action  :   defined at each time-step at the air-sea interface
117      !!              - utau, vtau  i- and j-component of the wind stress
118      !!              - taum        wind stress module at T-point
119      !!              - wndm        10m wind module at T-point
120      !!              - qns, qsr    non-slor and solar heat flux
121      !!              - emp, emps   evaporation minus precipitation
122      !!----------------------------------------------------------------------
123      INTEGER, INTENT(in) ::   kt   ! ocean time step
124      !!
125      INTEGER  ::   ifpr, jfpr   ! dummy indices
126      INTEGER  ::   ierr0, ierr1, ierr2, ierr3   ! return error code
127      !!
128      CHARACTER(len=100) ::  cn_dir                            !   Root directory for location of CLIO files
129      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                 ! array of namelist informations on the fields to read
130      TYPE(FLD_N) ::   sn_utau, sn_vtau, sn_wndm, sn_tair      ! informations about the fields to be read
131      TYPE(FLD_N) ::   sn_humi, sn_ccov, sn_prec               !   "                                 "
132      !!
133      NAMELIST/namsbc_clio/ cn_dir, sn_utau, sn_vtau, sn_wndm, sn_humi,   &
134         &                          sn_ccov, sn_tair, sn_prec
135      !!---------------------------------------------------------------------
136
137      !                                         ! ====================== !
138      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
139         !                                      ! ====================== !
140         ! set file information (default values)
141         cn_dir = './'       ! directory in which the model is executed
142
143         ! (NB: frequency positive => hours, negative => months)
144         !            !    file    ! frequency ! variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
145         !            !    name    !  (hours)  !  name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
146         sn_utau = FLD_N( 'utau'   ,    24     , 'utau'   ,  .true.    , .false. ,   'yearly'  , ''       , ''       ) 
147         sn_vtau = FLD_N( 'vtau'   ,    24     , 'vtau'   ,  .true.    , .false. ,   'yearly'  , ''       , ''       ) 
148         sn_wndm = FLD_N( 'mwnd10m',    24     , 'm_10'   ,  .true.    , .false. ,   'yearly'  , ''       , ''       ) 
149         sn_tair = FLD_N( 'tair10m',    24     , 't_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       ) 
150         sn_humi = FLD_N( 'humi10m',    24     , 'q_10'   ,  .false.   , .false. ,   'yearly'  , ''       , ''       ) 
151         sn_ccov = FLD_N( 'ccover' ,    -1     , 'cloud'  ,  .true.    , .false. ,   'yearly'  , ''       , ''       ) 
152         sn_prec = FLD_N( 'precip' ,    -1     , 'precip' ,  .true.    , .false. ,   'yearly'  , ''       , ''       ) 
153
154         REWIND( numnam )                    ! ... read in namlist namsbc_clio
155         READ  ( numnam, namsbc_clio )
156
157         ! store namelist information in an array
158         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau   ;   slf_i(jp_wndm) = sn_wndm
159         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
160         slf_i(jp_ccov) = sn_ccov   ;   slf_i(jp_prec) = sn_prec
161         
162         ! set sf structure
163         ALLOCATE( sf(jpfld), STAT=ierr0 )
164         IF( ierr0 > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_clio: unable to allocate sf structure' )
165         DO ifpr= 1, jpfld
166            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) , STAT=ierr1)
167            IF( slf_i(ifpr)%ln_tint ) ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) , STAT=ierr2 )
168         END DO
169         IF( ierr1+ierr2 > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_clio: unable to allocate sf array structure' )
170         ! fill sf with slf_i and control print
171         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_clio', 'flux formulation for ocean surface boundary condition', 'namsbc_clio' )
172         
173         ! allocate sbcblk clio arrays
174         ALLOCATE( sbudyko(jpi,jpj) , stauc(jpi,jpj), STAT=ierr3 )
175         IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_clio: unable to allocate arrays' )
176         !
177      ENDIF
178      !                                         ! ====================== !
179      !                                         !    At each time-step   !
180      !                                         ! ====================== !
181      !
182      CALL fld_read( kt, nn_fsbc, sf )                ! input fields provided at the current time-step
183      !
184      IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_clio( sf, sst_m )
185      !
186   END SUBROUTINE sbc_blk_clio
187
188
189   SUBROUTINE blk_oce_clio( sf, pst )
190      !!---------------------------------------------------------------------------
191      !!                     ***  ROUTINE blk_oce_clio  ***
192      !!                 
193      !!  ** Purpose :   Compute momentum, heat and freshwater fluxes at ocean surface
194      !!               using CLIO bulk formulea
195      !!         
196      !!  ** Method  :   The flux of heat at the ocean surfaces are derived
197      !!       from semi-empirical ( or bulk ) formulae which relate the flux to
198      !!       the properties of the surface and of the lower atmosphere. Here, we
199      !!       follow the work of Oberhuber, 1988   
200      !!               - momentum flux (stresses) directly read in files at U- and V-points
201      !!               - compute ocean/ice albedos (call albedo_oce/albedo_ice) 
202      !!               - compute shortwave radiation for ocean (call blk_clio_qsr_oce)
203      !!               - compute long-wave radiation for the ocean
204      !!               - compute the turbulent heat fluxes over the ocean
205      !!               - deduce the evaporation over the ocean
206      !!  ** Action  :   Fluxes over the ocean:
207      !!               - utau, vtau  i- and j-component of the wind stress
208      !!               - taum        wind stress module at T-point
209      !!               - wndm        10m wind module at T-point
210      !!               - qns, qsr    non-slor and solar heat flux
211      !!               - emp, emps   evaporation minus precipitation
212      !!  ** Nota    :   sf has to be a dummy argument for AGRIF on NEC
213      !!----------------------------------------------------------------------
214      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
215      USE wrk_nemo, ONLY: zqlw => wrk_2d_1  ! long-wave heat flux over ocean
216      USE wrk_nemo, ONLY: zqla => wrk_2d_2  ! latent heat flux over ocean
217      USE wrk_nemo, ONLY: zqsb => wrk_2d_3  ! sensible heat flux over ocean
218      !!
219      TYPE(fld), INTENT(in), DIMENSION(:)       ::   sf    ! input data
220      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj) ::   pst   ! surface temperature                      [Celcius]
221      !!
222      INTEGER  ::   ji, jj   ! dummy loop indices
223      !!
224      REAL(wp) ::   zrhova, zcsho, zcleo, zcldeff               ! temporary scalars
225      REAL(wp) ::   zqsato, zdteta, zdeltaq, ztvmoy, zobouks    !    -         -
226      REAL(wp) ::   zpsims, zpsihs, zpsils, zobouku, zxins, zpsimu   !    -         -
227      REAL(wp) ::   zpsihu, zpsilu, zstab,zpsim, zpsih, zpsil   !    -         -
228      REAL(wp) ::   zvatmg, zcmn, zchn, zcln, zcmcmn, zdenum    !    -         -
229      REAL(wp) ::   zdtetar, ztvmoyr, zlxins, zchcm, zclcm      !    -         -
230      REAL(wp) ::   zmt1, zmt2, zmt3, ztatm3, ztamr, ztaevbk    !    -         -
231      REAL(wp) ::   zsst, ztatm, zcco1, zpatm, zcmax, zrmax     !    -         -
232      REAL(wp) ::   zrhoa, zev, zes, zeso, zqatm, zevsqr        !    -         -
233      REAL(wp) ::   ztx2, zty2                                  !    -         -
234      !!---------------------------------------------------------------------
235
236      IF( wrk_in_use(3, 1,2,3) ) THEN
237         CALL ctl_stop('blk_oce_clio: requested workspace arrays are unavailable')   ;   RETURN
238      ENDIF
239
240      zpatm = 101000._wp      ! atmospheric pressure  (assumed constant here)
241
242      !------------------------------------!
243      !   momentum fluxes  (utau, vtau )   !
244      !------------------------------------!
245!CDIR COLLAPSE
246      utau(:,:) = sf(jp_utau)%fnow(:,:,1)
247!CDIR COLLAPSE
248      vtau(:,:) = sf(jp_vtau)%fnow(:,:,1)
249
250      !------------------------------------!
251      !   wind stress module (taum )       !
252      !------------------------------------!
253!CDIR NOVERRCHK
254      DO jj = 2, jpjm1
255!CDIR NOVERRCHK
256         DO ji = fs_2, fs_jpim1   ! vector opt.
257            ztx2 = utau(ji-1,jj  ) + utau(ji,jj)
258            zty2 = vtau(ji  ,jj-1) + vtau(ji,jj)
259            taum(ji,jj) = 0.5 * SQRT( ztx2 * ztx2 + zty2 * zty2 )
260         END DO
261      END DO
262      CALL lbc_lnk( taum, 'T', 1. )
263
264      !------------------------------------!
265      !   store the wind speed  (wndm )    !
266      !------------------------------------!
267!CDIR COLLAPSE
268      wndm(:,:) = sf(jp_wndm)%fnow(:,:,1)
269
270      !------------------------------------------------!
271      !   Shortwave radiation for ocean and snow/ice   !
272      !------------------------------------------------!
273     
274      CALL blk_clio_qsr_oce( qsr )
275
276      !------------------------!
277      !   Other ocean fluxes   !
278      !------------------------!
279!CDIR NOVERRCHK
280!CDIR COLLAPSE
281      DO jj = 1, jpj
282!CDIR NOVERRCHK
283         DO ji = 1, jpi
284            !
285            zsst  = pst(ji,jj)              + rt0           ! converte Celcius to Kelvin the SST
286            ztatm = sf(jp_tair)%fnow(ji,jj,1)               ! and set minimum value far above 0 K (=rt0 over land)
287            zcco1 = 1.0 - sf(jp_ccov)%fnow(ji,jj,1)         ! fraction of clear sky ( 1 - cloud cover)
288            zrhoa = zpatm / ( 287.04 * ztatm )              ! air density (equation of state for dry air)
289            ztamr = ztatm - rtt                             ! Saturation water vapour
290            zmt1  = SIGN( 17.269,  ztamr )                  !           ||
291            zmt2  = SIGN( 21.875,  ztamr )                  !          \  /
292            zmt3  = SIGN( 28.200, -ztamr )                  !           \/
293            zes   = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 ) / ( ztatm - 35.86  + MAX( 0.e0, zmt3 ) )  )
294            zev    = sf(jp_humi)%fnow(ji,jj,1) * zes        ! vapour pressure 
295            zevsqr = SQRT( zev * 0.01 )                     ! square-root of vapour pressure
296            zqatm = 0.622 * zev / ( zpatm - 0.378 * zev )   ! specific humidity
297
298            !--------------------------------------!
299            !  long-wave radiation over the ocean  !  ( Berliand 1952 ; all latitudes )
300            !--------------------------------------!
301            ztatm3  = ztatm * ztatm * ztatm
302            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)   
303            ztaevbk = ztatm * ztatm3 * zcldeff * ( 0.39 - 0.05 * zevsqr ) 
304            !
305            zqlw(ji,jj) = - emic * stefan * ( ztaevbk + 4. * ztatm3 * ( zsst - ztatm ) ) 
306
307            !--------------------------------------------------
308            !  Latent and sensible heat fluxes over the ocean
309            !--------------------------------------------------
310            !                                                          ! vapour pressure at saturation of ocean
311#if defined key_z_first
312            zeso =  611.0 * EXP ( 17.2693884 * ( zsst - rtt ) * tmask_1(ji,jj) / ( zsst - 35.86 ) )
313#else
314            zeso =  611.0 * EXP ( 17.2693884 * ( zsst - rtt ) * tmask(ji,jj,1) / ( zsst - 35.86 ) )
315#endif
316
317            zqsato = ( 0.622 * zeso ) / ( zpatm - 0.378 * zeso )       ! humidity close to the ocean surface (at saturation)
318
319            ! Drag coefficients from Large and Pond (1981,1982)
320            !                                                          ! Stability parameters
321            zdteta  = zsst - ztatm
322            zdeltaq = zqatm - zqsato
323            ztvmoy  = ztatm * ( 1. + 2.2e-3 * ztatm * zqatm )
324            zdenum  = MAX( sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) * ztvmoy, eps20 )
325            zdtetar = zdteta / zdenum
326            ztvmoyr = ztvmoy * ztvmoy * zdeltaq / zdenum
327            !                                                          ! case of stable atmospheric conditions
328            zobouks = -70.0 * 10. * ( zdtetar + 3.2e-3 * ztvmoyr )
329            zobouks = MAX( 0.e0, zobouks )
330            zpsims = -7.0 * zobouks
331            zpsihs =  zpsims
332            zpsils =  zpsims
333            !                                                          ! case of unstable atmospheric conditions
334            zobouku = MIN(  0.e0, -100.0 * 10.0 * ( zdtetar + 2.2e-3 * ztvmoyr )  )
335            zxins   = ( 1. - 16. * zobouku )**0.25
336            zlxins  = LOG( ( 1. + zxins * zxins ) / 2. )
337            zpsimu  = 2. * LOG( ( 1 + zxins ) * 0.5 )  + zlxins - 2. * ATAN( zxins ) + rpi * 0.5
338            zpsihu  = 2. * zlxins
339            zpsilu  = zpsihu
340            !                                                          ! intermediate values
341            zstab   = MAX( 0.e0, SIGN( 1.e0, zdteta ) )
342            zpsim   = zstab * zpsimu + ( 1.0 - zstab ) * zpsims
343            zpsih   = zstab * zpsihu + ( 1.0 - zstab ) * zpsihs
344            zpsil   = zpsih
345           
346            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) / grav, eps20 )
347            zcmn           = vkarmn / LOG ( 10. / zvatmg )
348            zchn           = 0.0327 * zcmn
349            zcln           = 0.0346 * zcmn
350            zcmcmn         = 1. / ( 1. - zcmn * zpsim / vkarmn )
351            ! sometimes the ratio zchn * zpsih / ( vkarmn * zcmn ) is too close to 1 and zchcm becomes very very big
352            zcmax = 0.1               ! choice for maximum value of the heat transfer coefficient, guided by my intuition
353            zrmax = 1 - 3.e-4 / zcmax ! maximum value of the ratio
354            zchcm = zcmcmn / ( 1. - MIN ( zchn * zpsih / ( vkarmn * zcmn ) , zrmax ) )
355            zclcm          = zchcm
356            !                                                          ! transfert coef. (Large and Pond 1981,1982)
357            zcsho          = zchn * zchcm                               
358            zcleo          = zcln * zclcm 
359
360            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj,1)
361
362            ! sensible heat flux
363            zqsb(ji,jj) = zrhova * zcsho * 1004.0  * ( zsst - ztatm ) 
364         
365            ! latent heat flux (bounded by zero)
366            zqla(ji,jj) = MAX(  0.e0, zrhova * zcleo * 2.5e+06 * ( zqsato - zqatm )  )
367            !               
368         END DO
369      END DO
370     
371      ! ----------------------------------------------------------------------------- !
372      !     III    Total FLUXES                                                       !
373      ! ----------------------------------------------------------------------------- !
374
375!CDIR COLLAPSE
376#if defined key_z_first
377      emp (:,:) = zqla(:,:) / cevap - sf(jp_prec)%fnow(:,:,1) / rday * tmask_1(:,:)
378#else
379      emp (:,:) = zqla(:,:) / cevap - sf(jp_prec)%fnow(:,:,1) / rday * tmask(:,:,1)
380#endif
381      qns (:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)         ! Downward Non Solar flux
382      emps(:,:) = emp(:,:)
383      !
384      CALL iom_put( "qlw_oce",   zqlw )   ! output downward longwave  heat over the ocean
385      CALL iom_put( "qsb_oce", - zqsb )   ! output downward sensible  heat over the ocean
386      CALL iom_put( "qla_oce", - zqla )   ! output downward latent    heat over the ocean
387      CALL iom_put( "qns_oce",   qns  )   ! output downward non solar heat over the ocean
388
389      IF(ln_ctl) THEN
390         CALL prt_ctl(tab2d_1=zqsb , clinfo1=' blk_oce_clio: zqsb   : ', tab2d_2=zqlw , clinfo2=' zqlw  : ')
391         CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce_clio: zqla   : ', tab2d_2=qsr  , clinfo2=' qsr   : ')
392         CALL prt_ctl(tab2d_1=pst  , clinfo1=' blk_oce_clio: pst    : ', tab2d_2=emp  , clinfo2=' emp   : ')
393         CALL prt_ctl(tab2d_1=utau , clinfo1=' blk_oce_clio: utau   : ', mask1=umask,   &
394            &         tab2d_2=vtau , clinfo2=' vtau : ', mask2=vmask )
395      ENDIF
396
397      IF( wrk_not_released(3, 1,2,3) )   CALL ctl_stop('blk_oce_clio: failed to release workspace arrays')
398      !
399   END SUBROUTINE blk_oce_clio
400
401
402   SUBROUTINE blk_ice_clio(  pst   , palb_cs, palb_os ,       &
403      &                      p_taui, p_tauj, p_qns , p_qsr,   &
404      &                      p_qla , p_dqns, p_dqla,          &
405      &                      p_tpr , p_spr ,                  &
406      &                      p_fr1 , p_fr2 , cd_grid, pdim  )
407      !!---------------------------------------------------------------------------
408      !!                     ***  ROUTINE blk_ice_clio  ***
409      !!                 
410      !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
411      !!       surface the solar heat at ocean and snow/ice surfaces and the
412      !!       sensitivity of total heat fluxes to the SST variations
413      !!         
414      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
415      !!       from semi-empirical ( or bulk ) formulae which relate the flux to
416      !!       the properties of the surface and of the lower atmosphere. Here, we
417      !!       follow the work of Oberhuber, 1988   
418      !!
419      !!  ** Action  :   call albedo_oce/albedo_ice to compute ocean/ice albedo
420      !!          computation of snow precipitation
421      !!          computation of solar flux at the ocean and ice surfaces
422      !!          computation of the long-wave radiation for the ocean and sea/ice
423      !!          computation of turbulent heat fluxes over water and ice
424      !!          computation of evaporation over water
425      !!          computation of total heat fluxes sensitivity over ice (dQ/dT)
426      !!          computation of latent heat flux sensitivity over ice (dQla/dT)
427      !!
428      !!----------------------------------------------------------------------
429      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
430      USE wrk_nemo, ONLY:   ztatm  => wrk_2d_1   ! Tair in Kelvin
431      USE wrk_nemo, ONLY:   zqatm  => wrk_2d_2   ! specific humidity
432      USE wrk_nemo, ONLY:   zevsqr => wrk_2d_3   ! vapour pressure square-root
433      USE wrk_nemo, ONLY:   zrhoa  => wrk_2d_4   ! air density
434      USE wrk_nemo, ONLY:   wrk_3d_1 , wrk_3d_2
435      !!
436      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   pst      ! ice surface temperature                   [Kelvin]
437      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_cs  ! ice albedo (clear    sky) (alb_ice_cs)         [%]
438      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_os  ! ice albedo (overcast sky) (alb_ice_os)         [%]
439      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_taui   ! surface ice stress at I-point (i-component) [N/m2]
440      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tauj   ! surface ice stress at I-point (j-component) [N/m2]
441      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qns    ! non solar heat flux over ice (T-point)      [W/m2]
442      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qsr    !     solar heat flux over ice (T-point)      [W/m2]
443      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qla    ! latent    heat flux over ice (T-point)      [W/m2]
444      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqns   ! non solar heat sensistivity  (T-point)      [W/m2]
445      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqla   ! latent    heat sensistivity  (T-point)      [W/m2]
446      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tpr    ! total precipitation          (T-point)   [Kg/m2/s]
447      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_spr    ! solid precipitation          (T-point)   [Kg/m2/s]
448      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr1    ! 1sr fraction of qsr penetration in ice         [%]
449      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr2    ! 2nd fraction of qsr penetration in ice         [%]
450      CHARACTER(len=1), INTENT(in   )             ::   cd_grid  ! type of sea-ice grid ("C" or "B" grid)
451      INTEGER, INTENT(in   )                      ::   pdim     ! number of ice categories
452      !!
453      INTEGER  ::   ji, jj, jl    ! dummy loop indices
454      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
455      !!
456      REAL(wp) ::   zcoef, zmt1, zmt2, zmt3, ztatm3     ! temporary scalars
457      REAL(wp) ::   ztaevbk, zind1, zind2, zind3, ztamr         !    -         -
458      REAL(wp) ::   zesi, zqsati, zdesidt                       !    -         -
459      REAL(wp) ::   zdqla, zcldeff, zev, zes, zpatm, zrhova     !    -         -
460      REAL(wp) ::   zcshi, zclei, zrhovaclei, zrhovacshi        !    -         -
461      REAL(wp) ::   ztice3, zticemb, zticemb2, zdqlw, zdqsb     !    -         -
462      !!
463      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qlw, z_qsb
464      !!---------------------------------------------------------------------
465
466      IF(  wrk_in_use(2, 1,2,3,4)  .OR.  wrk_in_use(3, 1,2)  ) THEN
467         CALL ctl_stop('blk_ice_clio: requested workspace arrays are unavailable')   ;   RETURN
468      ELSE IF(pdim > jpk)THEN
469         CALL ctl_stop('blk_ice_clio: too many ice levels to use wrk_nemo 3D workspaces.')
470         RETURN
471      END IF
472      z_qlw => wrk_3d_1(:,:,1:pdim)
473      z_qsb => wrk_3d_2(:,:,1:pdim)
474
475      ijpl  = pdim                           ! number of ice categories
476      zpatm = 101000.                        ! atmospheric pressure  (assumed constant  here)
477
478#if defined key_lim3     
479      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)   ! LIM3: make Tair available in sea-ice. WARNING allocated after call to ice_init
480#endif
481      !                                                        ! surface ocean fluxes computed with CLIO bulk formulea
482      !------------------------------------!
483      !   momentum fluxes  (utau, vtau )   !
484      !------------------------------------!
485
486      SELECT CASE( cd_grid )
487      CASE( 'C' )                          ! C-grid ice dynamics
488         zcoef  = cai / cao                         ! Change from air-sea stress to air-ice stress
489         p_taui(:,:) = zcoef * utau(:,:)
490         p_tauj(:,:) = zcoef * vtau(:,:)
491      CASE( 'I' )                          ! I-grid ice dynamics:  I-point (i.e. F-point lower-left corner)
492         zcoef  = 0.5_wp * cai / cao                ! Change from air-sea stress to air-ice stress
493         DO jj = 2, jpj         ! stress from ocean U- and V-points to ice U,V point
494            DO ji = 2, jpi   ! I-grid : no vector opt.
495               p_taui(ji,jj) = zcoef * ( utau(ji-1,jj  ) + utau(ji-1,jj-1) )
496               p_tauj(ji,jj) = zcoef * ( vtau(ji  ,jj-1) + vtau(ji-1,jj-1) )
497            END DO
498         END DO
499         CALL lbc_lnk( p_taui(:,:), 'I', -1. )   ;   CALL lbc_lnk( p_tauj(:,:), 'I', -1. )   ! I-point
500      END SELECT
501
502
503      !  Determine cloud optical depths as a function of latitude (Chou et al., 1981).
504      !  and the correction factor for taking into account  the effect of clouds
505      !------------------------------------------------------
506!CDIR NOVERRCHK
507!CDIR COLLAPSE
508      DO jj = 1, jpj
509!CDIR NOVERRCHK
510         DO ji = 1, jpi
511            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj,1)                ! air temperature in Kelvins
512     
513            zrhoa(ji,jj) = zpatm / ( 287.04 * ztatm(ji,jj) )         ! air density (equation of state for dry air)
514     
515            ztamr = ztatm(ji,jj) - rtt                               ! Saturation water vapour
516            zmt1  = SIGN( 17.269,  ztamr )
517            zmt2  = SIGN( 21.875,  ztamr )
518            zmt3  = SIGN( 28.200, -ztamr )
519            zes   = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &
520               &                / ( ztatm(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
521
522            zev = sf(jp_humi)%fnow(ji,jj,1) * zes                    ! vapour pressure 
523            zevsqr(ji,jj) = SQRT( zev * 0.01 )                       ! square-root of vapour pressure
524            zqatm(ji,jj) = 0.622 * zev / ( zpatm - 0.378 * zev )     ! specific humidity
525
526            !----------------------------------------------------
527            !   Computation of snow precipitation (Ledley, 1985) |
528            !----------------------------------------------------
529            zmt1  =   253.0 - ztatm(ji,jj)            ;   zind1 = MAX( 0.e0, SIGN( 1.e0, zmt1 ) )
530            zmt2  = ( 272.0 - ztatm(ji,jj) ) / 38.0   ;   zind2 = MAX( 0.e0, SIGN( 1.e0, zmt2 ) )
531            zmt3  = ( 281.0 - ztatm(ji,jj) ) / 18.0   ;   zind3 = MAX( 0.e0, SIGN( 1.e0, zmt3 ) )
532            p_spr(ji,jj) = sf(jp_prec)%fnow(ji,jj,1) / rday   &      ! rday = converte mm/day to kg/m2/s
533               &         * (          zind1      &                   ! solid  (snow) precipitation [kg/m2/s]
534               &            + ( 1.0 - zind1 ) * (          zind2   * ( 0.5 + zmt2 )   &
535               &                                 + ( 1.0 - zind2 ) *  zind3 * zmt3  )   ) 
536
537            !----------------------------------------------------!
538            !  fraction of net penetrative shortwave radiation   !
539            !----------------------------------------------------!
540            ! fraction of qsr_ice which is NOT absorbed in the thin surface layer
541            ! and thus which penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
542            p_fr1(ji,jj) = 0.18  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.35 * sf(jp_ccov)%fnow(ji,jj,1) 
543            p_fr2(ji,jj) = 0.82  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.65 * sf(jp_ccov)%fnow(ji,jj,1)
544         END DO
545      END DO
546      CALL iom_put( 'snowpre', p_spr )   ! Snow precipitation
547     
548      !-----------------------------------------------------------!
549      !  snow/ice Shortwave radiation   (abedo already computed)  !
550      !-----------------------------------------------------------!
551      CALL blk_clio_qsr_ice( palb_cs, palb_os, p_qsr )
552
553      !                                     ! ========================== !
554      DO jl = 1, ijpl                       !  Loop over ice categories  !
555         !                                  ! ========================== !
556!CDIR NOVERRCHK
557!CDIR COLLAPSE
558         DO jj = 1 , jpj
559!CDIR NOVERRCHK
560            DO ji = 1, jpi
561               !-------------------------------------------!
562               !  long-wave radiation over ice categories  !  ( Berliand 1952 ; all latitudes )
563               !-------------------------------------------!
564               ztatm3  = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
565               zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)   
566               ztaevbk = ztatm3 * ztatm(ji,jj) * zcldeff * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
567               !
568               z_qlw(ji,jj,jl) = - emic * stefan * ( ztaevbk + 4. * ztatm3 * ( pst(ji,jj,jl) - ztatm(ji,jj) ) ) 
569
570               !----------------------------------------
571               !  Turbulent heat fluxes over snow/ice     ( Latent and sensible )
572               !----------------------------------------       
573
574               ! vapour pressure at saturation of ice (tmask to avoid overflow in the exponential)
575#if defined key_z_first
576               zesi =  611.0 * EXP( 21.8745587 * tmask_1(ji,jj) * ( pst(ji,jj,jl) - rtt )/ ( pst(ji,jj,jl) - 7.66 ) )
577#else
578               zesi =  611.0 * EXP( 21.8745587 * tmask(ji,jj,1) * ( pst(ji,jj,jl) - rtt )/ ( pst(ji,jj,jl) - 7.66 ) )
579#endif
580               ! humidity close to the ice surface (at saturation)
581               zqsati   = ( 0.622 * zesi ) / ( zpatm - 0.378 * zesi )
582               
583               !  computation of intermediate values
584               zticemb  = pst(ji,jj,jl) - 7.66
585               zticemb2 = zticemb * zticemb 
586               ztice3   = pst(ji,jj,jl) * pst(ji,jj,jl) * pst(ji,jj,jl)
587               zdesidt  = zesi * ( 9.5 * LOG( 10.0 ) * ( rtt - 7.66 )  / zticemb2 )
588               
589               !  Transfer cofficients assumed to be constant (Parkinson 1979 ; Maykut 1982)
590               zcshi    = 1.75e-03
591               zclei    = zcshi
592               
593               !  sensible and latent fluxes over ice
594               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj,1)      ! computation of intermediate values
595               zrhovaclei = zrhova * zcshi * 2.834e+06
596               zrhovacshi = zrhova * zclei * 1004.0
597           
598               !  sensible heat flux
599               z_qsb(ji,jj,jl) = zrhovacshi * ( pst(ji,jj,jl) - ztatm(ji,jj) )
600           
601               !  latent heat flux
602               p_qla(ji,jj,jl) = MAX(  0.e0, zrhovaclei * ( zqsati - zqatm(ji,jj) )  )
603             
604               !  sensitivity of non solar fluxes (dQ/dT) (long-wave, sensible and latent fluxes)
605               zdqlw = 4.0 * emic * stefan * ztice3
606               zdqsb = zrhovacshi
607               zdqla = zrhovaclei * ( zdesidt * ( zqsati * zqsati / ( zesi * zesi ) ) * ( zpatm / 0.622 ) )   
608               !
609               p_dqla(ji,jj,jl) = zdqla                           ! latent flux sensitivity
610               p_dqns(ji,jj,jl) = -( zdqlw + zdqsb + zdqla )      !  total non solar sensitivity
611            END DO
612            !
613         END DO
614         !
615      END DO
616      !
617      ! ----------------------------------------------------------------------------- !
618      !    Total FLUXES                                                       !
619      ! ----------------------------------------------------------------------------- !
620      !
621!CDIR COLLAPSE
622      p_qns(:,:,:) = z_qlw (:,:,:) - z_qsb (:,:,:) - p_qla (:,:,:)      ! Downward Non Solar flux
623!CDIR COLLAPSE
624      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:,1) / rday                     ! total precipitation [kg/m2/s]
625      !
626!!gm : not necessary as all input data are lbc_lnk...
627      CALL lbc_lnk( p_fr1  (:,:) , 'T', 1. )
628      CALL lbc_lnk( p_fr2  (:,:) , 'T', 1. )
629      DO jl = 1, ijpl
630         CALL lbc_lnk( p_qns (:,:,jl) , 'T', 1. )
631         CALL lbc_lnk( p_dqns(:,:,jl) , 'T', 1. )
632         CALL lbc_lnk( p_qla (:,:,jl) , 'T', 1. )
633         CALL lbc_lnk( p_dqla(:,:,jl) , 'T', 1. )
634      END DO
635
636!!gm : mask is not required on forcing
637      DO jl = 1, ijpl
638#if defined key_z_first
639         p_qns (:,:,jl) = p_qns (:,:,jl) * tmask_1(:,:)
640         p_qla (:,:,jl) = p_qla (:,:,jl) * tmask_1(:,:)
641         p_dqns(:,:,jl) = p_dqns(:,:,jl) * tmask_1(:,:)
642         p_dqla(:,:,jl) = p_dqla(:,:,jl) * tmask_1(:,:)
643#else
644         p_qns (:,:,jl) = p_qns (:,:,jl) * tmask(:,:,1)
645         p_qla (:,:,jl) = p_qla (:,:,jl) * tmask(:,:,1)
646         p_dqns(:,:,jl) = p_dqns(:,:,jl) * tmask(:,:,1)
647         p_dqla(:,:,jl) = p_dqla(:,:,jl) * tmask(:,:,1)
648#endif
649      END DO
650
651      IF(ln_ctl) THEN
652         CALL prt_ctl(tab3d_1=z_qsb  , clinfo1=' blk_ice_clio: z_qsb  : ', tab3d_2=z_qlw  , clinfo2=' z_qlw  : ', kdim=ijpl)
653         CALL prt_ctl(tab3d_1=p_qla  , clinfo1=' blk_ice_clio: z_qla  : ', tab3d_2=p_qsr  , clinfo2=' p_qsr  : ', kdim=ijpl)
654         CALL prt_ctl(tab3d_1=p_dqns , clinfo1=' blk_ice_clio: p_dqns : ', tab3d_2=p_qns  , clinfo2=' p_qns  : ', kdim=ijpl)
655         CALL prt_ctl(tab3d_1=p_dqla , clinfo1=' blk_ice_clio: p_dqla : ', tab3d_2=pst    , clinfo2=' pst    : ', kdim=ijpl)
656         CALL prt_ctl(tab2d_1=p_tpr  , clinfo1=' blk_ice_clio: p_tpr  : ', tab2d_2=p_spr  , clinfo2=' p_spr  : ')
657         CALL prt_ctl(tab2d_1=p_taui , clinfo1=' blk_ice_clio: p_taui : ', tab2d_2=p_tauj , clinfo2=' p_tauj : ')
658      ENDIF
659
660      IF( wrk_not_released(2, 1,2,3,4)  .OR.   &
661          wrk_not_released(3, 1,2)      )   CALL ctl_stop('blk_ice_clio: failed to release workspace arrays')
662      !
663   END SUBROUTINE blk_ice_clio
664
665
666   SUBROUTINE blk_clio_qsr_oce( pqsr_oce )
667      !!---------------------------------------------------------------------------
668      !!                     ***  ROUTINE blk_clio_qsr_oce  ***
669      !!                 
670      !!  ** Purpose :   Computation of the shortwave radiation at the ocean and the
671      !!               snow/ice surfaces.
672      !!         
673      !!  ** Method  : - computed qsr from the cloud cover for both ice and ocean
674      !!               - also initialise sbudyko and stauc once for all
675      !!----------------------------------------------------------------------
676      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
677      USE wrk_nemo, ONLY:   zev   => wrk_2d_1                  ! vapour pressure
678      USE wrk_nemo, ONLY:   zdlha => wrk_2d_2 , zlsrise => wrk_2d_3 , zlsset => wrk_2d_4 
679      USE wrk_nemo, ONLY:   zps   => wrk_2d_5 , zpc     => wrk_2d_6   ! sin/cos of latitude per sin/cos of solar declination
680      !!
681      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj)     ::   pqsr_oce    ! shortwave radiation  over the ocean
682      !!
683      INTEGER, PARAMETER  ::   jp24 = 24   ! sampling of the daylight period (sunrise to sunset) into 24 equal parts
684      !!     
685      INTEGER  ::   ji, jj, jt    ! dummy loop indices
686      INTEGER  ::   indaet            !  = -1, 0, 1 for odd, normal and leap years resp.
687      INTEGER  ::   iday              ! integer part of day
688      INTEGER  ::   indxb, indxc      ! index for cloud depth coefficient
689
690      REAL(wp)  ::   zalat , zclat, zcmue, zcmue2    ! local scalars
691      REAL(wp)  ::   zmt1, zmt2, zmt3                !
692      REAL(wp)  ::   zdecl, zsdecl , zcdecl          !
693      REAL(wp)  ::   za_oce, ztamr                   !
694
695      REAL(wp) ::   zdl, zlha                        ! local scalars
696      REAL(wp) ::   zlmunoon, zcldcor, zdaycor       !   
697      REAL(wp) ::   zxday, zdist, zcoef, zcoef1      !
698      REAL(wp) ::   zes
699      !!---------------------------------------------------------------------
700
701      IF( wrk_in_use(2, 1,2,3,4,5,6) ) THEN
702         CALL ctl_stop('blk_clio_qsr_oce: requested workspace arrays unavailable')   ;   RETURN
703      END IF
704
705      IF( lbulk_init ) THEN             !   Initilization at first time step only
706         rdtbs2 = nn_fsbc * rdt * 0.5
707         ! cloud optical depths as a function of latitude (Chou et al., 1981).
708         ! and the correction factor for taking into account  the effect of clouds
709         DO jj = 1, jpj
710            DO ji = 1 , jpi
711               zalat          = ( 90.e0 - ABS( gphit(ji,jj) ) ) /  5.e0
712               zclat          = ( 95.e0 -      gphit(ji,jj)   ) / 10.e0
713               indxb          = 1 + INT( zalat )
714               indxc          = 1 + INT( zclat )
715               zdl            = zclat - INT( zclat )
716               !  correction factor to account for the effect of clouds
717               sbudyko(ji,jj) = budyko(indxb)
718               stauc  (ji,jj) = ( 1.e0 - zdl ) * tauco( indxc ) + zdl * tauco( indxc + 1 )
719            END DO
720         END DO
721         lbulk_init = .FALSE.
722      ENDIF
723
724
725      ! Saturated water vapour and vapour pressure
726      ! ------------------------------------------
727!CDIR NOVERRCHK
728!CDIR COLLAPSE
729      DO jj = 1, jpj
730!CDIR NOVERRCHK
731         DO ji = 1, jpi
732            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt
733            zmt1  = SIGN( 17.269,  ztamr )
734            zmt2  = SIGN( 21.875,  ztamr )
735            zmt3  = SIGN( 28.200, -ztamr )
736            zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
737               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
738            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                 ! vapour pressure 
739         END DO
740      END DO
741
742      !-----------------------------------!
743      !  Computation of solar irradiance  !
744      !-----------------------------------!
745!!gm : hard coded  leap year ???
746      indaet   = 1                                    ! = -1, 0, 1 for odd, normal and leap years resp.
747      zxday = nday_year + rdtbs2 / rday               ! day of the year at which the fluxes are calculated
748      iday  = INT( zxday )                            ! (centred at the middle of the ice time step)
749      CALL flx_blk_declin( indaet, iday, zdecl )      ! solar declination of the current day
750      zsdecl = SIN( zdecl * rad )                     ! its sine
751      zcdecl = COS( zdecl * rad )                     ! its cosine
752
753
754      !  correction factor added for computation of shortwave flux to take into account the variation of
755      !  the distance between the sun and the earth during the year (Oberhuber 1988)
756      zdist    = zxday * 2. * rpi / REAL(nyear_len(1), wp)
757      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
758
759!CDIR NOVERRCHK
760      DO jj = 1, jpj
761!CDIR NOVERRCHK
762         DO ji = 1, jpi
763            !  product of sine (cosine) of latitude and sine (cosine) of solar declination
764            zps(ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
765            zpc(ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
766            !  computation of the both local time of sunrise and sunset
767            zlsrise(ji,jj) = ACOS( - SIGN( 1.e0, zps(ji,jj) )    &
768               &                   * MIN(  1.e0, SIGN( 1.e0, zps(ji,jj) ) * ( zps(ji,jj) / zpc(ji,jj) )  )   )
769            zlsset (ji,jj) = - zlsrise(ji,jj)
770            !  dividing the solar day into jp24 segments of length zdlha
771            zdlha  (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jp24, wp )
772         END DO
773      END DO
774
775
776      !---------------------------------------------!
777      !  shortwave radiation absorbed by the ocean  !
778      !---------------------------------------------!
779      pqsr_oce(:,:)   = 0.e0      ! set ocean qsr to zero     
780
781      ! compute and sum ocean qsr over the daylight (i.e. between sunrise and sunset)
782!CDIR NOVERRCHK   
783      DO jt = 1, jp24
784         zcoef = FLOAT( jt ) - 0.5
785!CDIR NOVERRCHK     
786!CDIR COLLAPSE
787         DO jj = 1, jpj
788!CDIR NOVERRCHK
789            DO ji = 1, jpi
790               zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle
791               zcmue              = MAX( 0.e0 ,   zps(ji,jj) + zpc(ji,jj) * zlha  )   ! cos of local solar altitude
792               zcmue2             = 1368.0 * zcmue * zcmue
793
794               ! ocean albedo depending on the cloud cover (Payne, 1972)
795               za_oce     = ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * 0.05 / ( 1.1 * zcmue**1.4 + 0.15 )   &   ! clear sky
796                  &       +         sf(jp_ccov)%fnow(ji,jj,1)   * 0.06                                     ! overcast
797
798                  ! solar heat flux absorbed by the ocean (Zillman, 1972)
799               pqsr_oce(ji,jj) = pqsr_oce(ji,jj)                                         &
800                  &            + ( 1.0 - za_oce ) * zdlha(ji,jj) * zcmue2                &
801                  &            / ( ( zcmue + 2.7 ) * zev(ji,jj) + 1.085 * zcmue +  0.10 )
802            END DO
803         END DO
804      END DO
805      ! Taking into account the ellipsity of the earth orbit, the clouds AND masked if sea-ice cover > 0%
806      zcoef1 = srgamma * zdaycor / ( 2. * rpi )
807!CDIR COLLAPSE
808      DO jj = 1, jpj
809         DO ji = 1, jpi
810            zlmunoon = ASIN( zps(ji,jj) + zpc(ji,jj) ) / rad                         ! local noon solar altitude
811            zcldcor  = MIN(  1.e0, ( 1.e0 - 0.62 * sf(jp_ccov)%fnow(ji,jj,1)   &     ! cloud correction (Reed 1977)
812               &                          + 0.0019 * zlmunoon )                 )
813#if defined key_z_first
814            pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask_1(ji,jj)    ! and zcoef1: ellipsity
815#else
816            pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask(ji,jj,1)    ! and zcoef1: ellipsity
817#endif
818         END DO
819      END DO
820
821      IF( wrk_not_released(2, 1,2,3,4,5,6) )   CALL ctl_stop('blk_clio_qsr_oce: failed to release workspace arrays')
822      !
823   END SUBROUTINE blk_clio_qsr_oce
824
825
826   SUBROUTINE blk_clio_qsr_ice( pa_ice_cs, pa_ice_os, pqsr_ice )
827      !!---------------------------------------------------------------------------
828      !!                     ***  ROUTINE blk_clio_qsr_ice  ***
829      !!                 
830      !!  ** Purpose :   Computation of the shortwave radiation at the ocean and the
831      !!               snow/ice surfaces.
832      !!         
833      !!  ** Method  : - computed qsr from the cloud cover for both ice and ocean
834      !!               - also initialise sbudyko and stauc once for all
835      !!----------------------------------------------------------------------
836      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
837      USE wrk_nemo, ONLY:   zev     => wrk_2d_1     ! vapour pressure
838      USE wrk_nemo, ONLY:   zdlha   => wrk_2d_2     ! 2D workspace
839      USE wrk_nemo, ONLY:   zlsrise => wrk_2d_3     ! 2D workspace
840      USE wrk_nemo, ONLY:   zlsset  => wrk_2d_4     ! 2D workspace
841      USE wrk_nemo, ONLY:   zps     => wrk_2d_5 , zpc => wrk_2d_6   ! sin/cos of latitude per sin/cos of solar declination
842      !!
843      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pa_ice_cs   ! albedo of ice under clear sky
844      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pa_ice_os   ! albedo of ice under overcast sky
845      REAL(wp), INTENT(  out), DIMENSION(:,:,:) ::   pqsr_ice    ! shortwave radiation over the ice/snow
846      !!
847      INTEGER, PARAMETER  ::   jp24 = 24   ! sampling of the daylight period (sunrise to sunset) into 24 equal parts
848      !!
849      INTEGER  ::   ji, jj, jl, jt    ! dummy loop indices
850      INTEGER  ::   ijpl              ! number of ice categories (3rd dim of pqsr_ice)
851      INTEGER  ::   indaet            !  = -1, 0, 1 for odd, normal and leap years resp.
852      INTEGER  ::   iday              ! integer part of day
853      !!
854      REAL(wp) ::   zcmue, zcmue2, ztamr          ! temporary scalars
855      REAL(wp) ::   zmt1, zmt2, zmt3              !    -         -
856      REAL(wp) ::   zdecl, zsdecl, zcdecl         !    -         -
857      REAL(wp) ::   zlha, zdaycor, zes            !    -         -
858      REAL(wp) ::   zxday, zdist, zcoef, zcoef1   !    -         -
859      REAL(wp) ::   zqsr_ice_cs, zqsr_ice_os      !    -         -
860      !!---------------------------------------------------------------------
861
862      IF( wrk_in_use(2, 1,2,3,4,5,6) ) THEN
863         CALL ctl_stop('blk_clio_qsr_ice: requested workspace arrays unavailable')   ;   RETURN
864      ENDIF
865
866      ijpl = SIZE(pqsr_ice, 3 )      ! number of ice categories
867     
868      ! Saturated water vapour and vapour pressure
869      ! ------------------------------------------
870!CDIR NOVERRCHK
871!CDIR COLLAPSE
872      DO jj = 1, jpj
873!CDIR NOVERRCHK
874         DO ji = 1, jpi           
875            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt           
876            zmt1  = SIGN( 17.269,  ztamr )
877            zmt2  = SIGN( 21.875,  ztamr )
878            zmt3  = SIGN( 28.200, -ztamr )
879            zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
880               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
881            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                 ! vapour pressure 
882         END DO
883      END DO
884
885      !-----------------------------------!
886      !  Computation of solar irradiance  !
887      !-----------------------------------!
888!!gm : hard coded  leap year ???
889      indaet   = 1                                    ! = -1, 0, 1 for odd, normal and leap years resp.
890      zxday = nday_year + rdtbs2 / rday               ! day of the year at which the fluxes are calculated
891      iday  = INT( zxday )                            ! (centred at the middle of the ice time step)
892      CALL flx_blk_declin( indaet, iday, zdecl )      ! solar declination of the current day
893      zsdecl = SIN( zdecl * rad )                     ! its sine
894      zcdecl = COS( zdecl * rad )                     ! its cosine
895
896     
897      !  correction factor added for computation of shortwave flux to take into account the variation of
898      !  the distance between the sun and the earth during the year (Oberhuber 1988)
899      zdist    = zxday * 2. * rpi / REAL(nyear_len(1), wp)
900      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
901
902!CDIR NOVERRCHK
903      DO jj = 1, jpj
904!CDIR NOVERRCHK
905         DO ji = 1, jpi
906            !  product of sine (cosine) of latitude and sine (cosine) of solar declination
907            zps(ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
908            zpc(ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
909            !  computation of the both local time of sunrise and sunset
910            zlsrise(ji,jj) = ACOS( - SIGN( 1.e0, zps(ji,jj) )    &
911               &                   * MIN(  1.e0, SIGN( 1.e0, zps(ji,jj) ) * ( zps(ji,jj) / zpc(ji,jj) )  )   ) 
912            zlsset (ji,jj) = - zlsrise(ji,jj)
913            !  dividing the solar day into jp24 segments of length zdlha
914            zdlha  (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jp24, wp )
915         END DO
916      END DO
917
918
919      !---------------------------------------------!
920      !  shortwave radiation absorbed by the ice    !
921      !---------------------------------------------!
922      ! compute and sum ice qsr over the daylight for each ice categories
923      pqsr_ice(:,:,:) = 0.e0
924      zcoef1 = zdaycor / ( 2. * rpi )       ! Correction for the ellipsity of the earth orbit
925     
926      !                    !----------------------------!
927      DO jl = 1, ijpl      !  loop over ice categories  !
928         !                 !----------------------------!
929!CDIR NOVERRCHK   
930         DO jt = 1, jp24   
931            zcoef = FLOAT( jt ) - 0.5
932!CDIR NOVERRCHK     
933!CDIR COLLAPSE
934            DO jj = 1, jpj
935!CDIR NOVERRCHK
936               DO ji = 1, jpi
937                  zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle
938                  zcmue              = MAX( 0.e0 ,   zps(ji,jj) + zpc(ji,jj) * zlha  )   ! cos of local solar altitude
939                  zcmue2             = 1368.0 * zcmue * zcmue
940                 
941                  !  solar heat flux absorbed by the ice/snow system (Shine and Crane 1984 adapted to high albedo)
942                  zqsr_ice_cs =  ( 1.0 - pa_ice_cs(ji,jj,jl) ) * zdlha(ji,jj) * zcmue2        &   ! clear sky
943                     &        / ( ( 1.0 + zcmue ) * zev(ji,jj) + 1.2 * zcmue + 0.0455 )
944                  zqsr_ice_os = zdlha(ji,jj) * SQRT( zcmue )                                  &   ! overcast sky
945                     &        * ( 53.5 + 1274.5 * zcmue )      * ( 1.0 - 0.996  * pa_ice_os(ji,jj,jl) )    &
946                     &        / (  1.0 + 0.139  * stauc(ji,jj) * ( 1.0 - 0.9435 * pa_ice_os(ji,jj,jl) ) )       
947             
948                  pqsr_ice(ji,jj,jl) = pqsr_ice(ji,jj,jl) + (  ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * zqsr_ice_cs    &
949                     &                                       +         sf(jp_ccov)%fnow(ji,jj,1)   * zqsr_ice_os  )
950               END DO
951            END DO
952         END DO
953         !
954         ! Correction : Taking into account the ellipsity of the earth orbit
955#if defined key_z_first
956         pqsr_ice(:,:,jl) = pqsr_ice(:,:,jl) * zcoef1 * tmask_1(:,:)
957#else
958         pqsr_ice(:,:,jl) = pqsr_ice(:,:,jl) * zcoef1 * tmask(:,:,1)
959#endif
960         !
961         !                 !--------------------------------!
962      END DO               !  end loop over ice categories  !
963      !                    !--------------------------------!
964
965
966!!gm  : this should be suppress as input data have been passed through lbc_lnk
967      DO jl = 1, ijpl
968         CALL lbc_lnk( pqsr_ice(:,:,jl) , 'T', 1. )
969      END DO
970      !
971      IF( wrk_not_released(2, 1,2,3,4,5,6) )   CALL ctl_stop('blk_clio_qsr_ice: failed to release workspace arrays')
972      !
973   END SUBROUTINE blk_clio_qsr_ice
974
975
976   SUBROUTINE flx_blk_declin( ky, kday, pdecl )
977      !!---------------------------------------------------------------------------
978      !!               ***  ROUTINE flx_blk_declin  ***
979      !!         
980      !! ** Purpose :   Computation of the solar declination for the day
981      !!       
982      !! ** Method  :   ???
983      !!---------------------------------------------------------------------
984      INTEGER , INTENT(in   ) ::   ky      ! = -1, 0, 1 for odd, normal and leap years resp.
985      INTEGER , INTENT(in   ) ::   kday    ! day of the year ( kday = 1 on january 1)
986      REAL(wp), INTENT(  out) ::   pdecl   ! solar declination
987      !!
988      REAL(wp) ::   a0  =  0.39507671      ! coefficients for solar declinaison computation
989      REAL(wp) ::   a1  = 22.85684301      !     "              ""                 "
990      REAL(wp) ::   a2  = -0.38637317      !     "              ""                 "
991      REAL(wp) ::   a3  =  0.15096535      !     "              ""                 "
992      REAL(wp) ::   a4  = -0.00961411      !     "              ""                 "
993      REAL(wp) ::   b1  = -4.29692073      !     "              ""                 "
994      REAL(wp) ::   b2  =  0.05702074      !     "              ""                 "
995      REAL(wp) ::   b3  = -0.09028607      !     "              ""                 "
996      REAL(wp) ::   b4  =  0.00592797
997      !!
998      REAL(wp) ::   zday   ! corresponding day of type year (cf. ky)
999      REAL(wp) ::   zp     ! temporary scalars
1000      !!---------------------------------------------------------------------
1001           
1002      IF    ( ky == 1 )  THEN   ;   zday = REAL( kday, wp ) - 0.5
1003      ELSEIF( ky == 3 )  THEN   ;   zday = REAL( kday, wp ) - 1.
1004      ELSE                      ;   zday = REAL( kday, wp )
1005      ENDIF
1006     
1007      zp = rpi * ( 2.0 * zday - 367.0 ) / REAL(nyear_len(1), wp)
1008     
1009      pdecl  = a0                                                                      &
1010         &   + a1 * COS( zp ) + a2 * COS( 2. * zp ) + a3 * COS( 3. * zp ) + a4 * COS( 4. * zp )   &
1011         &   + b1 * SIN( zp ) + b2 * SIN( 2. * zp ) + b3 * SIN( 3. * zp ) + b4 * SIN( 4. * zp )
1012      !
1013   END SUBROUTINE flx_blk_declin
1014
1015   !!======================================================================
1016END MODULE sbcblk_clio
Note: See TracBrowser for help on using the repository browser.