PLUTO
eos.c File Reference

Ideal (constant gamma) EOS. 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

Ideal (constant gamma) EOS.

Implements essential functions for the constant-gamma law for hydro/MHD, relativistic hydro/relativistic 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 48 of file eos.c.

59 {
60  int i;
61  double gmmr, theta;
62 
63  gmmr = g_gamma/(g_gamma - 1.0);
64 
65 /* ---------------------------------------------------------------
66  Classical equations of state
67  --------------------------------------------------------------- */
68 
69  #if PHYSICS == HD || PHYSICS == MHD
70  for (i = beg; i <= end; i++) h[i] = gmmr*v[i][PRS]/v[i][RHO];
71  #elif PHYSICS == RHD || PHYSICS == RMHD
72  for (i = beg; i <= end; i++) {
73  theta = v[i][PRS]/v[i][RHO];
74  h[i] = 1.0 + gmmr*theta;
75  }
76  #endif
77 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
static double gmmr
Definition: two_shock.c:42
int i
Definition: analysis.c:2

Here is the caller graph for this function:

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 80 of file eos.c.

91 {
92  int i;
93  double rho, th;
94 
95  #if PHYSICS == HD || PHYSICS == MHD
96  for (i = beg; i <= end; i++){
97  rho = v[i][RHO];
98  s[i] = v[i][PRS]/pow(rho,g_gamma);
99  }
100  #elif PHYSICS == RHD || PHYSICS == RMHD
101  for (i = beg; i <= end; i++) {
102  rho = v[i][RHO];
103  s[i] = v[i][PRS]/pow(rho,g_gamma);
104  }
105  #endif
106 }
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 16 of file eos.c.

32 {
33  int i;
34 
35  #if PHYSICS == HD || PHYSICS == MHD
36  for (i = beg; i <= end; i++) cs2[i] = g_gamma*v[i][PRS]/v[i][RHO];
37  #elif PHYSICS == RHD || PHYSICS == RMHD
38  double theta;
39  Enthalpy(v, h, beg, end);
40  for (i = beg; i <= end; i++) {
41  theta = v[i][PRS]/v[i][RHO];
42  cs2[i] = g_gamma*theta/h[i];
43  }
44  #endif
45 }
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
int i
Definition: analysis.c:2

Here is the caller graph for this function: