/*nphot one of Kevin Kolk's quantum heating routines for grains */ #include "cddefines.h" #include "rfield.h" #include "grainvar.h" #include "nphotl.h" #include "lget.h" #include "nphot.h" void nphot(float umin, float umax, float *xphot, long int ndust1) { long int j, ipj1, ipj2; double val1, val2; # ifdef DEBUG_FUN fputs( "<+>nphot()\n", debug_fp ); # endif /* one of Kevin Kolk's quantum heating routines for grains * This routine calculates the photon flux able to produce a * transition. umin and umax give the energy range in rydberg * for which the total flux of photons weighted by the absorption * cross-section of the grain is to be calculated. */ /* The following assumes that nflux is always larger than 1 */ if( nphotl.iflnph < rfield.nflux ) { for( j=nphotl.iflnph-1; j < rfield.nflux; j++ ) { nphotl.vmin[j] = (float)((rfield.anu[j] - rfield.widflx[j]/2.)); nphotl.vmax[j] = (float)(rfield.anu[j] + rfield.widflx[j]/ 2.); } nphotl.iflnph = rfield.nflux; } *xphot = 0.; ipj1 = lget(rfield.anu,rfield.nflux,umin) - 1; ipj2 = lget(rfield.anu,rfield.nflux,umax) + 1; /* >>chng 97 june get rid of go to * do j=ipj1,ipj2 */ j = ipj1-1; while( j < ipj2-1 && nphotl.vmin[j] <= umax ) { if( nphotl.vmax[j] >= umin ) { /* if(vmin(j).gt.umax) goto 515 */ val1 = MAX2(umin,nphotl.vmin[j]); val2 = MIN2(umax,nphotl.vmax[j]); /* xphot =xphot+(flux(j)+otslin(j)+outcon(j)+otscon(j))* * >>chng 97 july 17, summedcon */ *xphot += (float)(rfield.SummedCon[j]*GrainVar.dstab1[ndust1][j]* (val2 - val1)/rfield.widflx[j]); } j += 1; } *xphot *= GrainVar.dstAbund[ndust1]; /* this assumes that the flux arrays are in photons/s/rydb/cm^2 units, * rather than cgs flux density units *515 xphot = xphot*qhnrat(ndust1)/qdep(ndust1) */ *xphot = *xphot*GrainVar.qhnrat[ndust1]/GrainVar.qdep[ndust1]; # ifdef DEBUG_FUN fputs( " <->nphot()\n", debug_fp ); # endif return; }