00001
00002
00003
00004 #include "cddefines.h"
00005 #include "cosmology.h"
00006 #include "physconst.h"
00007 #include "radius.h"
00008 #include "rfield.h"
00009 #include "parser.h"
00010
00011 void ParseBackgrd(Parser &p)
00012 {
00013 double a,
00014 fac,
00015 rlogl,
00016 z;
00017
00018 DEBUG_ENTRY( "ParseBackgrd()" );
00019
00020
00021
00022
00023 if( rfield.nShape != p.m_nqh )
00024 {
00025 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" );
00026 fprintf( ioQQQ, " Sorry.\n" );
00027 cdEXIT(EXIT_FAILURE);
00028 }
00029
00030
00031
00032
00033
00034
00035
00036 {
00037
00038
00039 p.set_point(0);
00040 string cmdSave = p.getRawTail();
00041 p.setline("TABLE POWERLAW ");
00042 ParseTable( p );
00043 p.setline(cmdSave.c_str());
00044 p.set_point(4);
00045 }
00046
00047
00048
00049
00050 strcpy( rfield.chRSpec[p.m_nqh], "SQCM" );
00051 strcpy( rfield.chSpNorm[p.m_nqh], "FLUX" );
00052
00053 rfield.lgBeamed[p.m_nqh] = false;
00054 rfield.Illumination[p.m_nqh] = Illuminate::SYMMETRIC;
00055
00056
00057 z = p.FFmtRead();
00058 if( p.lgEOL() )
00059 z = 0.;
00060
00061
00062 fac = p.FFmtRead();
00063 if( p.lgEOL() )
00064 fac = 1.0;
00065
00066
00067
00068
00069 rfield.totpow[p.m_nqh] = (log10(PI4*fac*1.e-21/
00070 (1.+powi(5./(1.+z),4))));
00071
00072
00073
00074
00075 rfield.range[p.m_nqh][0] = HIONPOT;
00076
00077 ++p.m_nqh;
00078 if( p.m_nqh >= LIMSPC )
00079 {
00080 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00081 cdEXIT(EXIT_FAILURE);
00082 }
00083
00084
00085 if( !(p.nMatch("NO FI") || p.nMatch("NO CM") ) )
00086 {
00087
00088
00089 strcpy( rfield.chSpType[rfield.nShape], "BLACK" );
00090
00091 rfield.slope[rfield.nShape] = (CMB_TEMP*(1. + z));
00092 rfield.cutoff[rfield.nShape][0] = 0.;
00093 rfield.cutoff[rfield.nShape][1] = 0.;
00094 strcpy( rfield.chSpNorm[p.m_nqh], "LUMI" );
00095 a = log10(rfield.slope[rfield.nShape]);
00096 rlogl = log10(4.*STEFAN_BOLTZ) + 4.*a;
00097 strcpy( rfield.chRSpec[p.m_nqh], "SQCM" );
00098 rfield.range[p.m_nqh][0] = rfield.emm;
00099 rfield.range[p.m_nqh][1] = rfield.egamry;
00100 rfield.totpow[p.m_nqh] = rlogl;
00101
00102
00103 rfield.lgCMB_set = true;
00104
00105 ++rfield.nShape;
00106 ++p.m_nqh;
00107 if( p.m_nqh >= LIMSPC )
00108 {
00109 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00110 cdEXIT(EXIT_FAILURE);
00111 }
00112 }
00113
00114
00115
00116 if( !radius.lgRadiusKnown )
00117 {
00118 radius.Radius = pow(10.,radius.rdfalt);
00119 }
00120 return;
00121 }