00001
00002
00003
00004
00005 #include "cddefines.h"
00006 #include "physconst.h"
00007 #include "taulines.h"
00008 #include "dense.h"
00009 #include "rt.h"
00010 #include "doppvel.h"
00011 #include "phycon.h"
00012 #include "conv.h"
00013 #include "thermal.h"
00014 #include "opacity.h"
00015 #include "lines_service.h"
00016 #include "rfield.h"
00017 #include "mewecoef.h"
00018 #include "atoms.h"
00019 #include "cooling.h"
00020
00021
00022 STATIC double ColStrGBar(transition * t , realnum cs1 );
00023
00024 void CoolDima(void)
00025 {
00026 long int i,
00027 ion,
00028 nelem;
00029 double cs;
00030
00031 DEBUG_ENTRY( "CoolDima()" );
00032
00033
00034 if( nWindLine<0 )
00035 return;
00036
00037 for( i=0; i < nWindLine; i++ )
00038 {
00039
00040 if( TauLine2[i].Hi->IonStg < TauLine2[i].Hi->nelem+1-NISO )
00041 {
00042 ion = TauLine2[i].Hi->IonStg;
00043 nelem = TauLine2[i].Hi->nelem;
00044
00045 if( dense.xIonDense[nelem-1][ion-1] > 0. )
00046 {
00047
00048 cs = ColStrGBar(&TauLine2[i] , cs1_flag_lev2[i] );
00049 }
00050 else
00051 {
00052 cs = 1.;
00053 }
00054
00055 PutCS(cs,&TauLine2[i] );
00056 RT_line_one( &TauLine2[i], true,0.f, GetDopplerWidth(dense.AtomicWeight[TauLine2[i].Hi->nelem-1]) );
00057 atom_level2(&TauLine2[i] );
00058 }
00059 }
00060
00061 return;
00062 }
00063
00064
00065 STATIC double ColStrGBar(transition * t , realnum cs1 )
00066 {
00067 long int i,
00068 j;
00069 double ColStrGBar_v,
00070 a,
00071 b,
00072 c,
00073 d,
00074 e1,
00075 gb,
00076 x,
00077 y;
00078 double xx,
00079 yy;
00080
00081 DEBUG_ENTRY( "ColStrGBar()" );
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 if( t->Hi->nelem == t->Hi->IonStg )
00096 {
00097 ColStrGBar_v = 0.0;
00098 return( ColStrGBar_v );
00099 }
00100
00101
00102 ASSERT( MeweCoef.g[1][0] != 0.);
00103
00104
00105
00106
00107 if( cs1 < 0. )
00108 {
00109 ColStrGBar_v = -cs1;
00110 return( ColStrGBar_v );
00111 }
00112
00113
00114 ASSERT( cs1 >= 0.05 );
00115
00116
00117 y = t->EnergyK/phycon.te;
00118 if( cs1 < 1.5 )
00119 {
00120 xx = -log10(y);
00121
00122 if( cs1 < 0.5 )
00123 {
00124 yy = (1.398813573838321 + xx*(0.02943050869177121 + xx*
00125 (-0.4439783893114510 + xx*(0.2316073358577902 + xx*(0.001870493481643103 +
00126 xx*(-0.008227246351067403))))))/(1.0 + xx*(-0.6064792600526370 +
00127 xx*(0.1958559534507252 + xx*(-0.02110452007196644 +
00128 xx*(0.01348743933722316 + xx*(-0.0001944731334371711))))));
00129 }
00130
00131 else
00132 {
00133 yy = (1.359675968512206 + xx*(0.04636500015069853 + xx*
00134 (-0.4491620298246676 + xx*(0.2498199231048967 + xx*(0.005053803073345794 +
00135 xx*(-0.01015647880244268))))))/(1.0 + xx*(-0.5904799485819767 +
00136 xx*(0.1877833737815317 + xx*(-0.01536634911179847 +
00137 xx*(0.01530712091180953 + xx*(-0.0001909176790831023))))));
00138 }
00139
00140 ColStrGBar_v = pow((double)10,yy)*t->Emis->gf/(t->EnergyWN * WAVNRYD* 13.6);
00141 }
00142 else
00143 {
00144 i = (long int)cs1;
00145
00146 if( i < 26 )
00147 {
00148 e1 = log(1.0+1.0/y) - 0.4/POW2(y + 1.0);
00149 a = MeweCoef.g[i-1][0];
00150 b = MeweCoef.g[i-1][1];
00151 c = MeweCoef.g[i-1][2];
00152 d = MeweCoef.g[i-1][3];
00153 x = (double)t->Hi->nelem - 3.0;
00154
00155 if( i == 14 )
00156 {
00157 a *= 1.0 - 0.5/x;
00158 b = 1.0 - 0.8/x;
00159 c *= 1.0 - 1.0/x;
00160 }
00161
00162 else if( i == 16 )
00163 {
00164 a *= 1.0 - 0.9/x;
00165 b *= 1.0 - 1.7/x;
00166 c *= 1.0 - 2.1/x;
00167 }
00168
00169 else if( i == 18 )
00170 {
00171 a *= 1.0 + 2.0/x;
00172 b *= 1.0 - 0.7/x;
00173 }
00174
00175 gb = a + (b*y - c*y*y + d)*e1 + c*y;
00176
00177
00178 ColStrGBar_v = 14.510395*t->Emis->gf*gb/(t->EnergyWN * WAVNRYD);
00179
00180 }
00181
00182 else
00183 {
00184
00185 if( i < 210 )
00186 {
00187 j = (long)(MeweCoef.g[i-1][3]);
00188 if( j == 1 )
00189 {
00190 ColStrGBar_v = t->Lo->g*MeweCoef.g[i-1][0]*
00191 pow(phycon.te/pow(10.,(double)MeweCoef.g[i-1][2]),(double)MeweCoef.g[i-1][1]);
00192 }
00193 else
00194 {
00195 ColStrGBar_v = t->Lo->g*MeweCoef.g[i-1][0]*
00196 sexp(MeweCoef.g[i-1][1]*(pow(10.,(double)MeweCoef.g[i-1][2])/
00197 phycon.te));
00198 }
00199 }
00200
00201 else
00202 {
00203
00204
00205
00206 ColStrGBar_v = 0.0125*phycon.sqrte*phycon.te10*
00207 phycon.te003;
00208 }
00209 }
00210 }
00211
00212
00213 ColStrGBar_v = MAX2(ColStrGBar_v,1e-10);
00214 return( ColStrGBar_v );
00215 }