00001 /* This file is part of Cloudy and is copyright (C)1978-2010 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseCMB parse parameters from fireball command */ 00004 #include "cddefines.h" 00005 #include "cosmology.h" 00006 #include "radius.h" 00007 #include "rfield.h" 00008 #include "parser.h" 00009 #include "physconst.h" 00010 00011 void ParseCMB(double z, 00012 long int *nqh) 00013 { 00014 double a, 00015 rlogl; 00016 00017 DEBUG_ENTRY( "ParseCMB()" ); 00018 00019 /* check that stack of shape and luminosity specifications 00020 * is parallel, stop if not - this happens is background comes 00021 * BETWEEN another set of shape and luminosity commands */ 00022 if( rfield.nShape != *nqh ) 00023 { 00024 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" ); 00025 fprintf( ioQQQ, " Sorry.\n" ); 00026 cdEXIT(EXIT_FAILURE); 00027 } 00028 00029 /* put in a black body */ 00030 strcpy( rfield.chSpType[rfield.nShape], "BLACK" ); 00031 /* >>chng 03 may 23, CMB temp from 2.756 to 2.725 */ 00032 rfield.slope[rfield.nShape] = (CMB_TEMP*(1. + z)); 00033 rfield.cutoff[rfield.nShape][0] = 0.; 00034 rfield.cutoff[rfield.nShape][1] = 0.; 00035 strcpy( rfield.chSpNorm[*nqh], "LUMI" ); 00036 a = log10(rfield.slope[rfield.nShape]); 00037 rlogl = log10(4.*STEFAN_BOLTZ) + 4.*a; 00038 strcpy( rfield.chRSpec[*nqh], "SQCM" ); 00039 rfield.range[*nqh][0] = rfield.emm; 00040 rfield.range[*nqh][1] = rfield.egamry; 00041 rfield.totpow[*nqh] = rlogl; 00042 /* this is an isotropic radiation field */ 00043 rfield.lgBeamed[*nqh] = false; 00044 rfield.Illumination[*nqh] = Illuminate::SYMMETRIC; 00045 00046 /* set radius to very large value if not already set */ 00047 /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */ 00048 if( !radius.lgRadiusKnown ) 00049 { 00050 radius.Radius = pow(10.,radius.rdfalt); 00051 } 00052 00053 ++rfield.nShape; 00054 ++*nqh; 00055 if( *nqh >= LIMSPC ) 00056 { 00057 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" ); 00058 cdEXIT(EXIT_FAILURE); 00059 } 00060 00061 /* this flag says that CMB has been set */ 00062 rfield.lgCMB_set = true; 00063 return; 00064 }