source: trunk/src/windalign.f90 @ 28

Last change on this file since 28 was 4, checked in by mlanger, 11 years ago
File size: 3.6 KB
Line 
1!**********************************************************************
2! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
3! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
4! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
5!                                                                     *
6! This file is part of FLEXPART.                                      *
7!                                                                     *
8! FLEXPART is free software: you can redistribute it and/or modify    *
9! it under the terms of the GNU General Public License as published by*
10! the Free Software Foundation, either version 3 of the License, or   *
11! (at your option) any later version.                                 *
12!                                                                     *
13! FLEXPART is distributed in the hope that it will be useful,         *
14! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
15! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
16! GNU General Public License for more details.                        *
17!                                                                     *
18! You should have received a copy of the GNU General Public License   *
19! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
20!**********************************************************************
21
22subroutine windalign(u,v,ffap,ffcp,ux,vy)
23  !                     i i  i    i   o  o
24  !*****************************************************************************
25  !                                                                            *
26  !  Transformation from along- and cross-wind components to u and v           *
27  !  components.                                                               *
28  !                                                                            *
29  !     Author: A. Stohl                                                       *
30  !                                                                            *
31  !     3 June 1996                                                            *
32  !                                                                            *
33  !*****************************************************************************
34  !                                                                            *
35  ! Variables:                                                                 *
36  ! ffap  turbulent wind in along wind direction                               *
37  ! ffcp  turbulent wind in cross wind direction                               *
38  ! u     main wind component in x direction                                   *
39  ! ux    turbulent wind in x direction                                        *
40  ! v     main wind component in y direction                                   *
41  ! vy    turbulent wind in y direction                                        *
42  !                                                                            *
43  !*****************************************************************************
44
45  implicit none
46
47  real :: u,v,ffap,ffcp,ux,vy,ffinv,ux1,ux2,vy1,vy2,sinphi,cosphi
48  real,parameter :: eps=1.e-30
49
50
51  ! Transform along wind components
52  !********************************
53
54  ffinv=1./max(sqrt(u*u+v*v),eps)
55  sinphi=v*ffinv
56  vy1=sinphi*ffap
57  cosphi=u*ffinv
58  ux1=cosphi*ffap
59
60
61  ! Transform cross wind components
62  !********************************
63
64  ux2=-sinphi*ffcp
65  vy2=cosphi*ffcp
66
67
68  ! Add contributions from along and cross wind components
69  !*******************************************************
70
71  ux=ux1+ux2
72  vy=vy1+vy2
73
74end subroutine windalign
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG