dustem_mathis_field.pro 2.21 KB
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)
; from Mathis et al. 1983, A&A 128, 212
;  
; 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 
;	     'W': wave in um [Default]
;	     'F': frequency in cm-1
;	     'E': energy in eV
;
; 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

 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)
  
the_end:
 RETURN, field
END                             ;FUNCTION DUSTEM_MATHIS_FIELD