]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/uiuc_getwind.c
Remove std::
[flightgear.git] / src / FDM / LaRCsim / uiuc_getwind.c
1 /* 
2         UIUC wind gradient test code v0.1
3         
4         Returns wind vector as a function of altitude for a simple
5         parabolic gradient profile
6
7         Glen Dimock
8         Last update: 020227
9 */
10
11 #include "uiuc_getwind.h"
12
13 void uiuc_getwind(double wind[3])
14 {
15         /* Wind parameters */
16         double zref = 300.; //Reference height (ft)
17         double uref = 0.; //Horizontal wind velocity at ref. height (ft/sec)
18         double ordref = 0.; //Horizontal wind ordinal from north (degrees)
19         double zoff = 15.; //Z offset (ft) - wind is zero at and below this point
20         double zcomp = 0.; //Vertical component (down is positive)
21
22
23         /* Get wind vector */
24         double windmag = 0; //Wind magnitude
25         double a = 0; //Parabola: Altitude = a*windmag^2 + zoff
26         
27         a = zref/pow(uref,2.);
28         if (Altitude >= zoff)
29                 windmag = sqrt(Altitude/a);
30         else
31                 windmag = 0.;
32
33         wind[0] = windmag * cos(ordref*3.14159/180.); //North component
34         wind[1] = windmag * sin(ordref*3.14159/180.); //East component
35         wind[2] = zcomp;
36
37         return;
38 }
39