Changeset 785
- Timestamp:
- 01/16/07 00:03:11 (2 years ago)
- Location:
- trunk/source
- Files:
-
- 2 removed
- 22 modified
-
atom_feii.cpp (modified) (1 diff)
-
atom_leveln.cpp (modified) (1 diff)
-
atom_oi.cpp (modified) (1 diff)
-
atom_pop5.cpp (modified) (1 diff)
-
atom_seq_beryllium.cpp (modified) (1 diff)
-
bevington.h (deleted)
-
cont_gaunt.cpp (modified) (1 diff)
-
conv_eden_ioniz.cpp (modified) (1 diff)
-
helike_cs.cpp (modified) (9 diffs)
-
helike_level.cpp (modified) (1 diff)
-
helike_recom.cpp (modified) (3 diffs)
-
hydrolevelpop.cpp (modified) (1 diff)
-
hydro_bauman.cpp (modified) (19 diffs)
-
ion_solver.cpp (modified) (1 diff)
-
lapack.h (deleted)
-
mole_co_solve.cpp (modified) (1 diff)
-
mole_h_step.cpp (modified) (1 diff)
-
prt_lines_helium.cpp (modified) (1 diff)
-
sanity_check.cpp (modified) (4 diffs)
-
service.cpp (modified) (1 diff)
-
thirdparty.cpp (modified) (16 diffs)
-
thirdparty.h (modified) (1 diff)
-
thirdparty_bevington.cpp (modified) (3 diffs)
-
thirdparty_lapack.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/atom_feii.cpp
r779 r785 51 51 #include "lines_service.h" 52 52 #include "ipoint.h" 53 #include " lapack.h"53 #include "thirdparty.h" 54 54 #include "hydrogenic.h" 55 55 #include "lines.h" -
trunk/source/atom_leveln.cpp
r763 r785 8 8 #include "dense.h" 9 9 #include "trace.h" 10 #include " lapack.h"10 #include "thirdparty.h" 11 11 #include "atoms.h" 12 12 -
trunk/source/atom_oi.cpp
r759 r785 14 14 #include "phycon.h" 15 15 #include "lines_service.h" 16 #include " lapack.h"16 #include "thirdparty.h" 17 17 #include "atoms.h" 18 18 -
trunk/source/atom_pop5.cpp
r759 r785 6 6 #include "phycon.h" 7 7 #include "dense.h" 8 #include " lapack.h"8 #include "thirdparty.h" 9 9 #include "atoms.h" 10 10 -
trunk/source/atom_seq_beryllium.cpp
r759 r785 5 5 #include "phycon.h" 6 6 #include "lines_service.h" 7 #include " lapack.h"7 #include "thirdparty.h" 8 8 #include "dense.h" 9 9 #include "cooling.h" -
trunk/source/cont_gaunt.cpp
r756 r785 349 349 350 350 /* This is the coefficient in equation 8 in Sutherland */ 351 /* Karzas and Latter give gammafun(2.*i+2.), Sutherland gives gammafun(2.*i+1.) */352 ICoef = 0.25*pow(-chi, (double)i+1.)*exp( 1.5708*fabs(etai-etaf) )/ gammafun(2.*i+1.);351 /* Karzas and Latter give tgamma(2.*i+2.), Sutherland gives tgamma(2.*i+1.) */ 352 ICoef = 0.25*pow(-chi, (double)i+1.)*exp( 1.5708*fabs(etai-etaf) )/factorial(2*i); 353 353 GammaProduct = cdgamma(complex<double>(i+1.,etai))*cdgamma(complex<double>(i+1.,etaf)); 354 354 ICoef *= abs(GammaProduct); -
trunk/source/conv_eden_ioniz.cpp
r761 r785 7 7 #include "trace.h" 8 8 #include "thermal.h" 9 #include " bevington.h"9 #include "thirdparty.h" 10 10 #include "phycon.h" 11 11 #include "conv.h" -
trunk/source/helike_cs.cpp
r761 r785 25 25 26 26 /* returns thermally-averaged Seaton 62 collision strength. */ 27 staticdouble S62_Therm_ave_coll_str( double EProjectile_eV );27 STATIC double S62_Therm_ave_coll_str( double EProjectile_eV ); 28 28 29 29 /* all of these are used in the calculation of Stark collision strengths 30 30 * following the algorithms in Vrinceanu & Flannery (2001). */ 31 static double Therm_ave_coll_str_int_VF01( double EProjectileRyd); 32 static double collision_strength_VF01( double velOrEner, bool lgParamIsRedVel ); 33 static double L_mix_integrand_VF01( double alpha ); 34 static double StarkCollTransProb_VF01( long int n, long int l, long int lp, double alpha, double deltaPhi); 35 36 /* returns the value of elliptical integral K */ 37 static double ellip_int_K( double k ); 31 STATIC double Therm_ave_coll_str_int_VF01( double EProjectileRyd); 32 STATIC double collision_strength_VF01( double velOrEner, bool lgParamIsRedVel ); 33 STATIC double L_mix_integrand_VF01( double alpha ); 34 STATIC double StarkCollTransProb_VF01( long int n, long int l, long int lp, double alpha, double deltaPhi); 38 35 39 36 static long int global_n, global_l, global_l_prime, global_s, global_z, global_Collider; … … 1238 1235 1239 1236 /* The integrand for calculating the thermal average of collision strengths */ 1240 staticdouble S62_Therm_ave_coll_str( double proj_energy )1237 STATIC double S62_Therm_ave_coll_str( double proj_energy ) 1241 1238 { 1242 1239 … … 1335 1332 zeta_of_betaone = zOverB2 * POW2(betaone); 1336 1333 1337 /* cs1 = betanot * gsl_sf_bessel_K0_e(betanot) * gsl_sf_bessel_K1_e(betanot); */ 1338 cs2 = 0.5*zeta_of_betaone + betaone * 1339 gsl_sf_bessel_K0_e(betaone) * gsl_sf_bessel_K1_e(betaone); 1334 /* cs1 = betanot * bessel_k0(betanot) * bessel_k1(betanot); */ 1335 cs2 = 0.5*zeta_of_betaone + betaone * bessel_k0(betaone) * bessel_k1(betaone); 1340 1336 1341 1337 /* cross_section = MIN2(cs1, cs2); */ … … 1511 1507 1512 1508 /* The integrand for calculating the thermal average of collision strengths */ 1513 staticdouble Therm_ave_coll_str_int_VF01( double EOverKT )1509 STATIC double Therm_ave_coll_str_int_VF01( double EOverKT ) 1514 1510 { 1515 1511 double integrand; … … 1524 1520 } 1525 1521 1526 staticdouble collision_strength_VF01( double velOrEner, bool lgParamIsRedVel )1522 STATIC double collision_strength_VF01( double velOrEner, bool lgParamIsRedVel ) 1527 1523 { 1528 1524 … … 1674 1670 } 1675 1671 1676 staticdouble L_mix_integrand_VF01( double alpha )1672 STATIC double L_mix_integrand_VF01( double alpha ) 1677 1673 { 1678 1674 double integrand, deltaPhi, b; … … 1703 1699 } 1704 1700 1705 staticdouble StarkCollTransProb_VF01( long n, long l, long lp, double alpha, double deltaPhi)1701 STATIC double StarkCollTransProb_VF01( long n, long l, long lp, double alpha, double deltaPhi) 1706 1702 { 1707 1703 double probability; … … 1776 1772 if( A < 0. ) 1777 1773 { 1778 probability *= ell ip_int_K( sqrt(B/(B-A)) );1774 probability *= ellpk( -A/(B-A) ); 1779 1775 probability /= sqrt( B - A ); 1780 1776 } 1781 1777 else 1782 1778 { 1783 probability *= ell ip_int_K( sqrt((B-A)/B));1779 probability *= ellpk( A/B ); 1784 1780 probability /= sqrt( B ); 1785 1781 } … … 1794 1790 1795 1791 } 1796 1797 1798 /* This is a modified version of two routines1799 * in the GNU science library, version 1.4:1800 * gsl_sf_ellint_Kcomp_e1801 * gsl_sf_ellint_RF_e1802 * The routines include references:1803 * [Carlson, Numer. Math. 33 (1979) 1, (4.5)]1804 * [Abramowitz+Stegun, 17.3.33]1805 */1806 static double ellip_int_K( double k )1807 {1808 double result;1809 1810 DEBUG_ENTRY( "ellip_int_K()" );1811 1812 ASSERT( k*k < 1.0 );1813 1814 if(k*k >= 1.0 - sqrt(DBL_EPSILON))1815 {1816 /* [Abramowitz+Stegun, 17.3.33] */1817 const double y = 1.0 - k*k;1818 const double a[] = { 1.38629436112, 0.09666344259, 0.03590092383 };1819 const double b[] = { 0.5, 0.12498593597, 0.06880248576 };1820 const double ta = a[0] + y*(a[1] + y*a[2]);1821 const double tb = -log(y) * (b[0] * y*(b[1] + y*b[2]));1822 result = ta + tb;1823 }1824 else1825 {1826 double y = 1.0 - k*k;1827 1828 /*const double lolim = 5.0 * DBL_MIN;1829 const double uplim = 0.2 * DBL_MAX;*/1830 1831 const double c1 = 1.0 / 24.0;1832 const double c2 = 3.0 / 44.0;1833 const double c3 = 1.0 / 14.0;1834 double xn = 0.0;1835 double yn_ = y;1836 double zn = 1.0;1837 double mu =0., xndev=0., yndev=0., zndev=0., e2_, e3, s;1838 /* yn and e2 hide VS.net internal symbol yn and cddefines symbol e2, respectively.1839 * An underscore at the end prevents this collision. */1840 1841 ASSERT( y >= 5.0 * DBL_MIN );1842 ASSERT( y < 0.2 * DBL_MAX );1843 1844 while(1)1845 {1846 double epslon, lamda;1847 double xnroot, ynroot, znroot;1848 mu = (xn + yn_ + zn) / 3.0;1849 ASSERT( mu > 0. );1850 xndev = 2.0 - (mu + xn) / mu;1851 yndev = 2.0 - (mu + yn_) / mu;1852 zndev = 2.0 - (mu + zn) / mu;1853 epslon = MAX3(fabs(xndev), fabs(yndev), fabs(zndev));1854 if(epslon < 0.001) break;1855 xnroot = sqrt(xn);1856 ynroot = sqrt(yn_);1857 znroot = sqrt(zn);1858 lamda = xnroot * (ynroot + znroot) + ynroot * znroot;1859 xn = (xn + lamda) * 0.25;1860 yn_ = (yn_ + lamda) * 0.25;1861 zn = (zn + lamda) * 0.25;1862 ASSERT( xn>0. && yn_>0. && zn>0. );1863 }1864 e2_ = xndev * yndev - zndev * zndev;1865 e3 = xndev * yndev * zndev;1866 s = 1.0 + (c1 * e2_ - 0.1 - c2 * e3) * e2_ + c3 * e3;1867 result = s / sqrt(mu);1868 }1869 1870 DEBUG_EXIT( "ellip_int_K()" );1871 1872 return result;1873 1874 }1875 1792 /*lint +e661 possible access of out-of-bounds pointer */ 1876 -
trunk/source/helike_level.cpp
r759 r785 4 4 /*HeLikeError fills uncertainty arrays */ 5 5 #include "cddefines.h" 6 #include " lapack.h"6 #include "thirdparty.h" 7 7 #include "trace.h" 8 8 #include "secondaries.h" -
trunk/source/helike_recom.cpp
r761 r785 35 35 #include "ionbal.h" 36 36 #include "atmdat.h" 37 #include "bevington.h" 38 /* This will be needed if the Peach algorithms are turned on. */ 39 /* #include "thirdparty.h" */ 37 #include "thirdparty.h" 40 38 41 39 /*lint -e662 creation of out of bound pointer */ … … 1981 1979 /* I'm pretty sure Peach has this wrong...and the exponent 1982 1980 * should be -1/2 instead of 1/2. */ 1983 K = 1./( nu * sqrt( zeta * gammafun(nu+l+1.) * gammafun(nu-l) ) );1981 K = 1./( nu * sqrt( zeta * tgamma(nu+l+1.) * tgamma(nu-l) ) ); 1984 1982 Sum = 1.; 1985 1983 b = 1.; … … 2047 2045 energy = POW2(kprime/(double)nelem); 2048 2046 2049 Fkl = gsl_sf_bessel_Jn_e(2*lp+1,bfa)+ (energy/12)*2050 ( lp*(lp+1)*(2*lp+1)* gsl_sf_bessel_Jn_e(2*lp+1,bfa)-2051 3*(lp+1)*(2*rho)* gsl_sf_bessel_Jn_e(2*lp+3,bfa)+2052 (pow(2.*rho, 1.5))* gsl_sf_bessel_Jn_e(2*lp+4,bfa) );2047 Fkl = bessel_jn(2*lp+1,bfa)+ (energy/12)* 2048 ( lp*(lp+1)*(2*lp+1)*bessel_jn(2*lp+1,bfa)- 2049 3*(lp+1)*(2*rho)*bessel_jn(2*lp+3,bfa)+ 2050 (pow(2.*rho, 1.5))*bessel_jn(2*lp+4,bfa) ); 2053 2051 Fkl *= sqrt(PI*rho); 2054 2052 2055 Hkl = gsl_sf_bessel_Yn_e(2*lp+1,bfa)+ (energy/12)*2056 ( lp*(lp+1)*(2*lp+1)* gsl_sf_bessel_Yn_e(2*lp+1,bfa)-2057 3*(lp+1)*(2*rho)* gsl_sf_bessel_Yn_e(2*lp+3,bfa)+2058 (pow(2.*rho, 1.5))* gsl_sf_bessel_Yn_e(2*lp+4,bfa) );2053 Hkl = bessel_yn(2*lp+1,bfa)+ (energy/12)* 2054 ( lp*(lp+1)*(2*lp+1)*bessel_yn(2*lp+1,bfa)- 2055 3*(lp+1)*(2*rho)*bessel_yn(2*lp+3,bfa)+ 2056 (pow(2.*rho, 1.5))*bessel_yn(2*lp+4,bfa) ); 2059 2057 Hkl *= pow(1.-sexp(tau_l*rho), 2.*lp+1.) * sqrt(PI*rho); 2060 2058 -
trunk/source/hydrolevelpop.cpp
r759 r785 13 13 #include "dense.h" 14 14 #include "trace.h" 15 #include " lapack.h"15 #include "thirdparty.h" 16 16 #include "hydrogenic.h" 17 17 #include "dynamics.h" -
trunk/source/hydro_bauman.cpp
r779 r785 15 15 #include "cddefines.h" 16 16 #include "physconst.h" 17 #include "thirdparty.h" 17 18 #include "hydro_bauman.h" 18 19 … … 527 528 528 529 inline double local_product( double K , long int lp ); 529 inline double log10_factorial( long int n );530 530 inline double log10_prodxx( long int lp, double Ksqrd ); 531 531 … … 560 560 561 561 static const double PHYSICAL_CONSTANT_TWO = 4./3.*PI*FINE_STRUCTURE*pow2(BohrRadiusCM); 562 563 /************************************************************************************************/564 /* pre-calculated factorials */565 /************************************************************************************************/566 567 static const int NPRE_FACTORIAL = 171;568 static const double pre_factorial[NPRE_FACTORIAL] =569 {570 1.00000000000000000000e+00,571 1.00000000000000000000e+00,572 2.00000000000000000000e+00,573 6.00000000000000000000e+00,574 2.40000000000000000000e+01,575 1.20000000000000000000e+02,576 7.20000000000000000000e+02,577 5.04000000000000000000e+03,578 4.03200000000000000000e+04,579 3.62880000000000000000e+05,580 3.62880000000000000000e+06,581 3.99168000000000000000e+07,582 4.79001600000000000000e+08,583 6.22702080000000000000e+09,584 8.71782912000000000000e+10,585 1.30767436800000000000e+12,586 2.09227898880000000000e+13,587 3.55687428096000000000e+14,588 6.40237370572800000000e+15,589 1.21645100408832000000e+17,590 2.43290200817664000000e+18,591 5.10909421717094400000e+19,592 1.12400072777760768000e+21,593 2.58520167388849766400e+22,594 6.20448401733239439360e+23,595 1.55112100433309859840e+25,596 4.03291461126605635592e+26,597 1.08888694504183521614e+28,598 3.04888344611713860511e+29,599 8.84176199373970195470e+30,600 2.65252859812191058647e+32,601 8.22283865417792281807e+33,602 2.63130836933693530178e+35,603 8.68331761881188649615e+36,604 2.95232799039604140861e+38,605 1.03331479663861449300e+40,606 3.71993326789901217463e+41,607 1.37637530912263450457e+43,608 5.23022617466601111726e+44,609 2.03978820811974433568e+46,610 8.15915283247897734264e+47,611 3.34525266131638071044e+49,612 1.40500611775287989839e+51,613 6.04152630633738356321e+52,614 2.65827157478844876773e+54,615 1.19622220865480194551e+56,616 5.50262215981208894940e+57,617 2.58623241511168180614e+59,618 1.24139155925360726691e+61,619 6.08281864034267560801e+62,620 3.04140932017133780398e+64,621 1.55111875328738227999e+66,622 8.06581751709438785585e+67,623 4.27488328406002556374e+69,624 2.30843697339241380441e+71,625 1.26964033536582759243e+73,626 7.10998587804863451749e+74,627 4.05269195048772167487e+76,628 2.35056133128287857145e+78,629 1.38683118545689835713e+80,630 8.32098711274139014271e+81,631 5.07580213877224798711e+83,632 3.14699732603879375200e+85,633 1.98260831540444006372e+87,634 1.26886932185884164078e+89,635 8.24765059208247066512e+90,636 5.44344939077443063905e+92,637 3.64711109181886852801e+94,638 2.48003554243683059915e+96,639 1.71122452428141311337e+98,640 1.19785716699698917933e+100,641 8.50478588567862317347e+101,642 6.12344583768860868500e+103,643 4.47011546151268434004e+105,644 3.30788544151938641157e+107,645 2.48091408113953980872e+109,646 1.88549470166605025458e+111,647 1.45183092028285869606e+113,648 1.13242811782062978295e+115,649 8.94618213078297528506e+116,650 7.15694570462638022794e+118,651 5.79712602074736798470e+120,652 4.75364333701284174746e+122,653 3.94552396972065865030e+124,654 3.31424013456535326627e+126,655 2.81710411438055027626e+128,656 2.42270953836727323750e+130,657 2.10775729837952771662e+132,658 1.85482642257398439069e+134,659 1.65079551609084610774e+136,660 1.48571596448176149700e+138,661 1.35200152767840296226e+140,662 1.24384140546413072522e+142,663 1.15677250708164157442e+144,664 1.08736615665674307994e+146,665 1.03299784882390592592e+148,666 9.91677934870949688836e+149,667 9.61927596824821198159e+151,668 9.42689044888324774164e+153,669 9.33262154439441526381e+155,670 9.33262154439441526388e+157,671 9.42594775983835941673e+159,672 9.61446671503512660515e+161,673 9.90290071648618040340e+163,674 1.02990167451456276198e+166,675 1.08139675824029090008e+168,676 1.14628056373470835406e+170,677 1.22652020319613793888e+172,678 1.32464181945182897396e+174,679 1.44385958320249358163e+176,680 1.58824554152274293982e+178,681 1.76295255109024466316e+180,682 1.97450685722107402277e+182,683 2.23119274865981364576e+184,684 2.54355973347218755612e+186,685 2.92509369349301568964e+188,686 3.39310868445189820004e+190,687 3.96993716080872089396e+192,688 4.68452584975429065488e+194,689 5.57458576120760587943e+196,690 6.68950291344912705515e+198,691 8.09429852527344373681e+200,692 9.87504420083360135884e+202,693 1.21463043670253296712e+205,694 1.50614174151114087918e+207,695 1.88267717688892609901e+209,696 2.37217324288004688470e+211,697 3.01266001845765954361e+213,698 3.85620482362580421582e+215,699 4.97450422247728743840e+217,700 6.46685548922047366972e+219,701 8.47158069087882050755e+221,702 1.11824865119600430699e+224,703 1.48727070609068572828e+226,704 1.99294274616151887582e+228,705 2.69047270731805048244e+230,706 3.65904288195254865604e+232,707 5.01288874827499165889e+234,708 6.91778647261948848943e+236,709 9.61572319694108900019e+238,710 1.34620124757175246000e+241,711 1.89814375907617096864e+243,712 2.69536413788816277557e+245,713 3.85437071718007276916e+247,714 5.55029383273930478744e+249,715 8.04792605747199194159e+251,716 1.17499720439091082343e+254,717 1.72724589045463891049e+256,718 2.55632391787286558753e+258,719 3.80892263763056972532e+260,720 5.71338395644585458806e+262,721 8.62720977423324042775e+264,722 1.31133588568345254503e+267,723 2.00634390509568239384e+269,724 3.08976961384735088657e+271,725 4.78914290146339387432e+273,726 7.47106292628289444390e+275,727 1.17295687942641442768e+278,728 1.85327186949373479574e+280,729 2.94670227249503832518e+282,730 4.71472363599206132029e+284,731 7.59070505394721872577e+286,732 1.22969421873944943358e+289,733 2.00440157654530257674e+291,734 3.28721858553429622598e+293,735 5.42391066613158877297e+295,736 9.00369170577843736335e+297,737 1.50361651486499903974e+300,738 2.52607574497319838672e+302,739 4.26906800900470527345e+304,740 7.25741561530799896496e+306741 /*,1.24101807021766782298e+309*/742 };743 562 744 563 /************************Start of program***************************/ … … 1221 1040 double Ksqrd = K * K; 1222 1041 1223 double ld1 = pre_factorial[ (2*n) - 1 ];1042 double ld1 = factorial( 2*n - 1 ); 1224 1043 double ld2 = powi((double)(4*n), n); 1225 1044 double ld3 = exp(-(double)(2 * n)); … … 1356 1175 /******************************/ 1357 1176 1358 ld1 = l og10_factorial( ( (2 * n) - 1));1177 ld1 = lfactorial( 2*n - 1 ); 1359 1178 ASSERT( ld1 >= 0. ); 1360 1179 … … 1482 1301 { 1483 1302 printf( "BadMagic: l and l' do NOT satisfy dipole requirements.\n\n" ); 1484 puts( "[Stop in log10_factorial]" );1303 puts( "[Stop in bhG_mx]" ); 1485 1304 cdEXIT(EXIT_FAILURE); 1486 1305 } … … 2294 2113 DEBUG_ENTRY( "bhg()" ); 2295 2114 2296 double ld1 = pre_factorial[ (n + l) ];2297 double ld2 = pre_factorial[ ((n - l) - 1) ];2115 double ld1 = factorial( n + l ); 2116 double ld2 = factorial( n - l - 1 ); 2298 2117 double ld3 = (ld1 / ld2); 2299 2118 … … 2377 2196 /**************************************************************************************/ 2378 2197 2379 double ld1 = l og10_factorial( (n + l));2380 double ld2 = l og10_factorial( ((n - l) - 1));2198 double ld1 = lfactorial( n + l ); 2199 double ld2 = lfactorial( n - l - 1 ); 2381 2200 2382 2201 /**********************************************************************/ … … 3053 2872 } 3054 2873 i2 = (2*l - 1); 3055 d3 = pre_factorial[ i2 ];2874 d3 = factorial( i2 ); 3056 2875 d4 = d2/d3; 3057 2876 d4 = sqrt( d4 ); … … 3395 3214 /**************************************/ 3396 3215 3397 ld2 = l og10_factorial( 2*l - 1 );3216 ld2 = lfactorial( 2*l - 1 ); 3398 3217 3399 3218 ASSERT( ((2*l)+1) >= 0); … … 3771 3590 /****************************************************************/ 3772 3591 3773 d0 = pre_factorial[ i1 ];3592 d0 = factorial( i1 ); 3774 3593 d1 = 4. * d0; 3775 3594 d2 = 1. / d1; … … 3825 3644 cdEXIT(EXIT_FAILURE); 3826 3645 } 3827 d1 = pre_factorial[ i1 ];3646 d1 = factorial( i1 ); 3828 3647 3829 3648 i2 = np + l - 1; … … 3834 3653 cdEXIT(EXIT_FAILURE); 3835 3654 } 3836 d2 = pre_factorial[ i2 ];3655 d2 = factorial( i2 ); 3837 3656 3838 3657 i3 = n - l - 1; … … 3843 3662 cdEXIT(EXIT_FAILURE); 3844 3663 } 3845 d3 = pre_factorial[ i3 ];3664 d3 = factorial( i3 );
