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.
usrdef_sbc.F90 in branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/USR – NEMO

source: branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/USR/usrdef_sbc.F90 @ 6717

Last change on this file since 6717 was 6717, checked in by gm, 8 years ago

#1692 - branch SIMPLIF_2_usrdef: numerous improvement in the user defined interface

File size: 11.6 KB
Line 
1MODULE usrdef_sbc
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_sbc  ***
4   !! Ocean forcing:  user defined momentum, heat and freshwater forcings
5   !!
6   !!                ===     Here  GYRE configuration      ===
7   !!
8   !!=====================================================================
9   !! History :  4.0   ! 2016-03  (S. Flavoni, G. Madec)  user defined interface
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_sbc    : user defined surface bounday conditions in GYRE case
14   !!----------------------------------------------------------------------
15   USE oce             ! ocean dynamics and tracers
16   USE dom_oce         ! ocean space and time domain
17   USE sbc_oce         ! Surface boundary condition: ocean fields
18   USE phycst          ! physical constants
19   !
20   USE in_out_manager  ! I/O manager
21   USE lib_mpp         ! distribued memory computing library
22   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
23   USE lib_fortran     !
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   usr_def_sbc    ! routine called in sbcmod module
29
30   !! * Substitutions
31#  include "vectopt_loop_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
34   !! $Id: $
35   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE usr_def_sbc( kt )
40      !!---------------------------------------------------------------------
41      !!                    ***  ROUTINE usr_def_sbc  ***
42      !!             
43      !! ** Purpose :   provide at each time-step the GYRE surface boundary
44      !!              condition, i.e. the momentum, heat and freshwater fluxes.
45      !!
46      !! ** Method  :   analytical seasonal cycle for GYRE configuration.
47      !!                CAUTION : never mask the surface stress field !
48      !!
49      !! ** Action  : - set the ocean surface boundary condition, i.e.   
50      !!                   utau, vtau, taum, wndm, qns, qsr, emp, sfx
51      !!
52      !! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
53      !!----------------------------------------------------------------------
54      INTEGER, INTENT(in) ::   kt   ! ocean time step
55      !!
56      INTEGER  ::   ji, jj                 ! dummy loop indices
57      INTEGER  ::   zyear0                 ! initial year
58      INTEGER  ::   zmonth0                ! initial month
59      INTEGER  ::   zday0                  ! initial day
60      INTEGER  ::   zday_year0             ! initial day since january 1st
61      REAL(wp) ::   ztau     , ztau_sais   ! wind intensity and of the seasonal cycle
62      REAL(wp) ::   ztime                  ! time in hour
63      REAL(wp) ::   ztimemax , ztimemin    ! 21th June, and 21th decem. if date0 = 1st january
64      REAL(wp) ::   ztimemax1, ztimemin1   ! 21th June, and 21th decem. if date0 = 1st january
65      REAL(wp) ::   ztimemax2, ztimemin2   ! 21th June, and 21th decem. if date0 = 1st january
66      REAL(wp) ::   ztaun                  ! intensity
67      REAL(wp) ::   zemp_s, zemp_n, zemp_sais, ztstar
68      REAL(wp) ::   zcos_sais1, zcos_sais2, ztrp, zconv, t_star
69      REAL(wp) ::   zsumemp, zsurf
70      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
71      REAL(wp) ::   zcdrag = 1.5e-3       ! drag coefficient
72      REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables
73      REAL(wp) ::   zyydd                 ! number of days in one year
74      !!---------------------------------------------------------------------
75      zyydd = REAL(nyear_len(1),wp)
76
77      ! ---------------------------- !
78      !  heat and freshwater fluxes  !
79      ! ---------------------------- !
80      !same temperature, E-P as in HAZELEGER 2000
81
82      zyear0     =   ndate0 / 10000                             ! initial year
83      zmonth0    = ( ndate0 - zyear0 * 10000 ) / 100            ! initial month
84      zday0      =   ndate0 - zyear0 * 10000 - zmonth0 * 100    ! initial day betwen 1 and 30
85      zday_year0 = ( zmonth0 - 1 ) * 30.+zday0                  ! initial day betwen 1 and 360
86
87      ! current day (in hours) since january the 1st of the current year
88      ztime = REAL( kt ) * rdt / (rmmss * rhhmm)   &       !  total incrementation (in hours)
89         &      - (nyear  - 1) * rjjhh * zyydd             !  minus years since beginning of experiment (in hours)
90
91      ztimemax1 = ((5.*30.)+21.)* 24.                      ! 21th june     at 24h in hours
92      ztimemin1 = ztimemax1 + rjjhh * zyydd / 2            ! 21th december        in hours
93      ztimemax2 = ((6.*30.)+21.)* 24.                      ! 21th july     at 24h in hours
94      ztimemin2 = ztimemax2 - rjjhh * zyydd / 2            ! 21th january         in hours
95      !                                                    ! NB: rjjhh * zyydd / 4 = one seasonal cycle in hours
96
97      ! amplitudes
98      zemp_S    = 0.7       ! intensity of COS in the South
99      zemp_N    = 0.8       ! intensity of COS in the North
100      zemp_sais = 0.1
101      zTstar    = 28.3      ! intemsity from 28.3 a -5 deg
102
103      ! 1/2 period between 21th June and 21th December and between 21th July and 21th January
104      zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi ) 
105      zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
106
107      ztrp= - 40.e0        ! retroaction term on heat fluxes (W/m2/K)
108      zconv = 3.16e-5      ! convertion factor: 1 m/yr => 3.16e-5 mm/s
109      DO jj = 1, jpj
110         DO ji = 1, jpi
111            ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3
112            ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
113            ! 64.5 in summer, 42.5 in winter
114            t_star = zTstar * ( 1. + 1. / 50. * zcos_sais2 )                &
115               &                    * COS( rpi * (gphit(ji,jj) - 5.)               &
116               &                    / ( 53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) )
117            ! 23.5 deg : tropics
118            qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )
119            qns (ji,jj) = ztrp * ( tsb(ji,jj,1,jp_tem) - t_star ) - qsr(ji,jj)
120            IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj) ) THEN    ! zero at 37.8 deg, max at 24.6 deg
121               emp  (ji,jj) =   zemp_S * zconv   &
122                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  &
123                  &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
124            ELSE
125               emp (ji,jj) =  - zemp_N * zconv   &
126                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  &
127                  &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
128            ENDIF
129         END DO
130      END DO
131
132!!gm  ===>>> The following lines are to be de-commented
133!!    Commented here as they change the GYRE results
134!#if !defined key_mpp_rep
135!      CALL ctl_stop( 'usr_def_sbc: key_mpp_rep is required to run GYRE configuration')
136!#endif
137!!gm
138
139      zsumemp = GLOB_SUM( emp  (:,:)   ) 
140      zsurf   = GLOB_SUM( tmask(:,:,1) ) 
141      zsumemp = zsumemp / zsurf         ! Default GYRE configuration
142
143      ! freshwater (mass flux) and update of qns with heat content of emp
144      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)        ! freshwater flux (=0 in domain average)
145      sfx (:,:) = 0.0_wp                                   ! no salt flux
146      qns (:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp   ! evap and precip are at SST
147
148
149      ! ---------------------------- !
150      !       momentum fluxes        !
151      ! ---------------------------- !
152      ! same wind as in Wico
153      !test date0 : ndate0 = 010203
154      zyear0  =   ndate0 / 10000
155      zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100
156      zday0   =   ndate0 - zyear0 * 10000 - zmonth0 * 100
157      !Calculates nday_year, day since january 1st
158      zday_year0 = (zmonth0-1)*30.+zday0
159
160      !accumulates days of previous months of this year
161      ! day (in hours) since january the 1st
162      ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &  ! incrementation in hour
163         &     - (nyear - 1) * rjjhh * zyydd          !  - nber of hours the precedent years
164      ztimemax = ((5.*30.)+21.)* 24.               ! 21th june     in hours
165      ztimemin = ztimemax + rjjhh * zyydd / 2      ! 21th december in hours
166      !                                            ! NB: rjjhh * zyydd / 4 = 1 seasonal cycle in hours
167
168      ! mean intensity at 0.105 ; srqt(2) because projected with 45deg angle
169      ztau = 0.105 / SQRT( 2. )
170      ! seasonal oscillation intensity
171      ztau_sais = 0.015
172      ztaun = ztau - ztau_sais * COS( (ztime - ztimemax) / (ztimemin - ztimemax) * rpi )
173      DO jj = 1, jpj
174         DO ji = 1, jpi
175           ! domain from 15deg to 50deg and 1/2 period along 14deg
176           ! so 5/4 of half period with seasonal cycle
177           utau(ji,jj) = - ztaun * SIN( rpi * (gphiu(ji,jj) - 15.) / (29.-15.) )
178           vtau(ji,jj) =   ztaun * SIN( rpi * (gphiv(ji,jj) - 15.) / (29.-15.) )
179         END DO
180      END DO
181
182      ! module of wind stress and wind speed at T-point
183      zcoef = 1. / ( zrhoa * zcdrag ) 
184      DO jj = 2, jpjm1
185         DO ji = fs_2, fs_jpim1   ! vect. opt.
186            ztx = utau(ji-1,jj  ) + utau(ji,jj) 
187            zty = vtau(ji  ,jj-1) + vtau(ji,jj) 
188            zmod = 0.5 * SQRT( ztx * ztx + zty * zty )
189            taum(ji,jj) = zmod
190            wndm(ji,jj) = SQRT( zmod * zcoef )
191         END DO
192      END DO
193      CALL lbc_lnk( taum(:,:), 'T', 1. )   ;   CALL lbc_lnk( wndm(:,:), 'T', 1. )
194
195      ! ---------------------------------- !
196      !  control print at first time-step  !
197      ! ---------------------------------- !
198      IF( kt == nit000 .AND. lwp ) THEN
199         WRITE(numout,*)
200         WRITE(numout,*)'usr_def_sbc : analytical surface fluxes for GYRE configuration'               
201         WRITE(numout,*)'~~~~~~~~~~~ ' 
202         WRITE(numout,*)'           nyear      = ', nyear
203         WRITE(numout,*)'           nmonth     = ', nmonth
204         WRITE(numout,*)'           nday       = ', nday
205         WRITE(numout,*)'           nday_year  = ', nday_year
206         WRITE(numout,*)'           ztime      = ', ztime
207         WRITE(numout,*)'           ztimemax   = ', ztimemax
208         WRITE(numout,*)'           ztimemin   = ', ztimemin
209         WRITE(numout,*)'           ztimemax1  = ', ztimemax1
210         WRITE(numout,*)'           ztimemin1  = ', ztimemin1
211         WRITE(numout,*)'           ztimemax2  = ', ztimemax2
212         WRITE(numout,*)'           ztimemin2  = ', ztimemin2
213         WRITE(numout,*)'           zyear0     = ', zyear0
214         WRITE(numout,*)'           zmonth0    = ', zmonth0
215         WRITE(numout,*)'           zday0      = ', zday0
216         WRITE(numout,*)'           zday_year0 = ', zday_year0
217         WRITE(numout,*)'           zyydd      = ', zyydd
218         WRITE(numout,*)'           zemp_S     = ', zemp_S
219         WRITE(numout,*)'           zemp_N     = ', zemp_N
220         WRITE(numout,*)'           zemp_sais  = ', zemp_sais
221         WRITE(numout,*)'           zTstar     = ', zTstar
222         WRITE(numout,*)'           zsumemp    = ', zsumemp
223         WRITE(numout,*)'           zsurf      = ', zsurf
224         WRITE(numout,*)'           ztrp       = ', ztrp
225         WRITE(numout,*)'           zconv      = ', zconv
226         WRITE(numout,*)'           ndastp     = ', ndastp
227         WRITE(numout,*)'           adatrj     = ', adatrj
228      ENDIF
229      !
230   END SUBROUTINE usr_def_sbc
231
232   !!======================================================================
233END MODULE usrdef_sbc
Note: See TracBrowser for help on using the repository browser.