/*ParseBackgrd parse options for the BACKGROUND command */ #include #include "cddefines.h" #include "physconst.h" #include "incidspec.h" #include "radius.h" #include "bounds.h" #include "powi.h" #include "ffmtread.h" #include "lgmatch.h" #include "parse.h" void ParseBackgrd(long int *nqh, char *chCard, float *ar1) { int lgEOL; long int i; double a, fac, rlogl, z; # ifdef DEBUG_FUN fputs( "<+>ParseBackgrd()\n", debug_fp ); # endif /* check that stack of shape and luminosity specifications * is parallel, stop if not - this happens is background comes * BETWEEN another set of shape and luminosity commands */ if( IncidSpec.nspec != *nqh ) { fprintf( ioQQQ, " This command has come between a previous ordered pair of continuum shape and luminosity commands.\n Reorder the commands to complete each continuum specification before starting another.\n" ); fprintf( ioQQQ, " Sorry.\n" ); puts( "[Stop in ParseBackgrd]" ); exit(1); } /* diffuse x-ray background from Ostriker and Ikeuchi Ap.J.L 268, L63. * parameter on card is redshift, followed by optional J21 (ApJ 301, 522) */ IncidSpec.nspec += 1; if( IncidSpec.nspec > LIMSPC ) { fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" ); puts( "[Stop in ParseBackgrd]" ); exit(1); } strcpy( spnorm.chSpType[IncidSpec.nspec-1], "POWER" ); IncidSpec.slope[IncidSpec.nspec-1] = -1.f; IncidSpec.cutoff[0][IncidSpec.nspec-1] = 1e10; IncidSpec.cutoff[1][IncidSpec.nspec-1] = 0.; /* now generate equivalent of luminosity command * enter phi(h), the number of h-ionizing photons/cm2 */ *nqh += 1; if( *nqh > LIMSPC ) { fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" ); puts( "[Stop in ParseBackgrd]" ); exit(1); } strcpy( spnorm.chRSpec[*nqh-1], "SQCM" ); strcpy( spnorm.chSpNorm[*nqh-1], "FLUX" ); i = 5; /* this will be the redshift */ z = FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { z = 0.; } /* optional scale factor */ fac = FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { fac = 1.0; } /* this equation from Ostriker and Ikeuchi Ap.J.L 268, L63. * this should be J_nu into 4\pi sr * >>chng 96 july 23, from ostriker to vedel, et al mnras 271, 743. */ IncidSpec.totpow[*nqh-1] = (float)(log10(PI4*fac*1.e-21/ (1.+powi(5./(1.+z),4)))); /* this is at 1 ryd for H * range(nqh,1) = 1. *chnage 96 dec 18, to H ioniz pot from 1 ryd */ IncidSpec.range[0][*nqh-1] = (float)HIONPOT; /* add fireball unless NO FIREBALL in */ if( !lgMatch("O FI",chCard) ) { IncidSpec.nspec += 1; *nqh += 1; if( *nqh > LIMSPC ) { fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" ); puts( "[Stop in ParseBackgrd]" ); exit(1); } /* put in a black body */ strcpy( spnorm.chSpType[IncidSpec.nspec-1], "BLACK" ); IncidSpec.slope[IncidSpec.nspec-1] = (float)(2.756*(1. + z)); IncidSpec.cutoff[0][IncidSpec.nspec-1] = 0.; IncidSpec.cutoff[1][IncidSpec.nspec-1] = 0.; strcpy( spnorm.chSpNorm[*nqh-1], "LUMI" ); a = log10(IncidSpec.slope[IncidSpec.nspec-1]); rlogl = log10(2.99792e10*7.56464e-15) + 4.*a; strcpy( spnorm.chRSpec[*nqh-1], "SQCM" ); IncidSpec.range[0][*nqh-1] = bounds.emm; IncidSpec.range[1][*nqh-1] = bounds.egamry; IncidSpec.totpow[*nqh-1] = (float)rlogl; } /* set radius to very large value if not already set */ if( radius.Radius == 0. ) { *ar1 = (float)radius.rdfalt; radius.Radius = pow(10.,*ar1); } # ifdef DEBUG_FUN fputs( " <->ParseBackgrd()\n", debug_fp ); # endif return; }