program teos implicit none save include 'vector_eos.dek' c.. c..tests the nadyozhin eos routine c.. c..ionmax = number of isotopes in the network c..xmass = mass fractions c..ymass = molar fractions c..aion = number of nucleons c..zion = number of protons integer ionmax parameter (ionmax=3) double precision xmass(ionmax),ymass(ionmax), 1 aion(ionmax),zion(ionmax),temp,den,abar,zbar c..set the mass fractions, z's and a's of the composition c..hydrogen xmass(1) = 0.75d0 aion(1) = 1.0d0 zion(1) = 1.0d0 c..helium xmass(2) = 0.23d0 aion(2) = 4.0d0 zion(2) = 2.0d0 c..carbon 12 xmass(3) = 0.02d0 aion(3) = 12.0d0 zion(3) = 6.0d0 c..get abar, zbar and a few other composition variables call azbar(xmass,aion,zion,ionmax, 1 ymass,abar,zbar) c..set the input vector temp_row(1) = 1.0d8 den_row(1) = 1.0d6 abar_row(1) = abar zbar_row(1) = zbar c..here the pipeline is only 1 element long jlo_eos = 1 jhi_eos = 1 c..call the eos call nados c..write out the results call pretty_eos_out('nados: ') stop 'normal termination' end subroutine azbar(xmass,aion,zion,ionmax, 1 ymass,abar,zbar) implicit none save c..this routine calculates composition variables for an eos routine c..input: c..mass fractions = xmass(1:ionmax) c..number of nucleons = aion(1:ionmax) c..charge of nucleus = zion(1:ionmax) c..number of isotopes = ionmax c..output: c..molar abundances = ymass(1:ionmax), c..mean number of nucleons = abar c..mean nucleon charge = zbar c..declare integer i,ionmax double precision xmass(ionmax),aion(ionmax),zion(ionmax), 1 ymass(ionmax),abar,zbar,zbarxx,ytot1 zbarxx = 0.0d0 ytot1 = 0.0d0 do i=1,ionmax ymass(i) = xmass(i)/aion(i) ytot1 = ytot1 + ymass(i) zbarxx = zbarxx + zion(i) * ymass(i) enddo abar = 1.0d0/ytot1 zbar = zbarxx * abar return end subroutine pretty_eos_out(whose) implicit none save include 'vector_eos.dek' c.. c..writes a pretty output for the eos tester c.. c..declare integer j character*7 whose c..popular formats 01 format(1x,t2,a,t11,'total',t24,'ion',t34,'e- & e+', 1 t46,'radiation',t58,'coulomb') 02 format(1x,t2,a,1p6e12.4) 03 format(1x,t2,a6,1pe12.4,t22,a6,1pe12.4, 1 t42,a6,1pe12.4,t62,a6,1pe12.4) do j=jlo_eos,jhi_eos c..the input write(6,03) 'temp =',temp_row(1),'den =',den_row(1), 1 'abar =',abar_row(1),'zbar =',zbar_row(1) write(6,*) ' ' c..and the output c..first the totals from each of the components write(6,01) whose write(6,02) 'pres =', 1 ptot_row(j),pion_row(j),pele_row(j), 2 prad_row(j),pcou_row(j) write(6,02) 'ener =', 1 etot_row(j),eion_row(j),eele_row(j), 2 erad_row(j),ecou_row(j) write(6,02) 'entr =', 1 stot_row(j),sion_row(j),sele_row(j), 2 srad_row(j),scou_row(j) c..derivatives of the totals with respect to the input variables write(6,*) ' ' write(6,03) 'dp/dd=',dpd_row(j),'dp/dt=',dpt_row(j), 1 'dp/da=',dpa_row(j),'dp/dz=',dpz_row(j) write(6,03) 'de/dd=',ded_row(j),'de/dt=',det_row(j), 1 'de/da=',dea_row(j),'de/dz=',dez_row(j) write(6,03) 'ds/dd=',dsd_row(j),'ds/dt=',dst_row(j), 1 'ds/da=',dsa_row(j),'ds/dz=',dsz_row(j) c..derivatives of the electron-positron compoenets with c..respect to the input variables write(6,*) ' ' write(6,03) 'dpepd=',dpepd_row(j),'dpept=',dpept_row(j), 1 'dpepa=',dpepa_row(j),'dpepz=',dpepz_row(j) write(6,03) 'deepd=',deepd_row(j),'deept=',deept_row(j), 1 'deepa=',deepa_row(j),'deepz=',deepz_row(j) write(6,03) 'dsepd=',dsepd_row(j),'dsept=',dsept_row(j), 1 'dsepa=',dsepa_row(j),'dsepz=',dsepz_row(j) c..the thermodynamic consistency relations, these should all be c..at the floating poiint limit of zero write(6,*) ' ' write(6,03) 'maxw1=',dse_row(j),'maxw2=',dpe_row(j), 1 'maxw3=',dsp_row(j) c..number density of electrons, poistrons, matter electrons, and ions write(6,03) 'xne =',xne_row(j),'xnp =',xnp_row(j), 1 'xnem =',xnem_row(j),'xni =',xni_row(j) c..derivatibves of the electron number density with c..respect to the input variables write(6,03) 'dxned=',dxned_row(j),'dxnet=',dxnet_row(j), 1 'dxnea=',dxnea_row(j),'dxnez=',dxnez_row(j) c..electron chemical potential, positron chemical potential c..and derivatives of electron chemical potential with respect c..to the input variables write(6,03) 'eta =',etaele_row(j),'etap =',etapos_row(j) write(6,03) 'detad=',detad_row(j),'detat=',detat_row(j), 1 'detaa=',detaa_row(j),'detaz=',detaz_row(j) c..specific heats, and ratio of electostatic to thermal energy write(6,03) 'cp =',cp_row(j),'cv =',cv_row(j), 1 'plasg=',plasg_row(j) c..the 3 gammas and the sound speed write(6,03) 'gam1 =',gam1_row(j),'gam2 =',gam2_row(j), 1 'gam3 =',gam3_row(j),'csond=',cs_row(j) write(6,*) ' ' enddo return end subroutine nados c*********************************************************************** c *** equation of state for completely ionized matter c *** electron & positron component --- fermi-dirac statistics using c various asymptotic expansions where possible c *** ion component --- a perfect gas approximation c *** black-body radiation c*********************************************************************** c references c 1. nadyozhin d.k. 1974, "naucnye informatsii", nos. 32, 33 c (ucsc science library: qb 1 a4) c*********************************************************************** implicit double precision (a-h,o-z) save include 'vector_eos.dek' double precision chit,chid,cv,cp,gam1,gam2,gam3,nabad,sound,zz,z, 1 prad,pion,dpiondd,dpiondt,erad,eion,srad,sion double precision clight,con2,me,mecc,kerg,avo parameter (clight = 2.997925d10, 1 con2 = clight * clight, 2 me = 9.1093897d-28, 3 mecc = me * con2, 4 kerg = 1.380658d-16, 5 avo = 6.0221367d23) c c *** the arguments common/arg/t,den,psi equivalence(den,pl) common/iarg/lst,kentr,kpar,jurs,jkk c*********************************************************************** c c *** t --- temperature in 10**9 k c *** den --- density in 10**7 g/ccm c *** psi --- parameter of degeneracy. works as an argument only when c one enters entry fd12f to get fermi-dirac functions, c otherwise it is calculated as a function of t and den. c *** lst, kentr, kpar --- the keys aimed to make the calculations c faster where possible (default: lst, kentr, kpar = 0) c *** lst=0 --- epeos calculates only thermodynamic functions p,e,s c lst=1 --- the first temperature-derivatives are calculated c in addition to the thermodynamic functions c lst=2 --- extends calculations to get density-derivatives as well c *** kentr=0 --- turns the calculation of entropy off and suspends c the calculation of psi in a perfect gas asymptotics (nz=1). c kentr=1 --- turns the calculation of entropy on. c *** kpar=0 --- when in relativistic asymptotics (nz=4), turns off the c calculation of total number of pair (hpr),(kpar=1 --- turns on) c kpar is inactive for other asymptotics. c c *** jkk --- the current number of mesh point, is inactive in this c version of epeos. however, it appears in epeos error messages c and, if defined, may be useful for locating of errors in c a program calling epeos. c*********************************************************************** common/nz/nz c*********************************************************************** c *** nz --- specifies the operational mode (default: nz=0) c nz=0 --- calculations with the overall search for c the appropriate working region c for 0 t_melt temperature exceeds the ion melting temperature c..rho >> abar*zbar electron gas is almost perfect, ionization full if ( (temp_row(j) .lt. tfermi) .and. 1 (temp_row(j) .gt. 0.1d0 * tmelt) .and. 2 (den_row(j) .gt. 2.0d0 * rhocond) 3 ) then c..yakovlev & shalybkov 1989 equations 82, 85, 86, 87 if (plasg .ge. 1.0) then x = plasg**(0.25d0) y = avo/as * kerg ecoul = y * temp_row(j) * (aa1*plasg + bb1*x + cc1/x + dd1) pcoul = third * den_row(j) * ecoul scoul = -y * (3.0d0*bb1*x - 5.0d0*cc1/x 1 + dd1 * (log(plasg) - 1.0d0) - ee1) y = avo/as*kerg*temp_row(j) 1 * (aa1 + 0.25d0/plasg*(bb1*x - cc1/x)) decouldd = y * plasgdd decouldt = y * plasgdt + ecoul/temp_row(j) y = third * den_row(j) dpcouldd = third * ecoul + y*decouldd dpcouldt = y * decouldt y = -avo*kerg/(as*plasg) 1 *(0.75d0*bb1*x +1.25d0*cc1/x +dd1) dscouldd = y * plasgdd dscouldt = y * plasgdt c..yakovlev & shalybkov 1989 equations 102, 103, 104 else if (plasg .lt. 1.0) then x = plasg*sqrt(plasg) y = plasg**bb2 z = cc2 * x - third * aa2 * y pcoul = -pion * z ecoul = 3.0d0 * pcoul/den_row(j) scoul = -avo/as*kerg*(cc2*x -aa2*(bb2-1.0d0)/bb2*y) sss = 1.5d0*cc2*x/plasg - third*aa2*bb2*y/plasg dpcouldd = -dpiondd*z - pion * sss * plasgdd dpcouldt = -dpiondt*z - pion * sss * plasgdt sss = 3.0d0/den_row(j) decouldd = sss * dpcouldd - ecoul/den_row(j) decouldt = sss * dpcouldt sss = -avo*kerg/(as*plasg) 1 * (1.5d0*cc2*x -aa2*(bb2-1.0d0)*y) dscouldd = sss * plasgdd dscouldt = sss * plasgdt end if c..soften the edges of the coulomb correction turn-on c..by doing linear interpolation to zero coulomb corrections c..within reasonable limits of when the above expressions are valid z2 = 1.0d0 if (den_row(j) .gt. 2.0d0*rhocond .and. 1 den_row(j) .lt. 20.0d0*rhocond) then x = den_row(j) x1 = 2.0d0 * rhocond x2 = 20.0d0 * rhocond z2 = (x-x1)/(x2-x1) else if (temp_row(j) .gt. 0.1d0 * tmelt .and. 1 temp_row(j) .lt. tmelt) then x = temp_row(j) x1 = 0.1d0 * tmelt x2 = tmelt z2 = (x-x1)/(x2-x1) else if (temp_row(j) .gt. 0.5d0 * tfermi .and. 1 temp_row(j) .lt. tfermi) then x = temp_row(j) x1 = tfermi x2 = 0.5d0 * tfermi z2 = (x-x1)/(x2-x1) end if pcoul = z2 * pcoul dpcouldd = z2 * dpcouldd dpcouldt = z2 * dpcouldt ecoul = z2 * ecoul decouldd = z2 * decouldd decouldt = z2 * decouldt scoul = z2 * scoul dscouldd = z2 * dscouldd dscouldt = z2 * dscouldt end if c..and add in the coulomb corrections p = p + pcoul pt = pt + dpcouldt ppl = ppl + dpcouldd e = e + ecoul et = et + decouldt epl = epl + decouldd sk = sk + scoul/(kerg*avo) s = s + scoul st = st + dscouldt spl = spl + dscouldd c..the temperature and density exponents (c&g 9.81 9.82) c..the specific heat at constant volume (c&g 9.92) c..the third adiabatic exponent (c&g 9.93) c..the first adiabatic exponent (c&g 9.97) c..the second adiabatic exponent (c&g 9.105) c..the specific heat at constant pressure (c&g 9.98) c..and relativistic formula for the sound speed (c&g 14.29) zz = p/den_row(j) chit = temp_row(j)/p * pt chid = ppl/zz cv = et x = zz * chit/(temp_row(j) * cv) gam3 = x + 1.0d0 gam1 = chit*x + chid nabad = x/gam1 gam2 = 1.0d0/(1.0d0 - nabad) cp = cv * gam1/chid z = 1.0d0 + (e + con2)/zz sound = clight * sqrt(gam1/z) c..these are the 3 thermodynamic consistency checks c..each is zero if the consistency is perfect dse = temp_row(j)*st/et - 1.0d0 dpe = (epl*den_row(j)*den_row(j) + temp_row(j)*pt)/p - 1.0d0 dsp = -spl*(den_row(j)**2/pt) - 1.0d0 c..store this row and go to the end of the do loop ptot_row(j) = p dpt_row(j) = pt dpd_row(j) = ppl dpa_row(j) = 0.0d0 dpz_row(j) = 0.0d0 etot_row(j) = e det_row(j) = et ded_row(j) = epl dea_row(j) = 0.0d0 dez_row(j) = 0.0d0 stot_row(j) = s dst_row(j) = st dsd_row(j) = spl dsa_row(j) = 0.0d0 dsz_row(j) = 0.0d0 prad_row(j) = prad erad_row(j) = erad srad_row(j) = srad pion_row(j) = pion eion_row(j) = eion sion_row(j) = sion xni_row(j) = avo/as * den_row(j) pele_row(j) = pe ppos_row(j) = 0.0d0 dpept_row(j) = dpepdt dpepd_row(j) = dpepdd dpepa_row(j) = 0.0d0 dpepz_row(j) = 0.0d0 eele_row(j) = ee epos_row(j) = 0.0d0 deept_row(j) = deepdt deepd_row(j) = deepdd deepa_row(j) = 0.0d0 deepz_row(j) = 0.0d0 sele_row(j) = se spos_row(j) = 0.0d0 dsept_row(j) = dsepdt dsepd_row(j) = dsepdd dsepa_row(j) = 0.0d0 dsepz_row(j) = 0.0d0 xnem_row(j) = zs * xni_row(j) xne_row(j) = xnem_row(j) + 0.5d0 * hpr * xnem_row(j) dxnet_row(j) = 0.0d0 dxned_row(j) = avo/emue * (1.0d0 + hpr) dxnea_row(j) = 0.0d0 dxnez_row(j) = 0.0d0 xnp_row(j) = 0.5d0 * hpr * xnem_row(j) etaele_row(j) = psi detat_row(j) = 0.0d0 detad_row(j) = 0.0d0 detaa_row(j) = 0.0d0 detaz_row(j) = 0.0d0 etapos_row(j) = 0.0d0 beta = kerg * temp_row(j)/mecc if (beta .gt. 0.02) etapos_row(j) = -psi - 2.0d0/beta pcou_row(j) = pcoul ecou_row(j) = ecoul scou_row(j) = scoul plasg_row(j) = plasg dse_row(j) = dse dpe_row(j) = dpe dsp_row(j) = dsp cv_row(j) = cv cp_row(j) = cp gam1_row(j) = gam1 gam2_row(j) = gam2 gam3_row(j) = gam3 cs_row(j) = sound goto 6969 c c *** further search for working region 51 if(plm.lt.y) go to 52 kzz=1 121 z=t/ep2 if(z.gt.0.57142857d0) go to 64 x=xep2*sq if(kzz.eq.3) xz=cu(3)*x go to 125 64 if(z.gt.1.07142857d0) go to 54 xz=7.306392d-2*z x=xz+3.414385d-2 go to 125 54 if(z.gt.1.d1) go to 58 x=((4.77856d-2*z-1.41839d-2)*z+7.2001d-2)*z-7.20897d-3 if(kzz.eq.3) xz=((1.433568d-1*z-2.83678d-2)*z+7.2001d-2)*z go to 125 58 x=4.708d-2*z**3 if(kzz.eq.3) xz=cu(17)*x 125 go to (55,115,114),kzz 55 if(plm-x) 59,59,61 c c *** expansion over half-integer fermi--dirac functions (nz=2) 2 sq=t*sqrt(t) 59 nzr=2 kenf=1 zp=plm/(cu(38)*sq) x=psi nit=0 kf=1 x1=cu(9)*al1 al2=al1**2 al3=0.21875d0*al2 go to 26 11 z=zp-f12-x1*f32-al3*f52 v=f12s+x1*f32s+al3*f52s dl=z/v z1=x if(z1.lt.0.d0)z1=-x v=1.d0 if(dl.lt.0.d0) v=-1.d0 z=v*dl if(z1.lt.0.1d0) go to 41 z=z/z1 if(z.gt.0.3d0) dl=0.3d0*v*z1 41 x=x+dl nit=nit+1 if(z.lt.eit) go to 73 if(nit.lt.nitm) go to 26 66 write(6,5072) nzr write(6,5073) dl,x,eit,nitm,jkk c.. print 72,nzr c.. print 4072,dl,x,eit,nitm,jkk eosfail = .true. stop 72 format(' iterations in region nzr=',i1, 1 1x,'do not converge!') 4072 format(' dx=',1p,d10.3,' x=',d10.3,' eit=',d10.3, 1 1x,'nitm=',i3,' jkk=',i4,' *stop in epeos*') 5072 format(10x,'epeos *** runaway of iterations in region nzr=', 1 i1,' *** stop*') 5073 format(10x,1p,'dx=',d10.3,' x=',d10.3,' eit=',d10.3,' nitm=',i3, 1 1x,'jkk=',i4) c 73 kf=2 go to 26 300 go to(31,9),kenf 31 psi=x v=sq*al1 x=cu(19)*al1 z=cu(39)*v z1=cu(3)*z/pl z3=x1*f32 z4=x*f52 al4=9.375d-2*al2 y=al4*f72 pe=z*(f32+z4+y) z5=x1*f52 y1=al3*f72 ee=z1*(f32+z5+y1) if(kentr.eq.0) go to 34 z2=cu(41)*sq/pl dl=cu(40)*psi z10=cu(44)*psi z11=cu(45)*al1 z6=z11*(f52-dl*f32) al5=0.16875d0*al2 y3=0.77777777778d0*psi y2=al5*(f72-y3*f52) se=z2*(f32-z10*f12+z6+y2) 34 if(lst.eq.0) go to 35 pal=f12s+x1*f32s+al3*f52s pap=zp/pal pal=(cu(3)*zp+z3+cu(15)*al3*f52)/pal z8=f32s+x1*f52s+al3*f72s z7=z5+cu(15)*y1-pal*z8 et=(cu(27)*ee+z1*z7)/t epl=z1*z8*pap-ee z9=f32s+x*f52s+al4*f72s pt=(cu(27)*pe+z*(z4+cu(15)*y-pal*z9))/t ppl=z*z9*pap/pl if(kentr.eq.0) go to 35 z9=f32s-z10*f12s-cu(44)*f12+z11*(f52s-dl*f32s-cu(40)*f32) z9=z9+al5*(f72s-0.77777777778d0*f52-y3*f52s) st=(cu(3)*se+z2*(z6+cu(15)*y2-pal*z9))/t spl=z2*pap*z9-se 35 go to 135 c c *** procedure of calculation of half-integer fermi--dirac functions c.. entry fd12f c kenf=2 c kf=2 c.. x=psi 26 if(x.ge.-1.d0) go to 21 z=exp(x) v=ck(1)*z f12=v*(1.d0+z*(a(1)+z*(a(2)+z*(a(3)+z*a(4))))) f12s=v*(1.d0+z*(c(1)+z*(c(2)+z*(c(3)+z*c(4))))) f32=ck(2)*z*(1.d0+z*(a(5)+z*(a(6)+z*(a(7)+z*a(8))))) f52=ck(3)*z*(1.d0+z*(a(9)+z*(a(10)+z*(a(11)+z*a(12))))) go to(30,12),kf 12 f72=a(13)*z*(1.d0+z*(a(14)+z*(a(15)+z*(a(16)+z*a(17))))) go to 30 21 if(x.ge.-.1d0) go to 22 n=1 go to 14 22 if(x.ge.1.d0) go to 23 n=2 go to 14 23 if(x.ge.2.5d0) go to 24 n=3 go to 14 24 if(x.ge.4.5d0) go to 25 n=4 14 f12=a1(n)+x*(a2(n)+x*(a3(n)+x*a4(n))) f12s=a2(n)+x*(df1(n)+x*df2(n)) f32=b1(n)+x*(b2(n)+x*(b3(n)+x*(b4(n)+x*b5(n)))) f52=c1(n)+x*(c2(n)+x*(c3(n)+x*(c4(n)+x*(c5(n)+x*c6(n))))) go to(30,13),kf 13 f72=d1(n)+x*(d2(n)+x*(d3(n)+x*(d4(n)+x*(d5(n)+x*(d6(n)+x*d(n)))))) 30 f32s=1.5d0*f12 f52s=2.5d0*f32 if(kf.eq.1) go to 11 f72s=3.5d0*f52 go to 300 25 z=sqrt(x) z1=z*x z2=1.d0/x**2 f12=z1*(b(1)+(b(2)+(b(3)+b(4)*z2)*z2)*z2) f12s=z*(c(5)+(c(6)+(c(7)+c(8)*z2)*z2)*z2) z=z1*x f32=z*(b(5)+(b(6)+(b(7)+b(8)*z2)*z2)*z2) f52=x*z*(b(9)+(b(10)+(b(11)+b(12)*z2)*z2)*z2) f32=f32+b(17) f52=f52+b(18)+b(19)*x go to(30,17),kf 17 f72=z*(b(13)+(b(14)+(b(15)+b(16)*z2)*z2)*z2)/z2 f72=f72+b(20)+x*(b(21)+b(22)*x) go to 30 c c *** search for working region is continued 61 y=x*grcf if(plm.lt.y) go to 62 c c *** chandrasekhar's expansion for degenerate gas (nz=3) 3 nzr=3 x1=plm/cu(47) if(psi.lt.3.d0) psi=3.d0 nit=0 x=psi*al1 x=sqrt(x*(x+cu(15))) al2=al1**2 z2=1.644934d0*al2 z4=1.894066d0*al2**2 74 x2=x**2 x3=x2*x x5=cu(17)*(z4/x3)/x2 x6=z2/x x8=cu(15)*z2*x dl=(x3*cu(49)+x8+x6+x5-x1)/(x3+x8-x6-cu(50)*x5) x6=1.d0 if(dl.lt.0.d0) x6=-1.d0 z1=x6*dl if(z1.gt.0.9d0) dl=0.9d0*x6 x=x*(cu(4)-dl) nit=nit+1 if(z1.lt.eit) go to 71 if(nit.lt.nitm) go to 74 go to 66 71 x2=x**2 x4=cu(4)+x2 z=sqrt(x4) y1=cu(4)+z z1=x2/y1 psi=alf*z1 z3=x*z x3=x*x2 z5=cu(15)*x2 x7=z5+cu(4) if(x.gt.0.1d0) go to 174 x5=x2*x3 f0=x5*(1.6d0-x2*(fgs(1)-x2*(fgs(2)-x2*(fgs(3)-x2*fgs(4)))))*cu(49) g0=x5*(0.8d0-x2*(fgs(5)-x2*(fgs(6)-x2*(fgs(7)-x2*fgs(8))))) go to 175 174 x6=log(x+z) f0=z3*(z5-cu(17))*cu(49)+x6 g0=x7*z3-x6-x3*cu(52) 175 x5=z4/x3 y5=z5-cu(4) f2=z2*cu(51)*z3 f4=x5*cu(51)*y5*z pe=cu(46)*(f0+f2+f4) y2=cu(51)/y1 y4=z*y1 g2=z2*y2*x*(x7+y4) g4=x5*cu(17)*y2*(cu(4)+y5*y4) ee=cu(46)*(g0+g2+g4)/pl if(kentr.eq.0) go to 75 y6=cu(48)/(t*pl) se=y6*(f2+cu(15)*f4) 75 if(lst.eq.0) go to 76 z6=cu(54)*x5/x3 z7=x7-cu(15) pap=x2+z2*z7/x2-z6 pal=cu(15)*(z2*x7+cu(55)*x5/x)/(x*pap) pap=x1/pap z9=cu(51)*x/z z10=x1*z9 z11=cu(46)*pap/pl ppl=z11*z10 y3=cu(46)/t pt=y3*(cu(15)*(f2+cu(15)*f4)-z10*pal) g0=z1*x2*cu(51) v=cu(15)*(g2+cu(15)*g4) g2=cu(51)*z2*((cu(4)+cu(17)*x7*y1)/y4-cu(15)) g4=cu(53)*x5*(cu(37)-z)/(x*y4) g0=g0+g2+g4 epl=z11*g0-ee et=y3*(v-pal*g0)/pl if(kentr.eq.0) go to 76 g4=(z2*x7+cu(55)*x5/x)*z9/x spl=y6*pap*g4-se st=(se+y6*(cu(37)*f4-pal*g4))/t 76 go to 135 c c *** quadratures taken with the gauss method (nz=5) 5 nzr=5 kkk=1 kk1=1 al3=alf**3 z11=plm*al3 x2=cu(15)*alf z10=z11/cu(47) kw=1 ku=10 go to 151 169 z=(g1m-z10)/g1mp z3=1.d0 if(z.lt.0.d0) z3=-1.d0 z2=z*z3 z1=pc if(pc.lt.0.d0) z1=-pc if(z1.lt.1.d0) go to 181 z2=z2/z1 if(z2.gt.0.3d0) z=0.3d0*z1*z3 181 pc=pc-z if(z2.gt.eit) go to 151 ku=15 kw=2 go to 151 170 z=1.44059d0/(al3*alf) z1=z/pl z2=z/cu(17) pe=z2*gp ee=z1*ge hpr=cu(15)*g1/z10 if(kentr.eq.0) go to 182 z3=pc+alf y3=g3+g31+cu(49)*gp-z3*g1m se=z1*y3/t 182 if(lst.eq.0) go to 183 pap=g1m/g1mp x=g1a1-g1a pal=(cu(17)*g1m-alf*(x+cu(15)*g1p))/g1mp x1=g2p1-g2p y2=g2a+g2a1-cu(15)*g2p ppl=ei*cu(49)*x1/g1mp pt=pe*(cu(37)-(alf*y2+x1*pal)/gp)/t y1=g4p1-g4p-x2*g1p epl=ee*(pap*y1/ge-cu(4)) et=ee*(cu(37)-(alf*(g4a1+g4a)+x2*(g1-g4p+alf*g1a-x2*g1p)+y1*pal)/ *ge)/t if(kentr.eq.0) go to 183 y1=g3p1-g3p+cu(49)*x1-g1m-z3*g1mp spl=se*(pap*y1/y3-cu(4)) st=g3a1+g3a+y2*cu(49)-g1m-z3*(g1a1-g1a+cu(15)*g1p)-cu(15)*g3p st=se*(cu(17)-(pal*y1+st*alf)/y3)/t 183 go to 135 151 kpg=0 152 wo=0.d0 w1=0.d0 w2=0.d0 wop=0.d0 w1p=0.d0 w2p=0.d0 woa=0.d0 w1a=0.d0 w2a=0.d0 if(pc.gt.pc2) go to 155 if(kkk.eq.0) go to 158 do 157 k=1,15 157 uac(k+65)=sqrt(uac(k)+x2) kkk=0 158 if(pc.gt.pc1) go to 156 if(pc.lt.-4.4d1) go to 163 x=exp(pc) do 161 k=1,ku 161 uac(k+80)=uac(k+15)/(uac(k+30)*x+1.d0) do 162 k=1,5 z=wk1(k)*wk4(k) wo=wo+z wop=wop+z/(1.d0+aio(k)*x) z=wk2(k)*wk5(k) w1=w1+z w1p=w1p+z/(1.d0+ai1(k)*x) if(kw.eq.1) go to 162 z=wk6(k)*wk3(k) w2=w2+z if(lst.eq.0) go to 162 woa=woa+wk4(k)/wk1(k) w1a=w1a+wk5(k)/wk2(k) w2p=w2p+z/(1.d0+ai2(k)*x) w2a=w2a+wk6(k)/wk3(k) 162 continue wop=wop*x w1p=w1p*x wo=wo*x w1=w1*x if(kw.eq.1) go to 163 w2=w2*x if(lst.eq.0) go to 163 w1a=w1a*x woa=woa*x w2a=w2a*x w2p=w2p*x 163 g1=w1+alf*wo g1p=w1p+alf*wop if(kw.eq.1) go to 164 g2=w2+x2*w1 g3=w2+alf*(w1+g1) g4=w2+alf*w1 if(lst.eq.0) go to 164 g1a=w1a+wo+alf*woa g2p=w2p+x2*w1p g3p=w2p+alf*(w1p+g1p) g4p=w2p+alf*w1p g2a=w2a+2.d0*w1+x2*w1a g3a=w2a+w1+g1+alf*(w1a+g1a) g4a=w2a+w1+alf*w1a 164 if(kpg.eq.1) go to 166 g11=g1 g1p1=g1p if(kw.eq.1) go to 168 g21=g2 g31=g3 g41=g4 if(lst.eq.0) go to 168 g1a1=g1a g2p1=g2p g3p1=g3p g4p1=g4p g2a1=g2a g3a1=g3a g4a1=g4a 168 pc=-pc-x2 kpg=1 if(pc.gt.-4.4d1) go to 152 g1=0.d0 g2=0.d0 g3=0.d0 g4=0.d0 g1p=0.d0 g2p=0.d0 g3p=0.d0 g4p=0.d0 g1a=0.d0 g2a=0.d0 g3a=0.d0 g4a=0.d0 166 pc=-pc-x2 g1m=g11-g1 g1mp=g1p1+g1p gp=g2+g21 ge=g4+g41+x2*g1 167 go to(169,170),kw 155 do 171 k=1,5 z4=xxi(k)-1.d0 z1=exp(pc*z4) y1=pc*xxi(k) z2=1.d0+z1 z3=x2+y1 y2=pc*aai(k)*sqrt(pc*z3)/z2 y4=cci(k)+pc z=y4+x2 y6=bbi(k)*sqrt(y4*z) wo=wo+y2+y6 if((lst.eq.0).and.(kw.ne.1)) go to 172 z5=1./pc y3=0.5d0*xxi(k)/z3-z4*z1/z2+1.5d0*z5 z6=1.d0/y4 y5=0.5d0*(1.d0/z+z6) wop=wop+y2*y3+y6*y5 z3=y2/z3 z=y6/z 172 y2=y2*y1 y6=y6*y4 w1=w1+y2+y6 y3=y3+z5 y5=y5+z6 w1p=w1p+y2*y3+y6*y5 if(kw.eq.1) go to 171 if(lst.eq.0) go to 173 woa=woa+z3+z z3=z3*y1 z=z*y4 w1a=w1a+z3+z 173 y2=y2*y1 y6=y6*y4 w2=w2+y2+y6 if(lst.eq.0) go to 171 w2p=w2p+y2*(y3+z5)+y6*(y5+z6) w2a=w2a+z3*y1+z*y4 171 continue go to 163 156 if(kk1.eq.0) go to 191 do 197 k=1,5 wk6(k)=hhi(k) wk7(k)=ggi(k) wk4(k)=sqrt(vvi(k)+x2) 197 wk5(k)=sqrt(zzi(k)+x2) do 195 k=1,24 195 abcg(k)=0.d0 k1=0 do 198 i=1,3 x=i x1=x-0.5d0 do 190 k=1,5 k2=k1+k k3=k2+65 z=(x+ggsi(k))/pc2 y=x1/zzi(k) z1=wk7(k)*(z-cpp(2))*cpp(4) z2=wk6(k)*(y-cpp(2))*cpp(4) z4=xxi(k)*wk7(k)/wk4(k) z5=wk6(k)/wk5(k) z6=cpp(5)*(z4+z5) asp(i)=asp(i)+abc(k2)*uac(k3)+z1*wk4(k)+z2*wk5(k)+z6*cpp(1) z8=cpp(5)*(z4/(vvi(k)+x2)+z5/(zzi(k)+x2)) aspa(i)=aspa(i)+abc(k2)/uac(k3)+z1/wk4(k)+z2/wk5(k)-z8*cpp(1) k4=k2+15 z1=wk7(k)*(cpp(3)-z)*cpp(1) z2=wk6(k)*(cpp(3)-y)*cpp(1) bsp(i)=bsp(i)+abc(k4)*uac(k3)+z1*wk4(k)+z2*wk5(k)-z6 bspa(i)=bspa(i)+abc(k4)/uac(k3)+z1/wk4(k)+z2/wk5(k)+z8 k4=k4+15 csp(i)=csp(i)+abc(k4)*uac(k3) cspa(i)=cspa(i)+abc(k4)/uac(k3) k4=k4+15 gsp(i)=gsp(i)+abc(k4)*uac(k3) gspa(i)=gspa(i)+abc(k4)/uac(k3) wk6(k)=wk6(k)*zzi(k) 190 wk7(k)=wk7(k)*vvi(k) 198 k1=k1+5 kk1=0 191 z=pc-pc1 z1=2.d0*z z2=1.5d0*z wo=gsp(1)+z*(csp(1)+z*(bsp(1)+z*asp(1))) w1=gsp(2)+z*(csp(2)+z*(bsp(2)+z*asp(2))) wop=csp(1)+z1*(bsp(1)+z2*asp(1)) w1p=csp(2)+z1*(bsp(2)+z2*asp(2)) if(kw.eq.1) go to 163 w2=gsp(3)+z*(csp(3)+z*(bsp(3)+z*asp(3))) if(lst.eq.0) go to 163 w2p=csp(3)+z1*(bsp(3)+z2*asp(3)) woa=gspa(1)+z*(cspa(1)+z*(bspa(1)+z*aspa(1))) w1a=gspa(2)+z*(cspa(2)+z*(bspa(2)+z*aspa(2))) w2a=gspa(3)+z*(cspa(3)+z*(bspa(3)+z*aspa(3))) go to 163 c c *** relativistic asymptotics (nz=4) 4 nzr=4 520 ro=pl*cu(58) hi=1.d0/emue r1=ro*0.5d0*hi pit=pi2*al1 pt2=pit*al1 pa=pt2-1.5d0 hu=psi*al1+1.d0 do 525 it=1,4 hu1=hu hu2=hu**2 hu =2.d0*(hu2*hu+r1)/(3.d0*hu2+pa) if(abs(hu1/hu-1.d0).le.eit) go to 527 525 continue r=r1**2+(pa*.3333333333d0)**3 x=(r1+sqrt(r))**(1.d0/3.d0) hu=x-pa/(3.d0*x) 527 continue hu2=hu**2 psi=-7.77d2 if(al1.gt.1.d-8) psi=(hu-1.d0)/al1 pe=.25d0*(hu2**2+2.d0*pa*hu2+.46666666667d0*pt2**2-pt2) ee=(3.d0*pe+0.5d0*(3.d0*hu2+pt2))/ro-hi pe=pe+1.1550858d0 ee=ee-1.1550858d0/ro if(lst.eq.0) go to 555 r=1.d0/(3.d0*hu2+pa) r1=hu2+pa pt=pit*(hu2-0.5d0+0.46666666667d0*pt2)-2.d0*pit*hu2*r1*r r2=hi*hu*r ppl=r2*r1 et=pit*(hu2*(1.d0-4.d0*pt2*r)+1.4d0*pt2-0.5d0)/ro epl=(3.d0*(ppl+r2)-ee-hi) 555 ee=ee*cu(59) pe=pe*cu(60) if(kpar.ne.1) go to 558 hpr=0.d0 if(t.lt.5.96d0) go to 558 eta=alf*hu if(eta.gt.6.d1) go to 558 hu1=exp(-eta) al2=al1**2 hpr=hu1*(1.2d1*al2-3.d0+hu1*((0.444444444d0*al2-1.d0) * *hu1-1.5d0*(al2-1.d0)))/(eta*r1) 558 continue if(lst.eq.0)go to 556 pt=pt*cu(61) ppl=ppl*cu(59) epl=epl*cu(59) et=et*cu(2) 556 if(kentr.eq.0) go to 557 y=cu(62) se=y*al1*(hu2+.466666666667d0*pt2-.5d0)/pl if(lst.eq.0) go to 557 spl=-se+2.d0*pi2*cu(2)*al1*r2 st=se/t+2.d0*y*pt2*(0.46666666667d0-2.d0*hu2*r)/(pl*cu(1)) 557 go to 135 c c *** interpolation between perfect gas and expansion over c *** half-integer f-d functions 52 pl1=x*emue pl2=y*emue nzp1=1 nzp2=2 c c *** interpolation over density 83 kin=ki lst1=lst lst=1 kk=0 dni=pl if(lst1.eq.0) go to 81 kk=1 tni=t t=t*(cu(4)+dst) 81 pl=pl1 nz=nzp1 ki=2 go to 90 77 pn1=pe en1=ee sn1=se psn1=psi hprn1=hpr pnp1=ppl enp1=epl/pl snp1=spl/pl pl=pl2 nz=nzp2 ki=3 nzr1=nzr go to 90 78 if(kk.eq.2) go to 92 wv=pl2-pl1 wv1=cu(4)/wv wv4=cu(15)*wv1 wv3=dni-pl1 wv5=wv1*wv3 92 x=epl/pl x1=pe-pn1 x2=x1*wv4 x3=x1*wv1 z1=pnp1+ppl-x2 z2=x3-z1-pnp1 z1=wv1*z1 pe=pn1+wv3*(pnp1+wv5*(z2+wv3*z1)) x1=ee-en1 x2=x1*wv4 x3=x1*wv1 y1=enp1+x-x2 y2=x3-y1-enp1 y1=wv1*y1 ee=en1+wv3*(enp1+wv5*(y2+wv3*y1)) if(kentr.eq.0) go to 91 x1=se-sn1 x2=x1*wv4 x3=x1*wv1 v1=snp1+spl/pl-x2 v2=x3-v1-snp1 v1=wv1*v1 se=sn1+wv3*(snp1+wv5*(v2+wv3*v1)) 91 if(kk.eq.1) go to 82 if(kk.eq.2) go to 124 127 x1=(dni-pl1)*wv1 psi=(psi-psn1)*x1+psn1 hpr=(hpr-hprn1)*x1+hprn1 nzr=10*nzr1+nzr pl=dni plm=pl/emue ki=kin lst=lst1 134 nz=0 pi=ei*pl 135 go to(57,77,78,79,80,577,578), ki 82 pn2=pe en2=ee sn2=se kk=2 t=tni go to 81 124 x1=t*dst pt=(pn2-pe)/x1 et=(en2-ee)/x1 if(kentr.eq.0) go to 126 st=(sn2-se)/x1 spl=snp1+wv5*(cu(15)*v2+cu(17)*wv3*v1) spl=dni*spl 126 ppl=pnp1+wv5*(cu(15)*z2+cu(17)*wv3*z1) epl=enp1+wv5*(cu(15)*y2+cu(17)*wv3*y1) epl=dni*epl go to 127 c c *** interpolation between degenerate gas and expansion over c *** half-integer fermi-dirac functions 62 pl1=x*emue pl2=y*emue nzp1=2 nzp2=3 go to 83 c c *** interpolation over temperature 128 kit=ki lst2=lst lst=1 kkt=0 dnt=t if(lst2.eq.0) go to 129 kkt=1 plni=pl pl=pl*(cu(4)+dst) 129 t=t1 nz=nz1 ki=4 go to 90 79 pnt=pe ent=ee snt=se psnt=psi hprnt=hpr pntt=pt entt=et sntt=st t=t2 nz=nz2 ki=5 nzrt=nzr go to 90 80 if(kkt.eq.2) go to 93 vw=t2-t1 vw1=cu(4)/vw vw4=cu(15)*vw1 vw3=dnt-t1 vw5=vw1*vw3 93 x1=pe-pnt x2=x1*vw4 x3=x1*vw1 z1=pntt+pt-x2 z2=x3-z1-pntt z1=vw1*z1 pe=pnt+vw3*(pntt+vw5*(z2+vw3*z1)) x1=ee-ent x2=x1*vw4 x3=x1*vw1 y1=entt+et-x2 y2=x3-y1-entt y1=vw1*y1 ee=ent+vw3*(entt+vw5*(y2+vw3*y1)) if(kentr.eq.0) go to 94 x1=se-snt x2=x1*vw4 x3=x1*vw1 v1=sntt+st-x2 v2=x3-v1-sntt v1=vw1*v1 se=snt+vw3*(sntt+vw5*(v2+vw3*v1)) 94 if(kkt.eq.1) go to 130 if(kkt.eq.2) go to 131 133 x1=(dnt-t1)*vw1 psi=(psi-psnt)*x1+psnt hpr=(hpr-hprnt)*x1+hprnt nzr=10*nzrt+nzr t=dnt alf=cu(1)/t al1=cu(4)/alf ei=t*rg eg=cu(3)*ei ki=kit lst=lst2 go to 134 130 pnt2=pe ent2=ee snt2=se kkt=2 pl=plni go to 129 131 x1=cu(4)/dst ppl=x1*(pnt2-pe)/pl epl=x1*(ent2-ee) if(kentr.eq.0) go to 132 spl=(snt2-se)*x1 st=sntt+vw5*(cu(15)*v2+cu(17)*vw3*v1) 132 pt=pntt+vw5*(cu(15)*z2+cu(17)*vw3*z1) et=entt+vw5*(cu(15)*y2+cu(17)*vw3*y1) go to 133 c..finish the pipeline loop 6969 continue enddo end