|
PLUTO
|
Thermodynamic relations for the thermal EoS, p=nkT and T=p/(nK) .
More...
#include "pluto.h"
Go to the source code of this file.
Macros | |
| #define | PV_TEMPERATURE_TABLE_NX 768 |
| #define | PV_TEMPERATURE_TABLE_NY 768 |
Functions | |
| static double | TFunc (double T, void *par) |
| void | MakePV_TemperatureTable () |
| double | Pressure (double *v, double T) |
| int | GetPV_Temperature (double *v, double *T) |
Variables | |
| static Table2D | Ttab |
A 2D table containing pre-computed values of temperature stored at equally spaced node values of Log(p/rho) and Log(rho) More... | |
Thermodynamic relations for the thermal EoS, p=nkT and T=p/(nK) .
Collect miscellaneous functions involving computations with the thermal equation of state,
where, in the second expression, rho and p are density and pressure (in code units), T is the temperature (in Kelvin), K is the KELVIN dimensionalization constant, mu(X) is the mean molecular weight and X is an array containing the ionization fractions of different elements. The previous relation is typically used to compute
p=p(T,rho,X) by calling Pressure(); T=T(p,rho,X) by calling GetPV_Temperature(). This relation can be either:H2_COOL or SNEq is enabled). Then one has
.X=X(T,rho) and the mean molecular weight now depends on temperature. Then one has
.Nonlinear equation can be solved with a root finder (typically Brent's method) or a tabulated approach (default). In both case, a 2D table (Ttab) of the temperature T(i,j) is pre-calculated for fixed values of p/rho and rho by MakePV_TemperatureTable() and stored into memory. The table is then used to bracket the root (in the case of a root finder) or to replace the runtime computation with a simpler array indexing operation followed by a combination of lookup table and bilinear (direct or inverse) interpolation.
Definition in file thermal_eos.c.
| #define PV_TEMPERATURE_TABLE_NX 768 |
Definition at line 50 of file thermal_eos.c.
| #define PV_TEMPERATURE_TABLE_NY 768 |
Definition at line 53 of file thermal_eos.c.
| int GetPV_Temperature | ( | double * | v, |
| double * | T | ||
| ) |
Compute gas temperature (in Kelvin) from density, pressure and fractions:
where K is the KELVIN macro.
The first relation is used when ion fractions are explicitly evolved by the code (NIONS>0) while the second one is inverted numerically using root finder or lookup table when either LTE or CIE is assumed.
| [in] | v | 1D array of primitive quantities. |
| [out] | T | Temperature in K |
Definition at line 221 of file thermal_eos.c.


| void MakePV_TemperatureTable | ( | ) |
Pre-calculate a 2D table of temperature T(p,rho) by inverting, at specified values of p and rho, the nonlinear equation (only in LTE or CIE)
For convenience, the table is constructed using equally spaced bins of x=log10(p/rho) and y=log10(rho) where p and rho are in code units. This function must be called only once to initialize the 2D table Ttab.
Definition at line 63 of file thermal_eos.c.


| double Pressure | ( | double * | v, |
| double | T | ||
| ) |
Return pressure as a function of temperature, density and fractions. If T(p/rho,rho) has been tabulated, this requires inverting the table by calling InverseLookupTable2D().
| [in] | v | a pointer to a vector of primitive quantities (only density and fractions will be actually used). |
| [in] | T | The temperature (in Kelvin); |
Definition at line 179 of file thermal_eos.c.


|
static |
Return the nonlinear function f(T) = T - T1 mu(T,rho) used by the root finder to find temperature T.
| [in] | T | The temperature in Kelvin |
| [in] | par | A pointer to a func_param structure containing density required for computing internal energy. |
Definition at line 319 of file thermal_eos.c.


|
static |
A 2D table containing pre-computed values of temperature stored at equally spaced node values of Log(p/rho) and Log(rho)
Definition at line 56 of file thermal_eos.c.