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

Go to the source code of this file.

Functions

void SoundSpeed2 (double **u, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
 
void Enthalpy (real **uprim, real *h, int beg, int end)
 
void ENTROPY (real **v, real *s, int is, int ie)
 

Function Documentation

void Enthalpy ( real **  uprim,
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 76 of file eos.c.

82 {
83  int i;
84  double g_gammar;
85 
86  #if EOS == IDEAL
87  g_gammar = g_gamma/(g_gamma - 1.0);
88  for (i = beg; i <= end; i++){
89  h[i] = g_gammar*uprim[i][PRS]/uprim[i][RHO];
90  }
91  #elif EOS == ISOTHERMAL
92  print (" Enthalpy not defined for isothermal EoS\n");
93  QUIT_PLUTO(1);
94  #endif
95 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
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:

void ENTROPY ( real **  v,
real s,
int  is,
int  ie 
)

Definition at line 97 of file eos.c.

103 {
104  int i;
105  double rho;
106 
107  #if EOS == IDEAL
108  for (i = is; i <= ie; i++){
109  rho = v[i][RHO];
110  s[i] = v[i][PRS]/pow(rho,g_gamma);
111  }
112  #elif EOS == ISOTHERMAL || EOS == BAROTROPIC
113  print (" Entropy not defined in isothermal or barotropic MHD\n");
114  QUIT_PLUTO(1);
115  #endif
116 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
void print(const char *fmt,...)
Definition: amrPluto.cpp:497
#define s
int i
Definition: analysis.c:2
#define QUIT_PLUTO(e_code)
Definition: macros.h:125

Here is the call graph for this function:

void SoundSpeed2 ( double **  u,
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 4 of file eos.c.

11 {
12  int i;
13 
14  #if EOS == IDEAL
15  for (i = beg; i <= end; i++) cs2[i] = g_gamma*u[i][PRS]/u[i][RHO];
16  #elif EOS == ISOTHERMAL
17  {
18  int j,k; /* -- used as multidimensional indices -- */
19  double *x1, *x2, *x3;
20 
21  x1 = grid[IDIR].x;
22  x2 = grid[JDIR].x;
23  x3 = grid[KDIR].x;
24 
25  i = g_i;
26  j = g_j;
27  k = g_k;
28 
29  if (g_dir == IDIR) {
30  double R;
31 
32  x1 = (pos == FACE_CENTER ? grid[IDIR].xr : grid[IDIR].x);
33  for (i = beg; i <= end; i++){
34  #if GEOMETRY == POLAR
35  R = x1[i];
36  #elif GEOMETRY == SPHERICAL
37  R = x1[i]*sin(x2[j]);
38  #endif
39  cs2[i] = g_isoSoundSpeed*g_isoSoundSpeed/R;
40  }
41 
42  }else if (g_dir == JDIR){
43  double R;
44 
45  x2 = (pos == FACE_CENTER ? grid[JDIR].xr : grid[JDIR].x);
46  for (j = beg; j <= end; j++) {
47  #if GEOMETRY == POLAR
48  R = x1[i];
49  #elif GEOMETRY == SPHERICAL
50  R = x1[i]*sin(x2[j]);
51  #endif
52  cs2[j] = g_isoSoundSpeed*g_isoSoundSpeed/R;
53  }
54  }else if (g_dir == KDIR){
55  double R;
56 
57  x3 = (pos == FACE_CENTER ? grid[KDIR].xr : grid[KDIR].x);
58  for (k = beg; k <= end; k++){
59  #if GEOMETRY == POLAR
60  R = x1[i];
61  #elif GEOMETRY == SPHERICAL
62  R = x1[i]*sin(x2[j]);
63  #endif
64  cs2[k] = g_isoSoundSpeed*g_isoSoundSpeed/R;
65  }
66  }
67  }
68  #else
69  print ("! SoundSpeed2: not defined for this EoS\n");
70  QUIT_PLUTO(1);
71  #endif
72 }
double g_gamma
Definition: globals.h:112
double * xr
Definition: structs.h:81
#define RHO
Definition: mod_defs.h:19
#define KDIR
Definition: pluto.h:195
int g_i
x1 grid index when sweeping along the x2 or x3 direction.
Definition: globals.h:82
#define IDIR
Definition: pluto.h:193
int g_dir
Specifies the current sweep or direction of integration.
Definition: globals.h:86
#define FACE_CENTER
Definition: pluto.h:206
int g_j
x2 grid index when sweeping along the x1 or x3 direction.
Definition: globals.h:83
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
void print(const char *fmt,...)
Definition: amrPluto.cpp:497
double * x
Definition: structs.h:80
int g_k
x3 grid index when sweeping along the x1 or x2 direction.
Definition: globals.h:84
int i
Definition: analysis.c:2
#define JDIR
Definition: pluto.h:194
#define QUIT_PLUTO(e_code)
Definition: macros.h:125

Here is the call graph for this function: