30 class my_Integrand_con_pump_op
38 PumpTau(tau), damp(damp)
42 my_Integrand_con_pump_op(
void );
44 double operator() (
double x)
const
48 double opfun_v =
sexp(PumpTau*v)*v;
53 class con_pump_op_conv
61 PumpTau(tau), damp(damp)
65 con_pump_op_conv(
void );
67 double operator() (
double y)
const
75 v = 1.0/(PI*(1.0+x*x));
76 double opfun_v =
sexp(PumpTau*v)*v;
88 profile_pow(
int npow,
realnum damp) :
89 npow(npow), damp(damp)
95 double operator() (
double y)
const
107 v = 1./(PI*(1.0+x*x));
109 double opfun_v =
powi(v,npow);
110 return opfun_v/(y*y);
122 PumpTau(tau), damp(damp)
128 double operator() (
double y)
const
131 double x = 1./y - 1.;
136 v = 1.0/(PI*(1.0+x*x));
137 double opfun_v = PumpTau*v;
139 opfun_v = 1-
sexp(opfun_v);
141 opfun_v *= 1-0.5*opfun_v;
142 return opfun_v/(y*y);
148 static double shieldFederman(
double tau,
double damp,
bool lgBug);
163 value = (1. - tau/2.);
165 value = (1. -
dsexp( tau ) )/ tau;
214 value =
MIN2(1.,value);
228 ASSERT( value>=0 && (value<=1.||tau<0.) );
238 enum options { AVG_OLD, AVG_DEPTH, AVG_NO, AVG_BACK, AVG_ARITH,
239 AVG_GEOM, AVG_COUNT };
240 const enum options opt = AVG_DEPTH;
243 return s1*log(1.+dTau)/dTau;
245 else if (opt == AVG_DEPTH)
248 double dTauRel = dTau/(1.+tau);
249 ASSERT( 1.+dTauRel >= 0. );
250 return s1*log(1.+dTauRel)/dTauRel;
252 else if (opt == AVG_NO)
256 else if (opt == AVG_BACK)
260 else if (opt == AVG_ARITH)
264 else if (opt == AVG_GEOM)
268 else if (opt == AVG_COUNT)
279 double core, wings, value;
287 core =
sexp( tau * 0.66666 );
291 core = 0.638 * pow(tau,(
realnum)-1.25f );
293 else if( tau < 100. )
295 core = 0.505 * pow(tau,(
realnum)-1.15f );
299 core = 0.344 * pow(tau,(
realnum)-1.0667f );
307 double t1 = 3.02*pow(damp*1e3,-0.064 );
308 double tauwing = lgBug ? tau : tau*SQRTPI;
309 double u1 = sqrt(
MAX2(tauwing,0.)*damp )/
SDIV(t1);
310 wings = damp/
SDIV(t1)/sqrt( 0.78540 +
POW2(u1) );
315 if( lgBug && tau>1e7 )
316 wings *= pow( tau/1e7,-1.1 );
318 value = core + wings;
324 value =
MIN2(1., value );
329 bool lgShield_this_zone,
double dTau )
336 if( lgShield_this_zone && dTau > 1e-3 )
338 if (0 && t.
ipCont() == 3627)
339 fprintf(
ioQQQ,
"?shield %ld %15.8g %15.8g %15.8g %15.8g %s\n",
340 nzone,tau,dTau,1./(1. + dTau ),
356 my_Integrand_con_pump_op func(tau, damp);
359 const double BREAK = 3.;
361 double yinc1 = opfun.
sum( 0., BREAK );
362 double yinc2 = opfun.
sum( BREAK, 100. );
364 double a0 = 0.5*SQRTPI;
365 return (yinc1 + yinc2)/
a0;
375 con_pump_op_conv func(tauint, damp);
381 if (func(0.5*top) > 0.0)
387 intl(integrate::Midpoint<con_pump_op_conv>(func,0.0,top));
390 return 2.0*intl.
sum();
400 growth func(tauint, damp);
403 intl(integrate::Midpoint<growth>(func,0.0,1.0));
406 return 2.0*intl.
sum();
417 if( tau <= 10+2.5*damp)
422 tausc = tau*(1.-1.5*damp);
426 tausc = tau*(1+damp)/(1.+2.5*damp*(1.+damp));
446 return (0.98925439 + 0.084594094*t)/(1. + t*(0.64794212 + t*0.44743976));
457 double taufac = SQRTPI;
458 double dampa = damp > 0.0 ? damp : 0.0;
460 for (
long i=0; i<49; ++i)
462 double tau = 1e-4*
exp10(i/4.);
463 fprintf(
ioQQQ,
"%13.8e %13.8e %13.8e %13.8e %13.8e %13.8e %13.8e\n",
475 FILE* ioVALID =
open_data(
"growth.dat",
"w");
476 fprintf(ioVALID,
"#tau damp growth_romb growthRodgers\n");
477 for (
long j=0; j<1+7*NSAMP; ++j)
479 double damp1 = 1e-5*
exp10(j/
double(NSAMP));
480 for (
long i=0; i<1+12*NSAMP; ++i)
482 double tau = 1e-4*
exp10(i/
double(NSAMP));
486 fprintf(ioVALID,
"%13.8e %13.8e %13.8e %13.8e %13.8e\n",
487 tau, damp1,gromb, grodg, err );
496 FILE* ioVALID =
open_data(
"shield.dat",
"w");
497 fprintf(ioVALID,
"#tau damp shield_romb shieldRodgers\n");
498 for (
long j=0; j<1+7*NSAMP; ++j)
500 double damp1 = 1e-5*
exp10(j/
double(NSAMP));
501 for (
long i=0; i<1+12*NSAMP; ++i)
503 double tau = 1e-4*
exp10(i/
double(NSAMP));
507 fprintf(ioVALID,
"%13.8e %13.8e %13.8e %13.8e %13.8e\n",
508 tau, damp1,gromb, grodg, err );
517 if (damp != 0.0 && damp < 0.5)
523 tau = 1.0/(damp*log(tau));
524 if (fabs(tau-tau0) < 1e-4*tau)
530 for (
long i=0; i<49; ++i)
532 double damp1 = 1e-6*damp*
exp10(0.25*i);
533 fprintf(
ioQQQ,
"%13.8e %13.8e %13.8e %13.8e %13.8e %13.8e\n",
543 for (
int n=1; n<10; ++n)
546 intg(integrate::Midpoint<profile_pow>(profile_pow(n,damp),0.0,1.0));
548 fprintf(ioQQQ," %13.8e",2.0*intg.sum());
567 double& w, double &dw)
570 double z = tau/(2 * PI * damp );
573 static const double a[] = {9.99997697674e-1,
591 6*a[5]+z*7*a[6])))));
597 static const double b[] = {7.97885095473e-1,
603 double sz = sqrt(z),rz = 1./z;
604 w = sz*(b[0]+rz*(b[1]+rz*(b[2]+rz*(b[3]+rz*(b[4]+rz*b[5])))));
609 -7*b[4]-rz*9*b[5])))))/
617 double& w,
double &dw)
620 double z = tau/SQRTPI;
623 static const double c[] = {9.99998291698e-1,
631 w = z*SQRTPI*(c[0]+z*(
644 7*c[6]+z*8*c[7])))))));
648 static const double d[] = {1.99999898289e0,
656 double lz = log(z), slz=sqrt(lz), rlz=1./lz;
663 d[6]+rlz*d[7])))))));
670 -11*d[6]-rlz*13*d[7])))))))/
692 double wls = wl*wl, wds = wd*wd, rtaus=1./(tau*tau);
693 double wv = sqrt(wls+wds-wls*wds*rtaus);
714 double wls = wl*wl, wds = wd*wd, rtaus=1./(tau*tau);
715 double wv = sqrt(wls+wds-wls*wds*rtaus);
716 double dwv = (wl*dwl*(1.0-wds*rtaus)+
717 wd*dwd*(1.0-wls*rtaus)+
718 wls*wds*rtaus/tau)/wv;
static void shieldRodgersLorentz(double tau, double damp, double &w, double &dw)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
string chLineLbl(const TransitionProxy &t)
NORETURN void TotalInsanity(void)
double DrvContPump(double tau, double damp)
STATIC double conpmp_qg32(double tau, double damp)
void DrivePump(double tau)
STATIC double RT_continuum_shield_fcn_point(const TransitionProxy &t, double tau)
STATIC double conpmp(double tau, double damp)
sys_float sexp(sys_float x)
static double growthRodgers(double tau, double damp)
static double shieldFederman(double tau, double damp, bool lgBug)
STATIC double conpmp_romb(double tau, double damp)
STATIC double fitted(double t)
EmissionList::reference Emis() const
STATIC double growth_romb(double tau, double damp)
static double shieldRodgers(double tau, double damp)
double powi(double, long int)
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
double sum(double min, double max) const
double RT_continuum_shield_fcn(const TransitionProxy &t, bool lgShieldThisZone, double dTau)
double esc_PRD_1side(double tau, double a)
static void shieldRodgersDoppler(double tau, double &w, double &dw)
void VoigtU(realnum a, const realnum v[], realnum y[], int n)
#define DEBUG_ENTRY(funcname)
int fprintf(const Output &stream, const char *format,...)
sys_float SDIV(sys_float x)
double esca0k2(double taume)
double esc_CRDwing_1side(double tau, double a)
void VoigtH(realnum a, const realnum v[], realnum y[], int n)
STATIC double avg_shield(double s1, double s2, double dTau, double tau)