Changeset 2109 for branches/c08_branch/source/grains.cpp
- Timestamp:
- 06/13/08 22:15:29 (7 months ago)
- Files:
-
- 1 modified
-
branches/c08_branch/source/grains.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/c08_branch/source/grains.cpp
r2034 r2109 33 33 inline double ASINH(double x) 34 34 { 35 if( abs(x) <= 2.3e-4 ) 36 return x - pow3(x)/6.; 37 else if( abs(x) <= 8.e-3 ) 35 if( abs(x) <= 8.e-3 ) 38 36 return ((0.075*pow2(x) - 1./6.)*pow2(x) + 1.)*x; 39 37 else if( abs(x) <= 1./sqrt(DBL_EPSILON) ) … … 47 45 { 48 46 if( x < 0. ) 49 return - log(-2.*x);47 return -(log(-x)+LN_TWO); 50 48 else 51 return log( 2.*x);49 return log(x)+LN_TWO; 52 50 } 53 51 } … … 145 143 return 1.e-7; 146 144 else 147 return 3.e-6* pow((double)gv.bin[nd]->dustp[0],-0.85)*pow(e*EVRYD*1.e-3,1.5);145 return 3.e-6*gv.bin[nd]->eec*sqrt(pow3(e*EVRYD*1.e-3)); 148 146 } 149 147 … … 192 190 STATIC void UpdatePot2(long,long); 193 191 /* Helper function to calculate primary and secondary yields and the average electron energy at infinity */ 194 STATICvoid Yfunc(long,long,double,double,double,double,double,/*@out@*/double*,/*@out@*/double*,192 inline void Yfunc(long,long,double,double,double,double,double,/*@out@*/double*,/*@out@*/double*, 195 193 /*@out@*/double*,/*@out@*/double*); 196 194 /* This calculates the y0 function for band electrons (Sect. 4.1.3/4.1.4 of WDB06) */ … … 203 201 STATIC double y1psa(long,long,double); 204 202 /* This calculates the y2 function for primary and Auger electrons (Eq. 8 of WDB06) */ 205 STATICdouble y2pa(double,double,long,double*);203 inline double y2pa(double,double,long,double*); 206 204 /* This calculates the y2 function for secondary electrons (Eq. 20-21 of WDB06) */ 207 STATICdouble y2s(double,double,long,double*);205 inline double y2s(double,double,long,double*); 208 206 /* find highest ionization stage with non-zero population */ 209 207 STATIC long HighestIonStage(void); … … 3216 3214 } 3217 3215 3216 double GrainPot = chrg2pot(Zg,nd); 3217 3218 3218 if( nfill > ipLo ) 3219 3219 { … … 3241 3241 /* calculate yield for band structure */ 3242 3242 Ehi = Ehi_band = anu[i] - ThresInfVal - Emin; 3243 Wcorr = ThresInfVal + Emin - chrg2pot(Zg,nd);3243 Wcorr = ThresInfVal + Emin - GrainPot; 3244 3244 Eel = anu[i] - DustWorkFcn; 3245 3245 yzero = y0b( nd, nz, i ); … … 3252 3252 3253 3253 /* add in yields for inner shell ionization */ 3254 for( ns=1; ns < gv.bin[nd]->nShells; ns++ ) 3254 unsigned long nsmax = gv.bin[nd]->nShells; 3255 for( ns=1; ns < nsmax; ns++ ) 3255 3256 { 3256 3257 sptr = gv.bin[nd]->sd[ns]; … … 3268 3269 3269 3270 /* add in Auger yields */ 3270 for( n=0; n < sptr->nData; n++ ) 3271 long nmax = sptr->nData; 3272 for( n=0; n < nmax; n++ ) 3271 3273 { 3272 3274 double max = sptr->AvNr[n]*sptr->p[i]; 3273 Ehi = sptr->Ener[n] - chrg2pot(Zg,nd);3275 Ehi = sptr->Ener[n] - GrainPot; 3274 3276 Eel = sptr->Ener[n]; 3275 3277 Yfunc(nd,nz,sptr->y01A[n][i],max,Elo,Ehi,Eel,&Yp1,&Ys1,&Ehp,&Ehs); … … 3432 3434 3433 3435 /* Helper function to calculate primary and secondary yields and the average electron energy at infinity */ 3434 STATICvoid Yfunc(long nd,3436 inline void Yfunc(long nd, 3435 3437 long nz, 3436 3438 double y01, … … 3472 3474 /* this is Eq. 18 of WDB06 */ 3473 3475 /* Eel may be negative near threshold -> set yield to zero */ 3474 f3 = max(Eel,0.)/(eps*elec_esc_length(Eel,nd)* (1./gv.bin[nd]->AvRadius + 1.e7));3476 f3 = max(Eel,0.)/(eps*elec_esc_length(Eel,nd)*gv.bin[nd]->eyc); 3475 3477 *Ys = y2sec*f3*min(y01,maxval); 3476 3478 } … … 3614 3616 3615 3617 /* This calculates the y2 function for primary and Auger electrons (Eq. 8 of WDB06) */ 3616 STATICdouble y2pa(double Elo,3618 inline double y2pa(double Elo, 3617 3619 double Ehi, 3618 3620 long Zg, … … 3658 3660 3659 3661 /* This calculates the y2 function for secondary electrons (Eqs. 20-21 of WDB06) */ 3660 STATICdouble y2s(double Elo,3662 inline double y2s(double Elo, 3661 3663 double Ehi, 3662 3664 long Zg, … … 3713 3715 { 3714 3716 N0 = alpha*(1./sqR0 - 1./sqRh); 3715 E0 = alpha*ETILDE*(ASINH(x ) + ASINH(yl) - yh/sqRh);3717 E0 = alpha*ETILDE*(ASINH(x*sqR0 + yl*sqRh) - yh/sqRh); 3716 3718 } 3717 3719 }
