/*lindst add local line intensity to line luminosity stack */ #include #include "cddefines.h" #include "e2.h" #include "physconst.h" #include "linesave.h" #include "grainvar.h" #include "opac.h" #include "rfield.h" #include "radius.h" #include "exptau.h" #include "lindst.h" void lindst(double xInten, long int lam, char *chLab, long int ipnt, int chInfo, int lgOutToo) { double e2fn; # ifdef DEBUG_FUN fputs( "<+>lindst()\n", debug_fp ); # endif /* increment the line counter */ ++LineSave.nsum; if( LineSave.ipass > 0 ) { /* not first pass, sum lines only */ LineSv[LineSave.nsum-1].sumlin += (float)(xInten*radius.dVeff); LineSv[LineSave.nsum-1].emslin = (float)xInten; /* add line to outward beam */ if( lgOutToo ) { /* >>chng 97 sep 02, add tmn */ rfield.outlin[ipnt-1] += (float)(xInten/(rfield.anu[ipnt-1]*EN1RYD)* radius.dVolOutwrd*opac.tmn[ipnt-1]); rfield.reflin[ipnt-1] += (float)(xInten/(rfield.anu[ipnt-1]*EN1RYD)* radius.dVolReflec); } } else if( LineSave.ipass == 0 ) { /* first call to suff lines in array, confirm that label is one of * the four correct ones */ assert( (chInfo == 'c') || (chInfo == 'h') || (chInfo != 'i') || (chInfo != 'r' ) ); LineSv[LineSave.nsum-1].chSumTyp = (char)chInfo; /* number of lines ok, set parameters for first pass */ LineSv[LineSave.nsum-1].sumlin = 0.; LineSv[LineSave.nsum-1].lin = lam; strcpy( LineSv[LineSave.nsum-1].chALab, chLab ); } /* this is dust part */ if( GrainVar.lgDustOn ) { if( LineSave.ipass > 0 ) { /* main production pass, sum lines only * evaluate 2nd exponential integral function * >>chng 97 nov 5, some variables not defined above nflux */ if( ipnt <= rfield.nflux ) { e2fn = e2(opac.tauabs[0][ipnt-1],exptau.ExpmTau[ipnt-1]); /* DSTOTH was unit vol energy lost onto dust by cooling lines * dstoth = dstoth + xInten * (1.-e2fn) */ LineDSv[LineSave.ndsum].smdlin += (float)(xInten*radius.dVeff/ 2.*(1. + opac.albedo[ipnt-1])*e2fn); } } else if( LineSave.ipass == 0 ) { /* set parameters for first pass */ LineDSv[LineSave.ndsum].smdlin = 0.; LineDSv[LineSave.ndsum].lind = lam; strcpy( LineDSv[LineSave.ndsum].chSMDLab, chLab ); } /* there is also case where ipass is negative, in this one we just add counter * since space for array has not been malloced yet */ /* increment the counter to the number of lines */ ++LineSave.ndsum; } # ifdef DEBUG_FUN fputs( " <->lindst()\n", debug_fp ); # endif return; }