00001
00002
00003
00004 #include "cddefines.h"
00005 #include "iso.h"
00006 #include "rfield.h"
00007 #include "dense.h"
00008 #include "heavy.h"
00009 #include "opacity.h"
00010
00011 void OpacityAdd1Element(
00012
00013 long int nelem)
00014 {
00015 long int ipHi,
00016 ipop,
00017 limit,
00018 low,
00019 n,
00020 ion,
00021 nshell;
00022 char chStat;
00023 double abundance;
00024
00025 DEBUG_ENTRY( "OpacityAdd1Element()" );
00026
00027
00028
00029
00030 ASSERT( (nelem >=0 ) && (nelem < LIMELM) );
00031
00032
00033
00034 limit = nelem + 1 - NISO;
00035
00036
00037 limit = MAX2( 0 , limit );
00038
00039
00040
00041 for( ion=0; ion < limit; ion++ )
00042 {
00043 if( dense.xIonDense[nelem][ion] > 0. )
00044 {
00045
00046
00047 chStat = 's';
00048
00049 for( nshell=0; nshell < Heavy.nsShells[nelem][ion]; nshell++ )
00050 {
00051
00052 if( nshell== Heavy.nsShells[nelem][ion]-1 )
00053 chStat = 'v';
00054
00055 low = opac.ipElement[nelem][ion][nshell][0];
00056 ipHi = opac.ipElement[nelem][ion][nshell][1];
00057 ipop = opac.ipElement[nelem][ion][nshell][2];
00058
00059 OpacityAdd1Subshell(ipop,low,ipHi,dense.xIonDense[nelem][ion] , chStat );
00060 }
00061 }
00062 }
00063
00064
00065
00066
00067 for( ion=limit; ion<nelem+1; ++ion )
00068 {
00069
00070 long int ipISO = nelem-ion;
00071
00072
00073
00074
00075
00076
00077 if( dense.xIonDense[nelem][ion] > 0. )
00078 {
00079 ASSERT( ipISO < NISO );
00080
00081
00082 n = 0;
00083
00084 abundance = StatesElem[ipISO][nelem][n].Pop*dense.xIonDense[nelem][ion+1];
00085
00086
00087
00088 if( abundance == 0. )
00089 {
00090
00091 abundance = dense.xIonDense[nelem][ion];
00092 }
00093
00094
00095
00096 OpacityAdd1SubshellInduc(
00097 iso.ipOpac[ipISO][nelem][n],
00098 iso.ipIsoLevNIonCon[ipISO][nelem][n],
00099
00100
00101 rfield.nflux,
00102
00103 abundance,
00104
00105 iso.DepartCoef[ipISO][nelem][n] , 'v' );
00106
00107
00108
00109 if( StatesElem[ipISO][nelem][3].Pop*dense.xIonDense[nelem][ion+1] > 0. )
00110 {
00111 char chType = 'v';
00112
00113
00114 for( long level =1; level < iso.numLevels_local[ipISO][nelem]; level++ )
00115 {
00116
00117 if( StatesElem[ipISO][nelem][level].n >= 5 )
00118 chType = 's';
00119
00120
00121 OpacityAdd1SubshellInduc(
00122 iso.ipOpac[ipISO][nelem][level],
00123 iso.ipIsoLevNIonCon[ipISO][nelem][level],
00124
00125
00126 iso.ipIsoLevNIonCon[ipISO][nelem][0],
00127 StatesElem[ipISO][nelem][level].Pop*dense.xIonDense[nelem][ion+1],
00128
00129 iso.DepartCoef[ipISO][nelem][level] , chType );
00130 }
00131 }
00132 }
00133 }
00134 return;
00135 }