00001 /* This file is part of Cloudy and is copyright (C)1978-2007 by Gary J. Ferland 00002 * For conditions of distribution and use see copyright notice in license.txt */ 00003 /*RT_line_one_tauinc increment optical depths for all heavy element lines, zone by zone, 00004 * mainly called by RT_tau_inc, but also by FeII */ 00005 #include "cddefines.h" 00006 #include "doppvel.h" 00007 #include "geometry.h" 00008 #include "rfield.h" 00009 #include "radius.h" 00010 #include "wind.h" 00011 #include "rt.h" 00012 00013 void RT_line_one_tauinc(EmLine * t , 00014 /* following four are flags to generate info if some species has extreme maser */ 00015 long int maser_flag_species, 00016 long int maser_flag_ion, 00017 long int maser_flag_hi, 00018 long int maser_flag_lo ) 00019 00020 { 00021 DEBUG_ENTRY( "RT_line_one_tauinc()" ); 00022 00023 /* routine increments optical depths for static or exanding atmosphere */ 00024 00025 /* use static solution for both d-critical and static, for d-critical speeds are only 00026 * roughly sonic and thermal for H itself, Lya is dominant, and flow across HII region 00027 * has nearly constant speed. so this seems like better bet. 00028 * for d-critical velocity gradients are too small to use a purely local calulation 00029 * of the total optical depth - the depth would be overestimated */ 00033 if( wind.windv <= 0. ) 00034 { 00035 /* static and negative velocity solutions */ 00036 float dTau_total; 00037 float opacity = t->opacity / DoppVel.doppler[ t->nelem -1]; 00038 /* this is optical depth within this one line itself */ 00039 float dTau_line = (float)( t->PopOpc * opacity * radius.drad_x_fillfac ); 00040 00041 /* if fine opacities fine grid fine mesh are calculated then use them to get optical depth 00042 * to continuum source */ 00043 if( t->ipFine>0 && t->ipFine<rfield.nfine && rfield.lgOpacityFine ) 00044 { 00045 /* pick up fine opacity at center of line */ 00046 dTau_total = rfield.fine_opac_zone[t->ipFine] * (float)radius.drad_x_fillfac; 00047 00048 /* sanity check - total fine opacity should be greater than single ine opacity */ 00049 ASSERT( fabs(dTau_line) < 0.01 || 00050 rfield.fine_opac_zone[t->ipFine]*1.1 >= opacity*t->PopOpc ); 00051 } 00052 else 00053 { 00054 dTau_total = dTau_line; 00055 } 00056 /*if( rfield.lgOpacityFine ) 00057 fprintf(ioQQQ,"DEBUG lgOpacityFine oops\n");*/ 00058 /* >>chng 03 aug 20, only use self abs for this optical depth */ 00059 t->TauIn += dTau_line; 00060 00061 /* >>chng 03 feb 12, add correction for lines that are not this line */ 00062 /* this is optical depth to continuum source, includes line overlap, 00063 * is used for continuum pumping */ 00064 t->TauCon += dTau_total; 00065 00066 /* keep track of any masers */ 00067 if( dTau_line < rt.dTauMase ) 00068 { 00069 rt.dTauMase = dTau_line; 00070 rt.mas_species = maser_flag_species; 00071 rt.mas_ion = maser_flag_ion; 00072 rt.mas_hi = maser_flag_hi; 00073 rt.mas_lo = maser_flag_lo; 00074 /*if( dTau_line < -0.1 ) 00075 fprintf(ioQQQ, 00076 " maser hittt, iteraton %li zone %li species %li ion %li hi, lo %li %li val %.2e\n", 00077 iteration, nzone, 00078 rt.maser_flag_species , rt.maser_flag_ion , rt.maser_flag_hi , rt.maser_flag_lo , dTau_line );*/ 00079 } 00080 00081 /* this will cause comment to be printed in prtComments */ 00082 if( rt.dTauMase < -1. ) 00083 { 00084 rt.lgMaserCapHit = true; 00085 } 00086 } 00087 00088 else 00089 { 00090 double absAccelTot = fabs(wind.AccelTot); 00091 float oldtau = t->TauIn; 00092 double hold; 00093 /* wind solution */ 00094 00095 /* this is effective length scale for sobolev or lvg approximation. 00096 * This is equation 3 of 00097 * >>refer RT wind Castor, J.I., Abbott, D.C., & Klein, R.I., 1975, ApJ, 195, 157 00098 * 00099 * >>chng 01 mar 24, change to this formalism from previous, constant velocity 00100 * approximation 00101 */ 00102 /*t->TauIn = wind.wndeff * t->PopOpc * t->opacity;*/ 00103 /* do not let the physical scale exceed the current depth */ 00104 hold = SDIV(absAccelTot); 00105 t->TauIn = (float)(MIN2( radius.depth, DoppVel.doppler[ t->nelem -1]/ hold ) * 00106 geometry.FillFac * t->PopOpc * t->opacity); 00107 if( t->TauIn < 0. && t->TauIn < oldtau ) 00108 { 00109 /* >>chng 04 dec 26, 00110 * we have a maser, dont let it run away - it can do this in this case wind no 00111 * memory of optical depth scale up to here - let it change by, at most, 00112 * -1 from previous optical depth */ 00113 t->TauIn = MAX2( oldtau-1.f, t->TauIn); 00114 } 00115 00116 t->TauCon = t->TauIn; 00117 00118 t->TauTot = t->TauIn; 00119 } 00120 00121 DEBUG_EXIT( "RT_line_one_tauinc()" ); 00122 return; 00123 }