Cloudy
Spectral Synthesis Code for Astrophysics
|
#include "cddefines.h"
#include "yield.h"
#include "prt.h"
#include "continuum.h"
#include "iso.h"
#include "dynamics.h"
#include "grainvar.h"
#include "newton_step.h"
#include "conv.h"
#include "secondaries.h"
#include "phycon.h"
#include "atmdat.h"
#include "heavy.h"
#include "elementnames.h"
#include "ionbal.h"
#include "trace.h"
#include "ion_trim.h"
#include "mole.h"
#include "freebound.h"
#include "dense.h"
#include "thirdparty.h"
Macros | |
#define | MAT(M_, I_, J_) ((M_)[(I_)*(ion_range)+(J_)]) |
#define | MAT1(M_, I_, J_) ((M_)[(I_)*(ion_range1)+(J_)]) |
#define | MAT2(M_, I_, J_) ((M_)[(I_)*(ion_range2)+(J_)]) |
Functions | |
STATIC bool | lgTrivialSolution (long nelem, double abund_total) |
STATIC void | find_solution (long nelem, long ion_range, valarray< double > &xmat, valarray< double > &source) |
STATIC void | fill_array (long int nelem, long ion_range, valarray< double > &xmat, valarray< double > &auger) |
STATIC void | fill_ext_src_and_snk (long nelem, long ion_low, long ion_range, valarray< double > &xmat, valarray< double > &source) |
STATIC double | get_total_abundance_ions (long int nelem) |
STATIC void | HomogeneousSource (long nelem, long ion_low, long ion_range, valarray< double > &xmat, valarray< double > &source, double abund_total) |
STATIC void | renorm_solution (long nelem, long ion_range, long ion_low, double *source, double abund_total, bool *lgNegPop) |
STATIC void | store_new_densities (long nelem, long ion_range, long ion_low, double *source) |
STATIC void | clean_up (long nelem, double abund_total) |
STATIC void | PrintRates (long nelem, bool lgNegPop, double abund_total, valarray< double > &auger, bool lgPrintIt) |
void | solveions (double *ion, double *rec, double *snk, double *src, long int nlev, long int nmax) |
void | ion_solver (long int nelem, bool lgPrintIt) |
void | ion_wrapper (long nelem) |
Referenced by fill_array(), fill_ext_src_and_snk(), find_solution(), HomogeneousSource(), and renorm_solution().
STATIC void clean_up | ( | long | nelem, |
double | abund_total | ||
) |
References ASSERT, DEBUG_ENTRY, dense, fixit, ion_trim_small(), t_dense::IonHigh, t_dense::IonLow, ipH_LIKE, iso_renorm(), and NISO.
Referenced by ion_solver().
STATIC void fill_array | ( | long int | nelem, |
long | ion_range, | ||
valarray< double > & | xmat, | ||
valarray< double > & | auger | ||
) |
References ASSERT, atmdat, t_atmdat::CharExcIonOf, t_atmdat::CharExcIonTotal, t_atmdat::CharExcRecTo, t_atmdat::CharExcRecTotal, t_ionbal::CollIonRate_Ground, t_secondaries::csupra, DEBUG_ENTRY, dense, t_yield::elec_eject_frac(), t_ionbal::elecsnk, t_ionbal::elecsrc, GrainVar::GrainChTrRate, gv, Heavy, Singleton< t_yield >::Inst(), ionbal, t_dense::IonHigh, t_dense::IonLow, iso_sp, t_atmdat::lgCTOn, GrainVar::lgDustOn(), t_ionbal::lgGrainIonRecom, GrainVar::lgGrainPhysicsOn, LIMELM, MAT, MIN2, mole, t_atmdat::NCX, t_yield::nelec_eject(), NISO, t_Heavy::nsShells, t_ionbal::PhotoRate_Shell, t_ionbal::RateIoniz, t_ionbal::RateRecomTot, SDIV(), secondaries, t_iso_sp::st, t_ionbal::UTA_ionize_rate, t_dense::xIonDense, and t_mole_local::xMoleChTrRate.
Referenced by ion_solver().
STATIC void fill_ext_src_and_snk | ( | long | nelem, |
long | ion_low, | ||
long | ion_range, | ||
valarray< double > & | xmat, | ||
valarray< double > & | source | ||
) |
References DEBUG_ENTRY, MAT, mole, t_mole_local::sink, and t_mole_local::source.
Referenced by ion_solver().
STATIC void find_solution | ( | long | nelem, |
long | ion_range, | ||
valarray< double > & | xmat, | ||
valarray< double > & | source | ||
) |
References ASSERT, cdEXIT, t_elementnames::chElementSym, conv, DEBUG_ENTRY, dense, t_dense::eden, elementnames, EXIT_FAILURE, fnzone, fprintf(), getrf_wrapper(), getrs_wrapper(), ionbal, t_dense::IonHigh, t_dense::IonLow, ioQQQ, ipHYDROGEN, isnan, MAT, MAX_DENSITY, mole, t_conv::nTotalIoniz, NULL, phycon, t_ionbal::RateIonizTot(), t_ionbal::RateRecomTot, t_mole_local::sink, solve_system(), t_mole_local::source, t_phycon::te, and t_dense::xIonDense.
Referenced by ion_solver().
STATIC double get_total_abundance_ions | ( | long int | nelem | ) |
References ASSERT, conv, DEBUG_ENTRY, dense, t_ionbal::elecsnk, t_ionbal::elecsrc, fp_equal_tol(), fprintf(), t_dense::gas_phase, t_conv::GasPhaseAbundErrorAllowed, ionbal, t_dense::IonHigh, t_dense::IonLow, ioQQQ, LIMELM, MAX_DENSITY, t_dense::xIonDense, and t_dense::xMolecules().
Referenced by ion_solver().
STATIC void HomogeneousSource | ( | long | nelem, |
long | ion_low, | ||
long | ion_range, | ||
valarray< double > & | xmat, | ||
valarray< double > & | source, | ||
double | abund_total | ||
) |
References ASSERT, conv, DEBUG_ENTRY, dense, t_dynamics::doNonEquilibriumSolve(), dynamics, fixit, fnzone, fprintf(), t_dense::gas_phase, ionbal, ioQQQ, ipHYDROGEN, iteration, t_dynamics::lgAdvection, t_dynamics::lgTimeDependentStatic, MAT, MAX2, mole, t_conv::nTotalIoniz, nzone, t_dynamics::Rate, t_ionbal::RateIonizTot(), t_ionbal::RateRecomTot, SDIV(), t_mole_local::sink, t_dynamics::Source, t_dense::xIonDense, and t_dense::xMolecules().
Referenced by ion_solver().
void ion_solver | ( | long int | nelem, |
bool | lgPrintIt | ||
) |
ion_solver solve the bi-diagonal matrix for ionization balance
nelem | - element number on C scale, He is 1 |
lgPrintIt | - option to print details of matrix elements |
References ASSERT, broken(), clean_up(), conv, DEBUG_ENTRY, dense, fill_array(), fill_ext_src_and_snk(), find_solution(), get_total_abundance_ions(), Heavy, HomogeneousSource(), ionbal, t_dense::IonHigh, t_dense::IonLow, ipCARBON, ipH_LIKE, iso_charge_transfer_update(), iso_departure_coefficients(), iso_satellite_update(), iso_set_ion_rates(), iso_solve(), t_prt::lgPrtArry, lgTrivialSolution(), LIMELM, MIN2, NISO, t_Heavy::nsShells, t_ionbal::PhotoRate_Shell, PrintRates(), prt, t_ionbal::RateRecomTot, t_conv::register_(), renorm_solution(), and store_new_densities().
Referenced by IonHelium(), IonHydro(), and IonNelem().
void ion_wrapper | ( | long | nelem | ) |
ion_wrapper a wrapper that redirects to IonHelium, IonCarbo, etc..
References ASSERT, t_elementnames::chElementSym, DEBUG_ENTRY, dense, elementnames, fprintf(), t_dense::gas_phase, IonHelium(), IonHydro(), IonNelem(), ioQQQ, ipHELIUM, ipHYDROGEN, lgElemsConserved(), t_dense::lgElmtOn, t_trace::lgHeavyBug, t_trace::lgTrace, LIMELM, trace, and t_dense::xIonDense.
Referenced by ConvBase().
STATIC bool lgTrivialSolution | ( | long | nelem, |
double | abund_total | ||
) |
References dense, t_dense::IonHigh, t_dense::IonLow, ipH_LIKE, iso_renorm(), t_dense::lgSetIoniz, NISO, t_dense::SetIoniz, and t_dense::xIonDense.
Referenced by ion_solver().
STATIC void PrintRates | ( | long | nelem, |
bool | lgNegPop, | ||
double | abund_total, | ||
valarray< double > & | auger, | ||
bool | lgPrintIt | ||
) |
References ASSERT, atmdat, cdEXIT, t_atmdat::CharExcIonOf, t_atmdat::CharExcIonTotal, t_atmdat::CharExcRecTo, t_atmdat::CharExcRecTotal, t_elementnames::chElementName, t_elementnames::chElementNameShort, t_elementnames::chElementSym, t_ionbal::CollIonRate_Ground, ContNegative(), conv, t_ionbal::CotaRate, t_secondaries::csupra, DEBUG_ENTRY, dense, t_ionbal::DR_Badnell_rate_coef, dynamics, t_dense::eden, t_dense::EdenHCorr, elementnames, EXIT_FAILURE, t_iso_sp::fb, fnzone, fprintf(), t_dense::gas_phase, GrainVar::GrainChTrRate, gv, Heavy, ionbal, t_dense::IonHigh, ioQQQ, ipHELIUM, ipHYDROGEN, iso_sp, t_dynamics::lgAdvection, t_prt::lgPrtArry, t_conv::lgSearch, t_dynamics::lgTimeDependentStatic, min(), mole, t_atmdat::NCX, NISO, t_Heavy::nsShells, t_iso_sp::numLevels_local, nzone, t_ionbal::PhotoRate_Shell, phycon, prt, t_dynamics::Rate, t_ionbal::RateIoniz, t_ionbal::RateIonizTot(), t_ionbal::RateRecomTot, t_ionbal::RR_rate_coef_used, SDIV(), secondaries, ShowMe(), t_mole_local::sink, t_dynamics::Source, t_mole_local::source, t_iso_sp::st, t_phycon::te, TorF(), t_ionbal::UTA_ionize_rate, t_dense::xIonDense, t_mole_local::xMoleChTrRate, and t_dense::xMolecules().
Referenced by ion_solver().
STATIC void renorm_solution | ( | long | nelem, |
long | ion_range, | ||
long | ion_low, | ||
double * | source, | ||
double | abund_total, | ||
bool * | lgNegPop | ||
) |
References ASSERT, t_elementnames::chElementSym, conv, DEBUG_ENTRY, dense, elementnames, fixit, fprintf(), ionbal, t_dense::IonHigh, t_dense::IonLow, ioQQQ, iso_sp, iteration, t_conv::lgSearch, LIMELM, MAT, MAX_DENSITY, NISO, t_iso_sp::numLevels_max, nzone, t_ionbal::RateIonizTot(), t_ionbal::RateRecomTot, and TorF().
Referenced by ion_solver().
void solveions | ( | double * | ion, |
double * | rec, | ||
double * | snk, | ||
double * | src, | ||
long int | nlev, | ||
long int | nmax | ||
) |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), and ioQQQ.
STATIC void store_new_densities | ( | long | nelem, |
long | ion_range, | ||
long | ion_low, | ||
double * | source | ||
) |
References ASSERT, DEBUG_ENTRY, dense, MAX_DENSITY, and t_dense::xIonDense.
Referenced by ion_solver().