dustem_write_gas.pro
1.91 KB
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
PRO dustem_write_gas,file,st
;=== Format for DUSTEM_WHICH=WEB3p8/RELEASE
;# DUSTEM : Gas quantities from Ysard, Juvela & Verstraete (2011)
;#
;# Gas temperature (K), hydrogen density, H2 density, CR rate, G0 (if>0 supersedes GRAIN.DAT)
;# number of charge type (electrons, H+, C+, ...)
;# ion density (cm-3), mass (amu), charge, polarizability (A^3)
;# >>>>> 1st line is electron <<<<<<<
;#
; 3.5550e+03 1e-1 -1e0 5e-17 1.0000e+00 3
;-1e0 5.4858e-04 -1e0 0.00
;0e0 1.00794e0 1e0 0.67
; -1.3000e-05 12.0107e0 1e0 1.54
Ncomments=n_elements(st.comments)
openw,unit,file,/get_lun
FOR i=0,Ncomments-1 DO BEGIN
printf,unit,st.comments[i]
ENDFOR
;st={file:file, $
; Tgas:0.D0,nH:0.D0,nh2:0.D0,CR_rate:0.D0,G0:0.D0,n_charges:0L, $
; charges_props:ptr_new(), $
; comments:strarr(Ncomments)}
;one_charge_st={density:0.D0,mass:0.D0,charge:0.D0,polarizability:0.D0}
frmt='(5E14.6,I4)'
printf,unit,st.Tgas,st.nH,st.nh2,st.CR_rate,st.G0,st.n_charges,format=frmt
frmt='(3E14.6,F5.2)'
FOR i=0L,st.n_charges-1 DO BEGIN
sst=(*st.charges_props)[i]
printf,unit,sst.density,sst.mass,sst.charge,sst.polarizability,format=frmt
IF !dustem_verbose EQ 1 THEN BEGIN
print,unit,sst.density,sst.mass,sst.charge,sst.polarizability,format=frmt
ENDIF
ENDFOR
close,unit
free_lun,unit
END
; ;==== LEFT OVERS
;
; PRO dustem_write_gas,dir,st
;
;
; ;Writes ALL the GAS_xxx.DAT files
; ;stop
;
; comments=st.comments
; Ncomments=n_elements(comments)
;
; frmt='(A)'
;
; ;Get filename
; ffile=st.file
; fv=str_sep(ffile,'/')
; file=dir+fv(n_elements(fv)-1)
; ;Open file
; message,'Will write GAS file '+file,/continue
; openw,unit,file,/get_lun
; ;Print comments
; IF Ncomments NE 0 THEN BEGIN
; FOR ii=0,Ncomments-1 DO BEGIN
; printf,unit,comments[ii]
; ENDFOR
; ENDIF
; ;print data
; FOR k=0L,n_elements(st.fgas)-1 DO BEGIN
; printf,unit,(st.fgas)[k],format=frmt
; ENDFOR
; close,unit
; free_lun,unit
;
; END
;