]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_ice_rates.cpp
JSBSim updates. This update changes the file format, so an update of the base
[flightgear.git] / src / FDM / UIUCModel / uiuc_ice_rates.cpp
1 //#include <ansi_c.h>
2 //#include <math.h>
3 //#include <stdio.h>
4 //#include <stdlib.h>
5 #include "uiuc_ice_rates.h"
6
7 ///////////////////////////////////////////////////////////////////////
8 // Calculates shed rate depending on current aero loads, eta, temp, and freezing fraction
9 // Code by Leia Blumenthal
10 //
11 // 13 Feb 02 - Created basic program with dummy variables and a constant shed rate (no dependency)
12 //
13 // Inputs:
14 // aero_load - aerodynamic load
15 // eta 
16 // T - Temperature in Farenheit
17 // ff - freezing fraction
18 //
19 // Output:
20 // rate - %eta shed/time
21 //
22 // Right now this is just a constant shed rate until we learn more...
23
24
25 double shed(double aero_load, double eta, double T, double ff, double time_step)
26 {
27         double rate, eta_new;
28
29         if (eta <= 0.0)
30           rate = 0.0;
31         else
32           rate =  0.2;
33
34         eta_new = eta-rate*eta*time_step;
35         if (eta_new <= 0.0)
36           eta_new = 0.0;
37         
38         return(eta_new);
39 }
40
41
42 ///////////////////////////////////////////////////////////////////////////////////////////////////
43 // Currently a simple linear approximation based on temperature and eta, but for next version, 
44 // should have so that it calculates sublimation rate depending on current temp,pressure, 
45 // dewpoint, radiation, and eta
46 //
47 // Code by Leia Blumenthal  
48 // 12 Feb 02 - Created basic program with linear rate for values when sublimation will occur
49 // 16 May 02 - Modified so that outputs new eta as opposed to rate
50 // Inputs:
51 // T - temperature and must be input in Farenheit
52 // P - pressure
53 // Tdew - Dew point Temperature
54 // rad - radiation
55 // time_step- increment since last run
56 //
57 // Intermediate:
58 // rate - sublimation rate (% eta change/time)
59 //
60 // Output:
61 // eta_new- eta after sublimation has occurred
62 //
63 // This takes a simple approximation that the rate of sublimation will decrease
64 // linearly with temperature increase.
65 //
66 // This code should be run every time step to every couple time steps 
67 //
68 // If eta is less than zero, than there should be no sublimation
69
70 double sublimation(double T, double eta, double time_step)
71 {
72         double rate, eta_new;
73         
74         if (eta <= 0.0) rate = 0;
75         
76         else{  
77            // According to the Smithsonian Meteorological tables sublimation occurs
78            // between -40 deg F < T < 32 deg F and between pressures of 0 atm < P < 0.00592 atm
79            if (T < -40) rate = 0;
80            else if (T >= -40 && T < 32)
81            {
82            // For a simple linear approximation, assume largest value is a rate of .2% per sec
83               rate = 0.0028 * T + 0.0889;
84            }
85            else if (T >= 32) rate = 0;
86         }
87
88         eta_new = eta-rate*eta*time_step;
89         if (eta_new <= 0.0)
90           eta_new = 0.0;
91         
92         return(eta_new);
93 }