rice-solar-physics / pydrad

Python tools for setting up HYDRAD runs and parsing output
https://pydrad.readthedocs.io
MIT License
4 stars 3 forks source link

New defines for radiation lookup tables #95

Closed sjbradshaw closed 4 years ago

sjbradshaw commented 4 years ago

The sequence of defines for using radiation lookup tables are:

define USE_POWER_LAW_RADIATIVE_LOSSES

define USE_RADIATION_LOOKUP_TABLE

ifdef USE_RADIATION_LOOKUP_TABLE

#define RADIATION_LOOKUP_TABLE "path/filename"

endif // USE_RADIATION_LOOKUP_TABLE

Note that USE_POWER_LAW_RADIATIVE_LOSSES must still be defined. The lookup table code hijacks the power law code when USE_RADIATION_LOOKUP_TABLE is defined. This avoids making the radiation calculation in CEquations::EvaluateTerms even more complicated and messy than it already is and means that only radiation.h and radiation.cpp need be modified.

A new directory has been added: Radiation_Model/atomic_data/lookupTables/

Example file: RADYN(noHE).rad

Lookup tables have the format:

N (number of temperature and emissivity values) M C (gradient and offset for a linear map from log10 T to array index for fast searching) T E (T = log10 T and E = log10 emissivity [erg cm^3 s^-1]) . . . . . .

To search the table the starting array index is found by: index = (int)(MT + C). Temperature must be in log10 form and the temperature bins must be of equal width.

wtbarnes commented 4 years ago

Thanks Steve!