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.
ocesbc.F90 in branches/dev_002_LIM/NEMO/OPA_SRC/SBC – NEMO

source: branches/dev_002_LIM/NEMO/OPA_SRC/SBC/ocesbc.F90 @ 824

Last change on this file since 824 was 824, checked in by rblod, 16 years ago

Delete LIM_SRC and add corresponding modifications in Ocean part

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.1 KB
Line 
1MODULE ocesbc
2   !!======================================================================
3   !!                     ***  MODULE  ocesbc  ***
4   !!                     Ocean surface boundary conditions
5   !!======================================================================
6
7   !!----------------------------------------------------------------------
8   !!   oce_sbc     : ???
9   !!   oce_sbc_dmp : ???
10   !!----------------------------------------------------------------------
11   !! * Modules used
12   USE oce            ! dynamics and tracers variables
13   USE dom_oce        ! ocean space domain variables
14   USE cpl_oce        ! coupled ocean-atmosphere variables
15   USE ice_oce        ! sea-ice variable
16   USE blk_oce        ! bulk variables
17   USE flx_oce        ! sea-ice/ocean forcings variables
18   USE phycst         ! Define parameters for the routines
19   USE taumod         ! surface stress forcing
20   USE flxmod         ! thermohaline fluxes
21   USE flxrnf         ! runoffs forcing
22   USE tradmp         ! damping salinity trend
23   USE dtatem         ! ocean temperature data
24   USE dtasal         ! ocean salinity data
25   USE ocfzpt         ! surface ocean freezing point
26   USE lbclnk         ! ocean lateral boundary condition
27   USE lib_mpp        ! distribued memory computing library
28   USE in_out_manager ! I/O manager
29   USE prtctl         ! Print control
30
31   IMPLICIT NONE
32   PRIVATE
33
34   !! * Accessibility
35   PUBLIC oce_sbc    ! routine called by step
36
37   !! * Shared module variables
38   REAL(wp), PUBLIC ::   &  !:
39      aplus, aminus,     &  !:
40      empold = 0.e0         !: current year freshwater budget correction
41   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
42      qt  ,         &  !: total surface heat flux (w/m2)
43      qsr ,         &  !: solar radiation (w/m2)
44      qla ,         &  !: Latent heat flux (W/m2)
45      qlw ,         &  !: Long Wave Heat Flux (W/m2)
46      qsb ,         &  !: Sensible Heat Flux (W/m2)
47      emp ,         &  !: evaporation minus precipitation (kg/m2/s = mm/s)
48      emps,         &  !: evaporation - precipitation (free surface)
49      qrp ,         &  !: heat flux damping (w/m2)
50      erp              !: evaporation damping (kg/m2/s = mm/s)
51#if ! defined key_dynspg_rl
52   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
53      dmp              !: internal dampind term
54#endif
55
56#  include "domzgr_substitute.h90"
57#  include "vectopt_loop_substitute.h90"
58
59   !!----------------------------------------------------------------------
60   !!  OPA 9.0 , LOCEAN-IPSL (2005)
61   !! $Header$
62   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
63   !!----------------------------------------------------------------------
64CONTAINS
65
66#if defined key_ice_lim || defined key_lim2
67   !!----------------------------------------------------------------------
68   !!   'key_ice_lim'     :                              LIM2 sea-ice model
69   !!   'key_lim2'        :                              LIM3 sea-ice model
70   !!----------------------------------------------------------------------
71# if defined key_coupled
72      !!----------------------------------------------------------------------
73      !!   'key_coupled' :                            Coupled Ocean/Atmosphere
74      !!----------------------------------------------------------------------
75
76   SUBROUTINE oce_sbc( kt )
77      !!---------------------------------------------------------------------
78      !!                 ***  ROUTINE oce_sbc  ***
79      !!                   
80      !! ** Purpose :   Ocean surface boundaries conditions with
81      !!        Louvain la Neuve Sea Ice Model in coupled mode
82      !!
83      !! History :
84      !!   1.0  !  00-10  (O. Marti)  Original code
85      !!   2.0  !  02-12  (G. Madec)  F90: Free form and module
86      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
87      !!----------------------------------------------------------------------
88      !! * Arguments
89      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
90
91      !! * Local declarations
92      INTEGER ::   ji, jj                   ! dummy loop indices
93      REAL(wp) ::   ztx, ztaux, zty, ztauy
94      REAL(wp) ::   ztdta, ztgel, zqrp
95      !!----------------------------------------------------------------------
96
97      ! 1. initialization to zero at kt = nit000
98      ! ---------------------------------------
99
100      IF( kt == nit000 ) THEN     
101         qsr   (:,:) = 0.e0
102         freeze(:,:) = 0.e0
103         qt    (:,:) = 0.e0
104         qrp   (:,:) = 0.e0
105         emp   (:,:) = 0.e0
106         emps  (:,:) = 0.e0
107         erp   (:,:) = 0.e0
108#if ! defined key_dynspg_rl
109         dmp   (:,:) = 0.e0
110#endif
111      ENDIF
112
113      IF( MOD( kt-1, nfice ) == 0 ) THEN
114
115         CALL oce_sbc_dmp   ! Computation of internal and evaporation damping terms       
116
117         ! Surface heat flux (W/m2)
118         ! -----------------------
119
120         ! restoring heat flux
121         DO jj = 1, jpj
122            DO ji = 1, jpi
123               ztgel = fzptn(ji,jj)
124#if defined key_dtasst
125               ztdta = MAX( sst(ji,jj),    ztgel )
126#else
127               ztdta = MAX( t_dta(ji,jj,1), ztgel )
128#endif
129               zqrp = dqdt0 * ( tb(ji,jj,1) - ztdta )
130
131               qrp(ji,jj) = (1.0-freeze(ji,jj) ) * zqrp
132            END DO
133         END DO
134
135         ! non solar heat flux + solar flux + restoring
136         qt (:,:) = fnsolar(:,:) + fsolar(:,:) + qrp(:,:)
137
138         ! solar flux
139         qsr(:,:) = fsolar(:,:)
140
141#if ! defined key_dynspg_rl 
142         ! total concentration/dilution effect (use on SSS)
143         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)
144
145         ! total volume flux (use on sea-surface height)
146         emp (:,:) = fmass(:,:)  -  dmp(:,:) + runoff(:,:) + erp(:,:)
147#else
148         ! Rigid-lid (emp=emps=E-P-R+Erp)
149         ! freshwater flux
150         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)
151         emp (:,:) = emps(:,:)
152#endif
153
154         DO jj = 1, jpjm1
155            DO ji = 1, fs_jpim1   ! vertor opt.
156               ztx   = 0.5 * ( freeze(ji+1,jj) + freeze(ji+1,jj+1) )
157               ztaux = 0.5 * ( ftaux (ji+1,jj) + ftaux (ji+1,jj+1) )
158               taux(ji,jj) = (1.0-ztx) * taux(ji,jj) + ztx * ztaux
159
160               zty   = 0.5 * ( freeze(ji,jj+1) + freeze(ji+1,jj+1) )
161               ztauy = 0.5 * ( ftauy (ji,jj+1) + ftauy (ji+1,jj+1) )
162               tauy(ji,jj) = (1.0-zty) * tauy(ji,jj) + zty * ztauy
163            END DO
164         END DO
165         CALL lbc_lnk( taux, 'U', -1. )
166         CALL lbc_lnk( tauy, 'V', -1. )   
167
168         ! Re-initialization of fluxes
169         sst_io(:,:) = 0.e0
170         sss_io(:,:) = 0.e0
171         u_io  (:,:) = 0.e0
172         v_io  (:,:) = 0.e0
173         gtaux (:,:) = 0.e0
174         gtauy (:,:) = 0.e0
175
176      ENDIF
177
178   END SUBROUTINE oce_sbc
179
180# elif defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
181      !!----------------------------------------------------------------------
182      !!   'key_ice_lim'                              with  LIM sea-ice model
183      !!----------------------------------------------------------------------
184
185   SUBROUTINE oce_sbc( kt )
186      !!---------------------------------------------------------------------
187      !!                   ***  ROUTINE oce_sbc  ***
188      !!                   
189      !! ** Purpose : - Ocean surface boundary conditions with LIM sea-ice
190      !!        model in forced mode using bulk formulea
191      !!
192      !! History :
193      !!   1.0  !  99-11  (M. Imbard)  Original code
194      !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
195      !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
196      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
197      !!----------------------------------------------------------------------
198      !! * arguments
199      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
200
201      !! * Local declarations
202      INTEGER  ::   ji, jj                   ! dummy loop indices
203      REAL(wp) ::   ztx, ztaux, zty, ztauy
204      !!----------------------------------------------------------------------
205
206      ! 1. initialization to zero at kt = nit000
207      ! ---------------------------------------
208
209      IF( kt == nit000 ) THEN     
210         qsr    (:,:) = 0.e0
211         qt     (:,:) = 0.e0
212         qla    (:,:) = 0.e0
213         qlw    (:,:) = 0.e0
214         qsb    (:,:) = 0.e0
215         qrp    (:,:) = 0.e0
216         emp    (:,:) = 0.e0
217         emps   (:,:) = 0.e0
218         erp    (:,:) = 0.e0
219#if ! defined key_dynspg_rl
220         dmp    (:,:) = 0.e0
221#endif
222      ENDIF
223#if defined key_flx_core
224      qla(:,:) = (1 - freeze(:,:))*qla_oce + freeze(:,:)*qla_ice(:,:)
225      qsb(:,:) = (1 - freeze(:,:))*qsb_oce + freeze(:,:)*qsb_ice(:,:)
226      qlw(:,:) = (1 - freeze(:,:))*qlw_oce + freeze(:,:)*qlw_ice(:,:)
227#endif
228      IF( MOD( kt-1, nfice ) == 0 ) THEN
229
230         CALL oce_sbc_dmp       ! Computation of internal and evaporation damping terms       
231
232         ! Surface Ocean fluxes
233         ! ====================
234
235         ! Surface heat flux (W/m2)
236         ! -----------------
237
238         qt  (:,:) = fnsolar(:,:) + fsolar(:,:)     ! non solar heat flux + solar flux
239         qsr (:,:) = fsolar(:,:)                     ! solar flux
240
241#if ! defined key_dynspg_rl     
242         ! total concentration/dilution effect (use on SSS)
243         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:) + empold
244
245         ! total volume flux (use on sea-surface height)
246         emp (:,:) = fmass(:,:) -   dmp(:,:) + runoff(:,:) + erp(:,:) + empold     
247#else
248         ! Rigid-lid (emp=emps=E-P-R+Erp)
249         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)     ! freshwater flux
250         emp (:,:) = emps(:,:)
251
252#endif
253
254         ! Surface stress
255         ! --------------
256
257         ! update the stress beloww sea-ice area
258         DO jj = 1, jpjm1
259            DO ji = 1, fs_jpim1   ! vertor opt.
260               ztx         = MAX( freezn(ji,jj), freezn(ji,jj+1) )   ! ice/ocean indicator at U- and V-points
261               zty         = MAX( freezn(ji,jj), freezn(ji+1,jj) )
262               ztaux       = 0.5 *( ftaux(ji+1,jj) + ftaux(ji+1,jj+1) ) ! ice-ocean stress at U- and V-points
263               ztauy       = 0.5 *( ftauy(ji,jj+1) + ftauy(ji+1,jj+1) )
264               taux(ji,jj) = (1.-ztx) * taux(ji,jj) + ztx * ztaux    ! stress at the ocean surface
265               tauy(ji,jj) = (1.-zty) * tauy(ji,jj) + zty * ztauy
266            END DO
267         END DO
268
269         ! boundary condition on the stress (taux,tauy)
270         CALL lbc_lnk( taux, 'U', -1. )
271         CALL lbc_lnk( tauy, 'V', -1. )
272
273         ! Re-initialization of fluxes
274         sst_io(:,:) = 0.e0
275         sss_io(:,:) = 0.e0
276         u_io  (:,:) = 0.e0
277         v_io  (:,:) = 0.e0
278
279      ENDIF
280
281   END SUBROUTINE oce_sbc
282
283# else
284      !!----------------------------------------------------------------------
285      !!   Error option               LIM sea-ice model requires bulk formulea
286      !!----------------------------------------------------------------------
287      This line forced a compilation error
288# endif
289
290#else
291   !!----------------------------------------------------------------------
292   !!   Default option                                 NO LIM sea-ice model
293   !!----------------------------------------------------------------------
294# if defined key_coupled
295      !!----------------------------------------------------------------------
296      !!   'key_coupled' :                            Coupled Ocean/Atmosphere
297      !!----------------------------------------------------------------------
298
299   SUBROUTINE oce_sbc( kt )
300      !!---------------------------------------------------------------------
301      !!                 ***  ROUTINE oce_sbc  ***
302      !!                   
303      !! ** Purpose :   Ocean surface boundaries conditions in
304      !!                coupled ocean/atmosphere case without sea-ice
305      !!
306      !! History :
307      !!   1.0  !  00-10  (O. Marti)  Original code
308      !!   2.0  !  02-12  (G. Madec)  F90: Free form and module
309      !!----------------------------------------------------------------------
310      !! * Modules used
311      USE cpl_oce       ! coupled ocean-atmosphere variables
312
313      !! * Arguments
314      INTEGER, INTENT( in  ) ::   kt   ! ocean time step index
315
316      !! * Local declarations
317      INTEGER  ::   ji, jj, jf         ! dummy loop indices
318      REAL(wp) ::   ztgel,          &  ! temporary scalars
319         zice, zhemis, zqrp, zqri,  &  !    "         "
320         zq, zqi, zerp, ze, zei, zro   !    "         "
321      !!----------------------------------------------------------------------
322
323      ! Compute fluxes
324      ! --------------
325
326      DO jj = 1, jpj
327         DO ji = 1, jpi
328
329            ztgel = fzptn(ji,jj)   ! local freezing temperature
330
331            ! opa model ice freeze()
332
333            zice = tmask(ji,jj,1)
334            IF( tn(ji,jj,1) >=  ztgel ) zice = 0.
335            freeze(ji,jj) = zice
336
337            ! hemisphere indicator (=1 north, =-1 south)
338
339            zhemis = float(isign(1, mjg(jj)-(jpjglo/2+1)))
340
341            ! a) net downward radiative flux qsr()
342            ! - AGCM qsrc if no ice
343            ! - zero under ice (zice=1)
344
345            qsr(ji,jj) = (1.-zice)*qsrc(ji,jj)*tmask(ji,jj,1)
346
347            ! b) heat flux damping term qrp()
348            ! - no damping if no  ice      (zice=0)
349            ! - gamma*min(0,t-tgel) if ice (zice=1)
350
351            zqrp = 0.
352            zqri = dqdt0*MIN( 0., tb(ji,jj,1)-ztgel )
353            qrp(ji,jj) = ( ( 1. - zice ) * zqrp + zice * zqri ) * tmask(ji,jj,1)
354
355
356            ! c) net downward heat flux q() = q0 + qrp()
357            ! for q0
358            ! - AGCM qc if no  ice (zice=0)
359            ! - -2 watt/m2 (arctic) or -4 watt/m2 (antarctic) if ice (zice=1)
360            zq  = qc(ji,jj)
361            zqi = -3. + zhemis
362            qt(ji,jj) = ( (1.-zice) * zq + zice * zqi ) * tmask(ji,jj,1) + qrp(ji,jj)
363
364            ! d) water flux damping term erp()
365            ! - no damping
366            zerp = 0.
367            erp(ji,jj) = zerp
368
369            ! e) net upward water flux e() = eo + runoff() + erp()
370            ! for e0
371            ! - AGCM if no ice (zice=0)
372            ! - 1.mm/day if climatological and opa ice (zice=1)
373            ze  = ec(ji,jj)
374            zei = 1./rday
375            zro = runoff(ji,jj)
376            emp(ji,jj) = ( ( 1. - zice ) *  ze + zice * zei + zro ) * tmask(ji,jj,1) + erp(ji,jj)
377
378            ! f) net upward water flux for the salinity surface
379            !    boundary condition
380            emps(:,:) = emp(:,:)
381
382         END DO
383      END DO
384
385   END SUBROUTINE oce_sbc
386# elif defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_forced_daily || defined key_flx_core
387      !!-------------------------------------------------------------------------
388      !!   'key_flx_bulk_monthly' or 'key_flx_bulk_daily' or  core   bulk formulea
389      !!   'key_flx_forced_daily'                                or no bulk case
390      !!-------------------------------------------------------------------------
391
392   SUBROUTINE oce_sbc( kt )
393      !!---------------------------------------------------------------------
394      !!                   ***  ROUTINE oce_sbc  ***
395      !!                   
396      !! ** Purpose :   Ocean surface boundary conditions in forced mode
397      !!      using either flux or bulk formulation.
398      !!
399      !! History :
400      !!   1.0  !  99-11  (M. Imbard)  Original code
401      !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
402      !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
403      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
404      !!----------------------------------------------------------------------
405      !! * Modules used
406      USE daymod                 ! calendar
407#if ! defined key_dtasst
408      USE dtasst, ONLY : rclice  ! sea surface temperature data
409#endif
410#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
411      USE blk_oce                ! bulk variables
412#endif
413#if defined key_flx_forced_daily
414      USE flx_oce                ! sea-ice/ocean forcings variables
415#endif
416
417      !! * arguments
418      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
419
420      !! * local declarations
421      INTEGER ::   ji, jj        ! dummy loop arguments
422      INTEGER ::   i15, ifreq             !     
423      REAL(wp) ::  zxy
424      REAL(wp) ::  zsice, zqri, zqrp, ztdta, zqrj
425      REAL(wp) ::  zq, zqi, zhemis
426      REAL(wp), DIMENSION(jpi,jpj) :: zeri, zerps, ziclim
427      REAL(wp), DIMENSION(jpi,jpj) :: zqt, zqsr, zemp 
428      !!----------------------------------------------------------------------
429 
430
431#if defined key_flx_core
432      CALL ctl_stop( 'flxcore and no ice model not tested yet' )
433#endif
434
435      ! 1. initialization to zero at kt = nit000
436      ! ---------------------------------------
437
438      IF( kt == nit000 ) THEN     
439         qsr    (:,:) = 0.e0
440         freeze (:,:) = 0.e0
441         qt     (:,:) = 0.e0
442         qla    (:,:) = 0.e0
443         qlw    (:,:) = 0.e0
444         qsb    (:,:) = 0.e0
445         qrp    (:,:) = 0.e0
446         emp    (:,:) = 0.e0
447         emps   (:,:) = 0.e0
448         erp    (:,:) = 0.e0
449#if ! defined key_dynspg_rl
450         dmp    (:,:) = 0.e0
451#endif
452      ENDIF
453
454#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
455      ifreq      = nfbulk
456      zqt (:,:)  = qsr_oce(:,:) + qnsr_oce(:,:)
457      zqsr(:,:)  = qsr_oce(:,:)
458      zemp(:,:)  = evap(:,:) - tprecip(:,:)
459#endif 
460
461#if defined key_flx_forced_daily
462      ifreq      = 1
463      zqt (:,:)  = p_qt (:,:)
464      zqsr(:,:)  = p_qsr(:,:)
465      zemp(:,:)  = p_emp(:,:)
466#endif 
467#if defined key_flx_core
468      qla(:,:) = (1 - freeze(:,:))*qla_oce + freeze(:,:)*qla_ice(:,:)
469      qsb(:,:) = (1 - freeze(:,:))*qsb_oce + freeze(:,:)*qsb_ice(:,:)
470      qlw(:,:) = (1 - freeze(:,:))*qlw_oce + freeze(:,:)*qlw_ice(:,:)
471#endif
472      IF( MOD( kt-1, ifreq) == 0 ) THEN
473         ! Computation of internal and evaporation damping terms       
474         CALL oce_sbc_dmp
475
476         zsice = - 0.04 / 0.8    ! ratio of isohaline compressibility over isotherme compressibility
477                                 ! ( d rho / dt ) / ( d rho / ds )      ( s = 34, t = -1.8 )
478         ! Flux computation
479         DO jj = 1, jpj
480            DO ji = 1, jpi     
481               ! climatological ice
482               ziclim(ji,jj) = FLOAT( NINT( rclice(ji,jj,1) ) )
483
484               ! avoid surfreezing point           
485               tn(ji,jj,1) = MAX( tn(ji,jj,1), fzptn(ji,jj) )
486
487               ! hemisphere indicator (=1 north, =-1 south)           
488               zhemis = FLOAT( isign(1, mjg(jj) - (jpjdta/2+1) ) )
489
490               ! restoring temperature (ztdta >= to local freezing temperature)           
491#if defined key_dtasst
492               ztdta = MAX( sst(ji,jj),    fzptn(ji,jj) )
493#else
494               ztdta = MAX( t_dta(ji,jj,1), fzptn(ji,jj) )
495#endif
496
497               ! a) net downward radiative flux qsr()           
498               qsr(ji,jj) = (1.-ziclim(ji,jj)) * zqsr(ji,jj) * tmask(ji,jj,1)
499
500               ! b) heat flux damping term qrp()
501               ! - gamma*(t-tlevitus) if no  climatological ice (ziclim=0)
502               ! - gamma*(t-(tgel-1.))  if climatological ice and no opa ice   (ziclim=1 zicopa=0)
503               ! - gamma*min(0,t-tgel) if climatological and opa ice (ziclim=1 zicopa=1)
504
505               zqri = dqdt0 * ( tb(ji,jj,1) - ( fzptn(ji,jj) - 1.) )
506               zqrj = dqdt0 * MIN( 0., tb(ji,jj,1) - fzptn(ji,jj) )
507
508               qrp(ji,jj) =  ( ziclim(ji,jj) * ( (1 - freeze(ji,jj)) * zqri    &
509                 &                                  + freeze(ji,jj)  * zqrj ) ) * tmask(ji,jj,1)
510
511#if ! defined key_flx_bulk_monthly && ! defined key_flx_bulk_daily && ! defined key_flx_core
512               zqrp = dqdt0 * ( tb(ji,jj,1) - ztdta )
513               qrp(ji,jj) = qrp(ji,jj) + (1. - ziclim(ji,jj)) * zqrp
514# endif
515
516               ! c) net downward heat flux q() = q0 + qrp()
517               ! for q0
518               ! - ECMWF fluxes if no climatological ice      (ziclim=0)
519               ! - qrp if climatological ice and no opa ice   (ziclim=1 zicopa=0)
520               ! - -2 watt/m2 (arctic) or -4 watt/m2 (antarctic) if climatological and opa ice
521               !                                              (ziclim=1 zicopa=1)
522               zq  = zqt(ji,jj)
523               zqi = -3. + zhemis
524               qt (ji,jj) = ( (1.-ziclim(ji,jj)) * zq   &
525                  +ziclim(ji,jj)  * freeze(ji,jj) * zqi )   &
526                  * tmask(ji,jj,1)   &
527                  + qrp(ji,jj)
528
529            END DO
530         END DO
531
532#if ! defined key_dynspg_rl
533         ! Free-surface
534
535         ! Water flux for zero buoyancy flux if no opa ice and ice clim
536         zeri(:,:) = -zsice * qrp(:,:) * ro0cpr * rauw / 34.0
537         zerps(:,:) = ziclim(:,:) * ( (1-freeze(:,:)) * zeri(:,:) )
538
539         ! Contribution to sea level:
540         ! net upward water flux emp() = e-p + runoff() + erp() + dmp + empold
541         emp (:,:) = zemp(:,:)     &   ! e-p data
542            &      + runoff(:,:)   &   ! runoff data
543            &      + erp(:,:)      &   ! restoring term to SSS data
544            &      + dmp(:,:)      &   ! freshwater flux associated with internal damping
545            &      + empold            ! domain averaged annual mean correction
546
547         ! Contribution to salinity:
548         ! net upward water flux emps() = e-p + runoff() + erp() + zerps + empold
549         emps(:,:) = zemp(:,:)     &
550            &      + runoff(:,:)   &
551            &      + erp(:,:)      &
552            &      + zerps(:,:)    &
553            &      + empold 
554#else
555         ! Rigid-lid (emp=emps=E-P-R+Erp)
556         ! freshwater flux
557         zeri(:,:)  = -zsice * qrp(:,:) * ro0cpr * rauw / 34.0
558         zerps(:,:) = ziclim(:,:) * ( (1-freeze(:,:)) * zeri(:,:) )
559         emps (:,:) = zemp(:,:)     &
560            &       + runoff(:,:)   &
561            &       + erp(:,:)      &
562            &       + zerps(:,:)
563         emp (:,:) = emps(:,:)
564#endif 
565
566         ! Boundary condition on emp for free surface option
567         ! -------------------------------------------------
568         CALL lbc_lnk( emp, 'T', 1. )
569
570      ENDIF
571
572   END SUBROUTINE oce_sbc
573
574# else
575      !!----------------------------------------------------------------------
576      !!   Default option :                                 Analytical forcing
577      !!----------------------------------------------------------------------
578
579   SUBROUTINE oce_sbc( kt )
580      !!---------------------------------------------------------------------
581      !!                    ***  ROUTINE oce_sbc  ***
582      !!             
583      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
584      !!                to the ocean at each time step.
585      !!
586      !! ** Method  :   Constant surface fluxes (read in namelist (namflx))
587      !!
588      !! ** Action  : - qt, qsr, emp, emps, qrp, erp
589      !!
590      !! History :
591      !!        !  91-03  ()  Original code
592      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
593      !!   9.0  !  04-05  (A. Koch-Larrouy) Add Gyre configuration
594      !!----------------------------------------------------------------------
595      !! * Modules used
596      USE flxrnf                       ! ocean runoffs
597      USE daymod, ONLY : nyear         ! calendar
598      USE dtasss                       ! sea surface salinity data
599
600      !! * arguments
601      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
602
603      !! * local declarations
604      REAL(wp) ::                   & !!! surface fluxes namelist (namflx)
605         q0   = 0.e0,               &  ! net heat flux
606         qsr0 = 0.e0,               &  ! solar heat flux
607         emp0 = 0.e0                   ! net freshwater flux
608      REAL(wp) ::   zsrp,           &
609         zemp_S, zemp_N, zemp_sais, &
610         zTstar, zcos_sais1, zconv, &
611         zcos_sais2
612      REAL(wp) ::           &
613         zsumemp,           &          ! tampon used for the emp sum
614         zsurf,             &          ! tampon used for the domain sum
615         ztime,             &          ! time in hour
616         ztimemax1, ztimemin1, &       ! 21th june,   and 21th december if date0 = 1st january
617         ztimemax2, ztimemin2          ! 21th august, and 21th february if date0 = 1st january
618      REAL(wp), DIMENSION(jpi,jpj) :: t_star
619      INTEGER  ::   ji, jj             ! dummy loop indices
620
621      INTEGER  ::           &
622         zyear0,            &          ! initial year
623         zmonth0,           &          ! initial month
624         zday0,             &          ! initial day
625         zday_year0                    ! initial day since january 1st
626
627      NAMELIST/namflx/ q0, qsr0, emp0
628      !!---------------------------------------------------------------------
629
630      !same temperature, E-P as in HAZELEGER 2000
631
632      IF( cp_cfg == 'gyre' ) THEN
633
634          zyear0  = ndate0 / 10000                              ! initial year
635          zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100           ! initial month
636          zday0   = ndate0 - zyear0 * 10000 - zmonth0 * 100     ! initial day betwen 1 and 30
637          zday_year0= (zmonth0-1)*30.+zday0                     ! initial day betwen 1 and 360
638
639          ! current day (in hours) since january the 1st of the current year
640          ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &    !  total incrementation (in hours)
641             &     - (nyear  - 1) * rjjhh * raajj           !  minus years since beginning of experiment (in hours)
642
643          ! 21th june at 24h  in hours
644          ztimemax1 = ((5.*30.)+21.)* 24.
645          ! 21th december in hours
646          ! rjjhh * raajj / 4 = 1 seasonal cycle in hours
647          ztimemin1 = ztimemax1 + rjjhh * raajj / 2         
648          ! 21th july at 24h in hours
649          ztimemax2 = ((6.*30.)+21.)* 24.
650          ! 21th january day in hours
651          ! rjjhh * raajj / 4 = 1 seasonal cycle in hours
652          ztimemin2 = ztimemax2 - rjjhh * raajj / 2         
653
654          ! amplitudes
655          zemp_S   = 0.7       ! intensity of COS in the South
656          zemp_N   = 0.8       ! intensity of COS in the North
657          zemp_sais= 0.1
658          zTstar   = 28.3      ! intemsity from 28.3 a -5 deg
659
660          ! 1/2 period between 21th June and 21th December
661          zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi )   
662
663          ! 1/2 period between 21th July and 21th January
664          zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
665
666          zconv = 3.16e-5      ! convert 1m/yr->3.16e-5mm/s
667          DO jj = 1, jpj
668             DO ji = 1, jpi
669                ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3
670                ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
671                ! 64.5 in summer, 42.5 in winter
672                t_star (ji,jj) = zTstar * ( 1 + 1. / 50. * zcos_sais2 )   &                 
673                   &             * COS( rpi * (gphit(ji,jj) - 5.)        &                 
674                   &                        / (53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) ) 
675                qt  (ji,jj) = dqdt0 * ( tb(ji,jj,1) - t_star(ji,jj) )
676                IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj)) THEN
677                   ! zero at 37.8 deg, max at 24.6 deg
678                   emp  (ji,jj) =   zemp_S * zconv   &
679                      &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  & 
680                      &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
681                   emps (ji,jj) = emp  (ji,jj)
682                ELSE
683                   ! zero at 37.8 deg, max at 46.8 deg
684                   emp (ji,jj) =  - zemp_N * zconv   &
685                      &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  & 
686                      &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
687                   emps (ji,jj) = emp  (ji,jj)
688                ENDIF
689                ! 23.5 deg : tropics
690                qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )   
691             END DO
692          END DO
693
694          ! Compute the emp flux such as its integration on the whole domain at each time is zero
695          IF( nbench /= 1 .AND. nbit_cmp /= 1 ) THEN
696             zsumemp = 0.e0   ;   zsurf = 0.e0
697             DO jj = 1, jpj
698                DO ji = 1, jpi
699                   zsumemp = zsumemp + emp(ji,jj) * tmask(ji,jj,1) * tmask_i(ji,jj)
700                   zsurf =  zsurf + tmask(ji,jj,1) * tmask_i(ji,jj)
701                END DO
702             END DO
703
704             IF( lk_mpp )   CALL mpp_sum( zsumemp  )       ! sum over the global domain
705             IF( lk_mpp )   CALL mpp_sum( zsurf    )       ! sum over the global domain
706
707             ! Default GYRE configuration
708             zsumemp = zsumemp / zsurf
709          ELSE
710             ! Benchmark GYRE configuration (to allow the bit to bit comparison between Mpp/Mono case)
711             zsumemp = 0.e0   ;    zsurf = 0.e0
712          ENDIF
713
714          IF( lk_dtasss ) THEN           ! Sea surface salinity damping
715             ! deds0 from (mm/day) => (mm/s)
716             zsrp = deds0 / rday 
717             erp(:,:) = zsrp * ( sss(:,:) - sb(:,:,1) ) / ( sn(:,:,1) + 1.e-20 )
718          ELSE                           ! NO Sea surface salinity damping
719             zsrp = 0.e0
720             erp(:,:) = 0.e0
721          ENDIF
722
723          ! freshwater fluxes terms
724          DO jj = 1, jpj
725             DO ji = 1, jpi
726                emp(ji, jj) =  emp(ji,jj) - zsumemp * tmask(ji,jj,1)
727                emps(ji, jj)=  emp(ji,jj) + erp(ji,jj)
728             END DO
729          END DO
730
731         IF( kt == nit000 .AND. lwp ) THEN
732            WRITE(numout,*)' ocesbc  : analytical formulation for gyre'
733            WRITE(numout,*)' ~~~~~~~ '
734            WRITE(numout,*)'           nyear      = ', nyear
735            WRITE(numout,*)'           ztime      = ',ztime
736            WRITE(numout,*)'           ztimemax1  = ',ztimemax1
737            WRITE(numout,*)'           ztimemin1  = ',ztimemin1
738            WRITE(numout,*)'           ztimemax2  = ',ztimemax2
739            WRITE(numout,*)'           ztimemin2  = ',ztimemin2
740            WRITE(numout,*)'           zyear0     = ', zyear0
741            WRITE(numout,*)'           zmonth0    = ', zmonth0
742            WRITE(numout,*)'           zday0      = ', zday0
743            WRITE(numout,*)'           zday_year0 = ',zday_year0
744            WRITE(numout,*)'           raajj      = ', raajj
745            WRITE(numout,*)'           zemp_S     = ',zemp_S 
746            WRITE(numout,*)'           zemp_N     = ',zemp_N 
747            WRITE(numout,*)'           zemp_sais  = ',zemp_sais
748            WRITE(numout,*)'           zTstar     = ',zTstar 
749            WRITE(numout,*)'           zsumemp    = ',zsumemp
750            WRITE(numout,*)'           zsurf      = ',zsurf 
751            WRITE(numout,*)'           dqdt0      = ',dqdt0
752            WRITE(numout,*)'           deds0      = ',deds0
753            WRITE(numout,*)'           zconv      = ',zconv 
754         ENDIF
755
756      ELSE
757
758         ! Constant surface fluxes
759
760         IF( kt == nit000 ) THEN
761            IF(lwp) THEN
762               WRITE(numout,*)' '
763               WRITE(numout,*)' ocesbc  : Constant surface fluxes read in namelist'
764               WRITE(numout,*)' ~~~~~~~ '
765               WRITE(numout,*)'           Namelist namflx: set the constant flux values'
766               WRITE(numout,*)'              net heat flux          q0   = ', q0  , ' W/m2'
767               WRITE(numout,*)'              solar heat flux        qsr0 = ', qsr0, ' W/m2'
768               WRITE(numout,*)'              net heat flux          emp0 = ', emp0, ' W/m2'
769            ENDIF
770
771            qt    (:,:) = q0
772            qsr   (:,:) = qsr0
773            emp   (:,:) = emp0
774            emps  (:,:) = emp0
775            qrp   (:,:) = 0.e0
776            erp   (:,:) = 0.e0
777
778            runoff(:,:) = 0.e0
779         ENDIF
780
781      ENDIF
782
783   END SUBROUTINE oce_sbc
784
785# endif
786#endif
787
788#if defined key_dtasal
789   !!----------------------------------------------------------------------
790   !!   'key_dtasal'                                          salinity data
791   !!----------------------------------------------------------------------
792   SUBROUTINE oce_sbc_dmp
793      !!---------------------------------------------------------------------
794      !!                   ***  ROUTINE oce_sbc_dmp  ***
795      !!                   
796      !! ** Purpose : Computation of internal and evaporation damping terms
797      !!        for ocean surface boundary conditions
798      !!
799      !! History :
800      !!   9.0  !  04-01  (G. Madec, C. Ethe)  Original code
801      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
802      !!----------------------------------------------------------------------
803      !! * Local declarations
804      INTEGER ::   ji, jj                   ! dummy loop indices
805      REAL(wp), DIMENSION(jpi,jpj)  :: zsss, zfreeze
806      REAL(wp) ::   zerp, zsrp
807      CHARACTER (len=71) :: charout
808#if ! defined key_dynspg_rl
809      REAL(wp) ::   zwei
810      REAL(wp) ::   zerpplus(jpi,jpj), zerpminus(jpi,jpj)
811      REAL(wp) ::   zplus, zminus, zadefi
812# if defined key_tradmp
813      INTEGER jk
814      REAL(wp), DIMENSION(jpi,jpj) ::   zstrdmp
815# endif
816#endif
817      !!----------------------------------------------------------------------
818
819#if defined key_ice_lim || defined key_lim2
820      ! sea ice indicator (1 or 0)
821      DO jj = 1, jpj
822         DO ji = 1, jpi
823            freezn(ji,jj) = MAX(0., SIGN(1., freeze(ji,jj)-rsmall) )
824         END DO
825      END DO
826      zsss   (:,:) = sss_io(:,:)
827      zfreeze(:,:) = freezn(:,:)
828#else
829      zsss   (:,:) = sb    (:,:,1)
830      zfreeze(:,:) = freeze(:,:)
831#endif
832
833      ! Initialisation
834      ! --------------
835      ! Restoring coefficients on SST and SSS   
836      zsrp = dqdt0 * ro0cpr * rauw   ! (Kg/m2/s)
837
838#if ! defined key_dynspg_rl
839      ! Free-surface
840         
841      ! Internal damping
842# if defined key_tradmp
843      ! Vertical mean of dampind trend (computed in tradmp module)
844      zstrdmp(:,:) = 0.e0
845      DO jk = 1, jpk
846         zstrdmp(:,:) = zstrdmp(:,:) + strdmp(:,:,jk) * fse3t(:,:,jk)
847      END DO
848      ! volume flux associated to internal damping to climatology
849      dmp(:,:) = zstrdmp(:,:) * rauw / ( zsss(:,:) + 1.e-20 )
850# else
851      dmp(:,:) = 0.e0            ! No internal damping
852# endif
853     
854      !   evaporation damping term ( Surface restoring )
855      zerpplus (:,:) = 0.e0
856      zerpminus(:,:) = 0.e0
857      zplus  =  15. / rday
858      zminus = -15. / rday
859     
860      DO jj = 1, jpj
861         DO ji = 1, jpi
862            zerp = ( 1. - 2.*upsrnfh(ji,jj) ) * zsrp   &
863               & * ( zsss(ji,jj) - s_dta(ji,jj,1) )     &
864               & / ( zsss(ji,jj) + 1.e-20        )
865           
866            zerp = MIN( zerp, zplus  )
867            zerp = MAX( zerp, zminus )
868            erp(ji,jj) = zerp
869            zerpplus (ji,jj) = MAX( erp(ji,jj), 0.e0 )
870            zerpminus(ji,jj) = MIN( erp(ji,jj), 0.e0 )
871         END DO
872      END DO
873
874      aplus  = 0.e0
875      aminus = 0.e0
876
877      IF( nbit_cmp == 1) THEN
878
879         IF(ln_ctl)   THEN
880            WRITE(charout,FMT="('oce_sbc_dmp : a+ = ',D23.16, ' a- = ',D23.16)") aplus, aminus
881            CALL prt_ctl_info(charout)
882         ENDIF
883         erp(:,:) = 0.e0
884
885      ELSE
886
887         DO jj = 1, jpj
888            DO ji = 1, jpi
889               zwei   = e1t(ji,jj) * e2t(ji,jj) * tmask_i(ji,jj)
890               aplus  = aplus  + zerpplus (ji,jj) * zwei
891               aminus = aminus - zerpminus(ji,jj) * zwei
892            END DO
893         END DO
894         IF( lk_mpp )   CALL mpp_sum( aplus  )   ! sums over the global domain
895         IF( lk_mpp )   CALL mpp_sum( aminus )
896
897         IF(ln_ctl)   THEN
898            WRITE(charout,FMT="('oce_sbc_dmp : a+ = ',D23.16, ' a- = ',D23.16)") aplus, aminus
899            CALL prt_ctl_info(charout)
900         ENDIF
901
902         zadefi = MIN( aplus, aminus )
903         IF( zadefi == 0.e0 ) THEN
904            erp(:,:) = 0.e0
905         ELSE
906            erp(:,:) = zadefi * ( zerpplus(:,:) / aplus + zerpminus(:,:) / aminus )
907         ENDIF
908
909      END IF
910#else
911      ! Rigid-lid (emp=emps=E-P-R+Erp)
912
913      erp(:,:) = ( 1. - zfreeze(:,:) ) * zsrp    &   ! surface restoring term
914         &     * ( zsss(:,:) - s_dta(:,:,1) )     &
915         &     / ( zsss(:,:) + 1.e-20      )
916#endif
917
918   END SUBROUTINE oce_sbc_dmp
919
920#else
921   !!----------------------------------------------------------------------
922   !!   Dummy routine                                      NO salinity data
923   !!----------------------------------------------------------------------
924   SUBROUTINE oce_sbc_dmp         ! Dummy routine
925      WRITE(*,*) 'oce_sbc_dmp: you should not have seen that print! error?'
926   END SUBROUTINE oce_sbc_dmp
927#endif
928
929   !!======================================================================
930END MODULE ocesbc
Note: See TracBrowser for help on using the repository browser.