/*ParseConstant parse parameters from the 'constant ...' command */ #include #include "cddefines.h" #include "varypar.h" #include "tseton.h" #include "forcte.h" #include "pressure.h" #include "phycon.h" #include "input.h" #include "ffmtread.h" #include "lgmatch.h" #include "parse.h" void ParseConstant(char *chCard ) { int lgEOL; long int i; # ifdef DEBUG_FUN fputs( "<+>ParseConstant()\n", debug_fp ); # endif if( lgMatch("TEMP",chCard) ) { /* force a constant temperature model */ tseton.lgTSetOn = TRUE; i = 5; forcte.ForceTemp = (float)FFmtRead(chCard,&i,76,&lgEOL); /* if linear option is not on the line, convert to exponent if <= 10 */ if( !lgMatch("LINE",chCard) ) { if( forcte.ForceTemp <= 10. ) forcte.ForceTemp = (float)pow(10.,forcte.ForceTemp); } if( lgEOL ) { fprintf( ioQQQ, " There should be a number here, sorry.\n" ); puts( "[Stop in ParseConstant]" ); exit(1); } /* check that termperature is not less than 3K */ if( forcte.ForceTemp < 3. ) { fprintf( ioQQQ, " TE<3K, reset to 3K.\n" ); forcte.ForceTemp = 3.; } /* bail if termperature is relativistic */ if( forcte.ForceTemp > 1e11 ) { fprintf( ioQQQ, " TE>1e11K, cloudy cannot handle this temperature.\n" ); fprintf( ioQQQ, " Sorry.\n" ); puts( "[Stop in ParseConstant]" ); exit(1); } /* set the real electron temperature to the forced value */ phycon.te = forcte.ForceTemp; /* vary option */ if( VaryPar.lgVarOn ) { /* no luminosity options on vary */ VaryPar.nvarxt[VaryPar.nparm] = 1; strcpy( chVaryPar.chVarFmt[VaryPar.nparm], "CONStant TEMP %f" ); /* pointer to where to write */ VaryPar.nvfpnt[VaryPar.nparm] = input.nRead; /* log of temp will be pointer */ VaryPar.vparm[0][VaryPar.nparm] = (float)log10(phycon.te); VaryPar.vincr[VaryPar.nparm] = 0.1f; ++VaryPar.nparm; } /* constant density */ } else if( lgMatch("DENS",chCard) ) { strcpy( pressure.chCPres, "CDEN" ); /* turn off radiation pressure */ pressure.lgRadPresON = FALSE; } else if( lgMatch("PRES",chCard) ) { /* constant pressure */ strcpy( pressure.chCPres, "CPRE" ); if( lgMatch(" GAS",chCard) ) { /* constant gas pressure (no radiation) * turn off radiation pressure */ pressure.lgRadPresON = FALSE; /* turn off incident continuum */ pressure.lgConPres = FALSE; /* optional second number is power law index */ i = 4; pressure.PresPowerlaw = (float)FFmtRead(chCard,&i,76,&lgEOL); } else { /* constant total pressure, gas+rad+incident continuum * turn on radiation pressure */ pressure.lgRadPresON = TRUE; /* option to turn off continuum pressure */ if( lgMatch("O CO",chCard) ) { pressure.lgConPres = FALSE; } else { pressure.lgConPres = TRUE; } /* option to not abort when too much radiation pressure, no abort */ if( lgMatch("O AB",chCard) ) { pressure.lgRadPresAbortOK = FALSE; } else { pressure.lgRadPresAbortOK = TRUE; } /* there is no optional power law option for constant total pressure */ pressure.PresPowerlaw = 0.; } } else { /* no keys were recognized */ fprintf( ioQQQ, " The keyword should be TEMPerature, DENSity, GAS or PRESsure, sorry.\n" ); puts( "[Stop in ParseConstant]" ); exit(1); } # ifdef DEBUG_FUN fputs( " <->ParseConstant()\n", debug_fp ); # endif return; }