PLUTO
eos.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief PVTE EoS header file.
5 
6  Contains basic macro definitions, function prototypes and structure
7  definition used by the PVTE_LAW equation of state.
8  In this module, two equations of state are used:
9  \f[
10  \left\{\begin{array}{lcll}
11  p &=&\DS \frac{\rho T}{{\rm K}\mu(\vec{X})} &\qquad\rm{(thermal)}\,,
12  \\ \noalign{\bigskip}
13  e &=& e(T,\vec{X}) &\qquad\rm{(caloric)}\,.
14  \end{array}\right.
15  \f]
16 
17  Since these two equations can be nonlinear functions and PLUTO performs
18  conversions between primitive and conservative variables quite often
19  during a single update step, the employment of this EoS is more
20  computationally intensive:
21 
22  -# *Non equilibrium case*:
23  when converting from primitive to conservative and
24  viceversa, the following operations are performed:
25  \f[ \begin{array}{lll}
26  (p,\rho,\vec{X}) &\quad\Longrightarrow\quad \DS T = \frac{p}{\rho}K\mu(\vec{X})
27  &\quad\Longrightarrow\quad e = e(T,\vec{X})
28  \\ \noalign{\medskip}
29  (e,\rho,\vec{X}) &\quad\Longrightarrow\quad T = T(e,\vec{X})^*
30  &\quad\Longrightarrow\quad \DS p = \frac{T\rho}{K\mu(\vec{X})}
31  \\ \noalign{\medskip}
32  \end{array}
33  \f]
34  The \* symbol means that a nonlinear equation must be inverted
35  numerically using a root-finder.
36  -# *Equilibrium case*: \b X \c (T,rho) and all the
37  dependencies on \b X become dependencies on \c (T,rho).
38  In this case the operations carried out during primitive to conservative
39  and viceversa are:
40  \f[ \begin{array}{lll}
41  (p,\rho) &\quad\Longrightarrow\quad \DS T = \frac{p}{\rho}K\mu(T,\rho)^*
42  &\quad\Longrightarrow\quad e = e(T,\rho)
43  \\ \noalign{\medskip}
44  (e,\rho) &\quad\Longrightarrow\quad T = T(e,\rho)^*
45  &\quad\Longrightarrow\quad \DS p = \frac{T\rho}{K\mu(T,\rho)}
46  \\ \noalign{\medskip}
47  \end{array}
48  \f]
49  requiring thus two numerical inversions of nonlinear equations \*.
50 
51  The sequence of operation is handled by the following functions:
52 
53  <CENTER>
54  Main variables | Calling Function | T(p,rho,X) | e = e(rho,T,X)
55  -------------- | ---------------- | ------------------- | --------------
56  (p,rho,X) | PrimToCons() | GetPV_Temperature() | InternalEnergy()
57 
58  Main variables | Calling Function | T(rho,e,X) | p = (rho,T,X)
59  -------------- | ---------------- | ------------------- | ------------
60  (rho,e,X) | ConsToPrim() | GetEV_Temperature() | Pressure()
61  </CENTER>
62 
63  \authors B. Vaidya (bhargav.vaidya@ph.unito.it)\n
64  A. Mignone (mignone@ph.unito.it)
65  \date June 25, 2014
66 */
67 /* ///////////////////////////////////////////////////////////////////// */
68 #ifndef T_CUT_RHOE
69  #define T_CUT_RHOE 10.0 /**< Sets the lowest cut-off temperature used in
70  the PVTE_LAW equation of state.
71  Zones with temperature below T_CUT_RHOE
72  will be reset to this value and the internal
73  energy will be redefined accordingly. */
74 #endif
75 
76 
77 #if ENTROPY_SWITCH
78  #error ! PVTE_LAW not working with ENTROPY_SWITCH
79 #endif
80 
81 
82 /* ***********************************************************
83  \cond REPEAT_FUNCTION_DOCUMENTATION_IN_HEADER_FILES
84  Function prototyping
85  *********************************************************** */
86 
87 double FundamentalDerivative(double *, double T);
88 double Gamma1(double *); /* User supplied */
89 int GetEV_Temperature (double, double *, double *);
90 void GetMu (double, double, double *); /* User supplied */
91 int GetPV_Temperature (double *, double *);
92 double InternalEnergy (double *, double);
93 double InternalEnergyFunc (double *, double); /* User supplied */
94 void InternalEnergyBracket (double, double *, double *, double *);
98 double Pressure(double *, double);
99 /* \endcond */
100 
101 struct func_param {
102  double v[NVAR];
103  double rhoe;
104  double T1;
105 };
107 /* The following set of switches should be enabled ONLY WITHOUT CHEMISTRY */
108 /* Use YES/NO to switch between the version with root finder in both
109  temperature and internal energy or faster version with lookup table */
110 
111 #if NIONS == 0
112  #ifndef PV_TEMPERATURE_TABLE
113  #define PV_TEMPERATURE_TABLE YES
114  #endif
115  #ifndef TV_ENERGY_TABLE
116  #define TV_ENERGY_TABLE YES
117  #endif
118 #else
119  #undef PV_TEMPERATURE_TABLE
120  #undef TV_ENERGY_TABLE
121  #define PV_TEMPERATURE_TABLE NO
122  #define TV_ENERGY_TABLE NO
123 #endif
124 
void GetMu(double T, double rho, double *mu)
Definition: pvte_law.c:115
tuple T
Definition: Sph_disk.py:33
double InternalEnergy(double *v, double T)
double FundamentalDerivative(double *v, double T)
double rhoe
Definition: eos.h:107
double T1
Definition: eos.h:108
double v[NVAR]
Definition: eos.h:106
int GetEV_Temperature(double rhoe, double *v, double *T)
void MakeEV_TemperatureTable()
double Gamma1(double *v)
Definition: pvte_law.c:231
double Pressure(double *v, double T)
Definition: thermal_eos.c:179
void MakeInternalEnergyTable()
int GetPV_Temperature(double *v, double *T)
Definition: thermal_eos.c:221
void MakePV_TemperatureTable()
Definition: thermal_eos.c:63
#define NVAR
Definition: pluto.h:609
double InternalEnergyFunc(double *v, double T)
Definition: pvte_law.c:47