Based on the original Rocket Workbench on SourceForge in CVS at: https://sourceforge.net/projects/rocketworkbench
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
7.0 KiB

  1. #ifndef thermo_h
  2. #define thermo_h
  3. #include "equilibrium.h"
  4. #include "const.h"
  5. /* MACRO: Number of symbol in the symbol table */
  6. #define N_SYMB 102
  7. /***************************************************************
  8. TYPE: Structure to hold information of species contain in the
  9. thermo data file
  10. ****************************************************************/
  11. typedef struct _thermo
  12. {
  13. char name[19];
  14. char comments[57];
  15. int nint; /* number of different temperature interval */
  16. char id[7]; /* identification code */
  17. int elem[5];
  18. int coef[5];
  19. state_t state;
  20. double weight; /* molecular weight */
  21. float heat; /* heat of formation at 298.15 K (J/mol) */
  22. double dho; /* HO(298.15) - HO(0) */
  23. float range[4][2]; /* temperature range */
  24. int ncoef[4]; /* number of coefficient for Cp0/R */
  25. int ex[4][8]; /* exponent in empirical equation */
  26. double param[4][9];
  27. /* for species with data at only one temperature */
  28. /* especially condensed */
  29. float temp;
  30. float enth;
  31. } thermo_t;
  32. /***************************************************************
  33. TYPE: Structure to hold information of species contain in the
  34. propellant data file
  35. ****************************************************************/
  36. typedef struct _propellant
  37. {
  38. char name[120]; /* name of the propellant */
  39. int elem[6]; /* element in the molecule (atomic number) max 6 */
  40. int coef[6]; /* stochiometric coefficient of this element
  41. (0 for none) */
  42. float heat; /* heat of formation in Joule/gram */
  43. float density; /* density in g/cubic cm */
  44. } propellant_t;
  45. extern propellant_t *propellant_list;
  46. extern thermo_t *thermo_list;
  47. extern const float molar_mass[];
  48. extern const char symb[][3];
  49. extern unsigned long num_thermo;
  50. extern unsigned long num_propellant;
  51. /*************************************************************
  52. FUNCTION: Search in the field name of thermo_list and return
  53. the value of the found item.
  54. PARAMETER: A string corresponding to what we search,
  55. example: "CO2"
  56. COMMENTS: If nothing is found, it return -1
  57. AUTHOR: Antoine Lefebvre
  58. modification bye Mark Pinese
  59. **************************************************************/
  60. int thermo_search(char *str);
  61. int propellant_search(char *str);
  62. int atomic_number(char *symbole);
  63. int propellant_search_by_formula(char *str);
  64. /*************************************************************
  65. FUNCTION: Return the enthalpy of the molecule in thermo_list[sp]
  66. at the temperature T in K. (Ho/RT)
  67. PARAMETER: sp is the position in the array of the molecule
  68. T is the temperature in K
  69. COMMENTS: It use the parametric form explain in the documentation
  70. to compute the value from the data read in the file
  71. thermo.dat
  72. AUTHOR: Antoine Lefebvre
  73. **************************************************************/
  74. double enthalpy_0(int sp, float T);
  75. /*************************************************************
  76. FUNCTION: Return the entropy of the molecule in thermo_list[sp]
  77. at the temperature T in K. (So/RT)
  78. PARAMETER: sp is the position in the array of the molecule
  79. T is the temperature in K
  80. COMMENTS: It use the parametric form explain in the documentation
  81. to compute the value from the data read in the file
  82. thermo.dat
  83. AUTHOR: Antoine Lefebvre
  84. **************************************************************/
  85. double entropy_0(int sp, float T);
  86. double entropy(int sp, state_t st, double ln_nj_n, float T, float P);
  87. /*************************************************************
  88. FUNCTION: Return the specific heat (Cp) of the molecule in
  89. thermo_list[sp] at the temperature T in K. (Cp/RT)
  90. PARAMETER: sp is the position in the array of the molecule
  91. T is the temperature in K
  92. COMMENTS: It use the parametric form explain in the documentation
  93. to compute the value from the data read in the file
  94. thermo.dat
  95. AUTHOR: Antoine Lefebvre
  96. **************************************************************/
  97. double specific_heat_0(int sp, float T);
  98. double mixture_specific_heat_0(equilibrium_t *e, double temp);
  99. /*************************************************************
  100. FUNCTION: Return true if the thermochemical data are define for
  101. this temperature.
  102. PARAMETER: The same as for entropy
  103. COMMENTS: It is useful to determine if a specie is present at
  104. a given temperature.
  105. AUTHOR: Antoine Lefebvre
  106. **************************************************************/
  107. int temperature_check(int sp, float T);
  108. double transition_temperature(int sp, float T);
  109. /*************************************************************
  110. FUNCTION: Return the variation of enthalpy of the molecule in
  111. thermo_list[sp] between the temperature T in K and
  112. 298.15 K.
  113. PARAMETER: sp is the position in the array of the molecule
  114. T is the temperature in K
  115. COMMENTS: It call enthalpy(...) for the enthalpy at temperature
  116. T and use the field heat of thermo_t for the enthalpy
  117. at 298.15
  118. AUTHOR: Antoine Lefebvre
  119. **************************************************************/
  120. double delta_enthalpy(int sp, float T);
  121. double propellant_enthalpy(equilibrium_t *e);
  122. double product_enthalpy(equilibrium_t *e);
  123. double product_entropy(equilibrium_t *e);
  124. double propellant_mass(equilibrium_t *e);
  125. int compute_density(composition_t *c);
  126. /*************************************************************
  127. FUNCTION: Return the gibbs free energy of the molecule in
  128. thermo_list[sp] at temperature T. (uo/RT)
  129. PARAMETER: sp is the position in the array of the molecule
  130. T is the temperature in K
  131. COMMENTS: g = H - ST where H is the enthalpy, T the temperature
  132. and S the entropy.
  133. **************************************************************/
  134. double gibbs_0(int sp, float T);
  135. /*************************************************************
  136. FUNCTION: Return the gibbs free energy of the molecule in
  137. thermo_list[sp] at temperature T, pressure P. (u/RT)
  138. PARAMETER: sp is the position in the array of the molecule
  139. T is the temperature in K
  140. COMMENTS: g = uo + ln(nj/n) + ln(P) for gazes
  141. g = uo for condensed
  142. AUTHOR: Antoine Lefebvre
  143. **************************************************************/
  144. //double gibbs(int sp, state_t st, double nj, double n, float T, float P);
  145. double gibbs(int sp, state_t st, double nj_n_n, float T, float P);
  146. /***************************************************************
  147. FUNCTION: Return the heat of formation of a propellant in kJ/mol
  148. ****************************************************************/
  149. double heat_of_formation(int molecule);
  150. /*************************************************************
  151. FUNCTION: Return the molar mass of a propellant (g/mol)
  152. PARAMETER: molecule is the number in propellant_list
  153. **************************************************************/
  154. double propellant_molar_mass(int molecule);
  155. double propellant_mass(equilibrium_t *e);
  156. #endif