-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalpe_neutralatm.pro
executable file
·100 lines (77 loc) · 3.59 KB
/
localpe_neutralatm.pro
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
pro localpe_neutralatm
@ace_common_blocks.prg ; common blocks used for all atmospheric chemistry and energetics (ace) software
; see this file for definitions
;doy=ace_date(idate,/to_doy,/from_yyyyddd)
doy=idate-(long(idate/1000)*1000)
utdoy=doy+utsec/(3600.*24.) ; ut in days since Jan 1 of year (input to zenith.pro)
sza=zenith(utdoy,lat,lon);105*!dtor;
localhour=(((utsec/240. + lon)/15. + 24. ) mod 24.)
;___________________________________________________________________________________________________________________________________________________
;#1 OLD/IDL msis method
;
; function MSIS2K,Zin,YYYYDDD,UTSEC,LAT,LON,SLTHR,F10AVG,F10,APINDX,$
; mass=massno,meters=meters,switches=switches,drag=drg,$
; t_inf_in=t_inf_in ,s_bates_in=s_bates_in ,t_lb_in=t_lb_in,$
; t_inf_out=t_inf_out,s_bates_out=s_bates_out,t_lb_out=t_lb_out
;msis=msis2k(zz,idate, utsec,lat,lon,localhour,f107a,f107,ap)
;zt=msis.t
;zo=msis.o
;zo2=msis.o2
;zn2=msis.n2
;________________________________________________________OR_________________________________________________________________________________________
;#2 Using the new msis beta to calculate the values
;##1 make an file with the inputs to the MSIS model
;openw, lun_msisinp,'msis_inputs.dat',/get_lun
;printf,lun_msisinp,'iyd', 'sec', 'number of altitudes','alt','glat','glong',$
; 'stl','f107a','f107','ap','mass'
;printf,lun_msisinp,idate
;printf,lun_msisinp,utsec
;printf,lun_msisinp,n_elements(zz)
;printf,lun_msisinp,zz
;printf,lun_msisinp,lat
;printf,lun_msisinp,lon
;printf,lun_msisinp,localhour
;printf,lun_msisinp,f107a
;printf,lun_msisinp,f107
;printf,lun_msisinp,ap
;printf,lun_msisinp,1.
;
;close, lun_msisinp
;__________________________________________________________________________________________
;;##2 make the msis executable file
;spawn,$
; "gfortran -ffree-line-length-200 -o msis_idl_interface.exe hgt2gph.f90 constants.f90 msis.f90 tfn.f90 dfn.f90 pymsis.f90 msis1.97_gtd8.f90 msis_idl_interface.f90"
;;__________________________________________________________________________________________
;
;;##3 call the fortran wrapper using spawn command
;
;msis_filename=['./msis_idl_interface.exe'] ; fortran executable file/wrapper. KEEP The MSIS files in the same directory as localpe
;
;spawn,msis_filename,result,/noshell
;
;
;__________________________________________________________________________________________
;##4 open the output file generated by fortran MSIS to get the varibles
msis_outdata=dblarr(4,n_elements(zz)) ;4 columns: O, O2 and N2 densitiy and temperature
msis_outfile='msis_outputs.dat'
openr, lun_msis, msis_outfile, /get_lun
skip_lun, lun_msis, 1, /lines ; 2 header lines
readf, lun_msis , msis_outdata
free_lun, lun_msis
;##5 save the file data into the local variables
zt=msis_outdata(3,*)
zo=msis_outdata(0,*)
zo2=msis_outdata(1,*)
zn2=msis_outdata(2,*)
close,/all
;___________________________________________________________________________________________________________________________________________________
; put neutral density into the glow format
zmaj=fltarr(nmaj,jmax)
zmaj(0,*)=zo ;number density of o
zmaj(1,*)=zo2 ;number density of o2
zmaj(2,*)=zn2 ;number density of n2
;___________________________________________________________________________________________________________________________________________________
ace_rcolum ,sza, zz, zmaj, zt, zcol, zvcd, jmax, nmaj
;first_neutral=1
return
end