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 @ 1559

Last change on this file since 1559 was 1559, checked in by ctlod, 15 years ago

only cosmetic changes

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