/*ParseQuantHeat parse qheat command line to set grains quantum heating, by K Volk */ #include "cddefines.h" #include "istrstr.h" #include "grainvar.h" #include "ffmtread.h" #include "nphotl.h" #include "parse.h" void ParseQuantHeat(char *chCard, /* iopt is flag saying what job to do */ long int iopt) { int lgEOL; long int i, j; double qtmax1, xqhg1; # ifdef DEBUG_FUN fputs( "<+>ParseQuantHeat()\n", debug_fp ); # endif /* initialize the values to defaults */ nphotl.iflnph = 1; GrainVar.nqhg1 = 50; GrainVar.qtmax = 3000.0; GrainVar.qtmin = 0.0; GrainVar.qwavec = (float)(0.00911267/30.0); /* 30 microns converted into rydberg units */ GrainVar.qdudt0 = 0.; GrainVar.qtcol = 0.; for( i=0; i < NQGRID; i++ ) { for( j=0; j < 2; j++ ) { GrainVar.qhprob[i][j] = 0.; GrainVar.qtemp[i][j] = 0.; } } /* read an optional second value on the command line, which is the number * of values in the enthalpy array, and third value which is the maximum * temperature for the calculation (which must be less than 5000 k, and * greater than 50 k). note that qtmax will be set higher if the * calculated equilibrium temperature is larger than 0.2 times qtmax. */ /* this returns the first space on chCard, so we can start the scan from there */ i = istrstr(chCard," "); lgEOL = TRUE; /* first number is number of bins in the temperature array */ xqhg1 = FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { GrainVar.nqhg1 = 50; } else { GrainVar.nqhg1 = (long)(xqhg1); if( GrainVar.nqhg1 < 10 || GrainVar.nqhg1 > NQGRID ) { GrainVar.nqhg1 = 50; } } qtmax1 = FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { qtmax1 = 3000.; } /* insure that qtmax is between 50 and 5000 */ qtmax1 = MIN2(5000.,qtmax1); qtmax1 = MAX2(50.,qtmax1); /* this is the default value for qtmax, probably safe under normal * nebular conditions */ if( lgEOL ) { GrainVar.qtmax = 3000.; } else { GrainVar.qtmax = (float)qtmax1; } if( istrstr(chCard,"ALL") > 0 ) { /* key option all sets quantum heating for all grains */ for( j=0; j < NDUST; j++ ) { GrainVar.lgQHeat[j] = TRUE; } } else { if( iopt == 0 ) { GrainVar.lgQHeat[8] = TRUE; GrainVar.lgQHeat[9] = TRUE; } } /* default: set quantum heating for only the pah grains */ if( istrstr(chCard,"PRINT") > 0 ) { GrainVar.iqp = fopen( "qheat.out", "w"); if( NULL == GrainVar.iqp ) { fprintf(ioQQQ," ParseQuantHeat could not open qheat.out\n"); puts( "[Stop in ParseQuantHeat]" ); exit(1); } } /* flag for printing the temperature arrays for any layer that is * included in the print-out */ # ifdef DEBUG_FUN fputs( " <->ParseQuantHeat()\n", debug_fp ); # endif return; }