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.
sbcana.F90 in trunk/NEMO/OPA_SRC/SBC – NEMO

source: trunk/NEMO/OPA_SRC/SBC/sbcana.F90 @ 1146

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

Add svn Id (first try), see ticket #210

  • Property svn:keywords set to Id
File size: 15.8 KB
Line 
1MODULE sbcana
2   !!======================================================================
3   !!                       ***  MODULE  sbcana  ***
4   !! Ocean forcing:  analytical momentum, heat and freshwater forcings
5   !!=====================================================================
6   !! History :  9.0   !  06-06  (G. Madec)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   sbc_ana  : set an analytical ocean forcing
11   !!   sbc_gyre : set the GYRE configuration analytical forcing
12   !!----------------------------------------------------------------------
13   USE oce             ! ocean dynamics and tracers
14   USE dom_oce         ! ocean space and time domain
15   USE sbc_oce         ! Surface boundary condition: ocean fields
16   USE phycst          ! physical constants
17   USE daymod          ! calendar
18   USE in_out_manager  ! I/O manager
19   USE lib_mpp         ! distribued memory computing library
20   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
21
22   IMPLICIT NONE
23   PRIVATE
24
25   PUBLIC   sbc_ana    ! routine called in sbcmod module
26   PUBLIC   sbc_gyre   ! routine called in sbcmod module
27
28   !! * Namelist namsbc_ana
29   INTEGER  ::   nn_tau000 = 1      ! nb of time-step during which the surface stress
30      !                             ! increase from 0 to its nominal value
31   REAL(wp) ::   rn_utau0  = 0.e0   ! constant wind stress value in i-direction
32   REAL(wp) ::   rn_vtau0  = 0.e0   ! constant wind stress value in j-direction
33   REAL(wp) ::   rn_qns0   = 0.e0   ! non solar heat flux
34   REAL(wp) ::   rn_qsr0   = 0.e0   !     solar heat flux
35   REAL(wp) ::   rn_emp0   = 0.e0   ! net freshwater flux
36 
37   REAL(wp) ::   rhoa      = 1.22   ! Air density kg/m3
38   REAL(wp) ::   cdrag     = 1.5e-3 ! drag coefficient
39 
40   !! * Substitutions
41#  include "domzgr_substitute.h90"
42#  include "vectopt_loop_substitute.h90"
43   !!----------------------------------------------------------------------
44   !!   OPA 9.0 , LOCEAN-IPSL (2006)
45   !! $ Id: $
46   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
47   !!----------------------------------------------------------------------
48
49CONTAINS
50
51   SUBROUTINE sbc_ana( kt )
52      !!---------------------------------------------------------------------
53      !!                    ***  ROUTINE sbc_ana ***
54      !!             
55      !! ** Purpose :   provide at each time-step the ocean surface boundary
56      !!      condition, i.e. the momentum, heat and freshwater fluxes.
57      !!
58      !! ** Method  :   Constant and uniform surface forcing specified from
59      !!      namsbc_ana namelist parameters. All the fluxes are time inde-
60      !!      pendant except the stresses which increase from zero during
61      !!      the first nn_tau000 time-step
62      !!      * C A U T I O N : never mask the surface stress field !
63      !!
64      !! ** Action  : - set the ocean surface boundary condition, i.e. 
65      !!                   utau, vtau, qns, qsr, emp, emps
66      !!----------------------------------------------------------------------
67      INTEGER, INTENT(in) ::   kt       ! ocean time step
68      !!
69      INTEGER             ::   ji, jj          ! dummy loop indices
70      REAL(wp)            ::   zfacto          ! local scalar
71      REAL(wp)            ::   ztx, zty, ztau  ! local scalar
72      !!
73      NAMELIST/namsbc_ana/ nn_tau000, rn_utau0, rn_vtau0, rn_qns0, rn_qsr0, rn_emp0
74      !!---------------------------------------------------------------------
75      !
76      IF( kt == nit000 ) THEN
77         !
78         REWIND ( numnam )                   ! Read Namelist namsbc : surface fluxes
79         READ   ( numnam, namsbc_ana )
80         !
81         IF(lwp) WRITE(numout,*)' '
82         IF(lwp) WRITE(numout,*)' sbc_ana : Constant surface fluxes read in namsbc_ana namelist'
83         IF(lwp) WRITE(numout,*)' ~~~~~~~ '
84         IF(lwp) WRITE(numout,*)'              spin up of the stress  nn_tau000 = ', nn_tau000, ' time-steps'
85         IF(lwp) WRITE(numout,*)'              constant i-stress      rn_utau0  = ', rn_utau0 , ' N/m2'
86         IF(lwp) WRITE(numout,*)'              constant j-stress      rn_vtau0  = ', rn_vtau0 , ' N/m2'
87         IF(lwp) WRITE(numout,*)'              non solar heat flux    rn_qns0   = ', rn_qns0  , ' W/m2'
88         IF(lwp) WRITE(numout,*)'              solar heat flux        rn_qsr0   = ', rn_qsr0  , ' W/m2'
89         IF(lwp) WRITE(numout,*)'              net heat flux          rn_emp0   = ', rn_emp0  , ' Kg/m2/s'
90         !
91         nn_tau000 = MAX( nn_tau000, 1 )   ! must be >= 1
92         qns   (:,:) = rn_qns0
93         qsr   (:,:) = rn_qsr0
94         emp   (:,:) = rn_emp0
95         emps  (:,:) = rn_emp0
96         !
97      ENDIF
98   
99      ! Increase the surface stress to its nominal value during the first nn_tau000 time-steps
100      IF( kt <= nn_tau000 ) THEN
101         zfacto = 0.5 * (  1. - COS( rpi * FLOAT( kt ) / FLOAT( nn_tau000 ) )  )
102         utau(:,:) = zfacto * rn_utau0
103         vtau(:,:) = zfacto * rn_vtau0
104      ENDIF
105
106      ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 )
107      zfacto = 0.5 / ( rhoa * cdrag )
108!CDIR NOVERRCHK
109      DO jj = 2, jpjm1
110!CDIR NOVERRCHK
111         DO ji = fs_2, fs_jpim1   ! vect. opt.
112            ztx = utau(ji-1,jj  ) + utau(ji,jj)           
113            zty = vtau(ji  ,jj-1) + vtau(ji,jj) 
114            ztau = SQRT( ztx * ztx + zty * zty )
115            wndm(ji,jj) = SQRT ( ztau * zfacto ) * tmask(ji,jj,1)
116         END DO
117      END DO
118      CALL lbc_lnk( wndm(:,:) , 'T', 1. )
119      !
120   END SUBROUTINE sbc_ana
121
122
123   SUBROUTINE sbc_gyre( kt )
124      !!---------------------------------------------------------------------
125      !!                    ***  ROUTINE sbc_ana ***
126      !!             
127      !! ** Purpose :   provide at each time-step the ocean surface boundary
128      !!      condition, i.e. the momentum, heat and freshwater fluxes.
129      !!
130      !! ** Method  :   analytical seasonal cycle for GYRE configuration.
131      !!      * C A U T I O N : never mask the surface stress field !
132      !!
133      !! ** Action  : - set the ocean surface boundary condition, i.e.   
134      !!                   utau, vtau, qns, qsr, emp, emps
135      !!
136      !! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
137      !!----------------------------------------------------------------------
138      INTEGER, INTENT(in) ::   kt          ! ocean time step
139
140      INTEGER  ::   ji, jj                 ! dummy loop indices
141      INTEGER  ::   zyear0                 ! initial year
142      INTEGER  ::   zmonth0                ! initial month
143      INTEGER  ::   zday0                  ! initial day
144      INTEGER  ::   zday_year0             ! initial day since january 1st
145      REAL(wp) ::   ztau     , ztau_sais   ! wind intensity and of the seasonal cycle
146      REAL(wp) ::   ztime                  ! time in hour
147      REAL(wp) ::   ztimemax , ztimemin    ! 21th June, and 21th decem. if date0 = 1st january
148      REAL(wp) ::   ztimemax1, ztimemin1   ! 21th June, and 21th decem. if date0 = 1st january
149      REAL(wp) ::   ztimemax2, ztimemin2   ! 21th June, and 21th decem. if date0 = 1st january
150      REAL(wp) ::   ztaun                  ! intensity
151      REAL(wp) ::   zemp_s, zemp_n, zemp_sais, ztstar
152      REAL(wp) ::   zcos_sais1, zcos_sais2, ztrp, zconv, t_star
153      REAL(wp) ::   zsumemp, zsurf
154      REAL(wp) ::   ztx, zty, zfacto
155      !!---------------------------------------------------------------------
156         
157      ! ---------------------------- !
158      !  heat and freshwater fluxes  !
159      ! ---------------------------- !
160      !same temperature, E-P as in HAZELEGER 2000
161
162      zyear0     =   ndate0 / 10000                             ! initial year
163      zmonth0    = ( ndate0 - zyear0 * 10000 ) / 100            ! initial month
164      zday0      =   ndate0 - zyear0 * 10000 - zmonth0 * 100    ! initial day betwen 1 and 30
165      zday_year0 = ( zmonth0 - 1 ) * 30.+zday0                  ! initial day betwen 1 and 360
166
167      ! current day (in hours) since january the 1st of the current year
168      ztime = REAL( kt ) * rdt / (rmmss * rhhmm)   &       !  total incrementation (in hours)
169         &      - (nyear  - 1) * rjjhh * raajj             !  minus years since beginning of experiment (in hours)
170
171      ztimemax1 = ((5.*30.)+21.)* 24.                      ! 21th june     at 24h in hours
172      ztimemin1 = ztimemax1 + rjjhh * raajj / 2            ! 21th december        in hours
173      ztimemax2 = ((6.*30.)+21.)* 24.                      ! 21th july     at 24h in hours
174      ztimemin2 = ztimemax2 - rjjhh * raajj / 2            ! 21th january         in hours
175      !                                                    ! NB: rjjhh * raajj / 4 = one seasonal cycle in hours
176
177      ! amplitudes
178      zemp_S    = 0.7       ! intensity of COS in the South
179      zemp_N    = 0.8       ! intensity of COS in the North
180      zemp_sais = 0.1
181      zTstar    = 28.3      ! intemsity from 28.3 a -5 deg
182
183      ! 1/2 period between 21th June and 21th December and between 21th July and 21th January
184      zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi ) 
185      zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
186
187      ztrp= - 40.e0        ! retroaction term on heat fluxes (W/m2/K)
188      zconv = 3.16e-5      ! convertion factor: 1 m/yr => 3.16e-5 mm/s
189      DO jj = 1, jpj
190         DO ji = 1, jpi
191            ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3
192            ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
193            ! 64.5 in summer, 42.5 in winter
194            t_star = zTstar * ( 1 + 1. / 50. * zcos_sais2 )                &
195               &                    * COS( rpi * (gphit(ji,jj) - 5.)               &
196               &                    / ( 53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) )
197            ! 23.5 deg : tropics
198            qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )
199            qns (ji,jj) = ztrp * ( tb(ji,jj,1) - t_star ) - qsr(ji,jj)
200            IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj) ) THEN    ! zero at 37.8 deg, max at 24.6 deg
201               emp  (ji,jj) =   zemp_S * zconv   &
202                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  &
203                  &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
204            ELSE
205               emp (ji,jj) =  - zemp_N * zconv   &
206                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  &
207                  &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
208            ENDIF
209         END DO
210      END DO
211      emps(:,:) = emp(:,:)
212
213      ! Compute the emp flux such as its integration on the whole domain at each time is zero
214      IF( nbench /= 1 .AND. nbit_cmp /= 1 ) THEN
215         zsumemp = 0.e0   ;   zsurf = 0.e0
216         DO jj = 1, jpj
217            DO ji = 1, jpi
218               zsumemp = zsumemp + emp(ji,jj) * tmask(ji,jj,1) * tmask_i(ji,jj)
219               zsurf   = zsurf   +              tmask(ji,jj,1) * tmask_i(ji,jj)
220            END DO
221         END DO
222
223         IF( lk_mpp )   CALL mpp_sum( zsumemp  )       ! sum over the global domain
224         IF( lk_mpp )   CALL mpp_sum( zsurf    )       ! sum over the global domain
225
226         ! Default GYRE configuration
227         zsumemp = zsumemp / zsurf
228      ELSE
229         ! Benchmark GYRE configuration (to allow the bit to bit comparison between Mpp/Mono case)
230         zsumemp = 0.e0   ;    zsurf = 0.e0
231      ENDIF
232
233      !salinity terms
234      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)
235      emps(:,:) = emp(:,:)
236
237
238      ! ---------------------------- !
239      !       momentum fluxes        !
240      ! ---------------------------- !
241      ! same wind as in Wico
242      !test date0 : ndate0 = 010203
243      zyear0  =   ndate0 / 10000
244      zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100
245      zday0   =   ndate0 - zyear0 * 10000 - zmonth0 * 100
246      !Calculates nday_year, day since january 1st
247      zday_year0 = (zmonth0-1)*30.+zday0
248
249      !accumulates days of previous months of this year
250      ! day (in hours) since january the 1st
251      ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &  ! incrementation in hour
252         &     - (nyear - 1) * rjjhh * raajj          !  - nber of hours the precedent years
253      ztimemax = ((5.*30.)+21.)* 24.               ! 21th june     in hours
254      ztimemin = ztimemax + rjjhh * raajj / 2      ! 21th december in hours
255      !                                            ! NB: rjjhh * raajj / 4 = 1 seasonal cycle in hours
256
257      ! mean intensity at 0.105 ; srqt(2) because projected with 45deg angle
258      ztau = 0.105 / SQRT( 2. )
259      ! seasonal oscillation intensity
260      ztau_sais = 0.015
261      ztaun = ztau - ztau_sais * COS( (ztime - ztimemax) / (ztimemin - ztimemax) * rpi )
262      DO jj = 1, jpj
263         DO ji = 1, jpi
264           ! domain from 15deg to 50deg and 1/2 period along 14deg
265           ! so 5/4 of half period with seasonal cycle
266           utau(ji,jj) = - ztaun * SIN( rpi * (gphiu(ji,jj) - 15.) / (29.-15.) )
267           vtau(ji,jj) =   ztaun * SIN( rpi * (gphiv(ji,jj) - 15.) / (29.-15.) )
268         END DO
269      END DO
270
271      ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 )
272      zfacto = 0.5 / ( rhoa * cdrag )
273!CDIR NOVERRCHK
274      DO jj = 2, jpjm1
275!CDIR NOVERRCHK
276         DO ji = fs_2, fs_jpim1   ! vect. opt.
277            ztx = utau(ji-1,jj  ) + utau(ji,jj)
278            zty = vtau(ji  ,jj-1) + vtau(ji,jj)
279            ztau = SQRT( ztx * ztx + zty * zty )
280            wndm(ji,jj) = SQRT ( ztau * zfacto ) * tmask(ji,jj,1)
281         END DO
282      END DO
283      CALL lbc_lnk( wndm(:,:) , 'T', 1. )
284
285      ! ---------------------------------- !
286      !  control print at first time-step  !
287      ! ---------------------------------- !
288      IF( kt == nit000 .AND. lwp ) THEN
289         WRITE(numout,*)
290         WRITE(numout,*)'sbc_gyre : analytical surface fluxes for GYRE configuration'               
291         WRITE(numout,*)'~~~~~~~~ ' 
292         WRITE(numout,*)'           nyear      = ', nyear
293         WRITE(numout,*)'           nmonth     = ', nmonth
294         WRITE(numout,*)'           nday       = ', nday
295         WRITE(numout,*)'           nday_year  = ',nday_year
296         WRITE(numout,*)'           ztime      = ', ztime
297         WRITE(numout,*)'           ztimemax1  = ', ztimemax1
298         WRITE(numout,*)'           ztimemin1  = ', ztimemin1
299         WRITE(numout,*)'           ztimemax2  = ', ztimemax2
300         WRITE(numout,*)'           ztimemin2  = ', ztimemin2
301         WRITE(numout,*)'           zyear0     = ', zyear0
302         WRITE(numout,*)'           zmonth0    = ', zmonth0
303         WRITE(numout,*)'           zday0      = ', zday0
304         WRITE(numout,*)'           zday_year0 = ', zday_year0
305         WRITE(numout,*)'           raajj      = ', raajj
306         WRITE(numout,*)'           zemp_S     = ', zemp_S
307         WRITE(numout,*)'           zemp_N     = ', zemp_N
308         WRITE(numout,*)'           zemp_sais  = ', zemp_sais
309         WRITE(numout,*)'           zTstar     = ', zTstar
310         WRITE(numout,*)'           zsumemp    = ', zsumemp
311         WRITE(numout,*)'           zsurf      = ', zsurf
312         WRITE(numout,*)'           ztrp       = ', ztrp
313         WRITE(numout,*)'           zconv      = ', zconv
314
315         WRITE(numout,*)'           ndastp     = ',ndastp
316         WRITE(numout,*)'           adatrj     = ',adatrj
317         WRITE(numout,*)'           ztime      = ',ztime
318
319         WRITE(numout,*)'           ztimemax   = ',ztimemax
320         WRITE(numout,*)'           ztimemin   = ',ztimemin
321         WRITE(numout,*)'           zyear0     = ', zyear0
322         WRITE(numout,*)'           zmonth0    = ', zmonth0
323         WRITE(numout,*)'           zday0      = ', zday0
324         WRITE(numout,*)'           zday_year0 = ',zday_year0
325         WRITE(numout,*)'           raajj  = ', raajj
326      ENDIF
327
328   END SUBROUTINE sbc_gyre
329
330   !!======================================================================
331END MODULE sbcana
Note: See TracBrowser for help on using the repository browser.