1 | ! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt |
---|
2 | ! SPDX-License-Identifier: GPL-3.0-or-later |
---|
3 | |
---|
4 | subroutine windalign(u,v,ffap,ffcp,ux,vy) |
---|
5 | ! i i i i o o |
---|
6 | !***************************************************************************** |
---|
7 | ! * |
---|
8 | ! Transformation from along- and cross-wind components to u and v * |
---|
9 | ! components. * |
---|
10 | ! * |
---|
11 | ! Author: A. Stohl * |
---|
12 | ! * |
---|
13 | ! 3 June 1996 * |
---|
14 | ! * |
---|
15 | !***************************************************************************** |
---|
16 | ! * |
---|
17 | ! Variables: * |
---|
18 | ! ffap turbulent wind in along wind direction * |
---|
19 | ! ffcp turbulent wind in cross wind direction * |
---|
20 | ! u main wind component in x direction * |
---|
21 | ! ux turbulent wind in x direction * |
---|
22 | ! v main wind component in y direction * |
---|
23 | ! vy turbulent wind in y direction * |
---|
24 | ! * |
---|
25 | !***************************************************************************** |
---|
26 | |
---|
27 | implicit none |
---|
28 | |
---|
29 | real :: u,v,ffap,ffcp,ux,vy,ffinv,ux1,ux2,vy1,vy2,sinphi,cosphi |
---|
30 | real,parameter :: eps=1.e-30 |
---|
31 | |
---|
32 | |
---|
33 | ! Transform along wind components |
---|
34 | !******************************** |
---|
35 | |
---|
36 | ffinv=1./max(sqrt(u*u+v*v),eps) |
---|
37 | sinphi=v*ffinv |
---|
38 | vy1=sinphi*ffap |
---|
39 | cosphi=u*ffinv |
---|
40 | ux1=cosphi*ffap |
---|
41 | |
---|
42 | |
---|
43 | ! Transform cross wind components |
---|
44 | !******************************** |
---|
45 | |
---|
46 | ux2=-sinphi*ffcp |
---|
47 | vy2=cosphi*ffcp |
---|
48 | |
---|
49 | |
---|
50 | ! Add contributions from along and cross wind components |
---|
51 | !******************************************************* |
---|
52 | |
---|
53 | ux=ux1+ux2 |
---|
54 | vy=vy1+vy2 |
---|
55 | |
---|
56 | end subroutine windalign |
---|