Add the HRR related function and parameters into LTORC
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.

173 lines
5.1KB

  1. #ifndef CANTERA_DEF
  2. #define CANTERA_DEF
  3. #include <cantera/IdealGasMix.h>
  4. #include <cantera/transport.h>
  5. #endif
  6. #include "gridRoutines.h"
  7. #ifndef USER_DEF
  8. #define USER_DEF
  9. typedef struct UserDataTag{
  10. /*An ideal gas object from Cantera. Contains thermodynamic and kinetic
  11. * info of all species.*/
  12. Cantera::IdealGasMix* gas;
  13. /*A Transport object from Cantera. Contains all transport info of all
  14. * species.*/
  15. Cantera::Transport* trmix;
  16. /*Length of the domain (in meters):*/
  17. double domainLength;
  18. /*Mass of gas in domain (in kg):*/
  19. double mass;
  20. /*Parameter that indicates the symmetry of the problem;*/
  21. /*metric=0:Planar*/
  22. /*metric=1:Cylindrical*/
  23. /*metric=2:Spherical*/
  24. int metric;
  25. /*No: of species:*/
  26. size_t nsp;
  27. /*No: of equations:*/
  28. size_t neq;
  29. /*No: of variables:*/
  30. size_t nvar;
  31. /*Pointer indices (see "macros.h" for aliases that use these):*/
  32. /*Pointer index for temperature:*/
  33. size_t nt;
  34. /*Pointer index for species:*/
  35. size_t ny;
  36. /*Pointer index for spatial coordinate:*/
  37. size_t nr;
  38. /*Pointer index for pressure:*/
  39. size_t np;
  40. /*Species index of bath gas:*/
  41. size_t k_bath;
  42. /*Species index of oxidizer:*/
  43. size_t k_oxidizer;
  44. size_t k_OH;
  45. size_t k_HO2;
  46. /*User-defined mass flux (kg/m^2/s):*/
  47. double mdot;
  48. /*Flag to solve isobaric/isochoric problem;*/
  49. /*constantPressure=1: isobaric*/
  50. /*constantPressure=0: isochoric*/
  51. int constantPressure;
  52. /*User-defined dPdt (Pa/s), activates when problem is "isobaric":*/
  53. double dPdt;
  54. /*Initial temperature of the gas (K):*/
  55. double initialTemperature;
  56. /*Initial Pressure of the gas (atm):*/
  57. double initialPressure;
  58. /*Classification of problem type;*/
  59. /*problemType=0: Mixture is premixed and spatially uniform initially.
  60. * In order for mixture to ignite, an external heat source (finite
  61. * maxQDot) must be used.*/
  62. /*problemType=1: Mixture is premixed but spatially non-uniform
  63. * initially. Equilibrium products are contained within a hot kernel of
  64. * size given by "shift" and a mixing length scale given by
  65. * "mixingWidth".*/
  66. /*problemType=2: User specified initial condition. Use file
  67. * "initialCondition.dat".*/
  68. int problemType;
  69. /*Maximum External heat source (K/s):*/
  70. double maxQDot;
  71. /*Ignition kernel size:*/
  72. double kernelSize;
  73. double maxTemperature;
  74. /*Maximum time for which the external heat source is applied (s):*/
  75. double ignTime;
  76. /*Vector of Mass Fractions used to impose Robin Boundary Condition for
  77. * species at the domain origin:*/
  78. double* innerMassFractions;
  79. /*Value of temperature to be used if Dirichlet Boundary Conditions are
  80. * imposed for temperature:*/
  81. double innerTemperature;
  82. double wallTemperature;
  83. /*Isotherm chosen to find the location of a "burning" front (K):*/
  84. double isotherm;
  85. /*Interval of time integration:*/
  86. double finalTime;
  87. /*Current time:*/
  88. double tNow;
  89. /*Flag to reflect initial conditions across center of the domain:*/
  90. int reflectProblem;
  91. /*Parameters for initial conditions in setting up profiles:
  92. increasing function of x: g=0.5*(erf(x-3*w-shift)/w)+1)
  93. decreasing function of x: f=1-g*/
  94. double mixingWidth;
  95. double shift;
  96. double firstRadius;
  97. /*Flag to run program without time-integration i.e. simply layout the
  98. * initial conditions and quit:*/
  99. int dryRun;
  100. /*Relative Tolerance:*/
  101. double relativeTolerance;
  102. /*Absolute Tolerance for spatial coordinate:*/
  103. double radiusTolerance;
  104. /*Absolute Tolerance for Temperature:*/
  105. double temperatureTolerance;
  106. /*Absolute Tolerance for Pressure:*/
  107. double pressureTolerance;
  108. /*Absolute Tolerance for Mass Fractions:*/
  109. double massFractionTolerance;
  110. /*Absolute Tolerance for bath gas mass fraction:*/
  111. double bathGasTolerance;
  112. /*Flag to set constraints on Mass fractions so they don't acquire
  113. * negative values:*/
  114. int setConstraints;
  115. /*Flag to suppress error checking on algebraic variables:*/
  116. int suppressAlg;
  117. /*Number of time-steps elapsed before saving the solution:*/
  118. int nSaves;
  119. /*Flag to set write for every regrid:*/
  120. int writeEveryRegrid;
  121. double writeDeltaT;
  122. /*Solution output file:*/
  123. FILE* output;
  124. /*Flag to write the rates (ydot) of solution components into the
  125. * "ratesOutput" file:*/
  126. int writeRates;
  127. /*Grid output file:*/
  128. FILE* gridOutput;
  129. ///*Rate of change (ydot) output file (see "writeRates"):*/
  130. //FILE* ratesOutput;
  131. /*Global properties (mdot, radius of flame, etc.) output file:*/
  132. FILE* globalOutput;
  133. /*Flag to adapt grid:*/
  134. int adaptiveGrid;
  135. /*Flag to move grid:*/
  136. int moveGrid;
  137. /*Flag to initiate regrid:*/
  138. int regrid;
  139. /*Integer that specifies grid movement direction:
  140. * gridDirection = -1: Move Left
  141. * gridDirection = +1: Move Right*/
  142. int gridDirection;
  143. /*Total number of points for grid:*/
  144. size_t npts;
  145. double gridOffset;
  146. UserGrid grid;
  147. double* uniformGrid;
  148. int dirichletInner,dirichletOuter;
  149. int nThreads;
  150. double clockStart;
  151. /*These arrays are used to compute dr/dt, which in turn is used to
  152. * compute the flame speed S_u:*/
  153. double flamePosition[2];
  154. double flameTime[2];
  155. size_t nTimeSteps;
  156. /*heat release rate (HRR) data */
  157. double* HRRdata;
  158. } *UserData;
  159. UserData allocateUserData(FILE *input);
  160. void setSaneDefaults(UserData data);
  161. void freeUserData(UserData data);
  162. #endif