00001
00002
00003
00004 #include "cddefines.h"
00005 #include "physconst.h"
00006 #include "radius.h"
00007 #include "rfield.h"
00008 #include "parse.h"
00009
00010 void ParseBackgrd(long int *nqh,
00011 char *chCard,
00012 float *ar1)
00013 {
00014 bool lgEOL;
00015 long int i;
00016 double a,
00017 fac,
00018 rlogl,
00019 z;
00020 char chLocal[INPUT_LINE_LENGTH];
00021
00022 DEBUG_ENTRY( "ParseBackgrd()" );
00023
00024
00025
00026
00027 if( rfield.nspec != *nqh )
00028 {
00029 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" );
00030 fprintf( ioQQQ, " Sorry.\n" );
00031 puts( "[Stop in ParseBackgrd]" );
00032 cdEXIT(EXIT_FAILURE);
00033 }
00034
00035
00036
00037
00038
00039
00040
00041 strcpy( chLocal, "TABLE POWERLAW " );
00042 ParseTable( nqh, chLocal , ar1);
00043
00044
00045
00046
00047 strcpy( rfield.chRSpec[*nqh], "SQCM" );
00048 strcpy( rfield.chSpNorm[*nqh], "FLUX" );
00049 i = 5;
00050
00051
00052 z = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00053 if( lgEOL )
00054 {
00055 z = 0.;
00056 }
00057
00058
00059 fac = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00060 if( lgEOL )
00061 {
00062 fac = 1.0;
00063 }
00064
00065
00066
00067
00068 rfield.totpow[*nqh] = (log10(PI4*fac*1.e-21/
00069 (1.+powi(5./(1.+z),4))));
00070
00071
00072
00073
00074 rfield.range[*nqh][0] = HIONPOT;
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 ++*nqh;
00087 if( *nqh >= LIMSPC )
00088 {
00089 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00090 puts( "[Stop in ParseBackgrd]" );
00091 cdEXIT(EXIT_FAILURE);
00092 }
00093
00094
00095 if( !(nMatch("O FI",chCard) || nMatch("O CM",chCard) ) )
00096 {
00097
00098
00099 strcpy( rfield.chSpType[rfield.nspec], "BLACK" );
00100
00101 rfield.slope[rfield.nspec] = (CMB_TEMP*(1. + z));
00102 rfield.cutoff[rfield.nspec][0] = 0.;
00103 rfield.cutoff[rfield.nspec][1] = 0.;
00104 strcpy( rfield.chSpNorm[*nqh], "LUMI" );
00105 a = log10(rfield.slope[rfield.nspec]);
00106 rlogl = log10(2.99792e10*7.56464e-15) + 4.*a;
00107 strcpy( rfield.chRSpec[*nqh], "SQCM" );
00108 rfield.range[*nqh][0] = rfield.emm;
00109 rfield.range[*nqh][1] = rfield.egamry;
00110 rfield.totpow[*nqh] = rlogl;
00111
00112
00113 rfield.lgCMB_set = true;
00114
00115 ++rfield.nspec;
00116 ++*nqh;
00117 if( *nqh >= LIMSPC )
00118 {
00119 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00120 puts( "[Stop in ParseBackgrd]" );
00121 cdEXIT(EXIT_FAILURE);
00122 }
00123 }
00124
00125
00126
00127 if( !radius.lgRadiusKnown )
00128 {
00129 *ar1 = (float)radius.rdfalt;
00130 radius.Radius = pow(10.,radius.rdfalt);
00131 }
00132
00133 DEBUG_EXIT( "ParseBackgrd()" );
00134 return;
00135 }
00136