dustem_habing_field.pro
1.99 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
FUNCTION DUSTEM_HABING_FIELD, x, unit=unit
;+
; NAME:
; dustem_habing_field
;
; PURPOSE:
; Returns the Habing interstellar radiation field SED (ISRF)
; in W/m2 (4*!pi*nu*I_nu)
; (from Draine & Bertoldi 1996)
;
; CATEGORY:
; DustEMWrap, Distributed, LowLevel, Helper
;
; CALLING SEQUENCE:
; habing = DUSTEM_HABING_FIELD(x,unit=unit)
;
; INPUTS:
; x : wavelength grid for the ISRF (1D array)
;
; OPTIONAL INPUT PARAMETERS:
; UNIT: unit of the ISRF. Choices are
; 'W': wave in um [Default]
; 'F': frequency in cm-1
; 'E': energy in eV
;
; OUTPUTS:
; ISRF : the Habing isrf as 1d vector in requested units
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
; help = print this help
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES
; wavs=3.+findgen(3000) ; wavelenghts 3 to 3003um
; isrf = DUSTEM_HABING_FIELD(wavs,unit='W')
;
; MODIFICATION HISTORY:
; Written by LV 2009
; Initially distributed with the Fortran, incorporated into DustEMWrap 2022
; 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_habing_field'
field=0
goto,the_end
ENDIF
; computes the Habing interstellar radiation field SED (ISRF)
; in W/m2 (4*!pi*nu*I_nu)
; (from Draine & Bertoldi 1996)
; X (I): X-grid for the ISRF
; UNIT (I): unit of the ISRF. Choices are
; 'W': wave in um [Default]
; 'F': frequency in cm-1
; 'E': energy in eV
if n_elements( UNIT ) EQ 0 then unit = 'W' $
else unit = strupcase( strcompress( unit,/rem) )
x = double( x )
CASE unit of
'W': x3 = 1.d1 * x
'F': x3 = 1.d5 / x
'E': x3 = 12.4 / x
ENDCASE
field = - x3^3*4.1667 + x3^2*12.5 - x3*4.3333
field = 1.d-1 * 3.d8 * 1.d-14 * field
i_neg = where( field LT 0.d0, c_neg )
field( i_neg ) = 0.d0
the_end:
RETURN, field
END ;FUNCTION DUSTEM_HABING_FIELD