/*ParseFluc parse the fluctuations command */ #include #include "cddefines.h" #include "fluct.h" #include "phycon.h" #include "pressure.h" #include "ffmtread.h" #include "lgmatch.h" #include "parse.h" void ParseFluc(char *chCard ) { int lgEOL; long int i; double flmax, flmin, period, temp; # ifdef DEBUG_FUN fputs( "<+>ParseFluc()\n", debug_fp ); # endif /* rapid density fluctuations * first parameter is log of period, 2 is log den max, 3 log Nmin */ if( lgMatch("ABUN",chCard) ) { /* abundances varied */ fluct.lgDenFluc = FALSE; } else { /* density is varied */ fluct.lgDenFluc = TRUE; } i = 5; /* 1st number log of period in centimeters */ period = pow(10.,FFmtRead(chCard,&i,76,&lgEOL)); fluct.flong = (float)(6.2831853/period); temp = FFmtRead(chCard,&i,76,&lgEOL); /* 2nd number log of max hydrogen density */ flmax = pow(10.,temp); /* 3rd number log of min hydrogen density */ flmin = pow(10.,FFmtRead(chCard,&i,76,&lgEOL)); if( flmax/flmin > 100. ) { fprintf( ioQQQ, "This range of density probably will not work.\n" ); } if( flmax > 1e15 ) { fprintf( ioQQQ, "These parameters look funny to me. Please check Hazy.\n" ); } if( lgEOL || (flmin > flmax) ) { fprintf( ioQQQ, "There MUST be three numbers on this line.\n" ); fprintf( ioQQQ, "These must be the period(cm), max, min densities, all logs, in that order.\n" ); puts( "[Stop in getfluc]" ); exit(1); } /* this is optional phase shift for the command */ fluct.flcPhase = (float)FFmtRead(chCard,&i,76,&lgEOL); /* FacAbunSav = (cfirst * COS( depth*flong+flcPhase ) + csecnd) */ fluct.cfirst = (float)((flmax - flmin)/2.); fluct.csecnd = (float)((flmax + flmin)/2.); /* >>chng 96 july 13 moved depset to SetAbundances fac * if( lgDenFluc ) then * this is a pressure law * chCPres = 'SINE' * else * this is the metallicity of the gas * do i=3,limelm * depset(i) = flmax * end do * endif * * now get density if this is density option (not abundances) */ if( fluct.lgDenFluc ) { strcpy( pressure.chCPres, "SINE" ); /* depth is zero for first zone */ phycon.hden = (float)(fluct.cfirst*cos(fluct.flcPhase) + fluct.csecnd); phycon.hden = (float)log10(phycon.hden); } # ifdef DEBUG_FUN fputs( " <->ParseFluc()\n", debug_fp ); # endif return; }