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