Droplet Lagrangian Transient One-dimensional Reacting Code Implementation of both liquid and gas phase governing equations.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

222 lines
6.6KB

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