dustem_write_size_lv.pro
2.17 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
PRO dustem_write_size_lv,dir,st,help=help
;+
; NAME:
; dustem_write_size_lv
;
; PURPOSE:
; writes information relating to size distribution parameters in the .DAT files
;
; CATEGORY:
; DustEMWrap, Distributed, LowLevel, Initialization
;
; CALLING SEQUENCE:
; dustem_write_size_lv,dir,st
;
; INPUTS:
; st : dustem data structure
; dir : output directory where file will be written
;
; OPTIONAL INPUT PARAMETERS:
; None
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUT PARAMETERS:
; None
;
; ACCEPTED KEY-WORDS:
; help : writes this help
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; Files are written
;
; RESTRICTIONS:
; The DustEM fortran code must be installed
; The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES:
;
; MODIFICATION HISTORY:
; Evolution details on the DustEMWrap gitlab.
; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
;-
IF keyword_set(help) THEN BEGIN
doc_library,'dustem_write_size_lv'
goto,the_end
ENDIF
Ncomments=10
c=strarr(Ncomments)
c(0)='# Size distribution of grain species'
c(1)='#'
c(2)='# Nbr of bulk materials'
c(3)='# Bulk densities in g/cm3'
c(4)='# Mass fractions for each bulk'
c(5)='# Nbr of size bins'
c(6)='# [ a (cm), dloga, a^4*dn/da, f_mix, f_pol, rho_eff, fv ]'
c(7)='# fmix mixing function for SED'
c(8)='# fv: volume fraction of bulks, rho_eff: volume mean density'
c(9)='#'
Nst=n_elements(st)
;stop
frmt='(7E14.6)' ;
;frmt='(7E10.2)'
FOR i=0L,Nst-1 DO BEGIN
IF ptr_valid(st(i)) THEN BEGIN
ffile=(*st(i)).file
fv=str_sep(ffile,'/')
file=dir+fv(n_elements(fv)-1)
openw,unit,file,/get_lun
FOR ii=0,Ncomments-1 DO BEGIN
printf,unit,c(ii)
ENDFOR
printf,unit,(*st(i)).Nbulk
printf,unit,(*st(i)).density
printf,unit,(*st(i)).mass_frac
printf,unit,(*st(i)).nsize
FOR k=0L,(*st(i)).nsize-1 DO BEGIN
printf,unit,((*st(i)).size_st.a)(k),((*st(i)).size_st.dloga)(k),((*st(i)).size_st.a4dnda)(k),((*st(i)).size_st.f_mix)(k), $
((*st(i)).size_st.f_pol)(k),((*st(i)).size_st.rho_eff)(k),((*st(i)).size_st.fv)(k),format=frmt
ENDFOR
close,unit
free_lun,unit
ENDIF
ENDFOR
the_end:
END