PLUTO
eos.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Implementation of the isothermal EOS.
5 
6  \author A. Mignone (mignone@ph.unito.it)
7  \date April 14, 2014
8 */
9 /* ///////////////////////////////////////////////////////////////////// */
10 #include "pluto.h"
11 
12 /* ********************************************************************* */
13 void SoundSpeed2 (double **v, double *cs2, double *h, int beg, int end,
14  int pos, Grid *grid)
15 /*!
16  * Define the square of the sound speed.
17  *
18  * \param [in] v 1D array of primitive quantities
19  * \param [out] cs2 1D array containing the square of the sound speed
20  * \param [in] h 1D array of enthalpy values
21  * \param [in] beg initial index of computation
22  * \param [in] end final index of computation
23  * \param [in] pos an integer specifying the spatial position
24  * inside the cell (only for spatially-dependent EOS)
25  * \param [in] grid pointer to an array of Grid structures
26  *
27  * \return This function has no return value.
28  *********************************************************************** */
29 {
30  int i, j,k; /* -- used as multidimensional indices -- */
31  double *x1, *x2, *x3;
32 
33  #if PHYSICS == HD || PHYSICS == MHD
34  x1 = grid[IDIR].x;
35  x2 = grid[JDIR].x;
36  x3 = grid[KDIR].x;
37 
38  i = g_i; j = g_j; k = g_k;
39 
40  if (g_dir == IDIR) {
41 
42  x1 = (pos == FACE_CENTER ? grid[IDIR].xr : grid[IDIR].x);
43  for (i = beg; i <= end; i++) cs2[i] = g_isoSoundSpeed*g_isoSoundSpeed;
44 
45  }else if (g_dir == JDIR){
46 
47  x2 = (pos == FACE_CENTER ? grid[JDIR].xr : grid[JDIR].x);
48  for (j = beg; j <= end; j++) cs2[j] = g_isoSoundSpeed*g_isoSoundSpeed;
49 
50  }else if (g_dir == KDIR){
51 
52  x3 = (pos == FACE_CENTER ? grid[KDIR].xr : grid[KDIR].x);
53  for (k = beg; k <= end; k++) cs2[k] = g_isoSoundSpeed*g_isoSoundSpeed;
54 
55  }
56  #else
57  print ("! SoundSpeed2: not defined for this EoS\n");
58  QUIT_PLUTO(1);
59  #endif
60 }
61 
62 /* ********************************************************************* */
63 void Enthalpy (double **v, real *h, int beg, int end)
64 /*!
65  * Compute the enthalpy.
66  *
67  * \param [in] v 1D array of primitive quantities
68  * \param [in] h 1D array of enthalpy values
69  * \param [in] beg initial index of computation
70  * \param [in] end final index of computation
71  *
72  * \return This function has no return value.
73  *********************************************************************** */
74 {
75  print ("! Enthalpy: enthalpy not defined in isothermal EOS\n");
76  QUIT_PLUTO(1);
77 }
78 
79 /* ********************************************************************* */
80 void Entropy (double **v, double *s, int beg, int end)
81 /*!
82  * Compute the entropy.
83  *
84  * \param [in] v 1D array of primitive quantities
85  * \param [in] s 1D array of entropy values
86  * \param [in] is initial index of computation
87  * \param [in] ie final index of computation
88  *
89  * \return This function has no return value.
90  *********************************************************************** */
91 {
92  print ("Entropy: entropy not defined for isothermal EOS\n");
93  QUIT_PLUTO(1);
94 }
double real
Definition: pluto.h:488
double * xr
Definition: structs.h:81
void Enthalpy(double **v, real *h, int beg, int end)
Definition: eos.c:48
#define KDIR
Definition: pluto.h:195
void SoundSpeed2(double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
Definition: eos.c:16
int g_i
x1 grid index when sweeping along the x2 or x3 direction.
Definition: globals.h:82
void Entropy(double **v, double *s, int beg, int end)
Definition: eos.c:80
#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
Definition: structs.h:78
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
#define s
PLUTO main header file.
int i
Definition: analysis.c:2
#define JDIR
Definition: pluto.h:194
#define QUIT_PLUTO(e_code)
Definition: macros.h:125