-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathatmosphere.f90
101 lines (87 loc) · 5.26 KB
/
atmosphere.f90
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
76
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
module atmosphere_m
use dataset_m
implicit none
type atmosphere_t
type(dataset_t) :: properties
end type
contains
!-----------------------------------------------------------------------------------------------------------
subroutine atm_create(t)
type(atmosphere_t) :: t
real :: temp(36,7)
! alt(m) geo(m) T(K) P(N/m^2) rho(kg/m^3) mu(kg/m-s) a(m/s)
temp( 1,:) = [ 0.0, 0.0,288.150,1.0133E+05,1.2250E+00,1.7895E-05,340.29]
temp( 2,:) = [ 2000.0, 1999.0,275.154,7.9501E+04,1.0066E+00,1.7261E-05,332.53]
temp( 3,:) = [ 4000.0, 3997.0,262.166,6.1660E+04,8.1935E-01,1.6613E-05,324.59]
temp( 4,:) = [ 6000.0, 5994.0,249.187,4.7218E+04,6.6011E-01,1.5950E-05,316.45]
temp( 5,:) = [ 8000.0, 7990.0,236.215,3.5652E+04,5.2579E-01,1.5272E-05,308.11]
temp( 6,:) = [10000.0, 9984.0,223.252,2.6500E+04,4.1351E-01,1.4577E-05,299.53]
temp( 7,:) = [12000.0,11977.0,216.650,1.9399E+04,3.1194E-01,1.4216E-05,295.07]
temp( 8,:) = [14000.0,13969.0,216.650,1.4170E+04,2.2786E-01,1.4216E-05,295.07]
temp( 9,:) = [16000.0,15960.0,216.650,1.0353E+04,1.6647E-01,1.4216E-05,295.07]
temp(10,:) = [18000.0,17949.0,216.650,7.5652E+03,1.2165E-01,1.4216E-05,295.07]
temp(11,:) = [20000.0,19937.0,216.650,5.5293E+03,8.8910E-02,1.4216E-05,295.07]
temp(12,:) = [22000.0,21924.0,218.574,4.0475E+03,6.4510E-02,1.4322E-05,296.38]
temp(13,:) = [24000.0,23910.0,220.560,2.9717E+03,4.6938E-02,1.4430E-05,297.72]
temp(14,:) = [26000.0,25894.0,222.544,2.1884E+03,3.4256E-02,1.4538E-05,299.06]
temp(15,:) = [28000.0,27877.0,224.527,1.6162E+03,2.5076E-02,1.4646E-05,300.39]
temp(16,:) = [30000.0,29859.0,226.509,1.1970E+03,1.8410E-02,1.4753E-05,301.71]
temp(17,:) = [32000.0,31840.0,228.490,8.8906E+02,1.3555E-02,1.4860E-05,303.02]
temp(18,:) = [34000.0,33819.0,233.744,6.6341E+02,9.8874E-03,1.5140E-05,306.49]
temp(19,:) = [36000.0,35797.0,239.282,4.9852E+02,7.2579E-03,1.5433E-05,310.10]
temp(20,:) = [38000.0,37774.0,244.818,3.7714E+02,5.3665E-03,1.5723E-05,313.67]
temp(21,:) = [40000.0,39750.0,250.350,2.8714E+02,3.9957E-03,1.6010E-05,317.19]
temp(22,:) = [42000.0,41724.0,255.878,2.1997E+02,2.9948E-03,1.6294E-05,320.67]
temp(23,:) = [44000.0,43698.0,261.403,1.6950E+02,2.2588E-03,1.6574E-05,324.12]
temp(24,:) = [46000.0,45670.0,266.925,1.3134E+02,1.7141E-03,1.6852E-05,327.52]
temp(25,:) = [48000.0,47640.0,270.650,1.0229E+02,1.3167E-03,1.7038E-05,329.80]
temp(26,:) = [50000.0,49610.0,270.650,7.9779E+01,1.0269E-03,1.7038E-05,329.80]
temp(27,:) = [52000.0,51578.0,270.650,6.2228E+01,8.0097E-04,1.7038E-05,329.80]
temp(28,:) = [54000.0,53545.0,267.560,4.8491E+01,6.3137E-04,1.6884E-05,327.91]
temp(29,:) = [56000.0,55511.0,263.628,3.7657E+01,4.9761E-04,1.6687E-05,325.49]
temp(30,:) = [58000.0,57476.0,259.699,2.9137E+01,3.9085E-04,1.6488E-05,323.06]
temp(31,:) = [60000.0,59439.0,255.772,2.2460E+01,3.0592E-04,1.6288E-05,320.61]
temp(32,:) = [62000.0,61401.0,251.045,1.7246E+01,2.3931E-04,1.6046E-05,317.63]
temp(33,:) = [64000.0,63362.0,243.202,1.3150E+01,1.8837E-04,1.5639E-05,312.63]
temp(34,:) = [66000.0,65322.0,235.363,9.9405E+00,1.4713E-04,1.5226E-05,307.55]
temp(35,:) = [68000.0,67280.0,227.529,7.4447E+00,1.1399E-04,1.4808E-05,302.39]
temp(36,:) = [70000.0,69238.0,219.700,5.5204E+00,8.7534E-05,1.4383E-05,297.14]
call ds_create_from_data(t%properties,36,7,temp(:,:))
call ds_cubic_setup(t%properties,1,2,0.0,2,0.0)
end subroutine atm_create
!-----------------------------------------------------------------------------------------------------------
subroutine atm_get_properties(t,altitude,ans)
type(atmosphere_t) :: t
real :: altitude, ans(7)
call ds_linear_interpolate(t%properties,altitude,ans(:))
write(*,*)
write(*,*) '-------------------------------------------------------------------'
write(*,*) 'Properties at altitude (m) = ',altitude
write(*,*) ' Temperature (K) = ',ans(3)
write(*,*) ' Pressure (N/m^2) = ',ans(4)
write(*,*) ' Density (kg/m^3) = ',ans(5)
write(*,*) 'Dynamic Viscosity (kg/m-s) = ',ans(6)
write(*,*) ' Speed of Sound (m/s) = ',ans(7)
write(*,*) '-------------------------------------------------------------------'
end subroutine atm_get_properties
!-----------------------------------------------------------------------------------------------------------
real function atm_get_velocity(t,altitude,ReynoldsNumber,length)
type(atmosphere_t) :: t
real :: altitude, ReynoldsNumber, length, temp(7)
real :: rho, mu
call ds_linear_interpolate(t%properties,altitude,temp(:))
rho = temp(5)
mu = temp(6)
atm_get_velocity = ReynoldsNumber*mu/rho/length
end function atm_get_velocity
!-----------------------------------------------------------------------------------------------------------
real function atm_get_Re(t,altitude,velocity,length)
type(atmosphere_t) :: t
real :: altitude, velocity, length, temp(7)
real :: rho, mu
call ds_linear_interpolate(t%properties,altitude,temp(:))
rho = temp(5)
mu = temp(6)
atm_get_Re = rho*velocity*length/mu
end function atm_get_Re
end module atmosphere_m