Commit 19e26da90ead0802b07c774bad70370c2254242c
1 parent
dcf48925
Exists in
master
corrected stellar_population & write_isrf_lv
Showing
2 changed files
with
101 additions
and
163 deletions
Show diff stats
src/idl/dustem_plugin_stellar_population.pro
... | ... | @@ -3143,76 +3143,13 @@ IF keyword_set(key) THEN BEGIN |
3143 | 3143 | ;============================================================================================== |
3144 | 3144 | |
3145 | 3145 | ENDFOR |
3146 | - | |
3147 | -;============This block creates a composite (9V) stellar population structure for when the function isn't used as a plugin=================== | |
3148 | -ENDIF ELSE BEGIN | |
3149 | - | |
3150 | -;IF NOT keyword_set(scope) AND NOT keyword_set(val) THEN BEGIN ;I need this condition because I don't want the accidental definition of the system variable (@the end.) that is actually tied to any parameters outside this routine. | |
3151 | - | |
3152 | - | |
3153 | - popnumber = 5. | |
3154 | - comp_pop = replicate(one_pop,popnumber) | |
3155 | - | |
3156 | - | |
3157 | - ;###BY DEFAULT ALL STELLAR POPULATIONS ARE ON THE MS### | |
3158 | - ;BECAUSE LESS MASSIVE (COLDER) STARS ARE MORE ABUNDANT, THEY WILL BE CHOSEN TO BUILD THE COMPOSITE STELLAR STRUCTURE | |
3159 | - ;THIS MEANS THAT THE CHOSEN SPECTRAL TYPE IS 9V (MAIN SEQUENCE) | |
3160 | - | |
3161 | - ;CHOSEN STELLAR POPULATIONS | |
3162 | - ;O9V | |
3163 | - ;B9V | |
3164 | - ;A9V | |
3165 | - ;F9V | |
3166 | - ;G9V | |
3167 | - | |
3168 | - comp_pop(0).popid = 'O9V_stellar_population' | |
3169 | - comp_pop(0).radius = 7.51*rsun2cm | |
3170 | - comp_pop(0).temperature = 33.3e3 | |
3171 | - comp_pop(0).distance = 10.0 | |
3172 | - comp_pop(0).nstars = stellar_density*(4.*!pi/3)*comp_pop(0).distance | |
3173 | - | |
3174 | - comp_pop(1).popid = 'B9V_stellar_population' | |
3175 | - comp_pop(1).radius = 2.49*rsun2cm | |
3176 | - comp_pop(1).temperature = 10.7e3 | |
3177 | - comp_pop(1).distance = 10.0 | |
3178 | - comp_pop(1).nstars = stellar_density*(4.*!pi/3)*comp_pop(1).distance | |
3179 | - | |
3180 | - comp_pop(2).popid = 'A9V_stellar_population' | |
3181 | - comp_pop(2).radius = 1.747*rsun2cm | |
3182 | - comp_pop(2).temperature = 7.4e3 | |
3183 | - comp_pop(2).distance = 10.0 | |
3184 | - comp_pop(2).nstars = stellar_density*(4.*!pi/3)*comp_pop(2).distance | |
3185 | - | |
3186 | - comp_pop(3).popid = 'F9V_stellar_population' | |
3187 | - comp_pop(3).radius = 1.167*rsun2cm | |
3188 | - comp_pop(3).temperature = 6.05e3 | |
3189 | - comp_pop(3).distance = 10.0 | |
3190 | - comp_pop(3).nstars = stellar_density*(4.*!pi/3)*comp_pop(3).distance | |
3191 | - | |
3192 | - comp_pop(4).popid = 'G9V_stellar_population' | |
3193 | - comp_pop(4).radius = 0.853*rsun2cm | |
3194 | - comp_pop(4).temperature = 5.38e3 | |
3195 | - comp_pop(4).distance = 10.0 | |
3196 | - comp_pop(4).nstars = stellar_density*(4.*!pi/3)*comp_pop(4).distance | |
3197 | - | |
3198 | - | |
3199 | -;ENDIF | |
3200 | - | |
3201 | -ENDELSE | |
3202 | - | |
3203 | -if keyword_set(key) then begin | |
3204 | -print, 'comp_pop is:' | |
3205 | -print, comp_pop | |
3206 | -endif | |
3207 | - | |
3208 | -;stop | |
3209 | 3146 | ;============================================================================================== |
3210 | 3147 | |
3211 | 3148 | ;========================================================NOTA BENE============================================================================ |
3212 | 3149 | ;THIS PROCEDURE DEVIDES BY THE VALUE OF G0. THE WRAPPER USES G0 AND GAS.G0. PLEASE LOCATE IT IN THE LINES BELOW AND CHANGE G0 TO THE ONE YOU'RE USING!!!! |
3213 | 3150 | ;============================================================================================================================================= |
3214 | 3151 | |
3215 | -st=(*!dustem_params).isrf | |
3152 | +st=((*!dustem_params).isrf) | |
3216 | 3153 | ;stop ;to check if the structure is indeed what we need. |
3217 | 3154 | c2a = 3e18 ;speed of light in ansgtroms/s (because of the Astron's PLANCK function) |
3218 | 3155 | pc2cm = 3.086e18 ;cm (cgs) |
... | ... | @@ -3288,9 +3225,73 @@ FOR i=0L,n_waves-1 DO BEGIN |
3288 | 3225 | ENDFOR |
3289 | 3226 | |
3290 | 3227 | close,unit |
3291 | -free_lun,unit | |
3228 | +free_lun,unit | |
3229 | + | |
3230 | +out=st.isrf | |
3231 | +;============This block creates a composite (9V) stellar population structure for when the function isn't used as a plugin=================== | |
3232 | +ENDIF ELSE BEGIN | |
3233 | + | |
3234 | +;IF NOT keyword_set(scope) AND NOT keyword_set(val) THEN BEGIN ;I need this condition because I don't want the accidental definition of the system variable (@the end.) that is actually tied to any parameters outside this routine. | |
3235 | + | |
3236 | + | |
3237 | + popnumber = 5. | |
3238 | + comp_pop = replicate(one_pop,popnumber) | |
3239 | + | |
3240 | + | |
3241 | + ;###BY DEFAULT ALL STELLAR POPULATIONS ARE ON THE MS### | |
3242 | + ;BECAUSE LESS MASSIVE (COLDER) STARS ARE MORE ABUNDANT, THEY WILL BE CHOSEN TO BUILD THE COMPOSITE STELLAR STRUCTURE | |
3243 | + ;THIS MEANS THAT THE CHOSEN SPECTRAL TYPE IS 9V (MAIN SEQUENCE) | |
3244 | + | |
3245 | + ;CHOSEN STELLAR POPULATIONS | |
3246 | + ;O9V | |
3247 | + ;B9V | |
3248 | + ;A9V | |
3249 | + ;F9V | |
3250 | + ;G9V | |
3251 | + | |
3252 | + comp_pop(0).popid = 'O9V_stellar_population' | |
3253 | + comp_pop(0).radius = 7.51*rsun2cm | |
3254 | + comp_pop(0).temperature = 33.3e3 | |
3255 | + comp_pop(0).distance = 10.0 | |
3256 | + comp_pop(0).nstars = stellar_density*(4.*!pi/3)*comp_pop(0).distance | |
3257 | + | |
3258 | + comp_pop(1).popid = 'B9V_stellar_population' | |
3259 | + comp_pop(1).radius = 2.49*rsun2cm | |
3260 | + comp_pop(1).temperature = 10.7e3 | |
3261 | + comp_pop(1).distance = 10.0 | |
3262 | + comp_pop(1).nstars = stellar_density*(4.*!pi/3)*comp_pop(1).distance | |
3263 | + | |
3264 | + comp_pop(2).popid = 'A9V_stellar_population' | |
3265 | + comp_pop(2).radius = 1.747*rsun2cm | |
3266 | + comp_pop(2).temperature = 7.4e3 | |
3267 | + comp_pop(2).distance = 10.0 | |
3268 | + comp_pop(2).nstars = stellar_density*(4.*!pi/3)*comp_pop(2).distance | |
3269 | + | |
3270 | + comp_pop(3).popid = 'F9V_stellar_population' | |
3271 | + comp_pop(3).radius = 1.167*rsun2cm | |
3272 | + comp_pop(3).temperature = 6.05e3 | |
3273 | + comp_pop(3).distance = 10.0 | |
3274 | + comp_pop(3).nstars = stellar_density*(4.*!pi/3)*comp_pop(3).distance | |
3275 | + | |
3276 | + comp_pop(4).popid = 'G9V_stellar_population' | |
3277 | + comp_pop(4).radius = 0.853*rsun2cm | |
3278 | + comp_pop(4).temperature = 5.38e3 | |
3279 | + comp_pop(4).distance = 10.0 | |
3280 | + comp_pop(4).nstars = stellar_density*(4.*!pi/3)*comp_pop(4).distance | |
3281 | + | |
3282 | + out=0. | |
3283 | +;ENDIF | |
3284 | + | |
3285 | +ENDELSE | |
3286 | + | |
3287 | +if keyword_set(key) then begin | |
3288 | +print, 'comp_pop is:' | |
3289 | +print, comp_pop | |
3290 | +endif | |
3291 | + | |
3292 | +;stop | |
3292 | 3293 | |
3293 | 3294 | the_end: |
3294 | 3295 | |
3295 | -return, st.isrf | |
3296 | +return, out | |
3296 | 3297 | end |
3297 | 3298 | \ No newline at end of file | ... | ... |
src/idl/dustem_write_isrf_lv.pro
... | ... | @@ -37,103 +37,40 @@ IF keyword_set(help) THEN BEGIN |
37 | 37 | ENDIF |
38 | 38 | |
39 | 39 | |
40 | -IF tag_exist((*!dustem_scope),'STELLAR_POPULATION') && ISA(((*!dustem_plugin).stellar_population)) THEN BEGIN | |
41 | - c2a = 3e18 ;speed of light in ansgtroms/s (because of the Astron's PLANCK function) | |
42 | - pc2cm = 3.086e18 ;cm (cgs) | |
43 | - wave_angstrom = st.lambisrf*1.e4 ;mic to Angstrom (Astron Planck's function uses wavelengths in Angstroms) | |
44 | - | |
45 | - stellar_component=fltarr(n_elements(st)) ; array of zeros to contain the new ISRF values. | |
46 | - | |
47 | - Ncomments = n_elements(((*(*!dustem_plugin).stellar_population).popid))*3+4 | |
48 | - c = strarr(Ncomments) | |
49 | - | |
50 | - | |
51 | - ;First and last lines of the new composite ISRF.DAT file | |
52 | - c(0)='# DUSTEM: exciting radiation field featuring' | |
53 | - c(1)='# Mathis ISRF' | |
54 | - c(Ncomments-2)='# Nbr of points' | |
55 | - c(Ncomments-1)='# wave (microns), 4*pi*Inu (erg/cm2/s/Hz)' | |
56 | - | |
57 | - FOR i=0L,n_elements(((*(*!dustem_plugin).stellar_population).popid))-1 DO BEGIN ; Looping over all the stellar populations | |
58 | - | |
59 | - ;The initial procedure had omega multiplied by a !pi factor. Its presence in the Planck (Astron) procedure makes for a good reason to discuss this with J.P. | |
60 | - | |
61 | - omega = (((*(*!dustem_plugin).stellar_population).radius)[i]/(((*(*!dustem_plugin).stellar_population).distance)[i]*pc2cm))^2 ; Dilution factor of a stellar population | |
62 | - | |
63 | - Inu = planck(wave_angstrom,((*(*!dustem_plugin).stellar_population).temperature)[i])/(4.*!pi)*(wave_angstrom)^2/c2a ; ergs/cm2/s/Hz/sr | |
64 | - | |
65 | - ;========================================================NOTA BENE================================================== | |
66 | - ;Deving the amplitudes of the stellar populations by G0 as the composite ISRF is multiplied by the latter as a whole | |
67 | - ;=================================================================================================================== | |
68 | - | |
69 | - stellar_component=stellar_component+((*(*!dustem_plugin).stellar_population).amplitude)[i]*((*(*!dustem_plugin).stellar_population).nstars)[i]*omega*Inu;/((*!dustem_params).gas.G0) | |
70 | - | |
71 | - ;Rest of the lines of the new composite ISRF.DAT file | |
72 | - c(3*i+2) = '#'+((*(*!dustem_plugin).stellar_population).popid)[i] | |
73 | - c(3*i+3) = '# Blackbody with T='+string(((*(*!dustem_plugin).stellar_population).temperature)[i]) | |
74 | - c(3*i+4) = '# dilution factor wdil='+string(omega) | |
75 | - | |
76 | - ENDFOR | |
77 | - | |
78 | - print,'stellar_component is:' | |
79 | - | |
80 | - print, stellar_component | |
81 | - | |
82 | - print, 'isrf is:' | |
83 | - print, st.isrf | |
84 | - | |
85 | - | |
86 | - st.isrf=st.isrf+stellar_component/((*!dustem_params).G0) | |
87 | - openw,unit,file,/get_lun | |
88 | - | |
89 | - FOR i=0,Ncomments-1 DO BEGIN | |
90 | - printf,unit,c(i) | |
91 | - ENDFOR | |
92 | - | |
93 | - n_waves=n_elements(st) | |
94 | - printf,unit,n_waves | |
95 | - | |
96 | - FOR i=0L,n_waves-1 DO BEGIN | |
97 | - printf,unit,st(i).lambisrf,st(i).isrf | |
98 | - ENDFOR | |
99 | - | |
100 | - close,unit | |
101 | - free_lun,unit | |
102 | - | |
103 | - | |
104 | -ENDIF ELSE BEGIN | |
105 | - | |
106 | - Ncomments=6 | |
107 | - c=strarr(Ncomments) | |
108 | - | |
109 | - ;First lines of the ISRF.DAT file | |
110 | - c(0)='# DUSTEM: exciting radiation field featuring' | |
111 | - c(1)='# Mathis ISRF' | |
112 | - c(2)='# Blackbody with T= 0.0000E+00' | |
113 | - c(3)='# dilution factor wdil= 1.0000E+00' | |
114 | - c(4)='# Nbr of points' | |
115 | - c(5)='# wave (microns), 4*pi*Inu (erg/cm2/s/Hz)' | |
116 | - | |
117 | - openw,unit,file,/get_lun | |
118 | - | |
119 | - FOR i=0,Ncomments-1 DO BEGIN | |
120 | - printf,unit,c(i) | |
121 | - ENDFOR | |
122 | - | |
123 | - n_waves=n_elements(st) | |
124 | - printf,unit,n_waves | |
125 | - | |
126 | - FOR i=0L,n_waves-1 DO BEGIN | |
127 | - printf,unit,st(i).lambisrf,st(i).isrf | |
128 | - ENDFOR | |
129 | - | |
130 | - close,unit | |
131 | - free_lun,unit | |
132 | - | |
133 | - the_end: | |
134 | - | |
135 | - | |
136 | -ENDELSE | |
40 | +IF ptr_valid((*!dustem_plugin).stellar_population) THEN goto, the_end | |
41 | + | |
42 | +;NOW YOU HAVE TO LOOP ON THE COMMENTS TO SEE IF IT IS THE COMPOSITE ISRF FILE OR THE MATHIS ONE. | |
43 | + | |
44 | +Ncomments=6 | |
45 | +c=strarr(Ncomments) | |
46 | + | |
47 | +;MODIFY THIS TO DISPLAY THE ACTUAL VALUES BECAUSE IT IS JUST DISPLAYING EMPTY STRINGS AT THE MOMENT | |
48 | + | |
49 | +;First lines of the ISRF.DAT file | |
50 | +c(0)='# DUSTEM: exciting radiation field featuring' | |
51 | +c(1)='# Mathis ISRF' | |
52 | +c(2)='# Blackbody with T= 0.0000E+00' | |
53 | +c(3)='# dilution factor wdil= 1.0000E+00' | |
54 | +c(4)='# Nbr of points' | |
55 | +c(5)='# wave (microns), 4*pi*Inu (erg/cm2/s/Hz)' | |
56 | + | |
57 | +openw,unit,file,/get_lun | |
58 | + | |
59 | +FOR i=0,Ncomments-1 DO BEGIN | |
60 | + printf,unit,c(i) | |
61 | +ENDFOR | |
62 | + | |
63 | +n_waves=n_elements(st) | |
64 | +printf,unit,n_waves | |
65 | + | |
66 | +FOR i=0L,n_waves-1 DO BEGIN | |
67 | + printf,unit,st(i).lambisrf,st(i).isrf | |
68 | +ENDFOR | |
69 | + | |
70 | +close,unit | |
71 | +free_lun,unit | |
72 | + | |
73 | +the_end: | |
137 | 74 | |
138 | 75 | |
139 | 76 | END | ... | ... |