47 inline double tau_from_here(
double tau_tot,
double tau_in)
49 const double SCALE = 10.;
50 double tt = tau_tot - tau_in;
82 class my_Integrand_escConE2
85 double chnukt_ContTkt, chnukt_ctau;
87 double operator() (
double x)
const
89 return exp(-chnukt_ContTkt*(x-1.))/x*
e2(chnukt_ctau/
POW3(x));
94 class my_Integrand_conrec
97 double chnukt_ContTkt;
99 double operator() (
double x)
const
101 return exp(-chnukt_ContTkt*(x-1.))/x;
131 if( strcmp(
rt.chEscFunSubord,
"SIMP") == 0 )
134 escinc_v = 1./(1. + tau);
150 b = 1.6 + (3.*pow(2.*a,-0.12))/(1. + atau);
154 double sqrtatau = sqrt(atau);
155 b = 1.6 + (3.*pow(2.*a,-0.12))*sqrtatau/(1. + sqrtatau);
159 escinc_v = 1./(1. + b*tau);
196 double sqrta = sqrt(a);
197 double scal = a*(1.0+a+tau)/(
POW2(1.0+a)+a*tau);
198 double pwing = scal*((tau > 0.0) ? sqrta/sqrt(a+2.25*SQRTPI*tau) : 1.0);
199 esccom_v = esccom_v*(1.0-pwing)+pwing;
242 DopplerWidth + conopc);
277 *dest = (dstin + dstout)/2.f;
288 ASSERT( escla_v >=0. && *dest>=0. && *esin>=0. );
297 double (*esc_1side)(
double,
double))
311 double tt = tau_from_here(tau_out, tau);
334 fprintf(
ioQQQ,
"DebuGGG escgrd_v %.2e iter %li tau %.2e damp %.2e frcin %.2e wayout %.2e\n",
366 for(
double tau=-29; tau<=100; tau+=0.1 )
369 fprintf(
ioQQQ,
"debuggg esc_CRDwing_1side \t %.2e \t%.2e\n",
397 if( tau_out <0 || tau_in < 0. )
400 tt =
MIN2( tau_out , tau_in );
404 tt = tau_from_here(tau_out, tau_in);
433 static const double a[5]={1.00,-0.1117897,-0.1249099917,-9.136358767e-3,
435 static const double b[6]={1.00,0.1566124168,9.013261660e-3,1.908481163e-4,
436 -1.547417750e-7,-6.657439727e-9};
437 static const double c[5]={1.000,19.15049608,100.7986843,129.5307533,-31.43372468};
438 static const double d[6]={1.00,19.68910391,110.2576321,169.4911399,-16.69969409,
456 else if( tau < 0.01 )
458 esca0k2_v = 1. - 2.*tau;
461 else if( tau <= 11. )
463 suma = a[0] + tau*(a[1] + tau*(a[2] + tau*(a[3] + a[4]*tau)));
464 sumb = b[0] + tau*(b[1] + tau*(b[2] + tau*(b[3] + tau*(b[4] +
466 esca0k2_v = tau/2.5066283*log(tau/SQRTPI) + suma/sumb;
472 arg = 1./log(tau/SQRTPI);
473 sumc = c[0] + arg*(c[1] + arg*(c[2] + arg*(c[3] + c[4]*arg)));
474 sumd = d[0] + arg*(d[1] + arg*(d[2] + arg*(d[3] + arg*(d[4] +
476 esca0k2_v = (sumc/sumd)/(2.*tau*sqrt(log(tau/SQRTPI)));
488 for (
int ipSpecies=0; ipSpecies <
nSpecies; ++ipSpecies)
491 em !=
dBaseTrans[ipSpecies].Emis().end(); ++em)
493 if((*em).TauIn() < -1. )
504 if(
TauLine2[i].Emis().TauIn() < -1. )
513 if(
HFLines[i].Emis().TauIn() < -1. )
531 escmase_v = 1. - tau*(0.5 - tau/6.);
533 else if( tau > -30. )
535 escmase_v = (1. - exp(-tau))/tau;
539 fprintf(
ioQQQ,
" DISASTER escmase called with 2big tau%10.2e the limit is -30\n",
547 ASSERT( escmase_v >= 1. );
569 else if( hnukt > 1. && tau > 100. )
575 my_Integrand_conrec func_conrec;
576 func_conrec.chnukt_ContTkt = hnukt;
579 my_Integrand_escConE2 func_escConE2;
580 func_escConE2.chnukt_ContTkt = hnukt;
581 func_escConE2.chnukt_ctau = tau;
585 sumrec = conrec.
sum(1.,1.+dinc);
586 sumesc = escConE2.
sum(1.,1.+dinc);
590 escpcn_v = sumesc/sumrec;
625 esc0 = 1./((0.6451 + tau)*(0.47 + 1.08/(1. + 7.3e-6*tau)));
627 esc0 =
MAX2(0.,esc0);
628 esc0 =
MIN2(1.,esc0);
632 taulog = log10(
MIN2(1e8,tau));
646 taucon =
MIN2(2.,beta*tau);
650 fac1 = -1.25 + 0.475*taulog;
651 fac2 = -0.485 + 0.1615*taulog;
652 fac = -fac1*taucon + fac2*
POW2(taucon);
663 *dest = (
realnum)(beta/(0.30972 -
MIN2(.28972,0.03541667*taulog)));
672 *dest =
MIN2(*dest,1.f-*esc);
673 *dest =
MAX2(0.f,*dest);
685 fprintf(
ioQQQ,
"scatdest tau %.2e beta%.2e 1-al%.2e al%.2e dest%.2e \n",
699 double destfit(
double beta)
705 return 7.0*beta/(1+7.0*beta);
716 return MIN2(1e-3,8.5*beta);
731 long int ipanu = t.
ipCont();
778 if( abund <= 0. || conopc <= 0. )
785 double opac_line = abund*crsec/DopplerWidth;
790 double beta = conopc/(SQRTPI*opac_line + conopc);
792 beta = conopc/
max(SQRTPI*opac_line,1e-6*conopc);
798 eovrlp_v = destfit(beta);
810 eovrlp_v = destfit(beta);
818 eovrlp_v = destfit(beta);
822 fprintf(
ioQQQ,
" chCore of %i not understood by RT_DestProb.\n",
830 eovrlp_v /= 1. + eovrlp_v;
837 eovrlp_v *=
MAX2(1. - escp, -escp*tau);
842 eovrlp_v *= 1. - escp;
852 enum {DEBUG_LOC=
false};
866 if (0 && t.
chLabel() ==
"He 1 3888.63A")
871 eovrlp_v,abund,conopc,escp,ipanu);
914 double opac_electron =
dense.
eden*SIGMA_THOMSON;
916 double conopc_tot = opac_electron+conopc;
917 if (conopc_tot > 0.0)
919 double fdest = conopc/conopc_tot;
929 double opac_line = (*t.
Lo()).Pop() * t.
Emis().
opacity()/DopplerWidth;
934 double opac_electron =
dense.
eden*SIGMA_THOMSON;
937 double opacity_ratio = opac_electron/(opac_electron+opac_line);
948 double RT_LineWidth_v,
1011 RT_LineWidth_v = 0.;
1020 aa = 4.8 + 5.2*tau + (4.*tau - 1.)*atau;
1026 atau = log(
MAX2(0.0001,tau));
1027 aa = 1. + 2.*atau/pow(1. + 0.3*t.
Emis().
damp()*tau,0.6667) +
1028 pow(6.5*t.
Emis().
damp()*tau,0.333);
1029 b = 1.6 + 1.5/(1. + 0.20*t.
Emis().
damp()*tau);
1033 RT_LineWidth_v = vth*0.8862*aa/b*(1. -
MIN2( 1. , escProb) );
1036 if( escProb >= 1. - 100. * FLT_EPSILON )
1037 RT_LineWidth_v = 0.;
1041 RT_LineWidth_v *= 2.;
1050 RT_LineWidth_v = vth*sqrt(log(
MAX2(1.,tau))*.2821);
1055 if( r*vth <= RT_LineWidth_v )
1057 RT_LineWidth_v = vth*r*log(RT_LineWidth_v/(r*vth));
1062 ASSERT( RT_LineWidth_v >= 0. );
1063 return RT_LineWidth_v;
1087 else if( beta > 1.0 )
1096 fhummr_v = 3.8363 - 0.56329*x;
1100 fhummr_v = 2.79153 - 0.75325*x;
1104 fhummr_v = 1.8446 - 1.0238*x;
1108 fhummr_v = 0.72500 - 1.5836*x;
1122 return (1.0-exp(tau))/tau;
1128 const complex<double> z1 ( -1.915394, 1.201751 ),
1129 rz1 ( -0.492975, 0.216820),
1130 z2 (-0.048093, 3.655564),
1131 rz2 (-0.007025, 0.050338);
1132 const complex<double> t1 = sqrt( (tau/z1-1.0)/sigma),
1133 t2 = sqrt( (tau/z2-1.0)/sigma);
1136 rz1*(1.0+tau/(2.0*t1*sigma*z1)*log((t1-1.0)/(t1+1.0)))+
1137 rz2*(1.0+tau/(2.0*t2*sigma*z2)*log((t2-1.0)/(t2+1.0))));
void DumpLine(const TransitionProxy &t)
realnum & opacity() const
realnum & Pelec_esc() const
double esc_CRDcore(double tau_in, double tau_out)
double esc_CRDwing(double tau_in, double tau_out, double damp)
const bool NEW_MASE_ESCAPE
double RT_EscLVG(double tau, double sigma)
TransitionList HFLines("HFLines",&AnonStates)
STATIC void RT_line_electron_scatter(const TransitionProxy &t, realnum DopplerWidth)
TransitionList TauLine2("TauLine2",&AnonStates)
double anu(size_t i) const
t_iso_sp iso_sp[NISO][LIMELM]
bool fp_equal(sys_float x, sys_float y, int n=3)
bool lgBallistic(void) const
void RT_DestProb(const TransitionProxy &t, double DopplerWidth, const DestType &nCore)
double esccon(double tau, double hnukt)
realnum & dampXvel() const
EmissionList::reference Emis() const
double sum(double min, double max) const
double esc_PRD_1side(double tau, double a)
STATIC double escmase(double tau)
qList::iterator Lo() const
double & mult_opac() const
#define DEBUG_ENTRY(funcname)
STATIC void RTesc_lya_1side(double taume, double beta, realnum *esc, realnum *dest, long ipLine)
STATIC double RT_DestHummer(double beta)
int fprintf(const Output &stream, const char *format,...)
STATIC void FindNeg(void)
double RTesc_lya(double *esin, double *dest, double abund, const TransitionProxy &t, realnum DopplerWidth)
double esca0k2(double taume)
double esc_PRD(double tau, double tau_out, double damp)
vector< TransitionList > dBaseTrans
double esc_CRDwing_1side(double tau, double a)
double RT_LineWidth(const TransitionProxy &t, realnum DopplerWidth)
double esc_2side_base(double tau, double tau_out, double damp, double(*esc_1side)(double, double))