Droplet Lagrangian Transient One-dimensional Reacting Code Implementation of both liquid and gas phase governing equations.
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.

203 lines
6.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. /* Droplet species composition */
  17. char dropSpec[MAXBUFLEN];
  18. /*Length of the domain (in meters):*/
  19. double domainLength;
  20. /*Initial Droplet Radius (in meters)*/
  21. double Rd;
  22. /*Droplet Mass*/
  23. double massDrop;
  24. /*Mass of gas in domain (in kg):*/
  25. double mass;
  26. /*Parameter that indicates the symmetry of the problem;*/
  27. /*metric=0:Planar*/
  28. /*metric=1:Cylindrical*/
  29. /*metric=2:Spherical*/
  30. int metric;
  31. /*No: of species:*/
  32. size_t nsp;
  33. /*No: of equations:*/
  34. size_t neq;
  35. /*No: of variables:*/
  36. size_t nvar;
  37. /*Pointer indices (see "macros.h" for aliases that use these):*/
  38. /*Pointer index for temperature:*/
  39. size_t nt;
  40. /*Pointer index for species:*/
  41. size_t ny;
  42. /*Pointer index for spatial coordinate:*/
  43. size_t nr;
  44. /*Pointer index for pressure:*/
  45. size_t np;
  46. /*Pointer index for mass flow rate:*/
  47. size_t nm;
  48. /*Species index of bath gas:*/
  49. size_t k_bath;
  50. /*Species index of oxidizer:*/
  51. size_t k_oxidizer;
  52. size_t k_OH;
  53. size_t k_HO2;
  54. /*Species index of droplet composition*/
  55. size_t k_drop;
  56. /*User-defined mass flux (kg/m^2/s):*/
  57. double mdot;
  58. /*Flag to solve isobaric/isochoric problem;*/
  59. /*constantPressure=1: isobaric*/
  60. /*constantPressure=0: isochoric*/
  61. int constantPressure;
  62. /*User-defined dPdt (Pa/s), activates when problem is "isobaric":*/
  63. double dPdt;
  64. /*Initial temperature of the gas (K):*/
  65. double initialTemperature;
  66. /*Initial Pressure of the gas (atm):*/
  67. double initialPressure;
  68. /*Classification of problem type;*/
  69. /*problemType=0: Mixture is premixed and spatially uniform initially.
  70. * In order for mixture to ignite, an external heat source (finite
  71. * maxQDot) must be used.*/
  72. /*problemType=1: Mixture is premixed but spatially non-uniform
  73. * initially. Equilibrium products are contained within a hot kernel of
  74. * size given by "shift" and a mixing length scale given by
  75. * "mixingWidth".*/
  76. /*problemType=2: User specified initial condition. Use file
  77. * "initialCondition.dat".*/
  78. int problemType;
  79. /*Quasi-Steady Assumption:
  80. *quasiSteady=0: The droplet surface recedes and the droplet losses mass.
  81. *quasiSteady=1: The droplet surface does not move and the droplet mass is constant.*/
  82. int quasiSteady;
  83. /*Maximum External heat source (K/s):*/
  84. double maxQDot;
  85. /*Ignition kernel size:*/
  86. double kernelSize;
  87. double maxTemperature;
  88. /*Maximum time for which the external heat source is applied (s):*/
  89. double ignTime;
  90. /*Vector of Mass Fractions used to impose Robin Boundary Condition for
  91. * species at the domain origin:*/
  92. double* innerMassFractions;
  93. /*Value of temperature to be used if Dirichlet Boundary Conditions are
  94. * imposed for temperature:*/
  95. double innerTemperature;
  96. double wallTemperature;
  97. /*Isotherm chosen to find the location of a "burning" front (K):*/
  98. double isotherm;
  99. /*Interval of time integration:*/
  100. double finalTime;
  101. /*Current time:*/
  102. double tNow;
  103. /*Flag to reflect initial conditions across center of the domain:*/
  104. int reflectProblem;
  105. /*Parameters for initial conditions in setting up profiles:
  106. increasing function of x: g=0.5*(erf(x-3*w-shift)/w)+1)
  107. decreasing function of x: f=1-g*/
  108. double mixingWidth;
  109. double shift;
  110. double firstRadius;
  111. /*Flag to run program without time-integration i.e. simply layout the
  112. * initial conditions and quit:*/
  113. int dryRun;
  114. /*Relative Tolerance:*/
  115. double relativeTolerance;
  116. /*Absolute Tolerance for spatial coordinate:*/
  117. double radiusTolerance;
  118. /*Absolute Tolerance for Temperature:*/
  119. double temperatureTolerance;
  120. /*Absolute Tolerance for Pressure:*/
  121. double pressureTolerance;
  122. /*Absolute Tolerance for Mass Fractions:*/
  123. double massFractionTolerance;
  124. /*Absolute Tolerance for bath gas mass fraction:*/
  125. double bathGasTolerance;
  126. /*Absolute Tolerance for Mdot:*/
  127. double MdotTolerance;
  128. /*Flag to set constraints on Mass fractions so they don't acquire
  129. * negative values:*/
  130. int setConstraints;
  131. /*Flag to suppress error checking on algebraic variables:*/
  132. int suppressAlg;
  133. /*Number of time-steps elapsed before saving the solution:*/
  134. int nSaves;
  135. /*Flag to set write for every regrid:*/
  136. int writeEveryRegrid;
  137. /*Solution output file:*/
  138. FILE* output;
  139. /*Flag to write the rates (ydot) of solution components into the
  140. * "ratesOutput" file:*/
  141. int writeRates;
  142. /*Grid output file:*/
  143. FILE* gridOutput;
  144. ///*Rate of change (ydot) output file (see "writeRates"):*/
  145. //FILE* ratesOutput;
  146. /*Global properties (mdot, radius of flame, etc.) output file:*/
  147. FILE* globalOutput;
  148. /*Flag to adapt grid:*/
  149. int adaptiveGrid;
  150. /*Flag to move grid:*/
  151. int moveGrid;
  152. /*Flag to initiate regrid:*/
  153. int regrid;
  154. /*Integer that specifies grid movement direction:
  155. * gridDirection = -1: Move Left
  156. * gridDirection = +1: Move Right*/
  157. int gridDirection;
  158. /*Grid Ratio: This replaces the uniform grid. dX0 and dXf are the grid
  159. spacing at the droplet surface and right boundary, respectivly. The Grid
  160. Ratio is equal to dXf/dX0. A Rg>1 focuses grid points on the droplet
  161. surface while a Rg<1 focuses grid points at the right boundary. A Rg of 1
  162. is a uniform grid.*/
  163. double Rg;
  164. /*Total number of points for grid:*/
  165. size_t npts;
  166. double gridOffset;
  167. UserGrid grid;
  168. double* uniformGrid;
  169. int dirichletInner,dirichletOuter;
  170. int nThreads;
  171. double clockStart;
  172. /*These arrays are used to compute dr/dt, which in turn is used to
  173. * compute the flame speed S_u:*/
  174. double flamePosition[2];
  175. double flameTime[2];
  176. size_t nTimeSteps;
  177. /*Following arrays are used to compute the characteristic time scale of
  178. species*/
  179. //double* wdot_mole ;
  180. //double* wdot_mass ;
  181. double* time_scale ;
  182. //double* MW;
  183. FILE* timescaleOutput;
  184. } *UserData;
  185. UserData allocateUserData(FILE *input);
  186. void setSaneDefaults(UserData data);
  187. void freeUserData(UserData data);
  188. #endif