00001
00002
00003
00004 #include "cddefines.h"
00005 #include "cooling.h"
00006 #include "thermal.h"
00007 #include "dense.h"
00008 #include "atoms.h"
00009 #include "transition.h"
00010
00011 void AtomSeqBoron(
00012
00013
00014 const TransitionProxy& t10,
00015 const TransitionProxy& t20,
00016 const TransitionProxy& t30,
00017 const TransitionProxy& t21,
00018 const TransitionProxy& t31,
00019 const TransitionProxy& t41,
00020 double cs40,
00021 double cs32,
00022 double cs42,
00023 double cs43,
00024
00025 double pump_rate ,
00026
00027 const char *chLabel
00028 )
00029 {
00030
00031
00032
00033
00034
00035
00036
00037 # define N_SEQ_BORON 5
00038 static double
00039 **AulEscp ,
00040 **col_str ,
00041 **AulDest,
00042
00043 **AulPump,
00044 **CollRate,
00045 *pops,
00046 *create,
00047 *destroy,
00048 *depart,
00049
00050 *stat ,
00051
00052 *excit;
00053
00054 double b_cooling,
00055 dCoolDT;
00056 double EnrLU, EnrUL;
00057 realnum abundan;
00058
00059 static bool lgFirst=true,
00060 lgZeroPop;
00061 int i , j;
00062 int
00063
00064 lgNegPop;
00065
00066 bool lgDeBug;
00067
00068 DEBUG_ENTRY( "AtomSeqBoron()" );
00069
00070 if( lgFirst )
00071 {
00072
00073 lgFirst = false;
00074
00075 excit = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00076 stat = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00077 pops = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00078 create = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00079 destroy = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00080 depart = (double *)MALLOC( sizeof(double)*(N_SEQ_BORON) );
00081
00082 AulPump = ((double **)MALLOC((N_SEQ_BORON)*sizeof(double *)));
00083 CollRate = ((double **)MALLOC((N_SEQ_BORON)*sizeof(double *)));
00084 AulDest = ((double **)MALLOC((N_SEQ_BORON)*sizeof(double *)));
00085 AulEscp = ((double **)MALLOC((N_SEQ_BORON)*sizeof(double *)));
00086 col_str = ((double **)MALLOC((N_SEQ_BORON)*sizeof(double *)));
00087 for( i=0; i<(N_SEQ_BORON); ++i )
00088 {
00089 AulPump[i] = ((double *)MALLOC((N_SEQ_BORON)*sizeof(double )));
00090 CollRate[i] = ((double *)MALLOC((N_SEQ_BORON)*sizeof(double )));
00091 AulDest[i] = ((double *)MALLOC((N_SEQ_BORON)*sizeof(double )));
00092 AulEscp[i] = ((double *)MALLOC((N_SEQ_BORON)*sizeof(double )));
00093 col_str[i] = ((double *)MALLOC((N_SEQ_BORON)*sizeof(double )));
00094 }
00095 }
00096
00097
00098 abundan = dense.xIonDense[ (*t10.Hi()).nelem() -1][(*t10.Hi()).IonStg()-1];
00099
00101 if( abundan <= 0. )
00102 {
00103
00104 (*t10.Lo()).Pop() = 0.;
00105 (*t20.Lo()).Pop() = 0.;
00106 (*t30.Lo()).Pop() = 0.;
00107 (*t21.Lo()).Pop() = 0.;
00108 (*t31.Lo()).Pop() = 0.;
00109 (*t41.Lo()).Pop() = 0.;
00110
00111 t10.Emis().PopOpc() = 0.;
00112 t20.Emis().PopOpc() = 0.;
00113 t30.Emis().PopOpc() = 0.;
00114 t21.Emis().PopOpc() = 0.;
00115 t31.Emis().PopOpc() = 0.;
00116 t41.Emis().PopOpc() = 0.;
00117
00118 (*t10.Hi()).Pop() = 0.;
00119 (*t20.Hi()).Pop() = 0.;
00120 (*t30.Hi()).Pop() = 0.;
00121 (*t21.Hi()).Pop() = 0.;
00122 (*t31.Hi()).Pop() = 0.;
00123 (*t41.Hi()).Pop() = 0.;
00124
00125 t10.Emis().xIntensity() = 0.;
00126 t20.Emis().xIntensity() = 0.;
00127 t30.Emis().xIntensity() = 0.;
00128 t21.Emis().xIntensity() = 0.;
00129 t31.Emis().xIntensity() = 0.;
00130 t41.Emis().xIntensity() = 0.;
00131
00132 t10.Coll().cool() = 0.;
00133 t20.Coll().cool() = 0.;
00134 t30.Coll().cool() = 0.;
00135 t21.Coll().cool() = 0.;
00136 t31.Coll().cool() = 0.;
00137 t41.Coll().cool() = 0.;
00138
00139 t10.Emis().phots() = 0.;
00140 t20.Emis().phots() = 0.;
00141 t30.Emis().phots() = 0.;
00142 t21.Emis().phots() = 0.;
00143 t31.Emis().phots() = 0.;
00144 t41.Emis().phots() = 0.;
00145
00146 t10.Emis().ColOvTot() = 0.;
00147 t20.Emis().ColOvTot() = 0.;
00148 t30.Emis().ColOvTot() = 0.;
00149 t21.Emis().ColOvTot() = 0.;
00150 t31.Emis().ColOvTot() = 0.;
00151 t41.Emis().ColOvTot() = 0.;
00152
00153 t10.Coll().heat() = 0.;
00154 t20.Coll().heat() = 0.;
00155 t30.Coll().heat() = 0.;
00156 t21.Coll().heat() = 0.;
00157 t31.Coll().heat() = 0.;
00158 t41.Coll().heat() = 0.;
00159
00160 CoolAdd( chLabel, t10.WLAng() , 0.);
00161 CoolAdd( chLabel, t20.WLAng() , 0.);
00162 CoolAdd( chLabel, t30.WLAng() , 0.);
00163 CoolAdd( chLabel, t21.WLAng() , 0.);
00164 CoolAdd( chLabel, t31.WLAng() , 0.);
00165 CoolAdd( chLabel, t41.WLAng() , 0.);
00166
00167
00168
00169 ASSERT( N_SEQ_BORON <= LIMLEVELN);
00170 for( i=0; i < N_SEQ_BORON; i++ )
00171 {
00172 atoms.PopLevels[i] = 0.;
00173 atoms.DepLTELevels[i] = 1.;
00174 }
00175 return;
00176 }
00177
00178 ASSERT( t10.Coll().col_str() > 0.);
00179 ASSERT( t20.Coll().col_str() > 0.);
00180 ASSERT( t30.Coll().col_str() > 0.);
00181 ASSERT( t21.Coll().col_str() > 0.);
00182 ASSERT( t31.Coll().col_str() > 0.);
00183 ASSERT( t41.Coll().col_str() > 0.);
00184 ASSERT( cs40>0.);
00185 ASSERT( cs32>0.);
00186 ASSERT( cs42>0.);
00187 ASSERT( cs43>0.);
00188
00189
00190 for( i=0; i < N_SEQ_BORON; i++ )
00191 {
00192 create[i] = 0.;
00193 destroy[i] = 0.;
00194 for( j=0; j < N_SEQ_BORON; j++ )
00195 {
00196
00197 AulEscp[j][i] = 0.;
00198 AulDest[j][i] = 0.;
00199 AulPump[j][i] = 0.;
00200 col_str[j][i] = 0.;
00201 }
00202 }
00203
00204
00205 stat[0] = (*t10.Lo()).g();
00206 stat[1] = (*t10.Hi()).g();
00207 stat[2] = (*t20.Hi()).g();
00208 stat[3] = (*t30.Hi()).g();
00209 stat[4] = (*t41.Hi()).g();
00210 ASSERT( stat[0]>0. && stat[1]>0. &&stat[2]>0. &&stat[3]>0. &&stat[4]>0.);
00211 ASSERT( fabs((*t10.Lo()).g()/2.-1.) < FLT_EPSILON);
00212 ASSERT( fabs((*t10.Hi()).g()/4.-1.) < FLT_EPSILON);
00213 ASSERT( fabs((*t20.Lo()).g()/2.-1.) < FLT_EPSILON);
00214 ASSERT( fabs((*t20.Hi()).g()/2.-1.) < FLT_EPSILON);
00215 ASSERT( fabs((*t30.Lo()).g()/2.-1.) < FLT_EPSILON);
00216 ASSERT( fabs((*t30.Hi()).g()/4.-1.) < FLT_EPSILON);
00217 ASSERT( fabs((*t21.Lo()).g()/4.-1.) < FLT_EPSILON);
00218 ASSERT( fabs((*t21.Hi()).g()/2.-1.) < FLT_EPSILON);
00219 ASSERT( fabs((*t31.Lo()).g()/4.-1.) < FLT_EPSILON);
00220 ASSERT( fabs((*t31.Hi()).g()/4.-1.) < FLT_EPSILON);
00221 ASSERT( fabs((*t41.Lo()).g()/4.-1.) < FLT_EPSILON);
00222 ASSERT( fabs((*t41.Hi()).g()/6.-1.) < FLT_EPSILON);
00223
00224
00225 excit[0] = 0.;
00226 excit[1] = t10.EnergyK();
00227 excit[2] = t20.EnergyK();
00228 excit[3] = t30.EnergyK();
00229 excit[4] = t41.EnergyK() + t10.EnergyK();
00230 ASSERT( excit[1]>0. &&excit[2]>0. &&excit[3]>0. &&excit[4]>0.);
00231
00232
00233 AulEscp[1][0] = t10.Emis().Aul()*(t10.Emis().Pesc() + t10.Emis().Pelec_esc());
00234 AulDest[1][0] = t10.Emis().Aul()*t10.Emis().Pdest();
00235 col_str[1][0] = t10.Coll().col_str();
00236 AulPump[0][1] = t10.Emis().pump();
00237
00238
00239 AulPump[0][1] += pump_rate;
00240
00241 AulEscp[2][0] = t20.Emis().Aul()*(t20.Emis().Pesc() + t20.Emis().Pelec_esc());
00242 AulDest[2][0] = t20.Emis().Aul()*t20.Emis().Pdest();
00243 col_str[2][0] = t20.Coll().col_str();
00244 AulPump[0][2] = t20.Emis().pump();
00245
00246 AulEscp[3][0] = t30.Emis().Aul()*(t30.Emis().Pesc() + t30.Emis().Pelec_esc());
00247 AulDest[3][0] = t30.Emis().Aul()*t30.Emis().Pdest();
00248 col_str[3][0] = t30.Coll().col_str();
00249 AulPump[0][3] = t30.Emis().pump();
00250
00251 AulEscp[4][0] = 1e-8;
00252 AulDest[4][0] = 0.;
00253 col_str[4][0] = cs40;
00254 AulPump[0][4] = 0.;
00255
00256 AulEscp[2][1] = t21.Emis().Aul()*(t21.Emis().Pesc() + t21.Emis().Pelec_esc());
00257 AulDest[2][1] = t21.Emis().Aul()*t21.Emis().Pdest();
00258 col_str[2][1] = t21.Coll().col_str();
00259 AulPump[1][2] = t21.Emis().pump();
00260
00261 AulEscp[3][1] = t31.Emis().Aul()*(t31.Emis().Pesc() + t31.Emis().Pelec_esc());
00262 AulDest[3][1] = t31.Emis().Aul()*t31.Emis().Pdest();
00263 col_str[3][1] = t31.Coll().col_str();
00264 AulPump[1][3] = t31.Emis().pump();
00265
00266 AulEscp[4][1] = t41.Emis().Aul()*(t41.Emis().Pesc() + t41.Emis().Pelec_esc());
00267 AulDest[4][1] = t41.Emis().Aul()*t41.Emis().Pdest();
00268 col_str[4][1] = t41.Coll().col_str();
00269 AulPump[1][4] = t41.Emis().pump();
00270
00271 AulEscp[3][2] = 1e-8;
00272 AulDest[3][2] = 0.;
00273 col_str[3][2] = cs32;
00274 AulPump[2][3] = 0.;
00275
00276 AulEscp[4][2] = 1e-8;
00277 AulDest[4][2] = 0.;
00278 col_str[4][2] = cs42;
00279 AulPump[2][4] = 0.;
00280
00281 AulEscp[4][3] = 1e-8;
00282 AulDest[4][3] = 0.;
00283 col_str[4][3] = cs43;
00284 AulPump[3][4] = 0.;
00285
00286 lgDeBug = false;
00287
00288
00289 atom_levelN(N_SEQ_BORON,
00290 abundan,
00291 stat,
00292 excit,
00293 'K',
00294 pops,
00295 depart,
00296 &AulEscp,
00297 &col_str,
00298 &AulDest,
00299 &AulPump,
00300 &CollRate,
00301 create,
00302 destroy,
00303 false,
00304 &b_cooling,
00305 &dCoolDT,
00306 chLabel,
00307 &lgNegPop,
00308 &lgZeroPop,
00309 lgDeBug );
00310
00311
00312
00313 ASSERT( N_SEQ_BORON <= LIMLEVELN);
00314 for( i=0; i< N_SEQ_BORON; ++i )
00315 {
00316 atoms.PopLevels[i] = pops[i];
00317 atoms.DepLTELevels[i] = depart[i];
00318 }
00319
00320 (*t10.Lo()).Pop() = pops[0];
00321 (*t20.Lo()).Pop() = pops[0];
00322 (*t30.Lo()).Pop() = pops[0];
00323 (*t21.Lo()).Pop() = pops[1];
00324 (*t31.Lo()).Pop() = pops[1];
00325 (*t41.Lo()).Pop() = pops[1];
00326
00327 t10.Emis().PopOpc() = (pops[0] - pops[1]*(*t10.Lo()).g()/(*t10.Hi()).g());
00328 t20.Emis().PopOpc() = (pops[0] - pops[2]*(*t20.Lo()).g()/(*t20.Hi()).g());
00329 t30.Emis().PopOpc() = (pops[0] - pops[3]*(*t30.Lo()).g()/(*t30.Hi()).g());
00330 t21.Emis().PopOpc() = (pops[1] - pops[2]*(*t21.Lo()).g()/(*t21.Hi()).g());
00331 t31.Emis().PopOpc() = (pops[1] - pops[3]*(*t31.Lo()).g()/(*t31.Hi()).g());
00332 t41.Emis().PopOpc() = (pops[1] - pops[4]*(*t41.Lo()).g()/(*t41.Hi()).g());
00333
00334 (*t10.Hi()).Pop() = pops[1];
00335 (*t20.Hi()).Pop() = pops[2];
00336 (*t30.Hi()).Pop() = pops[3];
00337 (*t21.Hi()).Pop() = pops[2];
00338 (*t31.Hi()).Pop() = pops[3];
00339 (*t41.Hi()).Pop() = pops[4];
00340
00341 t10.Emis().phots() = t10.Emis().Aul()*(t10.Emis().Pesc() + t10.Emis().Pelec_esc())*pops[1];
00342 t20.Emis().phots() = t20.Emis().Aul()*(t20.Emis().Pesc() + t20.Emis().Pelec_esc())*pops[2];
00343 t30.Emis().phots() = t30.Emis().Aul()*(t30.Emis().Pesc() + t30.Emis().Pelec_esc())*pops[3];
00344 t21.Emis().phots() = t21.Emis().Aul()*(t21.Emis().Pesc() + t21.Emis().Pelec_esc())*pops[2];
00345 t31.Emis().phots() = t31.Emis().Aul()*(t31.Emis().Pesc() + t31.Emis().Pelec_esc())*pops[3];
00346 t41.Emis().phots() = t41.Emis().Aul()*(t41.Emis().Pesc() + t41.Emis().Pelec_esc())*pops[4];
00347
00348 t10.Emis().xIntensity() = t10.Emis().phots()*t10.EnergyErg();
00349 t20.Emis().xIntensity() = t20.Emis().phots()*t20.EnergyErg();
00350 t30.Emis().xIntensity() = t30.Emis().phots()*t30.EnergyErg();
00351 t21.Emis().xIntensity() = t21.Emis().phots()*t21.EnergyErg();
00352 t31.Emis().xIntensity() = t31.Emis().phots()*t31.EnergyErg();
00353 t41.Emis().xIntensity() = t41.Emis().phots()*t41.EnergyErg();
00354
00355
00356 t10.Emis().ColOvTot() = CollRate[0][1]/SDIV(CollRate[0][1]+t10.Emis().pump());
00357 t20.Emis().ColOvTot() = CollRate[0][2]/SDIV(CollRate[0][2]+t20.Emis().pump());
00358 t30.Emis().ColOvTot() = CollRate[0][3]/SDIV(CollRate[0][3]+t30.Emis().pump());
00359 t21.Emis().ColOvTot() = CollRate[1][2]/SDIV(CollRate[1][2]+t21.Emis().pump());
00360 t31.Emis().ColOvTot() = CollRate[1][3]/SDIV(CollRate[1][3]+t31.Emis().pump());
00361 t41.Emis().ColOvTot() = CollRate[1][4]/SDIV(CollRate[1][4]+t41.Emis().pump());
00362
00363
00364 thermal.dCooldT += dCoolDT;
00365
00366
00367
00368
00369
00370
00371
00372
00373 EnrLU = (*t10.Lo()).Pop()*CollRate[0][1]*t10.EnergyErg();
00374 EnrUL = (*t10.Hi()).Pop()*CollRate[1][0]*t10.EnergyErg();
00375
00376
00377 t10.Coll().cool() = EnrLU - EnrUL*t10.Emis().ColOvTot();
00378
00379 t10.Coll().heat() = EnrUL*(1. - t10.Emis().ColOvTot());
00380
00381 CoolAdd( chLabel, t10.WLAng() , t10.Coll().cool());
00382
00383 thermal.dCooldT += t10.Coll().cool() * (t10.EnergyK() * thermal.tsq1 - thermal.halfte );
00384
00385 EnrLU = (*t20.Lo()).Pop()*CollRate[0][2]*t20.EnergyErg();
00386 EnrUL = (*t20.Hi()).Pop()*CollRate[2][0]*t20.EnergyErg();
00387 t20.Coll().cool() = EnrLU - EnrUL*t20.Emis().ColOvTot();
00388 t20.Coll().heat() = EnrUL*(1. - t20.Emis().ColOvTot());
00389
00390 CoolAdd( chLabel, t20.WLAng() , t20.Coll().cool());
00391 thermal.dCooldT += t20.Coll().cool() * (t20.EnergyK() * thermal.tsq1 - thermal.halfte );
00392
00393 EnrLU = (*t30.Lo()).Pop()*CollRate[0][3]*t30.EnergyErg();
00394 EnrUL = (*t30.Hi()).Pop()*CollRate[3][0]*t30.EnergyErg();
00395 t30.Coll().cool() = EnrLU - EnrUL*t30.Emis().ColOvTot();
00396 t30.Coll().heat() = EnrUL*(1. - t30.Emis().ColOvTot());
00397
00398 CoolAdd( chLabel, t30.WLAng() , t30.Coll().cool());
00399 thermal.dCooldT += t30.Coll().cool() * (t30.EnergyK() * thermal.tsq1 - thermal.halfte );
00400
00401 EnrLU = (*t21.Lo()).Pop()*CollRate[1][2]*t21.EnergyErg();
00402 EnrUL = (*t21.Hi()).Pop()*CollRate[2][1]*t21.EnergyErg();
00403 t21.Coll().cool() = EnrLU - EnrUL*t21.Emis().ColOvTot();
00404 t21.Coll().heat() = EnrUL*(1. - t21.Emis().ColOvTot());
00405
00406 CoolAdd( chLabel, t21.WLAng() , t21.Coll().cool());
00407
00408 thermal.dCooldT += t21.Coll().cool() * (t20.EnergyK() * thermal.tsq1 - thermal.halfte );
00409
00410 EnrLU = (*t31.Lo()).Pop()*CollRate[1][3]*t31.EnergyErg();
00411 EnrUL = (*t31.Hi()).Pop()*CollRate[3][1]*t31.EnergyErg();
00412 t31.Coll().cool() = EnrLU - EnrUL*t31.Emis().ColOvTot();
00413 t31.Coll().heat() = EnrUL*(1. - t31.Emis().ColOvTot());
00414
00415 CoolAdd( chLabel, t31.WLAng() , t31.Coll().cool());
00416
00417 thermal.dCooldT += t31.Coll().cool() * (t30.EnergyK() * thermal.tsq1 - thermal.halfte );
00418
00419 EnrLU = (*t41.Lo()).Pop()*CollRate[1][4]*t41.EnergyErg();
00420 EnrUL = (*t41.Hi()).Pop()*CollRate[4][1]*t41.EnergyErg();
00421 t41.Coll().cool() = EnrLU - EnrUL*t41.Emis().ColOvTot();
00422 t41.Coll().heat() = EnrUL*(1. - t41.Emis().ColOvTot());
00423
00424 CoolAdd( chLabel, t41.WLAng() , t41.Coll().cool());
00425
00426 thermal.dCooldT += t41.Coll().cool() * (t41.EnergyK() * thermal.tsq1 - thermal.halfte );
00427
00428 return;
00429 }