Blame view

src/idl/dustem_mathis_field.pro 2.21 KB
4002e6fa   Annie Hughes   updated help
1
2
3
4
5
6
7
8
FUNCTION DUSTEM_MATHIS_FIELD, x, unit=unit, help=help

;+
; NAME:
;   dustem_mathis_field
;  
; PURPOSE:
; Returns the Mathis interstellar radiation field SED (ISRF) in W/m2 (4*!pi*nu*I_nu)
a38807fc   Annie Hughes   first commit of f...
9
; from Mathis et al. 1983, A&A 128, 212
4002e6fa   Annie Hughes   updated help
10
11
12
13
14
15
16
17
18
19
20
21
;  
; CATEGORY:
;    DustEMWrap, Distributed, LowLevel, Helper
;  
; CALLING SEQUENCE:
;   mathis = DUSTEM_MATHIS_FIELD(x,unit=unit)
;
; INPUTS:
;    x : wavelength grid for the ISRF (1D array)
;
; OPTIONAL INPUT PARAMETERS:
;    UNIT: unit of the ISRF. Choices are 
a38807fc   Annie Hughes   first commit of f...
22
23
24
;	     'W': wave in um [Default]
;	     'F': frequency in cm-1
;	     'E': energy in eV
4002e6fa   Annie Hughes   updated help
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
;
; OUTPUTS:
;    ISRF : the Mathis 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_MATHIS_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_mathis_field'
     field=0
     goto,the_end
  ENDIF
a38807fc   Annie Hughes   first commit of f...
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

 if n_elements( UNIT ) EQ 0 then unit = 'W' $
 else unit = strupcase( strcompress( unit,/rem) )

 ly_limit = 9.11267101235d-2

 x = double( x )

;
; visible part 
;
 wdil = 4.d0 * [ 4.d-13, 1.d-13, 1.d-14]	; Mathis definition
						; 4*!pi*Wdil*B_nu
 field = !pi * x * DUSTEM_BLACKBODY( x, [ 3.d3, 4.d3, 7.5d3 ], wdil=wdil, unit=unit )

;
; UV part
;

; first convert to (lambda / 1e3 AA)
 CASE unit of 

   'W': x3 = 1.d1 * x 

   'F': x3 = 1.d5 / x

   'E': x3 = 12.4 / x

 ENDCASE
 
 il = where( x3 LE 2.46, cl ) 
 if cl GT 0 then field(il) = 0.D0

 il = where( x3 GE 1d1*ly_limit AND x3 LT 1.11, cl )
 if cl GT 0 then field(il) = 1.4817d-6 * x3(il)^(4.4172)
 il = where( x3 GE 1.11 AND x3 LT 1.34, cl ) 
 if cl GT 0 then field(il) = 2.0456d-6 * x3(il)
 il = where( x3 GE 1.34 AND x3 LT 2.46, cl )
 if cl GT 0 then field(il) = 3.3105d-6 * x3(il)^(-0.6678)
  
4002e6fa   Annie Hughes   updated help
99
the_end:
a38807fc   Annie Hughes   first commit of f...
100
101
 RETURN, field
END                             ;FUNCTION DUSTEM_MATHIS_FIELD