proteus  1.8.1
C/C++/Fortran libraries
densityRelations.h
Go to the documentation of this file.
1 #ifndef DENSITYRELATIONS_H
2 #define DENSITYRELATIONS_H
3 
21 {
22 public:
23  double rho,drho;
24 };
25 
27 {
28 public:
29  double rho_0;
30  inline ConstantDensity(const double* rwork):
31  rho_0(rwork[0])
32  {
33  rho=rho_0;
34  drho=0.0;
35  }
36  inline void calc(const double& psi)
37  {
38  rho=rho_0;
39  drho=0.0;
40  }
41 };
42 
56 {
57 public:
58  double rho_0,psi_0,beta;
59  inline LinearDensity(const double* rwork):
60  rho_0(rwork[0]),
61  psi_0(rwork[1]),
62  beta(rwork[2])
63  {}
64 
65  inline void calc(const double& psi)
66  {
67  rho = rho_0*(1.0+beta*(psi - psi_0));
68  drho = beta*rho_0;
69  }
70 };
71 
85 {
86 public:
87  inline ExponentialDensity(const double* rwork):
88  LinearDensity(rwork)
89  {}
90  inline void calc(const double& psi)
91  {
92  rho = rho_0*exp(beta*(psi-psi_0));
93  drho = beta*rho;
94  }
95 };
96 
108 {
109 public:
111  inline RealGasDensity(const double *rwork):
112  psi_0(rwork[0]),
113  oneOverZRT(rwork[1])
114  {}
115  inline void calc(const double& psi)
116  {
117  rho = psi*oneOverZRT;
118  drho = oneOverZRT;
119  }
120 };
121 
137 {
138 public:
140  inline IdealGasDensity(const double *rwork):
141  T(rwork[0]),
142  W(rwork[1]),
143  R(rwork[2]),
144  convFactor(rwork[3]),
145  rho0(rwork[4]),
146  psi0(rwork[5])
147  {
148  WoverRT = convFactor*W/(R*T);
149  }
150  inline void calc(const double& psi)
151  {
152  rho = rho0 + (psi-psi0)*WoverRT;
153  drho = WoverRT;
154  }
155 };
156 
157 
159 #endif
ExponentialDensity::ExponentialDensity
ExponentialDensity(const double *rwork)
Definition: densityRelations.h:87
LinearDensity::psi_0
double psi_0
Definition: densityRelations.h:58
ConstantDensity
Definition: densityRelations.h:27
LinearDensity::rho_0
double rho_0
Definition: densityRelations.h:58
ExponentialDensity
Definition: densityRelations.h:85
LinearDensity::beta
double beta
Definition: densityRelations.h:58
IdealGasDensity::calc
void calc(const double &psi)
Definition: densityRelations.h:150
IdealGasDensity::W
double W
Definition: densityRelations.h:139
DensityRelation::rho
double rho
Definition: densityRelations.h:23
IdealGasDensity::psi0
double psi0
Definition: densityRelations.h:139
DensityRelation::drho
double drho
Definition: densityRelations.h:23
RealGasDensity::RealGasDensity
RealGasDensity(const double *rwork)
Definition: densityRelations.h:111
RealGasDensity::psi_0
double psi_0
Definition: densityRelations.h:110
IdealGasDensity::WoverRT
double WoverRT
Definition: densityRelations.h:139
RealGasDensity
Definition: densityRelations.h:108
IdealGasDensity::IdealGasDensity
IdealGasDensity(const double *rwork)
Definition: densityRelations.h:140
RealGasDensity::oneOverZRT
double oneOverZRT
Definition: densityRelations.h:110
IdealGasDensity::T
double T
Definition: densityRelations.h:139
ExponentialDensity::calc
void calc(const double &psi)
Definition: densityRelations.h:90
IdealGasDensity::convFactor
double convFactor
Definition: densityRelations.h:139
IdealGasDensity::R
double R
Definition: densityRelations.h:139
IdealGasDensity
Definition: densityRelations.h:137
LinearDensity
Definition: densityRelations.h:56
IdealGasDensity::rho0
double rho0
Definition: densityRelations.h:139
ConstantDensity::ConstantDensity
ConstantDensity(const double *rwork)
Definition: densityRelations.h:30
ConstantDensity::calc
void calc(const double &psi)
Definition: densityRelations.h:36
DensityRelation
Definition: densityRelations.h:21
RealGasDensity::calc
void calc(const double &psi)
Definition: densityRelations.h:115
LinearDensity::LinearDensity
LinearDensity(const double *rwork)
Definition: densityRelations.h:59
psi
Double psi
Definition: Headers.h:78
ConstantDensity::rho_0
double rho_0
Definition: densityRelations.h:29
LinearDensity::calc
void calc(const double &psi)
Definition: densityRelations.h:65