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 branches/2013/dev_r3853_CNRS9_ConfSetting/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2013/dev_r3853_CNRS9_ConfSetting/NEMOGCM/NEMO/OPA_SRC/SBC/sbcana.F90 @ 3875

Last change on this file since 3875 was 3875, checked in by clevy, 11 years ago

Configuration Setting/Step? 1, see ticket:#1074

  • Property svn:keywords set to Id
File size: 16.2 KB
Line 
1MODULE sbcana
2   !!======================================================================
3   !!                       ***  MODULE  sbcana  ***
4   !! Ocean forcing:  analytical momentum, heat and freshwater forcings
5   !!=====================================================================
6   !! History :  3.0   ! 2006-06  (G. Madec)  Original code
7   !!            3.2   ! 2009-07  (G. Madec)  Style only
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   sbc_ana  : set an analytical ocean forcing
12   !!   sbc_gyre : set the GYRE configuration analytical forcing
13   !!----------------------------------------------------------------------
14   USE oce             ! ocean dynamics and tracers
15   USE dom_oce         ! ocean space and time domain
16   USE sbc_oce         ! Surface boundary condition: ocean fields
17   USE phycst          ! physical constants
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   USE lib_fortran
22
23   IMPLICIT NONE
24   PRIVATE
25
26   PUBLIC   sbc_ana    ! routine called in sbcmod module
27   PUBLIC   sbc_gyre   ! routine called in sbcmod module
28
29   !                                !!* Namelist namsbc_ana *
30   INTEGER  ::   nn_tau000 = 1       ! nb of time-step during which the surface stress
31   !                                 ! increase from 0 to its nominal value
32   REAL(wp) ::   rn_utau0  = 0._wp   ! constant wind stress value in i-direction
33   REAL(wp) ::   rn_vtau0  = 0._wp   ! constant wind stress value in j-direction
34   REAL(wp) ::   rn_qns0   = 0._wp   ! non solar heat flux
35   REAL(wp) ::   rn_qsr0   = 0._wp   !     solar heat flux
36   REAL(wp) ::   rn_emp0   = 0._wp   ! net freshwater flux
37   
38   !! * Substitutions
39#  include "domzgr_substitute.h90"
40#  include "vectopt_loop_substitute.h90"
41   !!----------------------------------------------------------------------
42   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
43   !! $Id$
44   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE sbc_ana( kt )
49      !!---------------------------------------------------------------------
50      !!                    ***  ROUTINE sbc_ana ***
51      !!             
52      !! ** Purpose :   provide at each time-step the ocean surface boundary
53      !!              condition, i.e. the momentum, heat and freshwater fluxes.
54      !!
55      !! ** Method  :   Constant and uniform surface forcing specified from
56      !!              namsbc_ana namelist parameters. All the fluxes are time
57      !!              independant except the stresses which increase from zero
58      !!              during the first nn_tau000 time-step
59      !!                CAUTION : never mask the surface stress field !
60      !!
61      !! ** Action  : - set the ocean surface boundary condition, i.e. 
62      !!                   utau, vtau, taum, wndm, qns, qsr, emp
63      !!----------------------------------------------------------------------
64      INTEGER, INTENT(in) ::   kt       ! ocean time step
65      !
66      INTEGER  ::   ios                   ! Local integer output status for namelist read
67      REAL(wp) ::   zfacto                ! local scalar
68      REAL(wp) ::   zrhoa  = 1.22_wp      ! Air density kg/m3
69      REAL(wp) ::   zcdrag = 1.5e-3_wp    ! drag coefficient
70      REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables
71      !!
72      NAMELIST/namsbc_ana/ nn_tau000, rn_utau0, rn_vtau0, rn_qns0, rn_qsr0, rn_emp0
73      !!---------------------------------------------------------------------
74      !
75      IF( kt == nit000 ) THEN
76         !
77         REWIND( numnam_ref )              ! Namelist namsbc_ana in reference namelist : Analytical surface fluxes
78         READ  ( numnam_ref, namsbc_ana, IOSTAT = ios, ERR = 901)
79901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_ana in reference namelist', lwp )
80
81         REWIND( numnam_cfg )              ! Namelist namsbc_ana in configuration namelist : Analytical surface fluxes
82         READ  ( numnam_cfg, namsbc_ana, IOSTAT = ios, ERR = 902 )
83902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_ana in configuration namelist', lwp )
84         WRITE ( numond, namsbc_ana )
85         !
86         IF(lwp) WRITE(numout,*)' '
87         IF(lwp) WRITE(numout,*)' sbc_ana : Constant surface fluxes read in namsbc_ana namelist'
88         IF(lwp) WRITE(numout,*)' ~~~~~~~ '
89         IF(lwp) WRITE(numout,*)'              spin up of the stress  nn_tau000 = ', nn_tau000, ' time-steps'
90         IF(lwp) WRITE(numout,*)'              constant i-stress      rn_utau0  = ', rn_utau0 , ' N/m2'
91         IF(lwp) WRITE(numout,*)'              constant j-stress      rn_vtau0  = ', rn_vtau0 , ' N/m2'
92         IF(lwp) WRITE(numout,*)'              non solar heat flux    rn_qns0   = ', rn_qns0  , ' W/m2'
93         IF(lwp) WRITE(numout,*)'              solar heat flux        rn_qsr0   = ', rn_qsr0  , ' W/m2'
94         IF(lwp) WRITE(numout,*)'              net heat flux          rn_emp0   = ', rn_emp0  , ' Kg/m2/s'
95         !
96         nn_tau000 = MAX( nn_tau000, 1 )     ! must be >= 1
97         !
98         emp (:,:) = rn_emp0
99         sfx (:,:) = 0.0_wp
100         qns (:,:) = rn_qns0 - emp(:,:) * sst_m(:,:) * rcp      ! including heat content associated with mass flux at SST
101         qsr (:,:) = rn_qsr0
102         !
103         utau(:,:) = rn_utau0
104         vtau(:,:) = rn_vtau0
105         taum(:,:) = SQRT ( rn_utau0 * rn_utau0 + rn_vtau0 * rn_vtau0 )
106         wndm(:,:) = SQRT ( taum(1,1) /  ( zrhoa * zcdrag ) )
107         !
108      ENDIF
109
110   
111      ! Increase the surface stress to its nominal value during the first nn_tau000 time-steps
112      IF( kt <= nn_tau000 ) THEN
113         zfacto = 0.5 * (  1. - COS( rpi * FLOAT( kt ) / FLOAT( nn_tau000 ) )  )
114         zcoef = 1. / ( zrhoa * zcdrag ) 
115         ztx = zfacto * rn_utau0
116         zty = zfacto * rn_vtau0
117         zmod = SQRT( ztx * ztx + zty * zty )
118         utau(:,:) = ztx
119         vtau(:,:) = zty
120         taum(:,:) = zmod
121         zmod = SQRT( zmod * zcoef )
122         wndm(:,:) = zmod
123      ENDIF
124      !
125   END SUBROUTINE sbc_ana
126
127
128   SUBROUTINE sbc_gyre( kt )
129      !!---------------------------------------------------------------------
130      !!                    ***  ROUTINE sbc_ana ***
131      !!             
132      !! ** Purpose :   provide at each time-step the GYRE surface boundary
133      !!              condition, i.e. the momentum, heat and freshwater fluxes.
134      !!
135      !! ** Method  :   analytical seasonal cycle for GYRE configuration.
136      !!                CAUTION : never mask the surface stress field !
137      !!
138      !! ** Action  : - set the ocean surface boundary condition, i.e.   
139      !!                   utau, vtau, taum, wndm, qns, qsr, emp, sfx
140      !!
141      !! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
142      !!----------------------------------------------------------------------
143      INTEGER, INTENT(in) ::   kt          ! ocean time step
144      !!
145      INTEGER  ::   ji, jj                 ! dummy loop indices
146      INTEGER  ::   zyear0                 ! initial year
147      INTEGER  ::   zmonth0                ! initial month
148      INTEGER  ::   zday0                  ! initial day
149      INTEGER  ::   zday_year0             ! initial day since january 1st
150      REAL(wp) ::   ztau     , ztau_sais   ! wind intensity and of the seasonal cycle
151      REAL(wp) ::   ztime                  ! time in hour
152      REAL(wp) ::   ztimemax , ztimemin    ! 21th June, and 21th decem. if date0 = 1st january
153      REAL(wp) ::   ztimemax1, ztimemin1   ! 21th June, and 21th decem. if date0 = 1st january
154      REAL(wp) ::   ztimemax2, ztimemin2   ! 21th June, and 21th decem. if date0 = 1st january
155      REAL(wp) ::   ztaun                  ! intensity
156      REAL(wp) ::   zemp_s, zemp_n, zemp_sais, ztstar
157      REAL(wp) ::   zcos_sais1, zcos_sais2, ztrp, zconv, t_star
158      REAL(wp) ::   zsumemp, zsurf
159      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
160      REAL(wp) ::   zcdrag = 1.5e-3       ! drag coefficient
161      REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables
162      REAL(wp) ::   zyydd                 ! number of days in one year
163      !!---------------------------------------------------------------------
164      zyydd = REAL(nyear_len(1),wp)
165
166      ! ---------------------------- !
167      !  heat and freshwater fluxes  !
168      ! ---------------------------- !
169      !same temperature, E-P as in HAZELEGER 2000
170
171      zyear0     =   ndate0 / 10000                             ! initial year
172      zmonth0    = ( ndate0 - zyear0 * 10000 ) / 100            ! initial month
173      zday0      =   ndate0 - zyear0 * 10000 - zmonth0 * 100    ! initial day betwen 1 and 30
174      zday_year0 = ( zmonth0 - 1 ) * 30.+zday0                  ! initial day betwen 1 and 360
175
176      ! current day (in hours) since january the 1st of the current year
177      ztime = REAL( kt ) * rdt / (rmmss * rhhmm)   &       !  total incrementation (in hours)
178         &      - (nyear  - 1) * rjjhh * zyydd             !  minus years since beginning of experiment (in hours)
179
180      ztimemax1 = ((5.*30.)+21.)* 24.                      ! 21th june     at 24h in hours
181      ztimemin1 = ztimemax1 + rjjhh * zyydd / 2            ! 21th december        in hours
182      ztimemax2 = ((6.*30.)+21.)* 24.                      ! 21th july     at 24h in hours
183      ztimemin2 = ztimemax2 - rjjhh * zyydd / 2            ! 21th january         in hours
184      !                                                    ! NB: rjjhh * zyydd / 4 = one seasonal cycle in hours
185
186      ! amplitudes
187      zemp_S    = 0.7       ! intensity of COS in the South
188      zemp_N    = 0.8       ! intensity of COS in the North
189      zemp_sais = 0.1
190      zTstar    = 28.3      ! intemsity from 28.3 a -5 deg
191
192      ! 1/2 period between 21th June and 21th December and between 21th July and 21th January
193      zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi ) 
194      zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
195
196      ztrp= - 40.e0        ! retroaction term on heat fluxes (W/m2/K)
197      zconv = 3.16e-5      ! convertion factor: 1 m/yr => 3.16e-5 mm/s
198      DO jj = 1, jpj
199         DO ji = 1, jpi
200            ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3
201            ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
202            ! 64.5 in summer, 42.5 in winter
203            t_star = zTstar * ( 1 + 1. / 50. * zcos_sais2 )                &
204               &                    * COS( rpi * (gphit(ji,jj) - 5.)               &
205               &                    / ( 53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) )
206            ! 23.5 deg : tropics
207            qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )
208            qns (ji,jj) = ztrp * ( tsb(ji,jj,1,jp_tem) - t_star ) - qsr(ji,jj)
209            IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj) ) THEN    ! zero at 37.8 deg, max at 24.6 deg
210               emp  (ji,jj) =   zemp_S * zconv   &
211                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  &
212                  &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
213            ELSE
214               emp (ji,jj) =  - zemp_N * zconv   &
215                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  &
216                  &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
217            ENDIF
218         END DO
219      END DO
220
221      ! Compute the emp flux such as its integration on the whole domain at each time is zero
222      IF( nbench /= 1 ) THEN
223         zsumemp = GLOB_SUM( emp(:,:) ) 
224         zsurf   = GLOB_SUM( tmask(:,:,1) ) 
225         ! Default GYRE configuration
226         zsumemp = zsumemp / zsurf
227      ELSE
228         ! Benchmark GYRE configuration (to allow the bit to bit comparison between Mpp/Mono case)
229         zsumemp = 0.e0   ;    zsurf = 0.e0
230      ENDIF
231
232      ! freshwater (mass flux) and update of qns with heat content of emp
233      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)        ! freshwater flux (=0 in domain average)
234      sfx (:,:) = 0.0_wp                                   ! no salt flux
235      qns (:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp   ! evap and precip are at SST
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 * zyydd          !  - nber of hours the precedent years
253      ztimemax = ((5.*30.)+21.)* 24.               ! 21th june     in hours
254      ztimemin = ztimemax + rjjhh * zyydd / 2      ! 21th december in hours
255      !                                            ! NB: rjjhh * zyydd / 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      ! module of wind stress and wind speed at T-point
272      zcoef = 1. / ( zrhoa * zcdrag ) 
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            zmod = 0.5 * SQRT( ztx * ztx + zty * zty )
280            taum(ji,jj) = zmod
281            wndm(ji,jj) = SQRT( zmod * zcoef )
282         END DO
283      END DO
284      CALL lbc_lnk( taum(:,:), 'T', 1. )   ;   CALL lbc_lnk( wndm(:,:), 'T', 1. )
285
286      ! ---------------------------------- !
287      !  control print at first time-step  !
288      ! ---------------------------------- !
289      IF( kt == nit000 .AND. lwp ) THEN
290         WRITE(numout,*)
291         WRITE(numout,*)'sbc_gyre : analytical surface fluxes for GYRE configuration'               
292         WRITE(numout,*)'~~~~~~~~ ' 
293         WRITE(numout,*)'           nyear      = ', nyear
294         WRITE(numout,*)'           nmonth     = ', nmonth
295         WRITE(numout,*)'           nday       = ', nday
296         WRITE(numout,*)'           nday_year  = ', nday_year
297         WRITE(numout,*)'           ztime      = ', ztime
298         WRITE(numout,*)'           ztimemax   = ', ztimemax
299         WRITE(numout,*)'           ztimemin   = ', ztimemin
300         WRITE(numout,*)'           ztimemax1  = ', ztimemax1
301         WRITE(numout,*)'           ztimemin1  = ', ztimemin1
302         WRITE(numout,*)'           ztimemax2  = ', ztimemax2
303         WRITE(numout,*)'           ztimemin2  = ', ztimemin2
304         WRITE(numout,*)'           zyear0     = ', zyear0
305         WRITE(numout,*)'           zmonth0    = ', zmonth0
306         WRITE(numout,*)'           zday0      = ', zday0
307         WRITE(numout,*)'           zday_year0 = ', zday_year0
308         WRITE(numout,*)'           zyydd      = ', zyydd
309         WRITE(numout,*)'           zemp_S     = ', zemp_S
310         WRITE(numout,*)'           zemp_N     = ', zemp_N
311         WRITE(numout,*)'           zemp_sais  = ', zemp_sais
312         WRITE(numout,*)'           zTstar     = ', zTstar
313         WRITE(numout,*)'           zsumemp    = ', zsumemp
314         WRITE(numout,*)'           zsurf      = ', zsurf
315         WRITE(numout,*)'           ztrp       = ', ztrp
316         WRITE(numout,*)'           zconv      = ', zconv
317         WRITE(numout,*)'           ndastp     = ', ndastp
318         WRITE(numout,*)'           adatrj     = ', adatrj
319      ENDIF
320      !
321   END SUBROUTINE sbc_gyre
322
323   !!======================================================================
324END MODULE sbcana
Note: See TracBrowser for help on using the repository browser.