/*GrnVryDpth set grains abundance as a function of depth into cloud*/ #include "cddefines.h" #include "grainvar.h" #include "ionfracs.h" #include "grnvrydpth.h" double GrnVryDpth( /* pointer to grain type */ long int nd) { float GrnVryDpth_v; # ifdef DEBUG_FUN fputs( "<+>GrnVryDpth()\n", debug_fp ); # endif /*set grains abundance as a function of depth into cloud *NB most quantities are undefined for first calls to this sub */ /* nd is the pointer to the grain species. This routine must return * a scale factor for the abundance at this position. * */ if( GrainVar.lgDustVary[nd] ) { /* sample code - the scale factor will be the hydrogen ionization fraction * following can be used for any other element - first dimesion * is atomic weight and second is stage of ionization */ GrnVryDpth_v = xIonFracs[1][0]/(xIonFracs[2][0] + xIonFracs[1][0]); } else { GrnVryDpth_v = 1.; } # ifdef DEBUG_FUN fputs( " <->GrnVryDpth()\n", debug_fp ); # endif return( GrnVryDpth_v ); }