Viewing contents of file '../idllib/astron/contrib/varosi/vlibm/allpro/mega_grain_abs.pro'
;+
; NAME:
; Mega_Grain_Abs
; PURPOSE:
; Compute fraction of photons absorbed by the inter-clump medium (ICM)
; for the case of photons emitted uniformly/centrally in a spheriod/disk.
; Returns what fraction of the photons absorbed in the two-phase
; clumpy medium are actually absorbed by the inter-clump medium (ICM).
; Uses a variation of the Mega-Grains approximation (see mega_grains.pro)
; but this theory is NOT in the original paper by Hobson & Padman 1993.
; The clumps are treated totally separate from ICM (not just overdensity).
; (See Varosi and Dwek, 1999 ApJ 523, 265 for all equations).
; CALLING:
; frac_abs_ICM = Mega_Grain_Abs( FILL_FACT=,... )
;
; KEYWORD INPUTS:
;
; XSEC_DUST = total (absorption + scattering) cross-section(s) of dust.
; ALBEDO_DUST = dust scattering albedo(s).
; GP_DUST = scattering asymmetry parameter(s).
;
; ICM_XSEC = optional, Xsec for dust in the ICM if different than clumps.
; ICM_ALBEDO = scattering albedo for dust in the ICM (optional).
; ICM_GP = scatt. asymmetry param. for dust in the ICM (optional).
;
; DENS_HOMOG = desired equivalent homogenous (average) density (default=1)
; RADIUS_EFF = effective radius of sphere enclosing the clumps.
;
; FILL_FACT = volume filling factor of clumps.
; RADIUS_CLUMP = radius of a spherical clump (same units as XSEC & DENS).
; RATIO_ICM_CL = ratio of ICM to clump densities.
; DRATIO_CL_ICM = ratio of clump to ICM densities (overrides RATIO_ICM_CL)
;
; SOURCE_TYPE = string (upper or lowercase) indicating source of photons:
; "C" : case of central point source,
; "X" : case of uniformly illuminating external source,
; "U" = uniformly distributed internal sources (default case).
; "MC" : central source only in clumps (no emission in ICM),
; "MU" : uniform source only in clumps (no emission in ICM).
;
; /CLUMPS : return instead fraction absorbed by clumps ( = 1 - f_ICM ).
; OUTPUTS:
; Function returns the fraction of photons absorbed by ICM,
; for the case of central or uniformly distributed emission.
;
; EXTERNAL CALLS:
; pro Mega_Grains,/NORMAL_CLUMPS
; function escape_prob
; function Tau_Eff_Scat
; PROCEDURE:
; Approximate the effects of scattering by function Tau_Eff_Scat.
; Then compute ICM fraction based on ratio of k_ICM/(k_MG+k_ICM).
; HISTORY:
; Written: Frank Varosi, HSTX @ NASA/GSFC, 1996-97.
; F.V. 2000, added source types "MC" and "MU" (source just in clumps).
;-
function Mega_Grain_Abs, XSEC_DUST=xsec, ALBEDO_DUST=albedo_DUST, GP_DUST=gp, $
ICM_XSEC=xsicm, ICM_ALBEDO=albedo_ICM, ICM_GP=gp_ICM, $
FILL_FACT=ffc, DENS_HOMOG=den_hom, $
RATIO_ICM_CL=drat, DRATIO_CL_ICM=drat_CL_ICM, $
RADIUS_CLUMP=radius_CL, RADIUS_EFF=radius, $
HP_ALBEDO=hp_albedo, HP_MG=hp_mg, KMG=kmg, KICM=kicm, $
SOURCE_TYPE=srctype ,CLUMPS=clumps, GAMMA_F=gamf
;first compute MG approx. with full clump optical depths (/NORMAL_CLUMP):
Mega_Grains, kmg, kicm, albedo_EFF, g_EFF, /NORMAL_CLUMP, $
TAU_CLUMP=tau_CL, ACLUMP=albedo_CL, GCLUMP=gclump, $
XSEC_DUST=xsec, ALBEDO_DUST=albedo_DUST, GP_DUST=gp, $
ICM_XSEC=xsicm, ICM_ALBEDO=albedo_ICM, ICM_GP=gp_ICM, $
FILL_FAC=ffc, RADIUS_C=radius_CL, RATIO=drat, DRAT=drat_CL_ICM,$
HP_ALB=hp_albedo, HP_MG=hp_mg, DENS_H=den_hom, GAMMA=gamf
ktot = kmg + kicm
if max( ktot ) LE 0 then return, replicate( 1.0, N_elements( ktot ) )
;now assume spherical geometry and apply effective scattering approx:
kicm = Tau_Eff_Scat( gp, albedo_DUST, kicm*radius )
kicm = (1-ffc) * kicm
kmg = Tau_Eff_Scat( gclump, albedo_CL, kmg * radius )
ktot = kmg + kicm
if N_elements( srctype ) ne 1 then srctype = "U"
srctype = strupcase( srctype )
;return absorption fraction ratios:
CASE srctype OF
"C": f_icm = kicm/ktot
"U": BEGIN
fifp = (1 - ffc) + ffc * escape_prob( tau_CL, albedo_DUST )
f_icm = fifp * (kicm/ktot)
END
"X": BEGIN
fifp = (1 - ffc) + ffc * escape_prob( tau_CL, albedo_DUST )
f_icm = fifp * (kicm/ktot)
f_icm = ( f_icm + kicm/ktot )/2
END
"MU": f_icm = (kicm/ktot) * escape_prob( tau_CL, albedo_DUST )
"MC": f_icm = (kicm/ktot) * $
exp( -Tau_Eff_Scat( gp, albedo_DUST, tau_CL ) )
else: BEGIN
message,"default is source type U (uniform)",/INFO
fifp = (1 - ffc) + ffc * escape_prob( tau_CL, albedo_DUST )
f_icm = fifp * (kicm/ktot)
END
ENDCASE
if keyword_set( clumps ) then return,1-f_icm else return,f_icm
end