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 tags/nemo_v1_13_dev1/NEMO/OPA_SRC/SBC – NEMO

source: tags/nemo_v1_13_dev1/NEMO/OPA_SRC/SBC/ocesbc.F90 @ 9126

Last change on this file since 9126 was 440, checked in by opalod, 18 years ago

nemo_v1_update_046 : CT : - light modifications related to the way to make SST/SSS damping

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