PLUTO  4.4-patch2
Functions
comp_equil.c File Reference

Compute equilibrium fractions for the H2_COOL module. More...

#include "pluto.h"

Functions

double CompEquil (double n, double T, double *v)
 

Detailed Description

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.

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
B. Vaidya
Date
March 1, 2015

Function Documentation

◆ CompEquil()

double CompEquil ( double  n,
double  T,
double *  v 
)
Parameters
[in]nthe particle number density (not needed, but kept for compatibility)
[in]Tthe temperature (in K) for which equilibrium must be found.
[in,out]van array of primitive variables. On input, only density needs to be defined. On output, fractions will be updated to the equilibrium values.