subroutine gen c------------------------------------------------------------------ c.. generate initial model for run: reads and writes formatted only c.. revised Fri Apr 16 08:18:52 MST 1999 for new format c reads new.model from unit 8, directory = local c.. last revision 1-16-00 c------------------------------------------------------------------ implicit none include 'dimenfile' include 'comod' include 'ctmstp' include 'cburn' include 'cruntm.h' include 'cbug' include 'czone' include 'cgen' include 'cbound' include 'cpgplot' include 'cenv' include 'cconst' include 'cdtnuc' include 'cnabla' integer*4 j, k, nc real*8 dth1, sum, yesum, xmsol character*5 cmodel character*7 filein, filout, filehr, filecv character*40 label character*72 text character*44 txt character*8 labl, labl1 character*2 txtxt logical tobe data txtxt/' '/ c----------------------------------------------------------------- c.. reading params.d for control parameters read (2,*)text write(*,*)text write(3,*)text c.. dummy read read (2,*)text write(*,*)ctstamp write(3,*)ctstamp read (2,*)text write(*,*)text write(3,*)text read (2,'(1x,a44,3x,a6,4x,2a1)')txt,labl,prefix write(*,*)txt,txtxt,labl,prefix write(3,*)txt,txtxt,labl,prefix labl1 = 'prefix' if( labl .ne. labl1 )goto 2000 c..replace possible blanks with underscores in filenames if( prefix(1) .eq. ' ' )prefix(1)='_' if( prefix(2) .eq. ' ' )prefix(2)='_' read (2,*)txt,labl,newnet write(*,*)txt,txtxt,labl,newnet write(3,*)txt,txtxt,labl,newnet labl1 = 'newnet' if( labl .ne. labl1 )goto 2000 c.. file for HR diagram, mass loss data filehr = 'hr.'//prefix(1)//prefix(2) open(7,file=filehr,status='unknown') rewind 7 c.. file for convection diagram filecv = 'cv.'//prefix(1)//prefix(2) open(11,file=filecv,status='unknown') rewind 11 c.. file for i(nitial) model (formatted data) filein = 'imodel' inquire(file=filein,exist=tobe) if( tobe )then open(8,file=filein,form='formatted',status='old') else write(*,*)'gen: no file ',filein,' in directory' stop'gen' endif rewind 8 nc = 1 call nreadf(note,nc) close(8) dth(1) = dth(2) dti(1) = dth(2) c.. save imodel in labeled file to insure record call modflgo(model,cmodel) filout = prefix(1)//prefix(2)//cmodel inquire(file=filout,exist=tobe) if( .not. tobe )then open(8,file=filout,form='formatted',status='new') rewind 8 nc = 1 call nritef(note,nc) close(8) write(3,92)filout,model write(6,92)filout,model 92 format(1x,'file ',a11,' is written, containing model',i6) endif c........................................................... c.. reads revised parameters from unit params.d (default) c.. nbug.ne.0 gives diagnostic run c.. ieos zero gives silent read of eos data file c.. ieos negative gives write on 6 of eos data tables c.. nup = 0 gives nbug = 1 on first time step c.. nup = 1 stops following first failure c idt.ne.0 gives constant time step c newt = 1 gives newtonian gravity c nouter = 1 gives constant r(kk) c-------------------------------------------------------- c ktot .gt. 1 in zone gives normal logic for rezoning c otherwise, zone reads c iff = 0 add, 1 delete, -1 end c zq = value in qqn array c-------------------------------------------------------- c ktot .eq. 0 in main gives skip of rezone call c ktot .lt. 0 in main following rezone call gives ktot = 0 c-------------------------------------------------------- c ktot .lt. -1 here gives equal mass zoning (-ktot zones) c c-------------------------------------------------------- c modez .eq. 0 gives old "zone division and merging" c modez .ne. 0 gives relaxation rezoning c-------------------------------------------------------- c ibnd = 0 gives orgin boundary condition for inner zone c-------------------------------------------------------- istep = 0 mset = 0 ncond = 12 nshel = 0 ibnd = 0 tenvelop = 0.0d0 idt = 0 qcons = 1.0d0 etar = 1.0d0 temin = 0.0d0 read (2,*)txt,labl,stime write(*,*)txt,txtxt,labl,stime write(3,*)txt,txtxt,labl,stime labl1 = 'stime' if( labl .ne. labl1 )goto 2000 if( stime .le. time )then write(*,*)'gen: stime error ',stime,time stop'gen: stime' endif read (2,*)txt,labl,ixstop write(*,*)txt,txtxt,labl,ixstop write(3,*)txt,txtxt,labl,ixstop labl1 = 'ixstop' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,xstop write(*,*)txt,txtxt,labl,xstop write(3,*)txt,txtxt,labl,xstop labl1 = 'xstop' if( labl .ne. labl1 )goto 2000 if( xstop .le. 0.0d0 .and. ixstop .ne. 0)then write(*,*)'error in gen: xstop =',xstop write(3,*)'error in gen: xstop =',xstop write(3,*)'error in gen: xstop =',xstop stop endif read (2,*)txt,labl,ll write(*,*)txt,txtxt,labl,ll write(3,*)txt,txtxt,labl,ll labl1 = 'll' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,ipause write(*,*)txt,txtxt,labl,ipause write(3,*)txt,txtxt,labl,ipause labl1 = 'ipause' if( labl .ne. labl1 )goto 2000 c.. to use, uncomment and add data line to params.d runtmx = 0.0d0 c read (2,*)txt,labl,runtmx c write(*,*)txt,txtxt,labl,runtmx c write(3,*)txt,txtxt,labl,runtmx c labl1 = 'runtmx' c if( labl .ne. labl1 )goto 2000 c ' Cpu time in seconds for this run (0=ignore)' 'runtmx' 0.0 read (2,*)text write(*,*)text mset = 0 c read (2,*)txt,labl,mset c write(*,*)txt,txtxt,labl,mset c write(3,*)txt,txtxt,labl,mset c labl1 = 'mset' c if( labl .ne. labl1 )goto 2000 c ' Flag to freeze abundances(0=change)........' 'mset' 0 read (2,*)txt,labl,nopac write(*,*)txt,txtxt,labl,nopac write(3,*)txt,txtxt,labl,nopac labl1 = 'nopac' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,noion write(*,*)txt,txtxt,labl,noion write(3,*)txt,txtxt,labl,noion labl1 = 'noion' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,nburn write(*,*)txt,txtxt,labl,nburn write(3,*)txt,txtxt,labl,nburn labl1 = 'nburn' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,istep write(*,*)txt,txtxt,labl,istep write(3,*)txt,txtxt,labl,istep labl1 = 'istep' if( labl .ne. labl1 )goto 2000 if( istep .lt. 0 .or. istep .gt. kk+1 1 .or. istep .eq. 1 )then write(*,*)istep, ' istep error in gen' endif read (2,*)txt,labl,izams write(*,*)txt,txtxt,labl,izams write(3,*)txt,txtxt,labl,izams labl1 = 'izams' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,fmxenv write(*,*)txt,txtxt,labl,fmxenv write(3,*)txt,txtxt,labl,fmxenv labl1 = 'fmxenv' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,fmnenv write(*,*)txt,txtxt,labl,fmnenv write(3,*)txt,txtxt,labl,fmnenv labl1 = 'fmnenv' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,tmenv write(*,*)txt,txtxt,labl,tmenv write(3,*)txt,txtxt,labl,tmenv labl1 = 'tmenv' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,epsilon write(*,*)txt,txtxt,labl,epsilon write(3,*)txt,txtxt,labl,epsilon labl1 = 'epsilon' if( labl .ne. labl1 )goto 2000 delchi = 0.05d0 c read (2,*)txt,labl,delchi c write(*,*)txt,txtxt,labl,delchi c write(3,*)txt,txtxt,labl,delchi c labl1 = 'delchi' c if( labl .ne. labl1 )goto 2000 c ' network: fractional change.................' 'delchi' 0.05d0 chimin = 1.0d-6 c read (2,*)txt,labl,chimin c write(*,*)txt,txtxt,labl,chimin c write(3,*)txt,txtxt,labl,chimin c labl1 = 'chimin' c if( labl .ne. labl1 )goto 2000 c ' network: minimum abundance used in dtime...' 'chimin' 1.0d-6 fdtn = 4.0d0 c read (2,*)txt,labl,fdtn c write(*,*)txt,txtxt,labl,fdtn c write(3,*)txt,txtxt,labl,fdtn c labl1 = 'fdtn' c if( labl .ne. labl1 )goto 2000 c ' network: fractional increase in dtime......' 'fdtn' 4.0d0 fdysum = 2.0d-2 c read (2,*)txt,labl,fdysum c write(*,*)txt,txtxt,labl,fdysum c write(3,*)txt,txtxt,labl,fdysum c labl1 = 'fdysum' c if( labl .ne. labl1 )goto 2000 c ' network: fractional of nucleons switching..' 'fdysum' 2.0d-2 ncymax = 200 c read (2,*)txt,labl,ncymax c write(*,*)txt,txtxt,labl,ncymax c write(3,*)txt,txtxt,labl,ncymax c labl1 = 'ncymax' c if( labl .ne. labl1 )goto 2000 c ' network: subcycles allowed.................' 'ncymax' 200 ncytest = ncymax - 10 c read (2,*)txt,labl,ncytest c write(*,*)txt,txtxt,labl,ncytest c write(3,*)txt,txtxt,labl,ncytest c labl1 = 'ncytest' c if( labl .ne. labl1 )goto 2000 c ' network: write if subcycles .ge.this value.' 'ncytest' 195 read (2,*)text write(*,*)text write(3,*)text c..debugging flag read (2,*)txt,labl,nbug write(*,*)txt,txtxt,labl,nbug write(3,*)txt,txtxt,labl,nbug labl1 = 'nbug' if( labl .ne. labl1 )goto 2000 nup = 5000 c read (2,*)txt,labl,nup c write(*,*)txt,txtxt,labl,nup c write(3,*)txt,txtxt,labl,nup c labl1 = 'nup' c if( labl .ne. labl1 )goto 2000 c ' Maximum number of updates which fail.......' 'nup' 5000 read (2,*)txt,labl,newt write(*,*)txt,txtxt,labl,newt write(3,*)txt,txtxt,labl,newt labl1 = 'newt' if( labl .ne. labl1 )goto 2000 nouter = 0 c read (2,*)txt,labl,nouter c write(*,*)txt,txtxt,labl,nouter c write(3,*)txt,txtxt,labl,nouter c labl1 = 'nouter' c if( labl .ne. labl1 )goto 2000 c ' Constant outer radius (=1; ignore=0).......' 'nouter' 0 read (2,*)txt,labl,mode write(*,*)txt,txtxt,labl,mode write(3,*)txt,txtxt,labl,mode labl1 = 'mode' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,l2 write(*,*)txt,txtxt,labl,l2 write(3,*)txt,txtxt,labl,l2 labl1 = 'l2' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,l3 write(*,*)txt,txtxt,labl,l3 write(3,*)txt,txtxt,labl,l3 labl1 = 'l3' if( labl .ne. labl1 )goto 2000 iter = 30 c read (2,*)txt,labl,iter c write(*,*)txt,txtxt,labl,iter c write(3,*)txt,txtxt,labl,iter c labl1 = 'iter' c if( labl .ne. labl1 )goto 2000 c ' Number of iterations allowed...............' 'iter' 30 read (2,*)txt,labl,modec write(*,*)txt,txtxt,labl,modec write(3,*)txt,txtxt,labl,modec labl1 = 'modec' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,alphaml write(*,*)txt,txtxt,labl,alphaml write(3,*)txt,txtxt,labl,alphaml labl1 = 'alphaml' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,hmlfak write(*,*)txt,txtxt,labl,hmlfak write(3,*)txt,txtxt,labl,hmlfak labl1 = 'hmlfak' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,modes write(*,*)txt,txtxt,labl,modes write(3,*)txt,txtxt,labl,modes labl1 = 'modes' if( labl .ne. labl1 )goto 2000 modex = 0 c read (2,*)txt,labl,modex c write(*,*)txt,txtxt,labl,modex c write(3,*)txt,txtxt,labl,modex c labl1 = 'modex' c if( labl .ne. labl1 )goto 2000 c ' Mixing mode(vc=0.1vs;vc=calculated)........' 'modex' 0 modez = 0 c read (2,*)txt,labl,modez c write(*,*)txt,txtxt,labl,modez c write(3,*)txt,txtxt,labl,modez c labl1 = 'modez' c if( labl .ne. labl1 )goto 2000 c ' Zoning mode(0=binary;1=relax;2=smooth).....' 'modez' 0 read (2,*)txt,labl,dth1 write(*,*)txt,txtxt,labl,dth1 write(3,*)txt,txtxt,labl,dth1 labl1 = 'dth1' if( labl .ne. labl1 )goto 2000 resid = 1.0d-6 c read (2,*)txt,labl,resid c write(*,*)txt,txtxt,labl,resid c write(3,*)txt,txtxt,labl,resid c labl1 = 'resid' c if( labl .ne. labl1 )goto 2000 c ' iteration residual (fractional)............' 'resid' 1.0d-6 cdelt = 0.01d0 c read (2,*)txt,labl,cdelt c write(*,*)txt,txtxt,labl,cdelt c write(3,*)txt,txtxt,labl,cdelt c labl1 = 'cdelt' c if( labl .ne. labl1 )goto 2000 c ' fractional temperature change.....0.01.....' 'cdelt' 0.02 cdelv = 3.0d0 * cdelt c read (2,*)txt,labl,cdelv c write(*,*)txt,txtxt,labl,cdelv c write(3,*)txt,txtxt,labl,cdelv c labl1 = 'cdelv' c if( labl .ne. labl1 )goto 2000 c ' fractional volume change..........0.03.....' 'cdelv' 0.02 c cdeln = 0.03d0 cdeln = 0.05d0 c read (2,*)txt,labl,cdeln c write(*,*)txt,txtxt,labl,cdeln c write(3,*)txt,txtxt,labl,cdeln c labl1 = 'cdeln' c if( labl .ne. labl1 )goto 2000 c ' fractional abundance change.......0.05.....' 'cdeln' 0.05 read (2,*)txt,labl,ktot write(*,*)txt,txtxt,labl,ktot write(3,*)txt,txtxt,labl,ktot labl1 = 'ktot' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,l4 write(*,*)txt,txtxt,labl,l4 write(3,*)txt,txtxt,labl,l4 labl1 = 'l4' if( labl .ne. labl1 )goto 2000 if( l4 .le. 0 )then write(*,*)'gen.f: l4 error, l4=',l4 stop'GEN: L4' endif dlnv = 0.1d0 c read (2,*)txt,labl,dlnv c write(*,*)txt,txtxt,labl,dlnv c write(3,*)txt,txtxt,labl,dlnv c labl1 = 'dlnv' c if( labl .ne. labl1 )goto 2000 c ' d log rho/d zone.(zones per decade rho 0.2)' 'dlnv' 0.1 xmmin = 2.0d-4 c read (2,*)txt,labl,xmmin c write(*,*)txt,txtxt,labl,xmmin c write(3,*)txt,txtxt,labl,xmmin c labl1 = 'xmmin' c if( labl .ne. labl1 )goto 2000 c ' fractional mass in outer zone......1.0d-4..' 'xmmin' 2.0d-4 dmmax = 0.01d0 c read (2,*)txt,labl,dmmax c write(*,*)txt,txtxt,labl,dmmax c write(3,*)txt,txtxt,labl,dmmax c labl1 = 'dmmax' c if( labl .ne. labl1 )goto 2000 c ' biggest fractional zone mass...............' 'dmmax' 0.01d0 drmax = 0.1d0 c read (2,*)txt,labl,drmax c write(*,*)txt,txtxt,labl,drmax c write(3,*)txt,txtxt,labl,drmax c labl1 = 'drmax' c if( labl .ne. labl1 )goto 2000 c ' fractional zone width......................' 'drmax' 0.1d0 facte = 0.02d0 c read (2,*)txt,labl,facte c write(*,*)txt,txtxt,labl,facte c write(3,*)txt,txtxt,labl,facte c labl1 = 'facte' c if( labl .ne. labl1 )goto 2000 c ' rezone for shell (edge of flame s5/s5max)..' 'facte' 5.0e-2 ismoo = 0 c read (2,*)txt,labl,ismoo c write(*,*)txt,txtxt,labl,ismoo c write(3,*)txt,txtxt,labl,ismoo c labl1 = 'ismoo' c if( labl .ne. labl1 )goto 2000 c ' smooth zone masses in rezone(yes=1)........' 'ismoo' 1 read (2,*)text write(*,*)text write(3,*)text read (2,*)txt,labl,peryear write(*,*)txt,txtxt,labl,peryear write(3,*)txt,txtxt,labl,peryear labl1 = 'peryear' if( labl .ne. labl1 )goto 2000 epsmax = 1.0d38 c read (2,*)txt,labl,epsmax c write(*,*)txt,txtxt,labl,epsmax c write(3,*)txt,txtxt,labl,epsmax c labl1 = 'epsmax' c if( labl .ne. labl1 )goto 2000 c ' target burning rate (erg/g-s) in shell.....' 'epsmax' 1.0d38 talimit = 2.0d10 c read (2,*)txt,labl,talimit c write(*,*)txt,txtxt,labl,talimit c write(3,*)txt,txtxt,labl,talimit c labl1 = 'talimit' c if( labl .ne. labl1 )goto 2000 c ' maximum temperature to attain..............' 'talimit' 2.0d10 read (2,*)txt,labl,mloss write(*,*)txt,txtxt,labl,mloss write(3,*)txt,txtxt,labl,mloss labl1 = 'mloss' if( labl .ne. labl1 )goto 2000 c.. safety check if( mloss .eq. 0 )then peryear = 0.0d0 endif read (2,*)text write(*,*)text write(3,*)text read (2,*)txt,labl,igraf write(*,*)txt,txtxt,labl,igraf write(3,*)txt,txtxt,labl,igraf labl1 = 'igraf' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,device1 write(*,*)txt,txtxt,labl,device1 write(3,*)txt,txtxt,labl,device1 labl1 = 'device1' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,ixflag write(*,*)txt,txtxt,labl,ixflag write(3,*)txt,txtxt,labl,ixflag labl1 = 'ixflag' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,nabflg write(*,*)txt,txtxt,labl,nabflg write(3,*)txt,txtxt,labl,nabflg labl1 = 'nabflg' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,nxflg write(*,*)txt,txtxt,labl,nxflg write(3,*)txt,txtxt,labl,nxflg labl1 = 'nxflg' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,fbot write(*,*)txt,txtxt,labl,fbot write(3,*)txt,txtxt,labl,fbot labl1 = 'fbot' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,ftop write(*,*)txt,txtxt,labl,ftop write(3,*)txt,txtxt,labl,ftop labl1 = 'ftop' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,xlogmin write(*,*)txt,txtxt,labl,xlogmin write(3,*)txt,txtxt,labl,xlogmin labl1 = 'xlogmin' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,xlogmax write(*,*)txt,txtxt,labl,xlogmax write(3,*)txt,txtxt,labl,xlogmax labl1 = 'xlogmax' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,cvsc write(*,*)txt,txtxt,labl,cvsc write(3,*)txt,txtxt,labl,cvsc labl1 = 'cvsc' if( labl .ne. labl1 )goto 2000 c.. HR plot read (2,*)txt,labl,device2 write(*,*)txt,txtxt,labl,device2 write(3,*)txt,txtxt,labl,device2 labl1 = 'device2' if( labl .ne. labl1 )goto 2000 c..plot limits for HR plot, used in hrplt.f read (2,*)txt,labl,gtmin write(*,*)txt,txtxt,labl,gtmin write(3,*)txt,txtxt,labl,gtmin labl1 = 'gtmin' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,gtmax write(*,*)txt,txtxt,labl,gtmax write(3,*)txt,txtxt,labl,gtmax labl1 = 'gtmax' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,glmin write(*,*)txt,txtxt,labl,glmin write(3,*)txt,txtxt,labl,glmin labl1 = 'glmin' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,glmax write(*,*)txt,txtxt,labl,glmax write(3,*)txt,txtxt,labl,glmax labl1 = 'glmax' if( labl .ne. labl1 )goto 2000 c.. cv (convection) plot read (2,*)txt,labl,device3 write(*,*)txt,txtxt,labl,device3 write(3,*)txt,txtxt,labl,device3 labl1 = 'device3' if( labl .ne. labl1 )goto 2000 c..plot limits for cv plot, used in cvplt.f read (2,*)txt,labl,pg3xmin write(*,*)txt,txtxt,labl,pg3xmin write(3,*)txt,txtxt,labl,pg3xmin labl1 = 'pg3xmin' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,pg3xmax write(*,*)txt,txtxt,labl,pg3xmax write(3,*)txt,txtxt,labl,pg3xmax labl1 = 'pg3xmax' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,pg3ymin write(*,*)txt,txtxt,labl,pg3ymin write(3,*)txt,txtxt,labl,pg3ymin labl1 = 'pg3ymin' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,pg3ymax write(*,*)txt,txtxt,labl,pg3ymax write(3,*)txt,txtxt,labl,pg3ymax labl1 = 'pg3ymax' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,ixpg3 write(*,*)txt,txtxt,labl,ixpg3 write(3,*)txt,txtxt,labl,ixpg3 labl1 = 'ixpg3' if( labl .ne. labl1 )goto 2000 read (2,*)txt,labl,iypg3 write(*,*)txt,txtxt,labl,iypg3 write(3,*)txt,txtxt,labl,iypg3 labl1 = 'iypg3' if( labl .ne. labl1 )goto 2000 1002 continue if(dth1 .gt. 0.0) then dth(2) = dth1 dth(1) = dth1 dti(1) = dth1 endif write(3,50) write(6,50) if( mode .eq. 0 )then label = 'explicit 2nd-order hydrodynamics, mode =' elseif( mode .eq. 1 )then label = 'implicit damped hydrodynamics, mode =' elseif( mode .eq. 2 )then label = 'implicit 1st-order hydrodynamics, mode =' else label = 'error: mode = ' stop endif write(3,*)label,mode write(6,*)label,mode if( newt .eq. 1 )then label = 'Newtonian dynamics, newt =' else label = 'GTR dynamics, newt =' endif write(3,*)label,newt write(6,*)label,newt if( modec .eq. 0 )then label = 'convection: dE + PdV = 0, modec =' stop'gen: work in progress' ccccccccccccccccccccccccc elseif( modec .eq. 1 )then label = 'convection: B = - rho*h*z, modec =' stop'gen: work in progress' cccccccccccccccccccccccc elseif( modec .eq. 2 )then label = 'convection: Schwarzschild, modec =' elseif( modec .eq. 3 )then label = 'convection: testing, modec =' elseif( modec .eq. -1 )then label = 'No convection, modec =' stop'gen: work in progress' ccccccccccccccccccccccc else label = 'error: modec = ' stop endif write(3,*)label,modec write(6,*)label,modec if( modes .eq. 0 )then label = 'Photosphere: outer zone kk, modes =' elseif( modes .eq. 1 )then label = 'Photosphere: zone ks .le. kk, modes =' elseif( modes .eq. 2 )then label = 'Photosphere: zone ks at kk+1, modes =' else label = 'error: modes = ' write(*,*)label write(*,*)'gen: bad parameter' stop endif write(3,*)label,modes write(6,*)label,modes if( modex .eq. 0 )then label = 'Mixing: conv. vel. = 0.1*sound, modex =' elseif( modex .eq. 1 )then label = 'Mixing: conv. vel. calculated, modex =' else label = 'error: modex =' stop endif write(3,*)label,modex write(6,*)label,modex if( modez .eq. 0 )then label = 'Zoning: division and merging, modez =' elseif( modez .eq. 1 )then label = 'Zoning: relaxation rezoning, modez =' elseif( modez .eq. 2 )then label = 'Zoning: smoothing rezone, modez =' elseif( modez .eq. 3 )then label = 'Zoning: smoothing2 rezone, modez =' elseif( modez .eq. 4 )then label = 'Zoning: doubling rezone, modez =' else label = 'error: modez =' write(*,*)label,modez stop endif write(3,*)label,modez write(6,*)label,modez if( nouter .eq. 1 )then write(3,*)'constant outer radius, nouter =',nouter write(6,*)'constant outer radius, nouter =',nouter elseif( nouter .ne. 0 )then write(3,*)'error: nouter = ',nouter write(6,*)'error: nouter = ',nouter stop endif write(3,50) write(6,50) c---------------------------------------------------- if( newnet .eq. 0 )then c.. test abundance consistency do k = 2, kk do j = 1, ndim-1 if( x(j,k) .lt. 0.0d0 )then write(*,*)'GEN: negative abundance in initial model' write(*,'(a8,2i5,a5,1pe12.3)') 1 "zone",k,j,cnuc(j),x(j,k) stop'gen' endif enddo enddo write(*,*)'GEN: no negative abundances' c.. renormalize abundances do k = 2, kk sum = -1.0d0 do j = 1, ndim-1 sum = sum + x(j,k)*dble( lz(j) + ln(j) ) enddo if( abs(sum) .gt. 1.0d-8 )then write(*,'(i5,1pe12.3,a30)')k,sum, 1 "renormalization in GEN" endif do j = 1, ndim-1 x(j,k) = x(j,k)/( 1.0d0 + sum ) enddo c.. reset Ye yesum = 0.0d0 sum = -1.0d0 do j = 1, ndim-1 yesum = yesum + x(j,k) * dble( lz(j) ) sum = sum + x(j,k)*dble( lz(j) + ln(j) ) enddo x(ndim,k) = yesum enddo else write(*,*)'gen: skipping renormalization' endif c.. mass coordinate dmi(1) = dmh(2) dmi(kk+1) = dmh(kk+1) do k = 2, kk xm(k) = xm(k-1) + dmh(k) dmi(k) = 0.5d0*( dmh(k+1) + dmh(k) ) enddo xm(kk+1) = xm(kk) + dmh(kk+1) c....................................................... 6 format(1x,' redefined composition, leaving gen') 7 format(a1) 10 format(12i6) 11 format( 4e15.7) 12 format(i6, 4e15.7) 13 format(i6,f10.3) 15 format(8a8) 21 format(2x,' ktot, l4, dlnv, xmmax, xmmin, dmmax, dmmaxc') 22 format(2i6,5e13.5) 23 format(3e15.7,i5) 24 format(1h0,' later input models scratched') 30 format(a4,1x,a5,a1) 40 format(' ifm,ieos,nbug,nup') 41 format(2x,' mode, l1, l2, l3, ncond, iter, nfall, nshel,', 1 ' modec, modes, modex, modez') 50 format(1x,70('-'),1x) c------------------------------------------------------------------ xmsol = xm(kk)/sol write(*,'(a10,2a1,0pf12.5,a21)') 1 'SEQUENCE ',prefix,xmsol,' solar masses on grid' write(3,'(a10,2a1,0pf12.5,a21)') 1 'SEQUENCE ',prefix,xmsol,' solar masses on grid' if( modes .eq. 2 )then write(*,'(a12,0pf12.5,9x,a12,0pf12.5)') 1 'envelope:',dmh(kk+1)/sol,'total mass:', 2 xmsol+dmh(kk+1)/sol write(3,'(a12,0pf12.5,9x,a12,0pf12.5)') 1 'envelope:',dmh(kk+1)/sol,'total mass:', 2 xmsol+dmh(kk+1)/sol endif write(*,*)note c.. remove any previous starlock files inquire(file='starlock',exist=tobe) if( tobe )then call rename('starlock','tmp') write(6,*)'starlock removed by gen' endif return 2000 continue write(*,*)'gen: error in file named input',label stop end