PLUTO
eos.c File Reference

Taub-Matthews (TM) EOS for relativistic hydro and MHD. More...

#include "pluto.h"
Include dependency graph for eos.c:

Go to the source code of this file.

Functions

void SoundSpeed2 (double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
 
void Enthalpy (double **v, real *h, int beg, int end)
 
void Entropy (double **v, double *s, int beg, int end)
 

Detailed Description

Taub-Matthews (TM) EOS for relativistic hydro and MHD.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
April 14, 2014

Definition in file eos.c.

Function Documentation

void Enthalpy ( double **  v,
real h,
int  beg,
int  end 
)

Compute the enthalpy.

Parameters
[in]v1D array of primitive quantities
[in]h1D array of enthalpy values
[in]beginitial index of computation
[in]endfinal index of computation
Returns
This function has no return value.

Definition at line 50 of file eos.c.

61 {
62  int i;
63  double gmmr, theta;
64 
65  #if PHYSICS == RHD || PHYSICS == RMHD
66  for (i = beg; i <= end; i++) {
67  theta = v[i][PRS]/v[i][RHO];
68  #if EOS == IDEAL
69  h[i] = 1.0 + gmmr*theta;
70  #elif EOS == TAUB
71  h[i] = 2.5*theta + sqrt(2.25*theta*theta + 1.0);
72  #endif
73  }
74  #endif
75 }
#define RHO
Definition: mod_defs.h:19
static double gmmr
Definition: two_shock.c:42
int i
Definition: analysis.c:2
void Entropy ( double **  v,
double *  s,
int  beg,
int  end 
)

Compute the entropy.

Parameters
[in]v1D array of primitive quantities
[in]s1D array of entropy values
[in]isinitial index of computation
[in]iefinal index of computation
Returns
This function has no return value.

Definition at line 78 of file eos.c.

89 {
90  int i;
91  double rho, th;
92 
93  #if PHYSICS == RHD || PHYSICS == RMHD
94  for (i = beg; i <= end; i++) {
95  rho = v[i][RHO];
96  #if EOS == IDEAL
97  s[i] = v[i][PRS]/pow(rho,g_gamma);
98  #elif EOS == TAUB
99  th = v[i][PRS]/rho;
100  s[i] = v[i][PRS]/pow(rho,5./3.)*(1.5*th + sqrt(2.25*th*th + 1.0));
101  #endif
102  }
103  #endif
104 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
#define s
int i
Definition: analysis.c:2
void SoundSpeed2 ( double **  v,
double *  cs2,
double *  h,
int  beg,
int  end,
int  pos,
Grid grid 
)

Define the square of the sound speed.

Parameters
[in]v1D array of primitive quantities
[out]cs21D array containing the square of the sound speed
[in]h1D array of enthalpy values
[in]beginitial index of computation
[in]endfinal index of computation
[in]posan integer specifying the spatial position inside the cell (only for spatially-dependent EOS)
[in]gridpointer to an array of Grid structures
Returns
This function has no return value.

Definition at line 13 of file eos.c.

29 {
30  int i;
31  double theta;
32 
33  #if PHYSICS == RHD || PHYSICS == RMHD
34  Enthalpy(v, h, beg, end);
35  for (i = beg; i <= end; i++) {
36  theta = v[i][PRS]/v[i][RHO];
37  #if EOS == IDEAL
38  cs2[i] = g_gamma*theta/h[i];
39  #elif EOS == TAUB
40  cs2[i] = theta/(3.0*h[i])*(5.0*h[i] - 8.0*theta)/(h[i] - theta);
41  #endif
42  }
43  #else
44  print ("! SoundSpeed2: Taub EOS not defined for this physics module.\n");
45  QUIT_PLUTO(1);
46  #endif
47 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
void Enthalpy(double **v, real *h, int beg, int end)
Definition: eos.c:48
void print(const char *fmt,...)
Definition: amrPluto.cpp:497
int i
Definition: analysis.c:2
#define QUIT_PLUTO(e_code)
Definition: macros.h:125

Here is the call graph for this function: