92 long int ion , nshell , low , ihi , ipop , ip;
117 for( ip=low-1; ip < ihi; ip++ )
160 fprintf(
ioQQQ,
" OpacityCreateAll called but NOT evaluated since already done.\n" );
171 fprintf(
ioQQQ,
" OpacityCreateAll called, evaluating.\n" );
186 for( nelem=ipISO; nelem <
LIMELM; nelem++ )
198 fixit(
"opacities really need to be owned by states or species");
210 long ipThresh =
iso_sp[ipISO][nelem].
fb[index].ipIsoLevNIonCon-1;
215 need = nupper - ipThresh;
221 for( i=ipThresh; i < nupper; i++ )
225 if( index==
iso_sp[ipISO][nelem].numLevels_max-1 )
240 for( vector< diss_tran >::iterator tran = (*diatom)->Diss_Trans.begin(); tran != (*diatom)->Diss_Trans.end(); ++tran )
243 long lower_limit =
ipoint(tran->energies[0]);
244 long upper_limit =
ipoint(tran->energies.back());
253 for(i = lower_limit; i <= upper_limit; ++i)
296 dx)/
POW3(dx)*(2.e0*dx*(1.e0 + dx)/(1.e0 + 2.e0*dx) - log(1.e0+
297 2.e0*dx)) + 1.e0/2.e0/dx*log(1.e0+2.e0*dx) - (1.e0 + 3.e0*
298 dx)/
POW3(1.e0 + 2.e0*dx));
322 POW2((-0.46737118 + x*(0.349255416 + x*0.002179893))/(1. +
323 x*(0.130471301 + x*0.000524906)));
373 const long nCSH2P = 5;
374 static const realnum enh2p[nCSH2P]={6.75f,8.68f,10.54f,12.46f,14.28f};
375 static const realnum csh2p[nCSH2P]={0.24f, 2.5f, 7.1f, 6.0f, 2.7f};
382 const long nCSH2P_ex = 9;
385 static const realnum enh2p_ex[nCSH2P_ex]={0.69f,0.83f,0.95f,1.03f,1.24f,1.38f,1.77f,2.48f,14.28f};
386 static const realnum csh2p_ex[nCSH2P_ex]={1e-5f,1e-4f,0.01f,0.08f, 2.0f,10.0f,20.0f, 8.0f, 1.0f};
413 for( nelem=2; nelem <
LIMELM; nelem++ )
452 for(
long n=1; n < 6; n++ )
502 (0.2602325880970085 +
503 445.8558249365131*exp(-
rfield.
anu(i)/0.1009243952792674))*
517 " OpacityCreateAll return OK, number of opacity cells used in OPSC= %ld and OPSV is dimensioned %ld\n",
525 fprintf(
ioQQQ,
"The COMPILE OPACITIES command is currently not supported\n" );
531 " Please consider revising ndimOpacityStack=%li in OpacityCreateAll, a total of %li cells were needed.\n\n" ,
565 for( i=ilo-1; i < ihi; i++ )
603 fprintf(
ioQQQ,
" Too many opacities were entered into OpacityCreateReilMan. Increase the value of NOP.\n" );
609 fprintf(
ioQQQ,
" Too few opacities were entered into OpacityCreateReilMan.\n" );
617 for( i=0; i < ncr; i++ )
619 en[i] = energ[i]/13.6f;
620 cs[i] = cross[i]*1e-18f;
627 " OpacityCreateReilMan: The entered opacity energy bandwidth is not large enough (low fail).\n" );
629 " The desired energy (Ryd) was%12.5eeV and the lowest entered in the array was%12.5e eV\n",
633 fprintf(
ioQQQ,
" The original energy (eV) and cross section (mb) arrays follow:\n" );
636 for( i=0; i < ncr; i++ )
646 slope = (cs[1] - cs[0])/(en[1] - en[0]);
653 for( i=low-1; i < ihi; i++ )
666 fprintf(
ioQQQ,
" OpacityCreateReilMan: The entered opacity energy bandwidth is not large enough (high fail).\n" );
667 fprintf(
ioQQQ,
" The entered energy was %10.2eeV and the highest in the array was %10.2eeV\n",
671 fprintf(
ioQQQ,
" The lowest energy enterd in the array was%10.2e eV\n",
673 fprintf(
ioQQQ,
" The highest energy ever needed would be%10.2eeV\n",
675 fprintf(
ioQQQ,
" The lowest energy needed was%10.2eeV\n",
680 slope = (cs[ics] - cs[ics-1])/(en[ics] - en[ics-1]);
689 fprintf(
ioQQQ,
" Internal logical error in OpacityCreateReilMan.\n" );
690 fprintf(
ioQQQ,
" The desired energy (%10.2eeV), I=%5ld, is not within the next energy bound%10.2e%10.2e\n",
691 rfield.
anu(i)*13.6, i, en[ics-1], en[ics] );
693 fprintf(
ioQQQ,
" The previous energy (eV) was%10.2e\n",
696 fprintf(
ioQQQ,
" Here comes the energy array. ICS=%4ld\n",
699 for( j=0; j < ncr; j++ )
721 static const double y[7][5] = {
722 {8.915,3995.,3.242,10.44,0.0},
723 {11.31,1498.,5.27,7.319,0.0},
724 {10.5,1.059e05,1.263,13.04,0.0},
725 {19.49,48.47,8.806,5.983,0.0},
726 {50.,4.244e04,0.1913,7.012,4.454e-02},
727 {110.5,0.1588,148.3,-3.38,3.589e-02},
728 {177.4,32.37,381.2,1.083,0.0}
730 static const double eth[7]={13.62,16.94,18.79,28.48,50.,110.5,538.};
731 static const long l[7]={1,1,1,0,1,1,0};
746 for(
int i=0; i < 7; i++ )
751 for(
int i=0; i < 7; i++ )
757 double q = 5.5 - 0.5*y[i][3] + l[i];
759 double x = e/y[i][0];
762 pow(x,q)/pow(1.0 + sqrt(x/y[i][2]),y[i][3]));
796 for( ion=0; ion < nelem; ion++ )
806 nelec = nelem+1 - ion;
809 for( nshell=0; nshell <
Heavy.
nsShells[nelem][ion]; nshell++ )
831 ASSERT( low <= ihi || low<5 );
834 for( ip=low-1; ip < ihi; ip++ )
891 fprintf(
ioQQQ,
" NOTE OpacityCreate1Element needed more opacity cells than ndimOpacityStack, please consider increasing it.\n" );
922 ASSERT( crs > 0. && crs < 1e-10 );
924 else if( index <
iso_sp[ipISO][nelem].numLevels_max -
iso_sp[ipISO][nelem].nCollapsed_max )
927 double photon =
MAX2( EgammaRyd/
iso_sp[ipISO][nelem].fb[index].xIsoLevNIonRyd, 1. + FLT_EPSILON*2. );
931 ASSERT( crs > 0. && crs < 1e-10 );
941 EgammaRyd =
MAX2( EgammaRyd ,
iso_sp[ipISO][nelem].fb[index].xIsoLevNIonRyd*1.001f );
945 ASSERT( crs > 0. && crs < 1e-10 );
950 double photon =
MAX2( EgammaRyd/
iso_sp[ipISO][nelem].fb[index].xIsoLevNIonRyd, 1. + FLT_EPSILON*2. );
958 ASSERT( crs > 0. && crs < 1e-10 );
963 EgammaRyd =
MAX2( EgammaRyd ,
iso_sp[ipISO][nelem].fb[index].xIsoLevNIonRyd);
975 (EgammaRyd <
iso_sp[ipISO][nelem].fb[index].xIsoLevNIonRyd*1.02) ||
976 (crs > 0. && crs < 1e-10) );
991 ASSERT( crs > 0. && crs < 1e-10 );
1008 static double y2[
NCRS];
1009 static double crs[
NCRS]={0.,0.124,0.398,0.708,1.054,1.437,1.805,
1010 2.176,2.518,2.842,3.126,3.377,3.580,3.741,3.851,3.913,3.925,
1011 3.887,3.805,3.676,3.511,3.306,3.071,2.810,2.523,2.219,1.898,
1012 1.567,1.233,.912,.629,.39,.19};
1013 static double ener[
NCRS]={0.,0.001459,0.003296,0.005256,0.007351,
1014 0.009595,0.01201,0.01460,0.01741,0.02044,0.02375,0.02735,0.03129,
1015 0.03563,0.04043,0.04576,0.05171,0.05841,0.06601,0.07469,0.08470,
1016 0.09638,0.1102,0.1268,0.1470,0.1723,0.2049,0.2483,0.3090,0.4001,
1017 0.5520,0.8557,1.7669};
1018 static bool lgFirst =
true;
1035 energy = freq - HMINUSIONPOT;
1036 if( energy < ener[0] || energy > ener[
NCRS-1] )
1069 rayleh_v = (8.41e-25*
powi(ener,4) + 3.37e-24*
powi(ener,6))*
1073 else if( ener < 0.646 )
1075 rayleh_v = (8.41e-25*
powi(ener,4) + 3.37e-24*
powi(ener,6) +
1079 else if( ener >= 0.646 && ener < 1.0 )
1081 rayleh_v = fabs(0.74959-ener);
1082 rayleh_v = 1.788e5/
POW2(FR1RYD*
MAX2(0.001,rayleh_v));
t_mole_global mole_global
long int ipElement[LIMELM][LIMELM][7][3]
STATIC void opacity_more_memory(void)
STATIC void OpacityCreate1Element(long int nelem)
NORETURN void TotalInsanity(void)
realnum ph1(int i, int j, int k, int l) const
void OpacityCreateAll(void)
double anu(size_t i) const
void splint(const double xa[], const double ya[], const double y2a[], long int n, double x, double *y)
t_iso_sp iso_sp[NISO][LIMELM]
long int nflux_with_check
vector< double > HighestLevelOpacStack
long ipoint(double energy_ryd)
long int n_HighestResolved_max
void spline(const double x[], const double y[], long int n, double yp1, double ypn, double y2a[])
long int nsShells[LIMELM][LIMELM]
double energy(const genericState &gs)
phfit_version get_version() const
double anusqrt(size_t i) const
vector< diatomics * > diatoms
STATIC void OpacityCreateReilMan(long int low, long int ihi, const realnum energ[], const realnum cross[], long int ncr, long int *ipop, const char *chLabl)
double powi(double, long int)
STATIC void ofit(double e, realnum opart[])
double anumin(size_t i) const
double H_photo_cs(double rel_photon_energy, long int n, long int l, long int iz)
#define DEBUG_ENTRY(funcname)
double powpq(double x, int p, int q)
double hpfit(long int iz, long int n, double e)
STATIC double Opacity_iso_photo_cs(double energy, long ipISO, long nelem, long index)
STATIC double rayleh(double ener)
int fprintf(const Output &stream, const char *format,...)
STATIC void OpacityValenceRescale(long int nelem, double scale)
double anumax(size_t i) const
double He_cross_section(double EgammaRyd, double EthRyd, long n, long l, long S, long nelem)
static long int ndimOpacityStack
double MolDissocCrossSection(const diss_tran &tran, const double &Mol_Ene)
STATIC double hmiopc(double freq)
STATIC void OpacityCreatePowerLaw(long int ilo, long int ihi, double cross, double s, long int *ip)
double phfit(long int nz, long int ne, long int is, double e)
const int NHYDRO_MAX_LEVEL
vector< diatomics * >::iterator diatom_iter