Cloudy
Spectral Synthesis Code for Astrophysics
|
#include "cddefines.h"
#include "rfield.h"
#include "phycon.h"
#include "dense.h"
#include "hmi.h"
#include "thermal.h"
#include "trace.h"
#include "iterations.h"
#include "vectorize.h"
#include "grainvar.h"
#include "grains.h"
Enumerations | |
enum | QH_Code { QH_OK, QH_ANALYTIC, QH_ANALYTIC_RELAX, QH_DELTA, QH_NEGRATE_FAIL, QH_LOOP_FAIL, QH_ARRAY_FAIL, QH_THIGH_FAIL, QH_RETRY, QH_CONV_FAIL, QH_BOUND_FAIL, QH_DELTA_FAIL, QH_NO_REBIN, QH_LOW_FAIL, QH_HIGH_FAIL, QH_STEP_FAIL, QH_FATAL, QH_WIDE_FAIL, QH_NBIN_FAIL, QH_REBIN_FAIL } |
Functions | |
double | no_atoms (size_t nd) |
STATIC void | qheat_init (size_t, vector< double > &, double *) |
STATIC void | GetProbDistr_LowLimit (size_t, double, double, double, const vector< double > &, const vector< double > &, vector< double > &, vector< double > &, vector< double > &, long *, double *, long *, QH_Code *) |
STATIC double | TryDoubleStep (vector< double > &, vector< double > &, vector< double > &, vector< double > &, vector< double > &, const vector< double > &, const vector< double > &, double, double *, double, long, size_t, bool *) |
STATIC double | log_integral (double, double, double, double, double, double, double, double) |
STATIC void | ScanProbDistr (const vector< double > &, const vector< double > &, long, double, long, double, long *, long *, long *, long *, QH_Code *) |
STATIC long | RebinQHeatResults (size_t, long, long, vector< double > &, vector< double > &, vector< double > &, vector< double > &, vector< double > &, vector< double > &, vector< double > &, QH_Code *) |
STATIC void | GetProbDistr_HighLimit (long, double, double, double, vector< double > &, vector< double > &, vector< double > &, double *, long *, double *, QH_Code *) |
STATIC double | uderiv (double, size_t) |
STATIC double | ufunct (double, size_t, bool *) |
STATIC double | inv_ufunct (double, size_t, bool *) |
STATIC double | DebyeDeriv (double, long) |
realnum | fast_expm1 (realnum x) |
STATIC long | GrainMakeDiffuseSingle (double Tgrain, double fracpop, avx_ptr< realnum > &flux, long nflux) |
void | GrainMakeDiffuse () |
void | qheat (vector< double > &qtemp, vector< double > &qprob, long int *qnbin, size_t nd) |
STATIC void | GetProbDistr_LowLimit (size_t nd, double rel_tol, double Umax, double fwhm, const vector< double > &Phi, const vector< double > &PhiDrv, vector< double > &qtemp, vector< double > &qprob, vector< double > &dPdlnT, long int *qnbin, double *new_tmin, long *nWideFail, QH_Code *ErrorCode) |
void | InitEnthalpy () |
Variables | |
static const long | NQMIN = 10L |
static const double | PROB_CUTOFF_LO = 1.e-15 |
static const double | PROB_CUTOFF_HI = 1.e-20 |
static const double | SAFETY = 1.e+8 |
static const long | NSTARTUP = 5L |
static const double | MAX_EVENTS = 150. |
static const long | LOOP_MAX = 20L |
static const double | DEF_FAC = 3. |
static const double | PROB_TOL = 0.02 |
static const long | NQTEST = 500L |
static const double | FWHM_RATIO = 0.1 |
static const double | FWHM_RATIO2 = 0.007 |
static const long | MAX_LOOP = 2*NQGRID |
static const double | QHEAT_TOL = 5.e-3 |
static const long | WIDE_FAIL_MAX = 3 |
static const double | STRICT = 1. |
static const double | RELAX = 15. |
static const double | QT_RATIO = 1.074 |
static const double | DEN_SIL = 3.30 |
static const double | MW_SIL = 24.6051 |
static const double | tlim [5] ={0.,50.,150.,500.,DBL_MAX} |
static const double | ppower [4] ={2.00,1.30,0.68,0.00} |
static const double | cval [4] |
static const realnum | LIM1 = 2.e-4f |
static const realnum | LIM2 = sqrtf(6.e-4f) |
static const realnum | LIM3 = cbrtf(24.e-4f) |
enum QH_Code |
STATIC double DebyeDeriv | ( | double | x, |
long | n | ||
) |
References ASSERT, DEBUG_ENTRY, gauss_init(), gauss_legendre(), MAX2, pow2(), pow3(), powi(), and TotalInsanity().
Referenced by uderiv().
References LIM1, LIM2, and LIM3.
Referenced by GrainMakeDiffuseSingle().
STATIC void GetProbDistr_HighLimit | ( | long | nd, |
double | TolFac, | ||
double | Umax, | ||
double | fwhm, | ||
vector< double > & | qtemp, | ||
vector< double > & | qprob, | ||
vector< double > & | dPdlnT, | ||
double * | tol, | ||
long * | qnbin, | ||
double * | new_tmin, | ||
QH_Code * | ErrorCode | ||
) |
References GrainVar::bin, DEBUG_ENTRY, GrainVar::dsttmp, fprintf(), gv, inv_ufunct(), ioQQQ, t_trace::lgDustBug, t_trace::lgTrace, log_integral(), MAX2, MIN2, NDEMS, NQGRID, NQMIN, nzone, pow(), pow2(), PROB_CUTOFF_HI, PROB_CUTOFF_LO, PROB_TOL, QH_ANALYTIC, QH_ANALYTIC_RELAX, QH_BOUND_FAIL, QH_CONV_FAIL, QH_THIGH_FAIL, QH_WIDE_FAIL, QT_RATIO, SAFETY, splint_safe(), STRICT, trace, uderiv(), ufunct(), and vlog().
Referenced by qheat().
STATIC void GetProbDistr_LowLimit | ( | size_t | , |
double | , | ||
double | , | ||
double | , | ||
const vector< double > & | , | ||
const vector< double > & | , | ||
vector< double > & | , | ||
vector< double > & | , | ||
vector< double > & | , | ||
long * | , | ||
double * | , | ||
long * | , | ||
QH_Code * | |||
) |
Referenced by qheat().
STATIC void GetProbDistr_LowLimit | ( | size_t | nd, |
double | rel_tol, | ||
double | Umax, | ||
double | fwhm, | ||
const vector< double > & | Phi, | ||
const vector< double > & | PhiDrv, | ||
vector< double > & | qtemp, | ||
vector< double > & | qprob, | ||
vector< double > & | dPdlnT, | ||
long int * | qnbin, | ||
double * | new_tmin, | ||
long * | nWideFail, | ||
QH_Code * | ErrorCode | ||
) |
References ASSERT, GrainVar::bin, DEBUG_ENTRY, DEF_FAC, GrainVar::dsttmp, fprintf(), GRAIN_TMIN, gv, ioQQQ, t_trace::lgDustBug, t_trace::lgTrace, max(), MAX2, MAX3, MAX_LOOP, MIN2, NDEMS, NQGRID, NQMIN, NQTEST, NSTARTUP, nzone, pow3(), PROB_CUTOFF_HI, PROB_CUTOFF_LO, PROB_TOL, QH_ARRAY_FAIL, QH_BOUND_FAIL, QH_CONV_FAIL, QH_DELTA_FAIL, QH_HIGH_FAIL, QH_LOOP_FAIL, QH_LOW_FAIL, QH_NBIN_FAIL, QH_NO_REBIN, QH_STEP_FAIL, QH_THIGH_FAIL, QH_WIDE_FAIL, QHEAT_TOL, RebinQHeatResults(), SAFETY, ScanProbDistr(), spldrv_safe(), splint_safe(), trace, TryDoubleStep(), uderiv(), ufunct(), and WIDE_FAIL_MAX.
void GrainMakeDiffuse | ( | ) |
main routine for generating the grain diffuse emission
References t_mesh::anu(), t_mesh::anu2(), ASSERT, GrainVar::bin, CONSERV_TOL, t_thermal::ConstGrainTemp, avx_ptr< T, lgBC >::data(), DEBUG_ENTRY, dense, GrainVar::dstAbundThresholdFar, GrainVar::dstAbundThresholdNear, GrainVar::GasCoolColl, get_ptr(), GrainVar::GrainEmission, GrainVar::GrainHeatChem, GrainVar::GrainHeatScaleFactor, GrainVar::GrainHeatSum, GrainMakeDiffuseSingle(), GrainVar::GraphiteEmission, gv, t_hmi::H2_total, t_thermal::heating(), hmi, ipHYDROGEN, GrainVar::lgBakesPAH_heat, GrainVar::lgDColOn, GrainVar::lgDHetOn, max(), MAX2, t_rfield::nflux, NQGRID, pow2(), qheat(), rfield, GrainVar::SilicateEmission, STRG_CAR, STRG_SIL, thermal, TotalInsanity(), GrainVar::which_strg, t_mesh::widflx(), and t_dense::xIonDense.
Referenced by RT_diffuse().
STATIC long GrainMakeDiffuseSingle | ( | double | Tgrain, |
double | fracpop, | ||
avx_ptr< realnum > & | flux, | ||
long | nflux | ||
) |
References t_mesh::anu(), fast_expm1(), avx_ptr< T, lgBC >::ptr0(), rfield, and vexpm1().
Referenced by GrainMakeDiffuse().
void InitEnthalpy | ( | ) |
initialize interpolation arrays for grain enthalpy
References GrainVar::bin, DEBUG_ENTRY, GrainVar::dsttmp, GRAIN_TMIN, gv, log_integral(), NDEMS, spline(), tlim, uderiv(), and vlog().
Referenced by GrainsInit().
STATIC double inv_ufunct | ( | double | enthalpy, |
size_t | nd, | ||
bool * | lgBoundErr | ||
) |
References ASSERT, GrainVar::bin, cdEXIT, DEBUG_ENTRY, GrainVar::dsttmp, EXIT_FAILURE, fprintf(), gv, ioQQQ, NDEMS, and splint_safe().
Referenced by GetProbDistr_HighLimit(), qheat(), and TryDoubleStep().
STATIC double log_integral | ( | double | xx1, |
double | yy1, | ||
double | xx2, | ||
double | yy2, | ||
double | log_xx1, | ||
double | log_yy1, | ||
double | log_xx2, | ||
double | log_yy2 | ||
) |
References DEBUG_ENTRY.
Referenced by GetProbDistr_HighLimit(), InitEnthalpy(), RebinQHeatResults(), and TryDoubleStep().
|
inline |
References GrainVar::bin, and gv.
Referenced by uderiv().
void qheat | ( | vector< double > & | qtemp, |
vector< double > & | qprob, | ||
long int * | qnbin, | ||
size_t | nd | ||
) |
References t_mesh::anu(), t_mesh::anu2(), ASSERT, GrainVar::bin, CONSERV_TOL, DEBUG_ENTRY, DEF_FAC, GrainVar::dsttmp, fprintf(), FWHM_RATIO, FWHM_RATIO2, GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), GRAIN_TMIN, gv, inv_ufunct(), ioQQQ, iterations, t_trace::lgDustBug, t_iterations::lgLastIt, GrainVar::lgQHPunLast, t_trace::lgTrace, LOOP_MAX, MAX2, MAX_EVENTS, MIN2, NDEMS, t_rfield::nflux_with_check, NQGRID, NULL, nzone, open_data(), pow2(), PROB_CUTOFF_LO, QH_ANALYTIC, QH_CONV_FAIL, QH_DELTA, QH_DELTA_FAIL, QH_FATAL, QH_HIGH_FAIL, QH_LOW_FAIL, QH_NEGRATE_FAIL, QH_NO_REBIN, QH_OK, QH_RETRY, QH_WIDE_FAIL, qheat_init(), GrainVar::QHSaveFile, RELAX, rfield, spldrv_safe(), STRICT, TorF(), trace, uderiv(), ufunct(), WIDE_FAIL_MAX, and t_mesh::widflx().
Referenced by GrainMakeDiffuse().
STATIC void qheat_init | ( | size_t | nd, |
vector< double > & | phiTilde, | ||
double * | check | ||
) |
References t_mesh::anu(), t_mesh::anumax(), ASSERT, GrainVar::bin, CONSERV_TOL, DEBUG_ENTRY, dprintf(), ChargeBin::DustZ, ChargeBin::ehat, t_mesh::emm(), ChargeBin::fac1, ChargeBin::FracPop, gv, ChargeBin::HeatingRate2, ioQQQ, t_mesh::ipointC(), ChargeBin::ipThresInf, ChargeBin::ipThresInfVal, GrainVar::lgWD01, LIM2, LIM3, max(), MAX2, min(), MIN2, ChargeBin::nfill, t_rfield::nPositive, phycon, ChargeBin::PotSurf, ChargeBin::PotSurfInc, powpq(), rfield, sign(), t_rfield::SummedCon, t_phycon::te, ChargeBin::ThresInfInc, ChargeBin::ThresSurf, ChargeBin::ThresSurfVal, t_mesh::widflx(), ChargeBin::yhat, and ChargeBin::yhat_primary.
Referenced by qheat().
STATIC long RebinQHeatResults | ( | size_t | nd, |
long | nstart, | ||
long | nend, | ||
vector< double > & | p, | ||
vector< double > & | qtemp, | ||
vector< double > & | qprob, | ||
vector< double > & | dPdlnT, | ||
vector< double > & | u1, | ||
vector< double > & | delu, | ||
vector< double > & | Lambda, | ||
QH_Code * | ErrorCode | ||
) |
References ASSERT, GrainVar::bin, CONSERV_TOL, DEBUG_ENTRY, GrainVar::dsttmp, fprintf(), frac(), gv, ioQQQ, t_trace::lgDustBug, t_trace::lgTrace, log_integral(), MAX2, MIN2, NDEMS, NQGRID, NQMIN, pow(), PROB_CUTOFF_LO, QH_CONV_FAIL, QH_REBIN_FAIL, QT_RATIO, SAFETY, splint_safe(), trace, uderiv(), ufunct(), and vlog().
Referenced by GetProbDistr_LowLimit().
STATIC void ScanProbDistr | ( | const vector< double > & | u1, |
const vector< double > & | dPdlnT, | ||
long | nbin, | ||
double | maxVal, | ||
long | nmax, | ||
double | qtmin1, | ||
long * | nstart, | ||
long * | nstart2, | ||
long * | nend, | ||
long * | nWideFail, | ||
QH_Code * | ErrorCode | ||
) |
References ASSERT, DEBUG_ENTRY, fprintf(), GRAIN_TMIN, ioQQQ, t_trace::lgDustBug, t_trace::lgTrace, MAX2, NQMIN, QH_HIGH_FAIL, QH_LOW_FAIL, QH_NBIN_FAIL, QH_NO_REBIN, QH_WIDE_FAIL, trace, and WIDE_FAIL_MAX.
Referenced by GetProbDistr_LowLimit().
STATIC double TryDoubleStep | ( | vector< double > & | u1, |
vector< double > & | delu, | ||
vector< double > & | p, | ||
vector< double > & | qtemp, | ||
vector< double > & | Lambda, | ||
const vector< double > & | Phi, | ||
const vector< double > & | PhiDrv, | ||
double | step, | ||
double * | cooling, | ||
double | p_max, | ||
long | index, | ||
size_t | nd, | ||
bool * | lgBoundFail | ||
) |
References t_mesh::anumax(), t_mesh::anumin(), ASSERT, GrainVar::bin, DEBUG_ENTRY, GrainVar::dsttmp, gv, inv_ufunct(), log_integral(), MAX2, NDEMS, NQGRID, PROB_CUTOFF_LO, QHEAT_TOL, rfield, splint_safe(), and vlog().
Referenced by GetProbDistr_LowLimit().
STATIC double uderiv | ( | double | temp, |
size_t | nd | ||
) |
References ASSERT, GrainVar::bin, cdEXIT, cval, DEBUG_ENTRY, DebyeDeriv(), ENTH_CAR, ENTH_CAR2, ENTH_PAH, ENTH_PAH2, ENTH_SIC, ENTH_SIL, ENTH_SIL2, EXIT_FAILURE, exp10(), fprintf(), gv, ioQQQ, MAX2, MIN2, no_atoms(), pow(), pow2(), ppower, tlim, and GrainVar::which_enth.
Referenced by GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), InitEnthalpy(), qheat(), and RebinQHeatResults().
STATIC double ufunct | ( | double | temp, |
size_t | nd, | ||
bool * | lgBoundErr | ||
) |
References ASSERT, GrainVar::bin, cdEXIT, DEBUG_ENTRY, GrainVar::dsttmp, EXIT_FAILURE, fprintf(), gv, ioQQQ, NDEMS, and splint_safe().
Referenced by GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), qheat(), and RebinQHeatResults().
|
static |
Referenced by uderiv().
|
static |
Referenced by GetProbDistr_LowLimit(), and qheat().
|
static |
|
static |
Referenced by qheat().
|
static |
Referenced by qheat().
|
static |
Referenced by fast_expm1().
|
static |
Referenced by fast_expm1(), and qheat_init().
|
static |
Referenced by fast_expm1(), and qheat_init().
|
static |
Referenced by cnewton(), lgCoolNetConverge(), and qheat().
|
static |
Referenced by qheat().
|
static |
Referenced by GetProbDistr_LowLimit().
|
static |
|
static |
Referenced by GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), RebinQHeatResults(), and ScanProbDistr().
|
static |
Referenced by GetProbDistr_LowLimit().
|
static |
Referenced by GetProbDistr_LowLimit().
|
static |
Referenced by uderiv().
|
static |
Referenced by GetProbDistr_HighLimit(), and GetProbDistr_LowLimit().
|
static |
Referenced by GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), qheat(), RebinQHeatResults(), and TryDoubleStep().
|
static |
Referenced by GetProbDistr_HighLimit(), and GetProbDistr_LowLimit().
|
static |
Referenced by GetProbDistr_LowLimit(), and TryDoubleStep().
|
static |
Referenced by GetProbDistr_HighLimit(), and RebinQHeatResults().
|
static |
Referenced by qheat().
|
static |
Referenced by gauss_legendre(), GetProbDistr_HighLimit(), GetProbDistr_LowLimit(), radius_next(), RebinQHeatResults(), spldrv_safe(), and splint_safe().
|
static |
Referenced by GetProbDistr_HighLimit(), and qheat().
|
static |
Referenced by InitEnthalpy(), and uderiv().
|
static |
Referenced by GetProbDistr_LowLimit(), qheat(), and ScanProbDistr().