Canoe
Comprehensive Atmosphere N' Ocean Engine
ammonia_vapors.hpp
Go to the documentation of this file.
1 #ifndef SRC_SNAP_THERMODYNAMICS_VAPORS_AMMONIA_VAPORS_HPP_
2 #define SRC_SNAP_THERMODYNAMICS_VAPORS_AMMONIA_VAPORS_HPP_
3 
4 // C/C++
5 #include <cmath>
6 
7 inline double svpnh3(double t, double p, double beta, double gamma) {
8  return p * exp((1. - 1. / t) * beta - gamma * log(t));
9 }
10 
11 inline double sat_vapor_p_NH3_UMich(double T) {
12  double x = -1790.00 / T - 1.81630 * log10(T) + 14.97593;
13  return pow(10.0, x) * 1.E5 / 760.;
14 }
15 
16 // (164, 371.5)
17 inline double sat_vapor_p_NH3_Antoine(double T) {
18  double result;
19  if (T < 239.6)
20  result = pow(10., 3.18757 - (506.713 / (T - 80.78)));
21  else
22  result = pow(10., 4.86886 - (1113.928 / (T - 10.409)));
23  return 1.E5 * result;
24 }
25 
26 // (130, 200)
27 inline double sat_vapor_p_NH3_Hubner(double T) {
28  double A = 24.3037, B = -1766.28, C = -5.64472, D = 0.00740241;
29 
30  double x = A + B / T + C * log10(T) + D * T;
31  return pow(10.0, x);
32 }
33 
34 inline double sat_vapor_p_NH3_BriggsS(double T) {
35  double a[6], x;
36  if (T < 195) {
37  a[1] = -4122.;
38  a[2] = 41.67871;
39  a[3] = -1.81630;
40  a[4] = 0.;
41  a[5] = 0.;
42  } else {
43  a[1] = -4409.3512;
44  a[2] = 76.864252;
45  a[3] = -8.4598340;
46  a[4] = 5.51029e-03;
47  a[5] = 6.80463e-06;
48  }
49  x = a[1] / T + a[2] + a[3] * log(T) + a[4] * T + a[5] * pow(T, 2);
50  return exp(x) / 10.;
51 }
52 
53 // (15, 195.4)
54 inline double sat_vapor_p_NH3_Fray(double T) {
55  double a[7], x = 0;
56  a[0] = 1.596e+01;
57  a[1] = -3.537e+03;
58  a[2] = -3.310e+04;
59  a[3] = 1.742e+06;
60  a[4] = -2.995e+07;
61  a[5] = 0.;
62  a[6] = 0.;
63 
64  for (int i = 1; i < 7; i++)
65  x = x + a[i] / pow(T, i); // best fit in [15K; 195.41K]
66 
67  return 1.E5 * exp(x + a[0]);
68 }
69 
70 inline double sat_vapor_p_NH3_Ideal(double T) {
71  double betal = 20.08, gammal = 5.62, betas = 20.64, gammas = 1.43, tr = 195.4,
72  pr = 6060.;
73 
74  return T > tr ? svpnh3(T / tr, pr, betal, gammal)
75  : svpnh3(T / tr, pr, betas, gammas);
76 }
77 
78 #endif // SRC_SNAP_THERMODYNAMICS_VAPORS_AMMONIA_VAPORS_HPP_
double sat_vapor_p_NH3_Ideal(double T)
double sat_vapor_p_NH3_Hubner(double T)
double sat_vapor_p_NH3_Fray(double T)
double svpnh3(double t, double p, double beta, double gamma)
double sat_vapor_p_NH3_BriggsS(double T)
double sat_vapor_p_NH3_UMich(double T)
double sat_vapor_p_NH3_Antoine(double T)
#define A(i, j)
Definition: band_back_sub.c:18