Viewing contents of file '../idllib/astron/contrib/varosi/vlibm/allpro/ep_lya.pro'
;+
; NAME:
;	EP_Lya
; PURPOSE:
;	Compute escape probability of Lyman alpha in spheriod of gas & dust.
;	The Lyman alpha emission is assumed to be uniformly distributed.
;	The effects of resonant scattering in a dusty medium are approximated
;	by computing an effective random walk path length thru the dust,
;	thus increasing the effective optical depth of the dust, based on
;	the parameter alpha indicating the amount of frequency redistribution
;	occuring with the Lyman alpha resonant scattering.
; CALLING:
;	ep = EP_Lya( ALPHA=, TGAS=, RADIUS=, GAS_DENS=, TAU=, ALBEDO= )
; KEYWORD INPUTS:
;	ALPHA = index controlling frequency redistribution, default = 0.5 :
;	alpha = 0.5 : complete freq-redistrib (Voigt profile) for scattering.
;	alpha = 1 : scattering by thermal gas (partial coherent & f-redistrib),
;	alpha = 2 : pure coherent scattering (line center, gas motion & T = 0).
;	GAS_DENS = default = 1/cm^3.
;	TGAS = default = 7000K.
;	RADIUS = effective radius of spheriod medium.
;	TAU_DUST = optical depth of dusty medium at Lyman alpha wavelength.
;	ALBEDO = albedo of dusty medium at Lyman alpha wavelength.
;	/VERBOSE : print parameters and the effective path-length.
; EXTERNAL CALLS:
;	function escape_prob
;	function scalar
;	Uses system structure variable !cv (created by Varosi's idl_startup.pro)
; PROCEDURE:
;	Compute Lya cross-section and effective path-length to get effective
;	optical depth of dust, then used in Osterbrock-Lucy escape probability.
; HISTORY:
;	Written: Frank Varosi, HSTX @ NASA/GSFC, 1995.
;-

function EP_Lya, ALPHA=alpha, TGAS=Tgas, RADIUS=Rs, VERBOSE=verbose, $
		GAS_DENS=den_gas, TAU_DUST=Taudust, ALBEDO=albedo

	if N_elements( Tgas ) NE 1 then Tgas = 7000.	;assumed gas temperature
	if N_elements( den_gas ) NE 1 then den_gas = 1
	if N_elements( alpha ) NE 1 then alpha = 0.5

	Siglya = 3/(8*!PI) * (0.1215e-4)^3 * 4.68e8 * $
			sqrt( !cv.mh/(2*!PI*!cv.k*Tgas) )

	path_factor = ( Siglya * Rs * den_gas )^(alpha/2.)

	if keyword_set( verbose ) then begin
	 print," H cross-section at Lyman-alpha =",Siglya,"  , gas Temp =",Tgas
	 print," Lya dust Tau & albedo: ", Taudust, albedo
	 print," effective path factor =",path_factor," , scatter-alpha =",alpha
	endif

return, scalar( escape_prob( path_factor * Taudust, albedo ) )
end