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/UKMO/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90 @ 9366

Last change on this file since 9366 was 9366, checked in by andmirek, 6 years ago

#2050 first version. Compiled OK in moci test suite

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