Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
! #######################
MODULE MODE_ROTATE_WIND
! #######################
IMPLICIT NONE
CONTAINS
! ###########################################################
SUBROUTINE ROTATE_WIND(PU,PV,PW, &
PDIRCOSXW, PDIRCOSYW, PDIRCOSZW, &
PCOSSLOPE,PSINSLOPE, &
PDXX,PDYY,PDZZ, &
PUSLOPE,PVSLOPE )
! ###########################################################
!
!
!!**** *ROTATE_WIND* - computes the wind components along the maximum slope
!! direction and its normal direction in the first mass level.
!!
!! PURPOSE
!! -------
!!****
! The purpose of this routine is to compute the wind component parallel
! to the orography at the first mass level. The exact location where these
! components are computed is the point of intersection between the normal
! to the orography and the first mass-level hyper-plane at PDZZ(:,:,IKB)/2
!
!!** METHOD
!! ------
!! The values of the 3 cartesian components of the wind are determined
!! by a bilinear interpolation between the 4 nearest points in the first
!! mass-level hyper-plane. These points are found according to the signs of
!! the slopes' sinus and cosinus. For each direction of interpolation, the
!! two different localizations (mass or flux grids) are used to avoid
!! lateral boundary problems.
!! Then, the rotation is performed for the wind components. The rotation
!! angle is the angle between the x axe and the maximum slope direction
!! defined by the slope vector (dZs/dx , dZs/dy).
!! Finally, the horizontal components are set at the marginal points
!! according to cyclic boundary conditions because this is the only case
!! where these points can be considered.
!!
!! EXTERNAL
!! --------
!! NONE
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!! MODD_CONF : L2D switch for 2D model version
!!
!!
!! REFERENCE
!! ---------
!! Book 1 of documentation (Chapter: Turbulence)
!!
!! AUTHOR
!! ------
!! Joel Stein * Meteo-France *
!!
!! MODIFICATIONS
!! -------------
!! Original 14/11/95
!! Modifications: 15/05/96, (N. wood)
!! take into account no slip conditions
!! at the surface
!! 14/02/01 (V. Masson)
!! Slip condition at the surface restored
!!
!! --------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------

RODIER Quentin
committed
USE MODD_PARAMETERS, ONLY: JPVEXT
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
!
IMPLICIT NONE
!
!
!* 0.1 declarations of arguments
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PU,PV,PW ! cartesian components
! of the wind
REAL, DIMENSION(:,:), INTENT(IN) :: PDIRCOSXW, PDIRCOSYW, PDIRCOSZW
! Director Cosinus along x, y and z directions at surface w-point
REAL, DIMENSION(:,:), INTENT(IN) :: PCOSSLOPE ! cosinus of the angle
! between i and the slope vector
REAL, DIMENSION(:,:), INTENT(IN) :: PSINSLOPE ! sinus of the angle
! between i and the slope vector
REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX, PDYY, PDZZ
! Metric coefficients
REAL, DIMENSION(:,:), INTENT(OUT) :: PUSLOPE ! wind component along
! the maximum slope direction
REAL, DIMENSION(:,:), INTENT(OUT) :: PVSLOPE ! wind component along
! the direction normal to the maximum slope one
!
!-------------------------------------------------------------------------------
!
! 0.2 declaration of local variables
!
INTEGER, DIMENSION(SIZE(PDIRCOSXW,1),SIZE(PDIRCOSXW,2)) :: ILOC,JLOC
! shift index to find the 4 nearest points in x and y directions
REAL, DIMENSION(SIZE(PDIRCOSXW,1),SIZE(PDIRCOSXW,2)) :: ZCOEFF,ZCOEFM, &
! interpolation weigths for flux and mass locations
ZUINT,ZVINT,ZWINT, &
! intermediate values of the cartesian components after x interp.
ZUFIN,ZVFIN,ZWFIN, &
! final values of the cartesian components after the 2 interp.
ZWGROUND
! vertical velocity at the surface
INTEGER :: IIB,IIE,IJB,IJE,IKB
! index values for the Beginning or the End of the physical
! domain in x,y and z directions
INTEGER :: IIU,IJU
! arrays' sizes for i and j indices
INTEGER :: JI,JJ
!
!----------------------------------------------------------------------------
!
!* 1. PRELIMINARIES
! -------------
!
PUSLOPE=0.
PVSLOPE=0.
!
IIB = 2
IJB = 2
IIU = SIZE(PU,1)
IJU = SIZE(PU,2)
IIE = IIU - 1
IJE = IJU - 1
IKB = 1+JPVEXT
!
ZWGROUND(:,:) = PW(:,:,IKB)
!
!* 2. INTERPOLATE THE CARTESIAN COMPONENTS
! ------------------------------------
!
ILOC(:,:)=NINT(SIGN(1.,-PCOSSLOPE(:,:)))
JLOC(:,:)=NINT(SIGN(1.,-PSINSLOPE(:,:)))
!
! interpolation in x direction
!
DO JJ = 1,IJU
DO JI = IIB,IIE
ZCOEFF(JI,JJ) = &
(0.5*PDXX(JI,JJ,IKB) + 0.5*PDZZ(JI,JJ,IKB)*PDIRCOSXW(JI,JJ) ) &
* 2. / (PDXX(JI,JJ,IKB)+PDXX(JI+1,JJ,IKB))
ZUINT(JI,JJ) = ZCOEFF(JI,JJ) * PU(JI+1,JJ,IKB) + &
(1.-ZCOEFF(JI,JJ)) * PU(JI,JJ,IKB)
!
ZCOEFM(JI,JJ) = 1. - 0.5 * PDZZ(JI,JJ,IKB) * ABS(PDIRCOSXW(JI,JJ)) &
/ PDXX(JI+(ILOC(JI,JJ)+1)/2,JJ,IKB)
ZVINT(JI,JJ) = ZCOEFM(JI,JJ) * PV(JI,JJ,IKB) + &
(1.-ZCOEFM(JI,JJ)) * PV(JI+ILOC(J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JI,JJ) * ZVFIN(JI,JJ)
!
END DO
END DO
!
!
!
!----------------------------------------------------------------------------
!
END SUBROUTINE ROTATE_WIND
END MODULE MODE_ROTATE_WIND