00001 /* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 #include "cddefines.h" 00004 #include "rfield.h" 00005 00006 #include "opacity.h" 00007 00008 t_rfield rfield; 00009 00010 const realnum *t_rfield::getCoarseTransCoef() 00011 { 00012 // average opacity transmission coefficient fine to coarse 00013 if( opac.lgScatON && trans_coef_total_stale) 00014 { 00015 /* sum over coarse continuum */ 00016 for( long i=0; i < nflux-1; i++ ) 00017 { 00018 // find transmission coefficient if lower and upper bounds 00019 // of coarse continuum is within boundaries of fine continuum 00020 // unity is default 00021 if( ipnt_coarse_2_fine[i] && ipnt_coarse_2_fine[i+1] ) 00022 { 00023 // first branch is normal case, where fine continuum is finer than 00024 // coarse continuum. But, when end temp is very high, fine continuum is 00025 // very coarse, so may be just one cell, and following will not pass 00026 if( ipnt_coarse_2_fine[i+1]>ipnt_coarse_2_fine[i] ) 00027 { 00028 trans_coef_total[i] = 0.; 00029 for( long j=ipnt_coarse_2_fine[i]; j<ipnt_coarse_2_fine[i+1]; ++j ) 00030 trans_coef_total[i] += sexp(fine_opt_depth[j]); 00031 trans_coef_total[i] /= (ipnt_coarse_2_fine[i+1]-ipnt_coarse_2_fine[i]); 00032 } 00033 else 00034 { 00035 // in case where fine is coarser than coarse, 00036 // just use first cell 00037 trans_coef_total[i] = sexp(fine_opt_depth[ipnt_coarse_2_fine[i]]); 00038 } 00039 } 00040 } 00041 trans_coef_total_stale = false; 00042 } 00043 return trans_coef_total; 00044 }