PLUTO
|
Compute equilibrium fractions for the H2_COOL module. More...
#include "pluto.h"
Go to the source code of this file.
Functions | |
void | CompEquil (double n, double T, double *v) |
Compute equilibrium fractions for the H2_COOL module.
Compute the equilibrium fractions of atomic and molecular hydrogen for a given density and temperature (Collisional Excitation Equlibrium or CIE). This corresponds to the simultaneous solution of the three rate equations
R_HI (f,h,g) = 0 R_HII(f,h,g) = 0 R_H2 (f,h,g) = 0
where f = X(HI), h = X(HII), g = X(H2) are the number fraction of atomic, ionized and molecular hydrogen, respectively. The functions R_HI, R_HII and R_H2 are given in radiat.c. The previous system is reduced to a single scalar equation in either f or h by using h = ci/cr*f and the normalization condition g = (1-h-f)/2. A maple script can be found at the end of this file. The final equation is a quadratic,
a*f^2 + b*f + c = 0
and we have verified that the solution with the - sign is the physical acceptable one since 0 <= f <= 1 for any T.
Note that the solution for g at very large temperatures may suffer from machine precision when g becomes very small (g < 1.e-19). Using long double for the coefficients of the quadratic helps a little bit.
Definition in file comp_equil.c.
void CompEquil | ( | double | n, |
double | T, | ||
double * | v | ||
) |
[in] | n | the particle number density (not needed, but kept for compatibility) |
[in] | T | the temperature (in K) for which equilibrium must be found. |
[in,out] | v | an array of primitive variables. On input, only density needs to be defined. On output, fractions will be updated to the equilibrium values. |
Definition at line 44 of file comp_equil.c.