| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | #include "cddefines.h" |
|---|
| 8 | #include "physconst.h" |
|---|
| 9 | #include "phycon.h" |
|---|
| 10 | #include "called.h" |
|---|
| 11 | #include "stopcalc.h" |
|---|
| 12 | #include "thermal.h" |
|---|
| 13 | #include "trace.h" |
|---|
| 14 | #include "elementnames.h" |
|---|
| 15 | #include "dense.h" |
|---|
| 16 | #include "radius.h" |
|---|
| 17 | #include "grainvar.h" |
|---|
| 18 | #include "abund.h" |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | STATIC void PrtElem( |
|---|
| 22 | |
|---|
| 23 | const char *chJob, |
|---|
| 24 | |
|---|
| 25 | const char *chLabl, |
|---|
| 26 | |
|---|
| 27 | double abund_prt); |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | void AbundancesPrt( void ) |
|---|
| 31 | { |
|---|
| 32 | long int i, |
|---|
| 33 | nd; |
|---|
| 34 | double GrainNumRelHydrSilicate , |
|---|
| 35 | GrainNumRelHydrCarbonaceous , |
|---|
| 36 | GrainNumRelHydr_PAH, |
|---|
| 37 | GrainMassRelHydrSilicate, |
|---|
| 38 | GrainMassRelHydrCarbonaceous, |
|---|
| 39 | GrainMassRelHydr_PAH; |
|---|
| 40 | |
|---|
| 41 | DEBUG_ENTRY( "AbundancesPrt()" ); |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | if( called.lgTalk ) |
|---|
| 45 | { |
|---|
| 46 | PrtElem("initG"," ",0.); |
|---|
| 47 | for( i=0; i < LIMELM; i++ ) |
|---|
| 48 | { |
|---|
| 49 | if( dense.lgElmtOn[i] ) |
|---|
| 50 | { |
|---|
| 51 | |
|---|
| 52 | PrtElem("fill",(char*)elementnames.chElementSym[i], |
|---|
| 53 | abund.solar[i]); |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | PrtElem("flus"," ",0.); |
|---|
| 59 | |
|---|
| 60 | fprintf( ioQQQ, " \n" ); |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | if( gv.lgDustOn ) |
|---|
| 64 | { |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | PrtElem("initD"," ",0.); |
|---|
| 68 | for( i=0; i < LIMELM; i++ ) |
|---|
| 69 | { |
|---|
| 70 | if( gv.elmSumAbund[i]>SMALLFLOAT ) |
|---|
| 71 | { |
|---|
| 72 | |
|---|
| 73 | PrtElem("fill",(char*)elementnames.chElementSym[i], |
|---|
| 74 | gv.elmSumAbund[i]/dense.gas_phase[ipHYDROGEN]); |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | PrtElem("flus"," ",0.); |
|---|
| 79 | |
|---|
| 80 | fprintf( ioQQQ, " \n" ); |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | GrainNumRelHydrSilicate = 0.; |
|---|
| 84 | GrainNumRelHydrCarbonaceous = 0; |
|---|
| 85 | GrainNumRelHydr_PAH = 0.; |
|---|
| 86 | GrainMassRelHydrSilicate = 0.; |
|---|
| 87 | GrainMassRelHydrCarbonaceous = 0; |
|---|
| 88 | GrainMassRelHydr_PAH = 0.; |
|---|
| 89 | |
|---|
| 90 | for( nd=0; nd < gv.nBin; nd++ ) |
|---|
| 91 | { |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | realnum DensityNumberPerHydrogen = |
|---|
| 97 | (gv.bin[nd]->IntVol/gv.bin[nd]->AvVol)*gv.bin[nd]->dstAbund / |
|---|
| 98 | gv.bin[nd]->GrnVryDpth; |
|---|
| 99 | |
|---|
| 100 | realnum DensityMassPerHydrogen = |
|---|
| 101 | gv.bin[nd]->IntVol*gv.bin[nd]->dustp[0]*gv.bin[nd]->dstAbund/ |
|---|
| 102 | (realnum)ATOMIC_MASS_UNIT / gv.bin[nd]->GrnVryDpth; |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | if( gv.bin[nd]->matType == MAT_CAR || gv.bin[nd]->matType == MAT_CAR2 ) |
|---|
| 108 | { |
|---|
| 109 | |
|---|
| 110 | GrainNumRelHydrCarbonaceous += DensityNumberPerHydrogen; |
|---|
| 111 | GrainMassRelHydrCarbonaceous += DensityMassPerHydrogen; |
|---|
| 112 | } |
|---|
| 113 | else if( gv.bin[nd]->matType == MAT_SIL || gv.bin[nd]->matType == MAT_SIL2 ) |
|---|
| 114 | { |
|---|
| 115 | |
|---|
| 116 | GrainNumRelHydrSilicate += DensityNumberPerHydrogen; |
|---|
| 117 | GrainMassRelHydrSilicate += DensityMassPerHydrogen; |
|---|
| 118 | } |
|---|
| 119 | else if( gv.bin[nd]->matType == MAT_PAH || gv.bin[nd]->matType == MAT_PAH2 ) |
|---|
| 120 | { |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | GrainNumRelHydr_PAH += DensityNumberPerHydrogen; |
|---|
| 125 | GrainMassRelHydr_PAH += DensityMassPerHydrogen; |
|---|
| 126 | } |
|---|
| 127 | else |
|---|
| 128 | TotalInsanity(); |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | fprintf(ioQQQ," Number of grains per hydrogen (scale=1) Mass of grains per hydrogen (scale=1)\n"); |
|---|
| 133 | fprintf(ioQQQ," Carbonaceous: %.3f Silicate: %.3f PAH: %.3f Carbonaceous: %.3f Silicate: %.3f PAH: %.3f\n\n" , |
|---|
| 134 | log10( MAX2( 1e-30, GrainNumRelHydrCarbonaceous ) ) , |
|---|
| 135 | log10( MAX2( 1e-30, GrainNumRelHydrSilicate ) ) , |
|---|
| 136 | log10( MAX2( 1e-30, GrainNumRelHydr_PAH ) ) , |
|---|
| 137 | log10( MAX2( 1e-30, GrainMassRelHydrCarbonaceous ) ) , |
|---|
| 138 | log10( MAX2( 1e-30, GrainMassRelHydrSilicate ) ) , |
|---|
| 139 | log10( MAX2( 1e-30, GrainMassRelHydr_PAH ) ) ); |
|---|
| 140 | } |
|---|
| 141 | } |
|---|
| 142 | return; |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | void AbundancesSet(void) |
|---|
| 147 | { |
|---|
| 148 | long int i, |
|---|
| 149 | nelem; |
|---|
| 150 | double fac; |
|---|
| 151 | static bool lgFirstCall=true; |
|---|
| 152 | static bool lgElOnOff[LIMELM]; |
|---|
| 153 | |
|---|
| 154 | DEBUG_ENTRY( "AbundancesSet()" ); |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | if( lgFirstCall ) |
|---|
| 165 | { |
|---|
| 166 | |
|---|
| 167 | for( i=0; i<LIMELM; ++i ) |
|---|
| 168 | { |
|---|
| 169 | lgElOnOff[i] = dense.lgElmtOn[i]; |
|---|
| 170 | } |
|---|
| 171 | } |
|---|
| 172 | lgFirstCall = false; |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | for( i=ipHYDROGEN; i<LIMELM; ++i ) |
|---|
| 177 | { |
|---|
| 178 | dense.lgElmtOn[i] = lgElOnOff[i] && dense.lgElmtOn[i]; |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | for( i=ipHELIUM; i < LIMELM; i++ ) |
|---|
| 183 | { |
|---|
| 184 | abund.solar[i] /= abund.solar[0]; |
|---|
| 185 | } |
|---|
| 186 | abund.solar[ipHYDROGEN] = 1.; |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | abund.solar[ipHELIUM] *= abund.depset[1]*abund.ScaleElement[1]; |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | if( dense.lgDenFlucOn ) |
|---|
| 196 | { |
|---|
| 197 | |
|---|
| 198 | fac = 1.; |
|---|
| 199 | } |
|---|
| 200 | else |
|---|
| 201 | { |
|---|
| 202 | |
|---|
| 203 | fac = dense.cfirst*cos(dense.flcPhase) + dense.csecnd; |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | for( i=ipLITHIUM; i < LIMELM; i++ ) |
|---|
| 207 | { |
|---|
| 208 | abund.solar[i] *= (realnum)(abund.ScaleMetals*abund.depset[i]* |
|---|
| 209 | abund.ScaleElement[i]*fac); |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | if( abund.lgAbTaON ) |
|---|
| 214 | { |
|---|
| 215 | for( nelem=ipHELIUM; nelem < LIMELM; ++nelem ) |
|---|
| 216 | { |
|---|
| 217 | if( abund.lgAbunTabl[nelem] ) |
|---|
| 218 | { |
|---|
| 219 | abund.solar[nelem] = (realnum)(AbundancesTable(radius.Radius, |
|---|
| 220 | radius.depth,nelem+1)); |
|---|
| 221 | } |
|---|
| 222 | } |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | for( nelem=ipHYDROGEN; nelem < LIMELM; ++nelem ) |
|---|
| 231 | { |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | if( abund.solar[nelem] < dense.AbundanceLimit ) |
|---|
| 235 | dense.lgElmtOn[nelem] = false; |
|---|
| 236 | |
|---|
| 237 | if( dense.lgElmtOn[nelem] ) |
|---|
| 238 | { |
|---|
| 239 | dense.gas_phase[nelem] = abund.solar[nelem]*dense.gas_phase[ipHYDROGEN]; |
|---|
| 240 | if( dense.gas_phase[nelem] <= 0. ) |
|---|
| 241 | { |
|---|
| 242 | fprintf( ioQQQ, " Abundances must be greater than zero. " |
|---|
| 243 | "Check entered abundance for element%3ld = %2.2s\n", |
|---|
| 244 | nelem, elementnames.chElementSym[nelem] ); |
|---|
| 245 | cdEXIT(EXIT_FAILURE); |
|---|
| 246 | } |
|---|
| 247 | else if( dense.gas_phase[nelem] < SMALLFLOAT ) |
|---|
| 248 | { |
|---|
| 249 | fprintf(ioQQQ," Abundance for %s is %.2e, less than lower " |
|---|
| 250 | "limit of %.3e, so turning element off.\n", |
|---|
| 251 | elementnames.chElementSym[nelem], |
|---|
| 252 | dense.gas_phase[nelem], |
|---|
| 253 | SMALLFLOAT ); |
|---|
| 254 | dense.lgElmtOn[nelem] = false; |
|---|
| 255 | } |
|---|
| 256 | else if( dense.gas_phase[nelem] > MAX_DENSITY ) |
|---|
| 257 | { |
|---|
| 258 | fprintf(ioQQQ," Abundance for %s is %.2e. This version of Cloudy does not " |
|---|
| 259 | "permit densities greater than %e cm-3.\n", |
|---|
| 260 | elementnames.chElementSym[nelem], |
|---|
| 261 | dense.gas_phase[nelem], |
|---|
| 262 | MAX_DENSITY ); |
|---|
| 263 | cdEXIT(EXIT_FAILURE); |
|---|
| 264 | } |
|---|
| 265 | } |
|---|
| 266 | if( !dense.lgElmtOn[nelem] ) |
|---|
| 267 | { |
|---|
| 268 | |
|---|
| 269 | dense.gas_phase[nelem] = 0.; |
|---|
| 270 | } |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | dense.xIonDense[nelem][0] = dense.gas_phase[nelem]; |
|---|
| 274 | for( long int ion=1; ion < LIMELM+1; ion++ ) |
|---|
| 275 | { |
|---|
| 276 | dense.xIonDense[nelem][ion] = 0.; |
|---|
| 277 | } |
|---|
| 278 | |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | |
|---|
| 283 | if( called.lgTalk && (StopCalc.TempLoStopZone < phycon.TEMP_STOP_DEFAULT || |
|---|
| 284 | |
|---|
| 285 | (thermal.ConstTemp > 0. && thermal.ConstTemp < phycon.TEMP_STOP_DEFAULT ) ) ) |
|---|
| 286 | { |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | if( dense.lgElmtOn[ipOXYGEN] && dense.gas_phase[ipCARBON]/SDIV( dense.gas_phase[ipOXYGEN]) >= 1. ) |
|---|
| 290 | { |
|---|
| 291 | fprintf( ioQQQ, "\n >>> \n" |
|---|
| 292 | " >>> The simulation is going into possibly molecular gas but the carbon/oxygen abundance ratio is greater than unity.\n" ); |
|---|
| 293 | fprintf( ioQQQ, " >>> Standard interstellar chemistry networks are designed for environments with C/O < 1.\n" ); |
|---|
| 294 | fprintf( ioQQQ, " >>> The chemistry network may (or may not) collapse deep in molecular regions where CO is fully formed.\n" ); |
|---|
| 295 | fprintf( ioQQQ, " >>> \n\n\n\n\n" ); |
|---|
| 296 | } |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | if( trace.lgTrace ) |
|---|
| 300 | { |
|---|
| 301 | realnum sumx , sumy , sumz = 0.; |
|---|
| 302 | |
|---|
| 303 | sumx = dense.gas_phase[ipHYDROGEN]*dense.AtomicWeight[ipHYDROGEN]; |
|---|
| 304 | sumy = dense.gas_phase[ipHELIUM]*dense.AtomicWeight[ipHELIUM]; |
|---|
| 305 | |
|---|
| 306 | fprintf( ioQQQ, "\n AbundancesSet sets following densities (cm^-3); \n" ); |
|---|
| 307 | for( i=0; i<3; i++ ) |
|---|
| 308 | { |
|---|
| 309 | for( nelem=i*10; nelem < i*10+10; nelem++ ) |
|---|
| 310 | { |
|---|
| 311 | fprintf( ioQQQ, " %2.2s", elementnames.chElementSym[nelem] ); |
|---|
| 312 | PrintE82( ioQQQ, dense.gas_phase[nelem] ); |
|---|
| 313 | if( nelem>ipHELIUM ) |
|---|
| 314 | sumz += dense.gas_phase[nelem]*dense.AtomicWeight[nelem]; |
|---|
| 315 | } |
|---|
| 316 | fprintf( ioQQQ, " \n" ); |
|---|
| 317 | } |
|---|
| 318 | fprintf( ioQQQ, "\n AbundancesSet sets following abundances rel to H; \n" ); |
|---|
| 319 | for( i=0; i<3; i++ ) |
|---|
| 320 | { |
|---|
| 321 | for( nelem=i*10; nelem < i*10+10; nelem++ ) |
|---|
| 322 | { |
|---|
| 323 | fprintf( ioQQQ, " %2.2s", elementnames.chElementSym[nelem] ); |
|---|
| 324 | PrintE82( ioQQQ, dense.gas_phase[nelem]/dense.gas_phase[ipHYDROGEN] ); |
|---|
| 325 | } |
|---|
| 326 | fprintf( ioQQQ, " \n" ); |
|---|
| 327 | } |
|---|
| 328 | fprintf( ioQQQ, " \n" ); |
|---|
| 329 | fprintf(ioQQQ," Gas-phase mass fractions, X:%.3e Y:%.3e Z:%.3e\n\n", |
|---|
| 330 | sumx/SDIV(sumx+sumy+sumz) , |
|---|
| 331 | sumy/SDIV(sumx+sumy+sumz) , |
|---|
| 332 | sumz/SDIV(sumx+sumy+sumz) ); |
|---|
| 333 | } |
|---|
| 334 | return; |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | |
|---|
| 338 | #define NELEM1LINE 9 |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | STATIC void PrtElem( |
|---|
| 342 | |
|---|
| 343 | const char *chJob, |
|---|
| 344 | |
|---|
| 345 | const char *chLabl, |
|---|
| 346 | |
|---|
| 347 | double abund_prt) |
|---|
| 348 | { |
|---|
| 349 | static char chAllLabels[NELEM1LINE][14]; |
|---|
| 350 | long int i, |
|---|
| 351 | noffset; |
|---|
| 352 | static long int nelem; |
|---|
| 353 | |
|---|
| 354 | DEBUG_ENTRY( "PrtElem()" ); |
|---|
| 355 | |
|---|
| 356 | if( strcmp(chJob,"initG") == 0 ) |
|---|
| 357 | { |
|---|
| 358 | |
|---|
| 359 | nelem = 0; |
|---|
| 360 | fprintf( ioQQQ, |
|---|
| 361 | " Gas Phase Chemical Composition\n" ); |
|---|
| 362 | } |
|---|
| 363 | else if( strcmp(chJob,"initD") == 0 ) |
|---|
| 364 | { |
|---|
| 365 | |
|---|
| 366 | nelem = 0; |
|---|
| 367 | fprintf( ioQQQ, |
|---|
| 368 | " Grain Chemical Composition\n" ); |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | else if( strcmp(chJob,"fill") == 0 ) |
|---|
| 372 | { |
|---|
| 373 | |
|---|
| 374 | abund_prt = log10( abund_prt ); |
|---|
| 375 | |
|---|
| 376 | sprintf( chAllLabels[nelem], " %2.2s:%8.4f", chLabl, abund_prt ); |
|---|
| 377 | if( nelem == NELEM1LINE-1 ) |
|---|
| 378 | { |
|---|
| 379 | |
|---|
| 380 | fprintf( ioQQQ, " " ); |
|---|
| 381 | for( i=0; i < NELEM1LINE; i++ ) |
|---|
| 382 | { |
|---|
| 383 | fprintf( ioQQQ, "%13.13s", chAllLabels[i] ); |
|---|
| 384 | } |
|---|
| 385 | fprintf( ioQQQ, "\n" ); |
|---|
| 386 | |
|---|
| 387 | nelem = 0; |
|---|
| 388 | } |
|---|
| 389 | else |
|---|
| 390 | { |
|---|
| 391 | |
|---|
| 392 | ++nelem; |
|---|
| 393 | } |
|---|
| 394 | } |
|---|
| 395 | |
|---|
| 396 | # if 0 |
|---|
| 397 | |
|---|
| 398 | else if( strcmp(chJob,"fillp") == 0 ) |
|---|
| 399 | { |
|---|
| 400 | |
|---|
| 401 | abund_prt = log10( abund_prt ); |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | sprintf( chAllLabels[nelem], " %2.2s:%8.4f", chLabl, abund_prt ); |
|---|
| 405 | if( nelem == NELEM1LINE-1 ) |
|---|
| 406 | { |
|---|
| 407 | |
|---|
| 408 | fprintf( ioQQQ, " " ); |
|---|
| 409 | for( i=0; i < NELEM1LINE; i++ ) |
|---|
| 410 | { |
|---|
| 411 | fprintf( ioQQQ, "%13.13s", chAllLabels[i] ); |
|---|
| 412 | } |
|---|
| 413 | fprintf( ioQQQ, "\n" ); |
|---|
| 414 | |
|---|
| 415 | nelem = 0; |
|---|
| 416 | } |
|---|
| 417 | else |
|---|
| 418 | { |
|---|
| 419 | |
|---|
| 420 | ++nelem; |
|---|
| 421 | } |
|---|
| 422 | } |
|---|
| 423 | # endif |
|---|
| 424 | |
|---|
| 425 | else if( strcmp(chJob,"flus") == 0 ) |
|---|
| 426 | { |
|---|
| 427 | |
|---|
| 428 | i = NELEM1LINE - (nelem - 2); |
|---|
| 429 | noffset = i/2-1; |
|---|
| 430 | |
|---|
| 431 | fprintf( ioQQQ, " " ); |
|---|
| 432 | |
|---|
| 433 | for(i=0; i < noffset; i++) |
|---|
| 434 | { |
|---|
| 435 | |
|---|
| 436 | fprintf( ioQQQ, " " ); |
|---|
| 437 | } |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | if( !(nelem%2) && nelem > 0) |
|---|
| 441 | fprintf( ioQQQ," "); |
|---|
| 442 | |
|---|
| 443 | for( i=0; i < nelem; i++ ) |
|---|
| 444 | { |
|---|
| 445 | fprintf( ioQQQ, "%13.13s", chAllLabels[i] ); |
|---|
| 446 | } |
|---|
| 447 | |
|---|
| 448 | fprintf( ioQQQ, "\n" ); |
|---|
| 449 | } |
|---|
| 450 | else |
|---|
| 451 | { |
|---|
| 452 | fprintf( ioQQQ, " PrtElem does not understand job=%4.4s\n", |
|---|
| 453 | chJob ); |
|---|
| 454 | cdEXIT(EXIT_FAILURE); |
|---|
| 455 | } |
|---|
| 456 | return; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | double AbundancesTable(double r0, |
|---|
| 462 | double depth, |
|---|
| 463 | long int iel) |
|---|
| 464 | { |
|---|
| 465 | bool lgHit; |
|---|
| 466 | long int j; |
|---|
| 467 | double frac, |
|---|
| 468 | tababun_v, |
|---|
| 469 | x; |
|---|
| 470 | |
|---|
| 471 | DEBUG_ENTRY( "AbundancesTable()" ); |
|---|
| 472 | |
|---|
| 473 | |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | if( abund.lgAbTaDepth[iel-1] ) |
|---|
| 477 | { |
|---|
| 478 | |
|---|
| 479 | x = log10(depth); |
|---|
| 480 | } |
|---|
| 481 | else |
|---|
| 482 | { |
|---|
| 483 | |
|---|
| 484 | x = log10(r0); |
|---|
| 485 | } |
|---|
| 486 | |
|---|
| 487 | |
|---|
| 488 | tababun_v = -DBL_MAX; |
|---|
| 489 | |
|---|
| 490 | if( x < abund.AbTabRad[0][iel-1] || x >= abund.AbTabRad[abund.nAbunTabl-1][iel-1] ) |
|---|
| 491 | { |
|---|
| 492 | fprintf( ioQQQ, " requested radius outside range of AbundancesTable\n" ); |
|---|
| 493 | fprintf( ioQQQ, " radius was%10.2e min, max=%10.2e%10.2e\n", |
|---|
| 494 | x, abund.AbTabRad[0][iel-1], abund.AbTabRad[abund.nAbunTabl-1][iel-1] ); |
|---|
| 495 | cdEXIT(EXIT_FAILURE); |
|---|
| 496 | } |
|---|
| 497 | |
|---|
| 498 | else |
|---|
| 499 | { |
|---|
| 500 | lgHit = false; |
|---|
| 501 | j = 1; |
|---|
| 502 | |
|---|
| 503 | while( !lgHit && j <= abund.nAbunTabl - 1 ) |
|---|
| 504 | { |
|---|
| 505 | if( abund.AbTabRad[j-1][iel-1] <= (realnum)x && |
|---|
| 506 | abund.AbTabRad[j][iel-1] > (realnum)x ) |
|---|
| 507 | { |
|---|
| 508 | frac = (x - abund.AbTabRad[j-1][iel-1])/(abund.AbTabRad[j][iel-1] - |
|---|
| 509 | abund.AbTabRad[j-1][iel-1]); |
|---|
| 510 | tababun_v = abund.AbTabFac[j-1][iel-1] + frac* |
|---|
| 511 | (abund.AbTabFac[j][iel-1] - abund.AbTabFac[j-1][iel-1]); |
|---|
| 512 | lgHit = true; |
|---|
| 513 | } |
|---|
| 514 | ++j; |
|---|
| 515 | } |
|---|
| 516 | |
|---|
| 517 | if( !lgHit ) |
|---|
| 518 | { |
|---|
| 519 | fprintf( ioQQQ, " radius outran dlaw table scale, requested=%6.2f largest=%6.2f\n", |
|---|
| 520 | x, abund.AbTabRad[abund.nAbunTabl-1][iel-1] ); |
|---|
| 521 | cdEXIT(EXIT_FAILURE); |
|---|
| 522 | } |
|---|
| 523 | } |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | tababun_v = pow(10.,tababun_v); |
|---|
| 527 | return( tababun_v ); |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | #ifdef _MSC_VER |
|---|
| 531 | # pragma warning( disable : 4305 ) |
|---|
| 532 | |
|---|
| 533 | #endif |
|---|
| 534 | |
|---|
| 535 | void AbundancesZero(void) |
|---|
| 536 | { |
|---|
| 537 | long int i; |
|---|
| 538 | |
|---|
| 539 | DEBUG_ENTRY( "AbundancesZero()" ); |
|---|
| 540 | |
|---|
| 541 | |
|---|
| 542 | |
|---|
| 543 | |
|---|
| 544 | abund.SolarSave[ipHYDROGEN] = 1.0f; |
|---|
| 545 | abund.SolarSave[ipHELIUM] = 0.100f; |
|---|
| 546 | abund.SolarSave[ipLITHIUM] = 2.04e-9f; |
|---|
| 547 | abund.SolarSave[ipBERYLLIUM] = 2.63e-11f; |
|---|
| 548 | abund.SolarSave[ipBORON] = 6.17E-10f; |
|---|
| 549 | |
|---|
| 550 | |
|---|
| 551 | |
|---|
| 552 | abund.SolarSave[ipCARBON] = 2.45e-4f; |
|---|
| 553 | |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | abund.SolarSave[ipNITROGEN] = 8.51e-5f; |
|---|
| 559 | |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | abund.SolarSave[ipOXYGEN] = 4.90e-4f; |
|---|
| 563 | abund.SolarSave[ipFLUORINE] = 3.02e-8f; |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | |
|---|
| 568 | |
|---|
| 569 | abund.SolarSave[ipNEON] = 1.00e-4f; |
|---|
| 570 | abund.SolarSave[ipSODIUM] = 2.14e-6f; |
|---|
| 571 | |
|---|
| 572 | |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | |
|---|
| 576 | abund.SolarSave[ipMAGNESIUM] = 3.47e-5f; |
|---|
| 577 | abund.SolarSave[ipALUMINIUM] = 2.95e-6f; |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | |
|---|
| 581 | |
|---|
| 582 | |
|---|
| 583 | abund.SolarSave[ipSILICON] = 3.47e-5f; |
|---|
| 584 | abund.SolarSave[ipPHOSPHORUS] = 3.20e-7f; |
|---|
| 585 | abund.SolarSave[ipSULPHUR] = 1.84e-5f; |
|---|
| 586 | abund.SolarSave[ipCHLORINE] = 1.91e-7f; |
|---|
| 587 | abund.SolarSave[ipARGON] = 2.51e-6f; |
|---|
| 588 | abund.SolarSave[ipPOTASSIUM] = 1.32e-7f; |
|---|
| 589 | abund.SolarSave[ipCALCIUM] = 2.29e-6f; |
|---|
| 590 | abund.SolarSave[ipSCANDIUM] = 1.48e-9f; |
|---|
| 591 | abund.SolarSave[ipTITANIUM] = 1.05e-7f; |
|---|
| 592 | abund.SolarSave[ipVANADIUM] = 1.00e-8f; |
|---|
| 593 | abund.SolarSave[ipCHROMIUM] = 4.68e-7f; |
|---|
| 594 | abund.SolarSave[ipMANGANESE] = 2.88e-7f; |
|---|
| 595 | |
|---|
| 596 | |
|---|
| 597 | |
|---|
| 598 | |
|---|
| 599 | |
|---|
| 600 | abund.SolarSave[ipIRON] = 2.82e-5f; |
|---|
| 601 | abund.SolarSave[ipCOBALT] = 8.32e-8f; |
|---|
| 602 | abund.SolarSave[ipNICKEL] = 1.78e-6f; |
|---|
| 603 | abund.SolarSave[ipCOPPER] = 1.62e-8f; |
|---|
| 604 | abund.SolarSave[ipZINC] = 3.98e-8f; |
|---|
| 605 | |
|---|
| 606 | |
|---|
| 607 | |
|---|
| 608 | abund.OldSolar84[ipHYDROGEN] = 1.0; |
|---|
| 609 | abund.OldSolar84[ipHELIUM] = 0.100; |
|---|
| 610 | abund.OldSolar84[ipLITHIUM] = 2.04e-9; |
|---|
| 611 | abund.OldSolar84[ipBERYLLIUM] = 2.63e-11; |
|---|
| 612 | abund.OldSolar84[ipBORON] = 7.59e-10; |
|---|
| 613 | abund.OldSolar84[ipCARBON] = 3.55e-4; |
|---|
| 614 | abund.OldSolar84[ipNITROGEN] = 9.33e-5; |
|---|
| 615 | abund.OldSolar84[ipOXYGEN] = 7.41e-4; |
|---|
| 616 | abund.OldSolar84[ipFLUORINE] = 3.02e-8; |
|---|
| 617 | abund.OldSolar84[ipNEON] = 1.17e-4; |
|---|
| 618 | abund.OldSolar84[ipSODIUM] = 2.06e-6; |
|---|
| 619 | abund.OldSolar84[ipMAGNESIUM] = 3.80e-5; |
|---|
| 620 | abund.OldSolar84[ipALUMINIUM] = 2.95e-6; |
|---|
| 621 | abund.OldSolar84[ipSILICON] = 3.55e-5; |
|---|
| 622 | abund.OldSolar84[ipPHOSPHORUS] = 3.73e-7; |
|---|
| 623 | abund.OldSolar84[ipSULPHUR] = 1.62e-5; |
|---|
| 624 | abund.OldSolar84[ipCHLORINE] = 1.88e-7; |
|---|
| 625 | abund.OldSolar84[ipARGON] = 3.98e-6; |
|---|
| 626 | abund.OldSolar84[ipPOTASSIUM] = 1.35e-7; |
|---|
| 627 | abund.OldSolar84[ipCALCIUM] = 2.29e-6; |
|---|
| 628 | abund.OldSolar84[ipSCANDIUM] = 1.58e-9; |
|---|
| 629 | abund.OldSolar84[ipTITANIUM] = 1.10e-7; |
|---|
| 630 | abund.OldSolar84[ipVANADIUM] = 1.05e-8; |
|---|
| 631 | abund.OldSolar84[ipCHROMIUM] = 4.84e-7; |
|---|
| 632 | abund.OldSolar84[ipMANGANESE] = 3.42e-7; |
|---|
| 633 | abund.OldSolar84[ipIRON] = 3.24e-5; |
|---|
| 634 | abund.OldSolar84[ipCOBALT] = 8.32e-8; |
|---|
| 635 | abund.OldSolar84[ipNICKEL] = 1.76e-6; |
|---|
| 636 | abund.OldSolar84[ipCOPPER] = 1.87e-8; |
|---|
| 637 | abund.OldSolar84[ipZINC] = 4.52e-8; |
|---|
| 638 | |
|---|
| 639 | |
|---|
| 640 | abund.anova[ipHYDROGEN] = 1.0; |
|---|
| 641 | abund.anova[ipHELIUM] = 0.098; |
|---|
| 642 | abund.anova[ipLITHIUM] = 2.04e-9; |
|---|
| 643 | abund.anova[ipBERYLLIUM] = 2.6e-11; |
|---|
| 644 | abund.anova[ipBORON] = 7.60e-9; |
|---|
| 645 | abund.anova[ipCARBON] = 9.4e-4; |
|---|
| 646 | abund.anova[ipNITROGEN] = 9.8e-3; |
|---|
| 647 | abund.anova[ipOXYGEN] = 1.7e-2; |
|---|
| 648 | abund.anova[ipFLUORINE] = 3.02e-8; |
|---|
| 649 | abund.anova[ipNEON] = 2.03e-3; |
|---|
| 650 | abund.anova[ipSODIUM] = 2.06e-6; |
|---|
| 651 | abund.anova[ipMAGNESIUM] = 3.80e-5; |
|---|
| 652 | abund.anova[ipALUMINIUM] = 2.95e-6; |
|---|
| 653 | abund.anova[ipSILICON] = 3.55e-5; |
|---|
| 654 | abund.anova[ipPHOSPHORUS] = 3.73e-7; |
|---|
| 655 | abund.anova[ipSULPHUR] = 1.62e-5; |
|---|
| 656 | abund.anova[ipCHLORINE] = 1.88e-7; |
|---|
| 657 | abund.anova[ipARGON] = 3.63e-6; |
|---|
| 658 | abund.anova[ipPOTASSIUM] = 1.35e-7; |
|---|
| 659 | abund.anova[ipCALCIUM] = 2.29e-6; |
|---|
| 660 | abund.anova[ipSCANDIUM] = 1.22e-9; |
|---|
| 661 | abund.anova[ipTITANIUM] = 8.60e-8; |
|---|
| 662 | abund.anova[ipVANADIUM] = 1.05e-8; |
|---|
| 663 | abund.anova[ipCHROMIUM] = 4.84e-7; |
|---|
| 664 | abund.anova[ipMANGANESE] = 3.42e-7; |
|---|
| 665 | abund.anova[ipIRON] = 4.68e-5; |
|---|
| 666 | abund.anova[ipCOBALT] = 2.24e-9; |
|---|
| 667 | abund.anova[ipNICKEL] = 1.76e-6; |
|---|
| 668 | abund.anova[ipCOPPER] = 1.87e-8; |
|---|
| 669 | abund.anova[ipZINC] = 4.52e-8; |
|---|
| 670 | |
|---|
| 671 | |
|---|
| 672 | abund.aprim[ipHYDROGEN] = 1.0; |
|---|
| 673 | abund.aprim[ipHELIUM] = 0.072; |
|---|
| 674 | abund.aprim[ipLITHIUM] = 1e-10; |
|---|
| 675 | abund.aprim[ipBERYLLIUM] = 1e-16; |
|---|
| 676 | |
|---|
| 677 | for( i=4; i < LIMELM; i++ ) |
|---|
| 678 | { |
|---|
| 679 | abund.aprim[i] = 1e-25; |
|---|
| 680 | } |
|---|
| 681 | |
|---|
| 682 | |
|---|
| 683 | |
|---|
| 684 | abund.aism[ipHYDROGEN] = 1.; |
|---|
| 685 | abund.aism[ipHELIUM] = 0.098; |
|---|
| 686 | abund.aism[ipLITHIUM] = 5.4e-11; |
|---|
| 687 | abund.aism[ipBERYLLIUM] = 1e-20; |
|---|
| 688 | abund.aism[ipBORON] = 8.9e-11; |
|---|
| 689 | abund.aism[ipCARBON] = 2.51e-4; |
|---|
| 690 | abund.aism[ipNITROGEN] = 7.94e-5; |
|---|
| 691 | |
|---|
| 692 | |
|---|
| 693 | |
|---|
| 694 | abund.aism[ipOXYGEN] = 3.19e-4; |
|---|
| 695 | abund.aism[ipFLUORINE] = 1e-20; |
|---|
| 696 | abund.aism[ipNEON] = 1.23e-4; |
|---|
| 697 | abund.aism[ipSODIUM] = 3.16e-7; |
|---|
| 698 | abund.aism[ipMAGNESIUM] = 1.26e-5; |
|---|
| 699 | abund.aism[ipALUMINIUM] = 7.94e-8; |
|---|
| 700 | abund.aism[ipSILICON] = 3.16e-6; |
|---|
| 701 | abund.aism[ipPHOSPHORUS] = 1.6e-7; |
|---|
| 702 | abund.aism[ipSULPHUR] = 3.24e-5; |
|---|
| 703 | abund.aism[ipCHLORINE] = 1e-7; |
|---|
| 704 | abund.aism[ipARGON] = 2.82e-6; |
|---|
| 705 | abund.aism[ipPOTASSIUM] = 1.1e-8; |
|---|
| 706 | abund.aism[ipCALCIUM] = 4.1e-10; |
|---|
| 707 | abund.aism[ipSCANDIUM] = 1e-20; |
|---|
| 708 | abund.aism[ipTITANIUM] = 5.8e-10; |
|---|
| 709 | abund.aism[ipVANADIUM] = 1.0e-10; |
|---|
| 710 | abund.aism[ipCHROMIUM] = 1.0e-8; |
|---|
| 711 | abund.aism[ipMANGANESE] = 2.3e-8; |
|---|
| 712 | abund.aism[ipIRON] = 6.31e-7; |
|---|
| 713 | abund.aism[ipCOBALT] = 1e-20; |
|---|
| 714 | abund.aism[ipNICKEL] = 1.82e-8; |
|---|
| 715 | abund.aism[ipCOPPER] = 1.5e-9; |
|---|
| 716 | abund.aism[ipZINC] = 2.0e-8; |
|---|
| 717 | |
|---|
| 718 | |
|---|
| 719 | |
|---|
| 720 | |
|---|
| 721 | abund.ahii[ipHYDROGEN] = 1.; |
|---|
| 722 | abund.ahii[ipHELIUM] = 0.095; |
|---|
| 723 | abund.ahii[ipLITHIUM] = 5.4e-11; |
|---|
| 724 | abund.ahii[ipBERYLLIUM] = 1e-20; |
|---|
| 725 | abund.ahii[ipBORON] = 8.9e-11; |
|---|
| 726 | abund.ahii[ipCARBON] = 3.e-4; |
|---|
| 727 | abund.ahii[ipNITROGEN] = 7.0e-5; |
|---|
| 728 | abund.ahii[ipOXYGEN] = 4.0e-4; |
|---|
| 729 | abund.ahii[ipFLUORINE] = 1e-20; |
|---|
| 730 | abund.ahii[ipNEON] = 6e-5; |
|---|
| 731 | abund.ahii[ipSODIUM] = 3e-7; |
|---|
| 732 | abund.ahii[ipMAGNESIUM] = 3.e-6; |
|---|
| 733 | abund.ahii[ipALUMINIUM] = 2.e-7; |
|---|
| 734 | abund.ahii[ipSILICON] = 4.e-6; |
|---|
| 735 | abund.ahii[ipPHOSPHORUS] = 1.6e-7; |
|---|
| 736 | abund.ahii[ipSULPHUR] = 1.0e-5; |
|---|
| 737 | abund.ahii[ipCHLORINE] = 1.e-7; |
|---|
| 738 | abund.ahii[ipARGON] = 3.e-6; |
|---|
| 739 | abund.ahii[ipPOTASSIUM] = 1.1e-8; |
|---|
| 740 | abund.ahii[ipCALCIUM] = 2.e-8; |
|---|
| 741 | abund.ahii[ipSCANDIUM] = 1e-20; |
|---|
| 742 | abund.ahii[ipTITANIUM] = 5.8e-10; |
|---|
| 743 | abund.ahii[ipVANADIUM] = 1.0e-10; |
|---|
| 744 | abund.ahii[ipCHROMIUM] = 1.0e-8; |
|---|
| 745 | abund.ahii[ipMANGANESE] = 2.3e-8; |
|---|
| 746 | abund.ahii[ipIRON] = 3.0e-6; |
|---|
| 747 | abund.ahii[ipCOBALT] = 1e-20; |
|---|
| 748 | abund.ahii[ipNICKEL] = 1e-7; |
|---|
| 749 | abund.ahii[ipCOPPER] = 1.5e-9; |
|---|
| 750 | abund.ahii[ipZINC] = 2.0e-8; |
|---|
| 751 | |
|---|
| 752 | |
|---|
| 753 | |
|---|
| 754 | abund.apn[ipHYDROGEN] = 1.; |
|---|
| 755 | abund.apn[ipHELIUM] = 0.1; |
|---|
| 756 | abund.apn[ipLITHIUM] = 1e-20; |
|---|
| 757 | abund.apn[ipBERYLLIUM] = 1e-20; |
|---|
| 758 | abund.apn[ipBORON] = 1e-20; |
|---|
| 759 | abund.apn[ipCARBON] = 7.8e-4; |
|---|
| 760 | abund.apn[ipNITROGEN] = 1.8e-4; |
|---|
| 761 | abund.apn[ipOXYGEN] = 4.4e-4; |
|---|
| 762 | abund.apn[ipFLUORINE] = 3e-7; |
|---|
| 763 | abund.apn[ipNEON] = 1.1e-4; |
|---|
| 764 | abund.apn[ipSODIUM] = 1.9e-6; |
|---|
| 765 | abund.apn[ipMAGNESIUM] = 1.6e-6; |
|---|
| 766 | abund.apn[ipALUMINIUM] = 2.7e-7; |
|---|
| 767 | abund.apn[ipSILICON] = 1e-5; |
|---|
| 768 | abund.apn[ipPHOSPHORUS] = 2e-7; |
|---|
| 769 | abund.apn[ipSULPHUR] = 1e-5; |
|---|
| 770 | abund.apn[ipCHLORINE] = 1.7e-7; |
|---|
| 771 | abund.apn[ipARGON] = 2.7e-6; |
|---|
| 772 | abund.apn[ipPOTASSIUM] = 1.2e-7; |
|---|
| 773 | abund.apn[ipCALCIUM] = 1.2e-8; |
|---|
| 774 | abund.apn[ipSCANDIUM] = 1e-20; |
|---|
| 775 | abund.apn[ipTITANIUM] = 1e-20; |
|---|
| 776 | abund.apn[ipVANADIUM] = 1e-20; |
|---|
| 777 | abund.apn[ipCHROMIUM] = 1e-20; |
|---|
| 778 | abund.apn[ipMANGANESE] = 1e-20; |
|---|
| 779 | abund.apn[ipIRON] = 5.0e-7; |
|---|
| 780 | abund.apn[ipCOBALT] = 1e-20; |
|---|
| 781 | abund.apn[ipNICKEL] = 1.8e-8; |
|---|
| 782 | abund.apn[ipCOPPER] = 1e-20; |
|---|
| 783 | abund.apn[ipZINC] = 1e-20; |
|---|
| 784 | |
|---|
| 785 | |
|---|
| 786 | abund.camern[ipHYDROGEN] = 1.; |
|---|
| 787 | abund.camern[ipHELIUM] = .0677; |
|---|
| 788 | abund.camern[ipLITHIUM] = 2.2e-9; |
|---|
| 789 | abund.camern[ipBERYLLIUM] = 4.5e-11; |
|---|
| 790 | abund.camern[ipBORON] = 3.4e-10; |
|---|
| 791 | abund.camern[ipCARBON] = 4.22e-4; |
|---|
| 792 | abund.camern[ipNITROGEN] = 8.72e-5; |
|---|
| 793 | abund.camern[ipOXYGEN] = 6.93e-4; |
|---|
| 794 | abund.camern[ipFLUORINE] = 2.9e-8; |
|---|
| 795 | abund.camern[ipNEON] = 9.77e-5; |
|---|
| 796 | abund.camern[ipSODIUM] = 2.25e-6; |
|---|
| 797 | abund.camern[ipMAGNESIUM] = 3.98e-5; |
|---|
| 798 | abund.camern[ipALUMINIUM] = 3.20e-6; |
|---|
| 799 | abund.camern[ipSILICON] = 3.76e-5; |
|---|
| 800 | abund.camern[ipPHOSPHORUS] = 2.4e-7; |
|---|
| 801 | abund.camern[ipSULPHUR] = 1.88e-5; |
|---|
| 802 | abund.camern[ipCHLORINE] = 1.78e-7; |
|---|
| 803 | abund.camern[ipARGON] = 3.99e-6; |
|---|
| 804 | abund.camern[ipPOTASSIUM] = 1.3e-7; |
|---|
| 805 | abund.camern[ipCALCIUM] = 2.35e-6; |
|---|
| 806 | abund.camern[ipSCANDIUM] = 1.16e-9; |
|---|
| 807 | abund.camern[ipTITANIUM] = 9.0e-8; |
|---|
| 808 | abund.camern[ipVANADIUM] = 9.5e-9; |
|---|
| 809 | abund.camern[ipCHROMIUM] = 4.8e-7; |
|---|
| 810 | abund.camern[ipMANGANESE] = 3.5e-7; |
|---|
| 811 | abund.camern[ipIRON] = 3.38e-5; |
|---|
| 812 | abund.camern[ipCOBALT] = 8.27e-8; |
|---|
| 813 | abund.camern[ipNICKEL] = 1.80e-6; |
|---|
| 814 | abund.camern[ipCOPPER] = 2.0e-8; |
|---|
| 815 | abund.camern[ipZINC] = 4.7e-8; |
|---|
| 816 | |
|---|
| 817 | |
|---|
| 818 | |
|---|
| 819 | for( i=0; i < LIMELM; i++ ) |
|---|
| 820 | { |
|---|
| 821 | abund.lgAGN[i] = false; |
|---|
| 822 | } |
|---|
| 823 | abund.lgAGN[ipHYDROGEN] = true; |
|---|
| 824 | abund.lgAGN[ipHELIUM] = true; |
|---|
| 825 | abund.lgAGN[ipCARBON] = true; |
|---|
| 826 | abund.lgAGN[ipNITROGEN] = true; |
|---|
| 827 | abund.lgAGN[ipOXYGEN] = true; |
|---|
| 828 | abund.lgAGN[ipNEON] = true; |
|---|
| 829 | abund.lgAGN[ipMAGNESIUM] = true; |
|---|
| 830 | abund.lgAGN[ipSILICON] = true; |
|---|
| 831 | abund.lgAGN[ipSULPHUR] = true; |
|---|
| 832 | abund.lgAGN[ipARGON] = true; |
|---|
| 833 | abund.lgAGN[ipIRON] = true; |
|---|
| 834 | return; |
|---|
| 835 | } |
|---|