-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheos.h
67 lines (53 loc) · 2.18 KB
/
eos.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* eos.h
*
* Declarations on the equation of state. Assumes a global equation of state.
* Spatially changing EOS, or adiabatic EOS with spatially varying adiabatic index would require modifications.
*/
#ifndef _AIOLOS_EOS_H_
#define _AIOLOS_EOS_H_
struct AOS ;
struct AOS_prim ;
class EOS_Base {
public:
virtual void compute_primitive(const AOS*, AOS_prim*, int) const = 0;
virtual void compute_conserved(const AOS_prim*, AOS*, int) const = 0 ;
virtual void compute_auxillary(AOS_prim*, int) const = 0;
virtual void update_p_from_eint(AOS_prim*, int) const =0;
virtual void update_eint_from_T(AOS_prim*, int) const =0;
virtual void get_p_over_rho_analytic(const double*, double*) const = 0;
virtual void get_p_from_rhoT(const double*,const double*, double*) const = 0;
// Base classes must have virtual destructors
virtual ~EOS_Base(){} ;
} ;
class IdealGas_EOS final: public EOS_Base {
public:
IdealGas_EOS(double dof, double cv, double mass)
: _gamma_m1(2./dof), _cv(cv), _mass(mass)
{ } ;
void compute_primitive(const AOS*, AOS_prim*, int) const ;
void compute_conserved(const AOS_prim*, AOS*, int) const ;
void compute_auxillary(AOS_prim*, int) const ;
void update_p_from_eint(AOS_prim*, int) const ;
void update_eint_from_T(AOS_prim*, int) const ;
void get_p_over_rho_analytic(const double*, double*) const ;
void get_p_from_rhoT(const double*,const double*, double*) const;
private:
double _gamma_m1, _cv, _mass ;
} ;
class Polytropic_EOS final: public EOS_Base {
public:
Polytropic_EOS(double gamma, double cv, double mass, double K0=1)
: _gamma(gamma), _cv(cv), _mass(mass), _K0(K0)
{ } ;
void compute_primitive(const AOS*, AOS_prim*, int) const ;
void compute_conserved(const AOS_prim*, AOS*, int) const ;
void compute_auxillary(AOS_prim*, int) const ;
void update_p_from_eint(AOS_prim*, int) const ;
void update_eint_from_T(AOS_prim*, int) const ;
void get_p_over_rho_analytic(const double*, double*) const ;
void get_p_from_rhoT(const double*,const double*, double*) const;
private:
double _gamma, _cv, _mass, _K0 ;
} ;
#endif//_AIOLOS_EOS_H_