Cloudy
Spectral Synthesis Code for Astrophysics
|
#include "cddefines.h"
#include "atmdat.h"
#include "atmdat_adfa.h"
#include "rfield.h"
#include "hmi.h"
#include "trace.h"
#include "conv.h"
#include "ionbal.h"
#include "thermal.h"
#include "phycon.h"
#include "doppvel.h"
#include "heavy.h"
#include "ipoint.h"
#include "elementnames.h"
#include "grainvar.h"
#include "grains.h"
#include "iso.h"
#include "mole.h"
#include "dense.h"
#include "vectorize.h"
#include "parser.h"
Macros | |
#define | FREE_CHECK(PTR) |
#define | FREE_SAFE(PTR) |
Functions | |
double | one_elec (long nd) |
double | pot2chrg (double x, long nd) |
double | chrg2pot (double x, long nd) |
double | elec_esc_length (double e, long nd) |
STATIC void | ReadAugerData () |
STATIC void | InitBinAugerData (size_t, long, long) |
STATIC void | InitEmissivities () |
STATIC double | PlanckIntegral (double, size_t, long) |
STATIC void | NewChargeData (long) |
STATIC double | GrnStdDpth (long) |
STATIC void | GrainChargeTemp () |
STATIC void | GrainCharge (size_t, double *) |
STATIC double | GrainElecRecomb1 (size_t, long, double *, double *) |
STATIC double | GrainElecEmis1 (size_t, long, double *, double *, double *, double *) |
STATIC void | GrainScreen (long, size_t, long, double *, double *) |
STATIC double | ThetaNu (double) |
STATIC void | UpdatePot (size_t, long, long, double[], double[]) |
STATIC void | GetFracPop (size_t, long, double[], double[], long *) |
STATIC void | UpdatePot1 (size_t, long, long, long) |
STATIC void | UpdatePot2 (size_t, long) |
STATIC void | Yfunc (long, long, const realnum[], const realnum[], const realnum[], double, const double[], const double[], realnum[], realnum[], realnum[], realnum[], long, long) |
STATIC void | Yfunc (long, long, const realnum[], const realnum[], double, double, double, realnum[], realnum[], realnum[], realnum[], long, long) |
STATIC void | y0b (size_t, long, realnum[], long, long) |
STATIC void | y0b01 (size_t, long, realnum[], long, long) |
STATIC double | y0psa (size_t, long, long, double) |
STATIC double | y1psa (size_t, long, double) |
void | y2pa (double, const double[], long, realnum[], realnum[], long, long) |
void | y2s (double, const double[], long, const realnum[], realnum[], realnum[], long, long) |
STATIC void | UpdateRecomZ0 (size_t, long) |
STATIC void | GetPotValues (size_t, long, double *, double *, double *, double *, double *, double *, bool) |
STATIC void | GrainIonColl (size_t, long, long, long, const double[], const double[], long *, realnum *, realnum *) |
STATIC void | GrainChrgTransferRates (long) |
STATIC void | GrainUpdateRadius1 () |
STATIC void | GrainUpdateRadius2 () |
STATIC void | GrainTemperature (size_t, realnum *, double *, double *, double *) |
STATIC void | PE_init (size_t, long, long, double *, double *, double *, double *, double *, double *, double *) |
STATIC void | GrainCollHeating (size_t, realnum *, realnum *) |
STATIC double | GrnVryDpth (size_t) |
void | GrainStartIter () |
void | GrainRestartIter () |
void | SetNChrgStates (long nChrg) |
void | GrainsInit () |
STATIC double | PlanckIntegral (double tdust, size_t nd, long int ip) |
STATIC double | GrnStdDpth (long int nd) |
void | GrainDrive () |
STATIC void | GrainIonColl (size_t nd, long int nz, long int nelem, long int ion, const double phi_s_up[], const double phi_s_dn[], long *Z0, realnum *ChEn, realnum *ChemEn) |
void | GrainDrift () |
Variables | |
static const long | MAGIC_AUGER_DATA = 20060126L |
static const bool | INCL_TUNNEL = true |
static const bool | NO_TUNNEL = false |
static const long | NTOP = NDEMS/5 |
static const double | TOLER = CONSERV_TOL/10. |
static const long | BRACKET_MAX = 50L |
static const long | CT_LOOP_MAX = 25L |
static const long | T_LOOP_MAX = 50L |
static double | HEAT_TOLER = DBL_MAX |
static double | HEAT_TOLER_BIN = DBL_MAX |
static double | CHRG_TOLER = DBL_MAX |
static const double | AC0 = 3.e-9 |
static const double | AC1G = 4.e-8 |
static const double | AC2G = 7.e-8 |
static const double | ETILDE = 2.*SQRT2/EVRYD |
static const double | INV_ETILDE = 1./ETILDE |
static const double | THERMCONST = PI4*ELECTRON_MASS*POW2(BOLTZMANN)/POW3(HPLANCK) |
static const double | STICK_ELEC = 0.5 |
static const double | STICK_ION = 1.0 |
#define FREE_CHECK | ( | PTR | ) |
|
inline |
convert grain charge in electrons into potential in Ryd
References one_elec().
Referenced by GetPotValues(), GrainCharge(), GrainDrive(), and UpdatePot1().
|
inline |
STATIC void GetFracPop | ( | size_t | nd, |
long | Zlo, | ||
double | rate_up[], | ||
double | rate_dn[], | ||
long * | newZlo ) |
References ASSERT, cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fnzone, fprintf(), gv, ioQQQ, MAX2, NCHU, safe_div(), ShowMe(), STATIC, x1, and x2.
Referenced by GrainCharge().
STATIC void GetPotValues | ( | size_t | nd, |
long | Zg, | ||
double * | ThresInf, | ||
double * | ThresInfVal, | ||
double * | ThresSurf, | ||
double * | ThresSurfVal, | ||
double * | PotSurf, | ||
double * | Emin, | ||
bool | lgUseTunnelCorr ) |
References AC0, AC1G, AC2G, cdEXIT, chrg2pot(), DEBUG_ENTRY, EXIT_FAILURE, fprintf(), gv, ioQQQ, MAX2, one_elec(), POT_CAR, POT_SIL, pow(), STATIC, and ThetaNu().
Referenced by GrainIonColl(), GrainsInit(), UpdatePot1(), and UpdateRecomZ0().
STATIC void GrainCharge | ( | size_t | nd, |
double * | ThermRatio ) |
References ASSERT, BRACKET_MAX, cdEXIT, chrg2pot(), conv, DEBUG_ENTRY, EXIT_FAILURE, fnzone, fprintf(), get_ptr(), GetFracPop(), GrainElecEmis1(), GrainElecRecomb1(), gv, ioQQQ, iteration, max(), MAX2, NCHS, NCHU, nint(), pot2chrg(), powi(), reduce_ab_a(), rfield, safe_div(), ShowMe(), STATIC, TorF(), trace, and UpdatePot().
Referenced by GrainChargeTemp().
STATIC void GrainChargeTemp | ( | ) |
References ASSERT, CHRG_TOLER, conv, ConvFail(), DEBUG_ENTRY, dense, elementnames, fnzone, fp_equal(), fprintf(), fudge(), GRAIN_TMAX, GRAIN_TMIN, GrainCharge(), GrainChrgTransferRates(), GrainTemperature(), GrainUpdateRadius1(), GrainUpdateRadius2(), gv, HEAT_TOLER, HEAT_TOLER_BIN, ionbal, ioQQQ, ipHYDROGEN, LIMELM, MAT_PAH, MAT_PAH2, NDEMS, NewChargeData(), nzone, phycon, POW2, splint_safe(), STATIC, T_LOOP_MAX, thermal, TOLER, TorF(), TotalInsanity(), and trace.
Referenced by GrainDrive().
STATIC void GrainChrgTransferRates | ( | long | nd | ) |
References atmdat, DEBUG_ENTRY, dense, ChargeBin::FracPop, GetAveVelocity(), GrainScreen(), gv, LIMELM, MAX2, ChargeBin::RecomZ0, STATIC, and STICK_ION.
Referenced by GrainChargeTemp().
References ChargeBin::ChemEn, DEBUG_ENTRY, molezone::den, dense, ChargeBin::DustZ, findspecieslocal(), fprintf(), ChargeBin::FracPop, GetAveVelocity(), GrainElecEmis1(), GrainElecRecomb1(), GrainScreen(), gv, H2_TOP, ChargeBin::HeatingRate2, hmi, ioQQQ, ipCARBON, ipH2, ipHYDROGEN, ipOXYGEN, LIMELM, MAX2, phycon, ChargeBin::PotSurf, ChargeBin::PotSurfInc, POW2, ChargeBin::RecomEn, ChargeBin::RecomZ0, STATIC, STICK_ION, ChargeBin::ThresSurfInc, and trace.
Referenced by GrainTemperature().
void GrainDrift | ( | ) |
GrainDrift computes grains drift velocity
References ASSERT, DEBUG_ENTRY, dense, fprintf(), gv, ioQQQ, ipHELIUM, ipHYDROGEN, phycon, POW2, POW3, rfield, and trace.
Referenced by ConvPresTempEdenIoniz().
void GrainDrive | ( | ) |
GrainDrive main routine to converge grains thermal solution
References chrg2pot(), conv, DEBUG_ENTRY, dense, fp_equal(), fprintf(), GrainChargeTemp(), GrainUpdateRadius1(), GrainUpdateRadius2(), gv, hmi, ioQQQ, ipHYDROGEN, LIMELM, nzone, phycon, pow(), SDIV(), thermal, and trace.
Referenced by ConvBase(), and mole_h2_grain_form().
STATIC double GrainElecEmis1 | ( | size_t | nd, |
long | nz, | ||
double * | sum1a, | ||
double * | sum1b, | ||
double * | sum2, | ||
double * | sum3 ) |
References ASSERT, ChargeBin::cs_pdt, DEBUG_ENTRY, dense, ChargeBin::DustZ, ChargeBin::ESum1a, ChargeBin::ESum1b, ChargeBin::ESum2, get_ptr(), GetAveVelocity(), GrainScreen(), gv, ChargeBin::ipThresInf, ChargeBin::ipThresInfVal, LIMELM, MAX2, flex_arr< T, lgBC >::ptr0(), ChargeBin::RecomZ0, reduce_ab(), reduce_abc(), rfield, STATIC, STICK_ION, and ChargeBin::yhat.
Referenced by GrainCharge(), GrainCollHeating(), and UpdatePot().
STATIC double GrainElecRecomb1 | ( | size_t | nd, |
long | nz, | ||
double * | sum1, | ||
double * | sum2 ) |
References ASSERT, DEBUG_ENTRY, dense, GetAveVelocity(), GrainScreen(), gv, LIMELM, MAX2, phycon, STATIC, and STICK_ION.
Referenced by GrainCharge(), GrainCollHeating(), and UpdatePot().
STATIC void GrainIonColl | ( | size_t | nd, |
long int | nz, | ||
long int | nelem, | ||
long int | ion, | ||
const double | phi_s_up[], | ||
const double | phi_s_dn[], | ||
long * | Z0, | ||
realnum * | ChEn, | ||
realnum * | ChemEn ) |
References DEBUG_ENTRY, GetPotValues(), gv, Heavy, NO_TUNNEL, rfield, save, and STATIC.
STATIC void GrainIonColl | ( | size_t | , |
long | , | ||
long | , | ||
long | , | ||
const double | [], | ||
const double | [], | ||
long * | , | ||
realnum * | , | ||
realnum * | ) |
References STATIC.
Referenced by UpdateRecomZ0().
void GrainRestartIter | ( | ) |
this routine is called by IterRestart()
References DEBUG_ENTRY, and gv.
Referenced by IterRestart().
STATIC void GrainScreen | ( | long | ion, |
size_t | nd, | ||
long | nz, | ||
double * | eta, | ||
double * | xi ) |
References ASSERT, DEBUG_ENTRY, gv, LIMELM, MIN2, phycon, POW2, powpq(), STATIC, and ThetaNu().
Referenced by GrainChrgTransferRates(), GrainCollHeating(), GrainElecEmis1(), and GrainElecRecomb1().
void GrainsInit | ( | ) |
startup routine for grains, called before first calculations, but after parsecommands
References flex_arr< T, lgBC >::alloc(), ASSERT, atoms, ShellData::AvNr, cdEXIT, CHRG_TOLER, conv, DEBUG_ENTRY, dense, DF_STANDARD, elec_esc_length(), elementnames, ENABLE_QUANTUM_HEATING, ShellData::Ener, EXIT_FAILURE, fprintf(), GetPotValues(), GrnStdDpth(), gv, HEAT_TOLER, HEAT_TOLER_BIN, INCL_TUNNEL, InitBinAugerData(), InitEmissivities(), InitEnthalpy(), ioQQQ, ipHYDROGEN, ipLITHIUM, ShellData::ipLo, LIMELM, MAT_PAH, MAT_PAH2, MAX2, NCHU, ShellData::nData, ShellData::nelem, nint(), ShellData::ns, ShellData::p, pow(), POW2, powpq(), ReadAugerData(), flex_arr< T, lgBC >::reserve(), rfield, STICK_ELEC, thermal, TorF(), trace, ShellData::y01, ShellData::y01A, ZMIN_CAR, and ZMIN_SIL.
Referenced by OpacityCreateAll().
void GrainStartIter | ( | ) |
STATIC void GrainTemperature | ( | size_t | nd, |
realnum * | dccool, | ||
double * | hcon, | ||
double * | hots, | ||
double * | hla ) |
References ASSERT, ChargeBin::bolflux1, ChargeBin::cs_pdt, DEBUG_ENTRY, dense, ChargeBin::DustZ, ChargeBin::fac1, ChargeBin::fac2, fprintf(), ChargeBin::FracPop, get_ptr(), GrainCollHeating(), gv, ChargeBin::hcon1, hmi, ChargeBin::hots1, ioQQQ, ipH1s, ipH2p, ipH_LIKE, ipHYDROGEN, ChargeBin::ipThresInf, iso_sp, MAX2, min(), MIN2, NDEMS, ChargeBin::pe1, phycon, ChargeBin::PotSurf, pow(), flex_arr< T, lgBC >::ptr0(), reduce_ab(), reduce_abc(), rfield, splint_safe(), STATIC, thermal, ChargeBin::ThermRate, ChargeBin::ThresSurf, and trace.
Referenced by GrainChargeTemp().
STATIC void GrainUpdateRadius1 | ( | ) |
References ASSERT, DEBUG_ENTRY, dense, GrnStdDpth(), gv, ipHYDROGEN, LIMELM, and STATIC.
Referenced by GrainChargeTemp(), and GrainDrive().
STATIC void GrainUpdateRadius2 | ( | ) |
References ASSERT, ChargeBin::cs_pdt, DEBUG_ENTRY, ChargeBin::DustZ, ChargeBin::FracPop, get_ptr(), gv, ChargeBin::ipThresInf, rfield, and STATIC.
Referenced by GrainChargeTemp(), and GrainDrive().
STATIC double GrnStdDpth | ( | long int | nd | ) |
References DEBUG_ENTRY, dense, DF_STANDARD, DF_SUBLIMATION, DF_USER_FUNCTION, fprintf(), GrnVryDpth(), gv, hmi, ioQQQ, ipHYDROGEN, MAT_PAH, MAT_PAH2, max(), pow3, sexp(), STATIC, and TotalInsanity().
STATIC double GrnStdDpth | ( | long | ) |
References STATIC.
Referenced by GrainsInit(), and GrainUpdateRadius1().
STATIC double GrnVryDpth | ( | size_t | nd | ) |
References cdEXIT, DEBUG_ENTRY, dense, EXIT_FAILURE, fprintf(), gv, ioQQQ, ipHYDROGEN, max(), and STATIC.
Referenced by GrnStdDpth().
STATIC void InitBinAugerData | ( | size_t | nd, |
long | ipBegin, | ||
long | ipEnd ) |
initialize the Auger data for grain bin nd between index ipBegin <= i < ipEnd
References ShellData::AvNr, flex_arr< T, lgBC >::clear(), DEBUG_ENTRY, ShellData::Ener, gv, Heavy, Singleton< t_ADfA >::Inst(), ShellData::ionPot, ipHYDROGEN, ShellData::ipLo, LIMELM, max(), MAX2, ShellData::nData, t_ADfA::phfit(), flex_arr< T, lgBC >::realloc(), rfield, STATIC, ShellData::y01, ShellData::y01A, y0psa(), y1psa(), and flex_arr< T, lgBC >::zero().
Referenced by GrainsInit(), and UpdatePot().
STATIC void InitEmissivities | ( | ) |
References ASSERT, cdEXIT, DEBUG_ENTRY, EXIT_SUCCESS, exp10(), fprintf(), fudge(), GRAIN_TMAX, GRAIN_TMID, GRAIN_TMIN, gv, ioQQQ, NDEMS, nint(), NTOP, PlanckIntegral(), powi(), spline(), splint(), STATIC, and trace.
Referenced by GrainsInit().
STATIC void NewChargeData | ( | long | nd | ) |
References DEBUG_ENTRY, fp_equal(), gv, LIMELM, NCHS, nzone, phycon, and STATIC.
Referenced by GrainChargeTemp().
|
inline |
evaluate e^2/a, the potential of one electron
References gv.
Referenced by chrg2pot(), GetPotValues(), and pot2chrg().
STATIC void PE_init | ( | size_t | nd, |
long | nz, | ||
long | i, | ||
double * | cs1, | ||
double * | cs2, | ||
double * | cs_tot, | ||
double * | cool1, | ||
double * | cool2, | ||
double * | ehat1, | ||
double * | ehat2 ) |
References ASSERT, ChargeBin::cs_pdt, DEBUG_ENTRY, ChargeBin::DustZ, ChargeBin::ehat, gv, ChargeBin::ipThresInf, ChargeBin::ipThresInfVal, ChargeBin::PotSurf, rfield, STATIC, ChargeBin::ThresSurf, ChargeBin::ThresSurfVal, and ChargeBin::yhat.
Referenced by UpdatePot1().
STATIC double PlanckIntegral | ( | double | tdust, |
size_t | nd, | ||
long int | ip ) |
STATIC double PlanckIntegral | ( | double | , |
size_t | , | ||
long | ) |
References STATIC.
Referenced by InitEmissivities().
|
inline |
convert grain potential in Ryd to charge in electrons
References one_elec().
Referenced by GrainCharge().
STATIC void ReadAugerData | ( | ) |
References ASSERT, AEInfo::AvNumber, DataParser::checkMagic(), DEBUG_ENTRY, AEInfo::Energy, ES_NONE, DataParser::getline(), DataParser::getToken(), gv, AEInfo::IonThres, LIMELM, MAGIC_AUGER_DATA, AEInfo::nData, AEInfo::nSubShell, and STATIC.
Referenced by GrainsInit().
void SetNChrgStates | ( | long | nChrg | ) |
this routine is called by ParseSet()
References ASSERT, DEBUG_ENTRY, gv, and NCHU.
Referenced by ParseSet().
STATIC double ThetaNu | ( | double | nu | ) |
References DEBUG_ENTRY, POW2, and STATIC.
Referenced by GetPotValues(), and GrainScreen().
STATIC void UpdatePot | ( | size_t | nd, |
long | Zlo, | ||
long | stride, | ||
double | rate_up[], | ||
double | rate_dn[] ) |
References ASSERT, CONSERV_TOL, DEBUG_ENTRY, fprintf(), GrainElecEmis1(), GrainElecRecomb1(), gv, InitBinAugerData(), ioQQQ, ipoint(), max(), MAX2, min(), NCHS, phycon, rfield, STATIC, trace, UpdatePot1(), and UpdatePot2().
Referenced by GrainCharge().
STATIC void UpdatePot1 | ( | size_t | nd, |
long | nz, | ||
long | Zg, | ||
long | ipStart ) |
References ASSERT, ShellData::AvNr, chrg2pot(), DEBUG_ENTRY, ShellData::Ener, GetPotValues(), gv, INCL_TUNNEL, ShellData::ionPot, ShellData::ipLo, LIMELM, max(), MAX2, min(), ShellData::nData, NO_TUNNEL, NULL, ShellData::p, PE_init(), POW2, avx_ptr< T, lgBC >::ptr0(), flex_arr< T, lgBC >::ptr0(), rfield, STATIC, UpdateRecomZ0(), ShellData::y01, ShellData::y01A, y0b(), and Yfunc().
Referenced by UpdatePot().
STATIC void UpdatePot2 | ( | size_t | nd, |
long | nz ) |
References DEBUG_ENTRY, gv, POW2, STATIC, and THERMCONST.
Referenced by UpdatePot().
STATIC void UpdateRecomZ0 | ( | size_t | nd, |
long | nz ) |
References DEBUG_ENTRY, dense, GetPotValues(), GrainIonColl(), gv, INCL_TUNNEL, LIMELM, NO_TUNNEL, and STATIC.
Referenced by UpdatePot1().
References ASSERT, DEBUG_ENTRY, gv, max(), min(), avx_ptr< T, lgBC >::ptr0(), rfield, STATIC, vexp(), vlog(), and y0b01().
Referenced by UpdatePot1().
STATIC double y0psa | ( | size_t | nd, |
long | ns, | ||
long | i, | ||
double | Eel ) |
References ASSERT, DEBUG_ENTRY, elec_esc_length(), gv, and STATIC.
Referenced by InitBinAugerData().
STATIC double y1psa | ( | size_t | nd, |
long | i, | ||
double | Eel ) |
References ASSERT, DEBUG_ENTRY, elec_esc_length(), gv, pow2, pow3, and STATIC.
Referenced by InitBinAugerData().
|
inline |
References ASSERT, DEBUG_ENTRY, and pow3.
|
inline |
References ASSERT, avx_ptr< T, lgBC >::data(), DEBUG_ENTRY, ETILDE, gv, INV_ETILDE, avx_ptr< T, lgBC >::ptr0(), vfast_asinh(), vsqrt(), and x2.
Referenced by Yfunc(), and Yfunc().
STATIC void Yfunc | ( | long | nd, |
long | nz, | ||
const realnum | y0[], | ||
const realnum | y1[], | ||
const realnum | maxval[], | ||
double | Elo, | ||
const double | Ehi[], | ||
const double | Eel[], | ||
realnum | Yp[], | ||
realnum | Ys[], | ||
realnum | Ehp[], | ||
realnum | Ehs[], | ||
long | ilo, | ||
long | ihi ) |
References ASSERT, cdEXIT, DEBUG_ENTRY, elec_esc_length(), EXIT_FAILURE, fprintf(), gv, ioQQQ, max(), min(), NULL, PE_CAR, PE_SIL, STATIC, y2pa(), and y2s().
Referenced by UpdatePot1().
STATIC void Yfunc | ( | long | nd, |
long | nz, | ||
const realnum | y01[], | ||
const realnum | maxval[], | ||
double | Elo, | ||
double | Ehi, | ||
double | Eel, | ||
realnum | Yp[], | ||
realnum | Ys[], | ||
realnum | Ehp[], | ||
realnum | Ehs[], | ||
long | ilo, | ||
long | ihi ) |
References ASSERT, cdEXIT, DEBUG_ENTRY, elec_esc_length(), EXIT_FAILURE, fprintf(), gv, ioQQQ, max(), min(), PE_CAR, PE_SIL, avx_ptr< T, lgBC >::ptr0(), STATIC, y2pa(), and y2s().
|
static |
Referenced by GetPotValues().
|
static |
Referenced by GetPotValues().
|
static |
Referenced by GetPotValues().
|
static |
Referenced by GrainCharge().
|
static |
Referenced by GrainChargeTemp(), and GrainsInit().
|
static |
|
static |
Referenced by y2s().
|
static |
Referenced by GrainChargeTemp(), and GrainsInit().
|
static |
Referenced by GrainChargeTemp(), and GrainsInit().
|
static |
Referenced by GrainsInit(), UpdatePot1(), and UpdateRecomZ0().
|
static |
Referenced by ReadAugerData().
|
static |
Referenced by GrainIonColl(), UpdatePot1(), and UpdateRecomZ0().
|
static |
Referenced by InitEmissivities().
|
static |
Referenced by GrainsInit().
|
static |
Referenced by GrainChrgTransferRates(), GrainCollHeating(), GrainElecEmis1(), and GrainElecRecomb1().
|
static |
Referenced by GrainChargeTemp().
Referenced by UpdatePot2().
|
static |
Referenced by GrainChargeTemp(), mie_auxiliary(), mie_cs_size_distr(), and search_limit().