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.
cyclone.F90 in branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90 @ 11738

Last change on this file since 11738 was 11738, checked in by marc, 5 years ago

The Dr Hook changes from my perl code.

File size: 14.7 KB
Line 
1MODULE cyclone
2   !!======================================================================
3   !!                       ***  MODULE  cyclone  ***
4   !! add the Tropical Cyclones along tracks to the surface wind forcing
5   !!                 
6   !!======================================================================
7   !! History : 3.3  ! 2010-05  (E Vincent, G Madec, S Masson)  Original code
8   !!----------------------------------------------------------------------
9
10#if defined key_cyclone
11   !!----------------------------------------------------------------------
12   !!  'key_cyclone' : key option add Tropical Cyclones in the wind forcing
13   !!----------------------------------------------------------------------
14   !!   wnd_cyc      : 1 module subroutine
15   !!----------------------------------------------------------------------
16   USE oce             ! ocean dynamics and active tracers
17   USE sbc_oce         ! surface boundary condition: ocean
18   USE dom_oce         ! ocean space domain variables
19   USE phycst          ! physical constant
20   USE fldread         ! read input fields
21   USE in_out_manager  ! I/O manager
22   USE geo2ocean       ! tools for projection on ORCA grid
23   USE wrk_nemo        ! work arrays
24   USE lib_mpp       
25
26   USE yomhook, ONLY: lhook, dr_hook
27   USE parkind1, ONLY: jprb, jpim
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   wnd_cyc   ! routine called in sbcblk_core.F90 module
33
34   INTEGER , PARAMETER ::   jp_is1  = 1   ! index of presence 1 or absence 0 of a TC record
35   INTEGER , PARAMETER ::   jp_lon  = 2   ! index of longitude for present TCs
36   INTEGER , PARAMETER ::   jp_lat  = 3   ! index of latitude  for present TCs
37   INTEGER , PARAMETER ::   jp_vmax = 4   ! index of max wind  for present TCs
38   INTEGER , PARAMETER ::   jp_pres = 5   ! index of eye-pres  for present TCs
39
40   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
41
42   !! * Substitutions
43#  include "vectopt_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)
46   !! $Id$
47   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
48   !!----------------------------------------------------------------------
49
50CONTAINS
51
52   SUBROUTINE wnd_cyc( kt, pwnd_i, pwnd_j )
53      !!----------------------------------------------------------------------
54      !!                    ***  ROUTINE wnd_cyc  ***
55      !!
56      !! ** Purpose :  Add cyclone winds on the ORCA grid
57      !!
58      !! ** Action  : - open TC data, find TCs for the current timestep
59      !!              - for each potential TC, add the winds on the grid
60      !!----------------------------------------------------------------------
61      INTEGER , INTENT(in)                      ::   kt       ! time step index
62      REAL(wp), INTENT(out), DIMENSION(jpi,jpj) ::   pwnd_i   ! wind speed i-components at T-point ORCA direction
63      REAL(wp), INTENT(out), DIMENSION(jpi,jpj) ::   pwnd_j   ! wind speed j-components at T-point ORCA direction
64      !
65      !!
66      INTEGER  ::   ji, jj , jtc        ! loop arguments
67      INTEGER  ::   ierror              ! loop arguments
68      INTEGER  ::   vortex=1            ! vortex shape to be used: 0=Holland 1=Willoughby
69      REAL(wp) ::   zrout1=1.5e6        ! distance from center where we begin to kill vortex (m)
70      REAL(wp) ::   zrout2=2.5e6        ! distance from center where we bring vortex to zero (m)
71      REAL(wp) ::   zb                  ! power in Holland vortex shape
72      REAL(wp) ::   zA                  ! shape parameter in Willoughby vortex : A transtion between first and second outter exp
73      REAL(wp) ::   zn                  ! shape parameter in Willoughby vortex : n power law in the eye
74      REAL(wp) ::   zXX1                ! shape parameter in Willoughby vortex : decay length second outter exponential
75      REAL(wp) ::   zXX2                ! shape parameter in Willoughby vortex : decay length first  outter exponential
76      REAL(wp) ::   zztmp               ! temporary
77      REAL(wp) ::   zzrglam, zzrgphi    ! temporary
78      REAL(wp) ::   ztheta              ! azimuthal angle
79      REAL(wp) ::   zdist               ! dist to the TC center
80      REAL(wp) ::   zhemi               ! 1 for NH ;  -1 for SH
81      REAL(wp) ::   zinfl               ! clim inflow angle in TCs
82      REAL(wp) ::   zrmw                ! mean radius of Max wind of a tropical cyclone (Willoughby 2004) [m]
83      REAL(wp) ::   zwnd_r, zwnd_t      ! radial and tangential components of the wind
84      REAL(wp) ::   zvmax               ! timestep interpolated vmax
85      REAL(wp) ::   zrlon, zrlat        ! temporary
86      REAL(wp), DIMENSION(:,:), POINTER ::   zwnd_x, zwnd_y   ! zonal and meridional components of the wind
87      REAL(wp), DIMENSION(14,5)    ::   ztct                ! tropical cyclone track data at kt
88      !
89      CHARACTER(len=100) ::  cn_dir            ! Root directory for location of files
90      TYPE(FLD_N), DIMENSION(1) ::   slf_i     ! array of namelist informations on the TC position
91      TYPE(FLD_N) ::   sn_tc                   ! informations about the fields to be read
92      INTEGER(KIND=jpim), PARAMETER :: zhook_in = 0
93      INTEGER(KIND=jpim), PARAMETER :: zhook_out = 1
94      REAL(KIND=jprb)               :: zhook_handle
95
96      CHARACTER(LEN=*), PARAMETER :: RoutineName='WND_CYC'
97
98      IF (lhook) CALL dr_hook(RoutineName,zhook_in,zhook_handle)
99
100      !!--------------------------------------------------------------------
101
102      CALL wrk_alloc( jpi,jpj, zwnd_x, zwnd_y )
103
104      !                                         ! ====================== !
105      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
106         !                                      ! ====================== !
107         ! set file information (default values)
108         cn_dir = './'       ! directory in which the model is executed
109         !
110         ! (NB: frequency positive => hours, negative => months)
111         !          !    file     ! frequency !  variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! land/sea mask !
112         !          !    name     !  (hours)  !   name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! filename      !
113         sn_tc = FLD_N( 'tc_track',     6     ,  'tc'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         , ''            )
114         !
115         !  Namelist is read in namsbc_core
116         ! set sf structure
117         ALLOCATE( sf(1), STAT=ierror )
118         IF( ierror > 0 ) THEN
119            CALL ctl_stop( 'wnd_cyc: unable to allocate sf structure' )   ;   RETURN
120         ENDIF
121         ALLOCATE( sf(1)%fnow(14,5,1) )
122         ALLOCATE( sf(1)%fdta(14,5,1,2) )
123         slf_i(1) = sn_tc
124         !
125         ! fill sf with slf_i and control print
126         CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_tc', 'tropical cyclone track', 'namsbc_tc' )
127         !
128      ENDIF
129
130
131      !       Interpolation of lon lat vmax... at the current timestep
132      !       ***************************************************************
133
134      CALL fld_read( kt, nn_fsbc, sf )                   ! input fields provided at the current time-step
135
136      ztct(:,:) = sf(1)%fnow(:,:,1)
137
138      !       Add TC wind on the grid
139      !       ***************************************************************
140
141      zwnd_x(:,:) = 0.e0 
142      zwnd_y(:,:) = 0.e0 
143     
144      DO jtc = 1, 14
145         !
146         IF( ztct(jtc,jp_is1) == 1 ) THEN                ! cyclone is defined in this slot ? yes--> begin
147
148            zvmax =       ztct(jtc,jp_vmax)
149            zrlon = rad * ztct(jtc,jp_lon )
150            zrlat = rad * ztct(jtc,jp_lat )
151            zhemi = SIGN( 1. , zrlat )
152            zinfl = 15.* rad                             ! clim inflow angle in Tropical Cyclones
153         IF ( vortex == 0 ) THEN
154
155            ! Vortex Holland reconstruct wind at each lon-lat position
156            ! ********************************************************
157            zrmw = 51.6 * EXP( -0.0223*zvmax + 0.0281* ABS( ztct(jtc,jp_lat) ) ) * 1000.
158            ! climatological ZRMW of cyclones as a function of wind and latitude (Willoughby 2004)             
159            ! zb = 1.0036 + 0.0173 * zvmax - 0.0313 * LOG(zrmw/1000.) + 0.0087 * ABS( ztct(jtc,jp_lat) )
160            ! fitted B parameter (Willoughby 2004)
161            zb = 2.
162
163            DO jj = 1, jpj
164               DO ji = 1, jpi
165
166                  ! calc distance between TC center and any point following great circle
167                  ! source : http://www.movable-type.co.uk/scripts/latlong.html
168                  zzrglam = rad * glamt(ji,jj) - zrlon
169                  zzrgphi = rad * gphit(ji,jj)
170                  zdist = ra * ACOS(  SIN( zrlat ) * SIN( zzrgphi )   &
171                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) )
172
173                 IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius
174                  ! shape of the wind profile
175                  zztmp = ( zrmw / ( zdist + 1.e-12 ) )**zb
176                  zztmp =  zvmax * SQRT( zztmp * EXP(1. - zztmp) )   
177
178                  IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2
179                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 )
180                  ENDIF
181
182                  ! !!! KILL EQ WINDS
183                  ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN
184                  !    zztmp = 0.                              ! winds in other hemisphere
185                  !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S
186                  ! ENDIF
187                  ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN
188                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) )
189                  !    !linear to zero between 10 and 5
190                  ! ENDIF
191                  ! !!! / KILL EQ
192
193                  IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude
194
195                  zwnd_t =   COS( zinfl ) * zztmp   
196                  zwnd_r = - SIN( zinfl ) * zztmp
197
198                  ! Project radial-tangential components on zonal-meridional components
199                  ! -------------------------------------------------------------------
200                 
201                  ! ztheta = azimuthal angle of the great circle between two points
202                  zztmp = COS( zrlat ) * SIN( zzrgphi ) &
203                     &  - SIN( zrlat ) * COS( zzrgphi ) * COS( zzrglam )
204                  ztheta = ATAN2(        COS( zzrgphi ) * SIN( zzrglam ) , zztmp )
205
206                  zwnd_x(ji,jj) = zwnd_x(ji,jj) - zhemi * COS(ztheta)*zwnd_t + SIN(ztheta)*zwnd_r
207                  zwnd_y(ji,jj) = zwnd_y(ji,jj) + zhemi * SIN(ztheta)*zwnd_t + COS(ztheta)*zwnd_r
208                 ENDIF
209               END DO
210            END DO
211         
212         ELSE IF ( vortex == 1 ) THEN
213
214            ! Vortex Willoughby reconstruct wind at each lon-lat position
215            ! ***********************************************************
216            zrmw = 46.4 * EXP( -0.0155*zvmax + 0.0169* ABS( ztct(jtc,jp_lat) ) )*1000.
217            ! climatological ZRMW of cyclones as a function of wind and latitude (Willoughby 2006)
218            zXX2 = 25.*1000.                                              ! 25km fixed "near-eye" exponential decay
219            zXX1 = ( 287.6  - 1.942 *zvmax + 7.799 *LOG(zrmw/1000.) + 1.819 *ABS( ztct(jtc,jp_lat) ) )*1000.   
220            zn   =   2.1340 + 0.0077*zvmax - 0.4522*LOG(zrmw/1000.) - 0.0038*ABS( ztct(jtc,jp_lat) )           
221            zA   =   0.5913 + 0.0029*zvmax - 0.1361*LOG(zrmw/1000.) - 0.0042*ABS( ztct(jtc,jp_lat) ) 
222            IF (zA < 0) THEN
223               zA=0
224            ENDIF           
225       
226            DO jj = 1, jpj
227               DO ji = 1, jpi
228                                 
229                  zzrglam = rad * glamt(ji,jj) - zrlon
230                  zzrgphi = rad * gphit(ji,jj)
231                  zdist = ra * ACOS(  SIN( zrlat ) * SIN( zzrgphi )   &
232                     &              + COS( zrlat ) * COS( zzrgphi ) * COS( zzrglam ) )
233
234                 IF (zdist < zrout2) THEN ! calculation of wind only to a given max radius
235               
236                  ! shape of the wind profile                     
237                  IF (zdist <= zrmw) THEN     ! inside the Radius of Maximum Wind
238                     zztmp  = zvmax * (zdist/zrmw)**zn
239                  ELSE
240                     zztmp  = zvmax * ( (1-zA) * EXP(- (zdist-zrmw)/zXX1 ) + zA * EXP(- (zdist-zrmw)/zXX2 ) )
241                  ENDIF
242
243                  IF (zdist > zrout1) THEN ! bring to zero between r_out1 and r_out2
244                     zztmp = zztmp * ( (zrout2-zdist)*1.e-6 )
245                  ENDIF
246
247                  ! !!! KILL EQ WINDS
248                  ! IF (SIGN( 1. , zrlat ) /= zhemi) THEN
249                  !    zztmp = 0.                              ! winds in other hemisphere
250                  !    IF (ABS(gphit(ji,jj)) <= 5.) zztmp=0.   ! kill between 5N-5S
251                  ! ENDIF
252                  ! IF (ABS(gphit(ji,jj)) <= 10. .and. ABS(gphit(ji,jj)) > 5.) THEN
253                  !    zztmp = zztmp * ( 1./5. * (ABS(gphit(ji,jj)) - 5.) )
254                  !    !linear to zero between 10 and 5
255                  ! ENDIF
256                  ! !!! / KILL EQ
257
258                  IF (ABS(gphit(ji,jj)) >= 55.) zztmp = 0. ! kill weak spurious winds at high latitude
259
260                  zwnd_t =   COS( zinfl ) * zztmp   
261                  zwnd_r = - SIN( zinfl ) * zztmp
262
263                  ! Project radial-tangential components on zonal-meridional components
264                  ! -------------------------------------------------------------------
265                 
266                  ! ztheta = azimuthal angle of the great circle between two points
267                  zztmp = COS( zrlat ) * SIN( zzrgphi ) &
268                     &  - SIN( zrlat ) * COS( zzrgphi ) * COS( zzrglam )
269                  ztheta = ATAN2(        COS( zzrgphi ) * SIN( zzrglam ) , zztmp )
270
271                  zwnd_x(ji,jj) = zwnd_x(ji,jj) - zhemi * COS(ztheta)*zwnd_t + SIN(ztheta)*zwnd_r
272                  zwnd_y(ji,jj) = zwnd_y(ji,jj) + zhemi * SIN(ztheta)*zwnd_t + COS(ztheta)*zwnd_r
273                 
274                 ENDIF
275               END DO
276            END DO
277         ENDIF                                         ! / vortex Holland or Wiloughby
278         ENDIF                                           ! / cyclone is defined in this slot ? yes--> begin
279      END DO ! / end simultaneous cyclones loop
280
281      CALL rot_rep ( zwnd_x, zwnd_y, 'T', 'en->i', pwnd_i ) !rotation of components on ORCA grid
282      CALL rot_rep ( zwnd_x, zwnd_y, 'T', 'en->j', pwnd_j ) !rotation of components on ORCA grid
283
284      CALL wrk_dealloc( jpi,jpj, zwnd_x, zwnd_y )
285
286      IF (lhook) CALL dr_hook(RoutineName,zhook_out,zhook_handle)
287   END SUBROUTINE wnd_cyc
288
289#endif
290
291   !!======================================================================
292END MODULE cyclone
Note: See TracBrowser for help on using the repository browser.