/* ------------- file: -------------------- saha.c ------------------- */ /* Evaluates: the Boltzmann equilibrium relation * input - statisical weights of different energy levels * - temperature * - energy difference levels in J * output - ratio nj/ni, dimensionless * Evaluates the Saha equilibrium relation * input - statisical weights of different ionization stages * - temperature * - ionization energy in J * - electron density (or set to 1) * output - ratio ni/(nc*ne) in units of m^3. * OR - ratio ni/nc unitless if ne is input as 1 * * Sara Seager * Last modified: July 11, 1995 */ #include #include "constant.h" /* -----------begin -----------------------Boltzmann.c---------------------- */ double Boltzmann(double gj, double gi, double E, double T ) { /* --- Computes nj/ni where j is the higher level ------------- */ return ( (gj/gi) * exp(-E/(kBoltz*T)) ); } /* ----------end -------------------------Boltzmann.c ---------------------- */ /* --------- begin ----------------------- SahaBoltz.c --------------------- */ double SahaBoltz(double gi, double gc, double ne, double E_ion, double T) { /* --- the form is ni/(nc*ne) i is the lower ionization state -------------- */ double c1; c1 = (hPlanck/(2.0*PI*mElect)) * (hPlanck/kBoltz); return (ne * gi/(2.0*gc) * pow(c1, 1.5) * pow(T, -1.5) * exp(E_ion/(kBoltz*T)) ); } /* ----------- end -------------------- SahaBoltz.c ------------------------ */