Droplet Lagrangian Transient One-dimensional Reacting Code Implementation of both liquid and gas phase governing equations.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

175 行
6.7KB

  1. #ifndef SUNDIALS_DEF
  2. #define SUNDIALS_DEF
  3. #include <sundials/sundials_types.h>
  4. #include <nvector/nvector_openmp.h>
  5. #endif
  6. #ifndef PRINT_DEF
  7. #define PRINT_DEF
  8. #include <string.h> //for strings
  9. #include <string>
  10. #include <cstring>
  11. #include <stdio.h> //for printf,scanf
  12. #include <stdlib.h> //for atoi, atof
  13. #endif
  14. #ifndef CANTERA_DEF
  15. #define CANTERA_DEF
  16. #include <cantera/IdealGasMix.h>
  17. #include <cantera/transport.h>
  18. #endif
  19. #ifndef COOLPROP_DEF
  20. #define COOLPROP_DEF
  21. #include <CoolProp.h> //for gas-phase thermodynamic properties
  22. //#include <HumidAirProp.h>
  23. //#include <CPState.h>
  24. #endif
  25. #include "UserData.h"
  26. #include <vector> //add the vector module
  27. #include <algorithm>
  28. void REGRID(double* ydata,double* ydotdata,UserData data);
  29. void INTERPO(double* y,double* ydot,const size_t nvar,size_t nPts,const double XNEW[], const double XOLD[]);
  30. double maxTemperaturePosition(const double* y,const size_t nt,const size_t nvar,const double* x ,size_t nPts);
  31. double maxTemperature(const double* y,const size_t nt, const size_t nvar, size_t nPts);
  32. int maxTemperatureIndex(const double* y,const size_t nt,const size_t nvar ,size_t nPts);
  33. double maxCurvPositionR(const double* y, const size_t nt,
  34. const size_t nvar, const size_t nr, size_t nPts);
  35. int maxCurvIndexR(const double* y, const size_t nt,
  36. const size_t nvar, const size_t nr, size_t nPts);
  37. double maxGradPosition(const double* y, const size_t nt,
  38. const size_t nvar, const double* x, size_t nPts);
  39. int maxGradIndex(const double* y, const size_t nt,
  40. const size_t nvar, const double* x, size_t nPts);
  41. double maxCurvPosition(const double* y, const size_t nt,
  42. const size_t nvar, const double* x, size_t nPts);
  43. int maxCurvIndex(const double* y, const size_t nt,
  44. const size_t nvar, const double* x, size_t nPts);
  45. double isothermPosition(const double* y, const double T, const size_t nt,
  46. const size_t nvar, const double* x, const size_t nPts);
  47. int setAlgebraicVariables(N_Vector *id,UserData data,const double* ydata);
  48. inline double calc_area(double x,int* i);
  49. void updateSolution(double* y, double* ydot, const size_t nvar,
  50. const double xOld[],const double xNew[],const size_t npts);
  51. //void readInitialCondition(FILE* input, double* ydata, const size_t nvar, const size_t nr, const size_t nPts);
  52. void readInitialCondition(FILE* input, double* ydata, const size_t nvar, const size_t nr, const size_t nPts, const size_t l_nPts, double Rg);
  53. double systemMass(double* ydata, UserData data);
  54. int initializePsiGrid(double* ydata, double* psidata, UserData data);
  55. int initializePsiEtaGrid(double* ydata, double* psidata, UserData data);
  56. int setInitialCondition(N_Vector* y,
  57. N_Vector* ydot,
  58. UserData data);
  59. inline void setGas(UserData data, double *ydata, size_t gridPoint);
  60. void getTransport(UserData data,
  61. double *ydata,
  62. size_t gridPoint,
  63. double *rho,
  64. double *lambda,
  65. double *YV);
  66. void getGasMassFlux(UserData data,
  67. double *ydata,
  68. size_t gridPoint,
  69. double* YV) ;
  70. int residue(double t,
  71. N_Vector y,
  72. N_Vector ydot,
  73. N_Vector res,
  74. void *user_data);
  75. void trackFlameOH(N_Vector y,UserData data);
  76. void trackFlame(N_Vector y,UserData data);
  77. size_t BathGasIndex(UserData data);
  78. size_t oxidizerIndex(UserData data);
  79. size_t specIndex(UserData data,const char *specName);
  80. inline double Qdot(double* t,
  81. double* x,
  82. double* ignTime,
  83. double* kernelSize,
  84. double* maxQdot);
  85. void printSpaceTimeHeader(UserData data);
  86. void printSpaceTimeOutput(double t, N_Vector* y, FILE* output, UserData data);
  87. void printSpaceTimeRates(double t, N_Vector ydot, UserData data);
  88. void printGlobalHeader(UserData data);
  89. void printGlobalVariables(double t, N_Vector* y, N_Vector* ydot, UserData data);
  90. void printSpaceTimeOutputInterpolated(double t, N_Vector y, UserData data);
  91. void writeRestart(double t, N_Vector* y, N_Vector* ydot, FILE* output, UserData data);
  92. void readRestart(N_Vector* y, N_Vector* ydot, FILE* input, UserData data);
  93. void getTimescale(UserData data, N_Vector* y);
  94. void printTimescaleHeader(UserData data);
  95. void printTimescaleOutput(double t,N_Vector* y,FILE* output,UserData data);
  96. void floorSmallValue(UserData data, N_Vector* y);
  97. void resetTolerance(UserData data, N_Vector* y,N_Vector* atolv);
  98. void getReactions(UserData data,N_Vector* y,FILE* output);
  99. void getSpecies(UserData data,N_Vector* y,FILE* output);
  100. //double getLiquidRho(double dropMole[],double temp,double pres);
  101. //double getLiquidCp(double dropMole[],double temp,double pres);
  102. //double getLiquidHv(double dropMole[],double temp,double pres);
  103. //double getLiquidMaxT(double dropMole[],double pres);
  104. double getLiquidDensity(const double temp,const double pres, const std::vector<std::string>& composition);
  105. double getLiquidDensity(const double temp,const double pres, const std::vector<std::string>& composition,const double mole_[]);
  106. double getLiquidCond(const double temp,const double pres, const std::vector<std::string>& composition);
  107. double getLiquidCond(const double temp,const double pres, std::vector<std::string>& composition,const double mole_[]);
  108. double getGasCond(UserData data, double *ydata, size_t gridPoint);
  109. double getLiquidCpb(const double temp,const double pres, const std::vector<std::string>& composition);
  110. double getLiquidCpb(const double temp,const double pres, const std::vector<std::string>& composition,const double mole_[]);
  111. void getLiquidCp(const double temp, const double pres, const std::vector<std::string> &composition, double liquidCp[]);
  112. void getLiquidMoleVec(UserData data,double* ydata,int gridPoint,double mole_[]);
  113. void getLiquidVH(const double pres, const int dropType, double vapheat[2]);
  114. //void mass2mole(const double mass_[], double mole_[], UserData data);
  115. double getLiquidmassdiff(UserData data, double* ydata, size_t gridPoint,const double temp);
  116. //void getLiquidmassvec(UserData data,double* ydata,int gridPoint, double mass_[]);
  117. //void getLiquidmolevec(UserData data,double* ydata,int gridPoint, double mole_[]);
  118. std::vector<std::string> components(int dropType);
  119. void getVapPressure(UserData data, double* ydata,int gridPoint,const double mole_[],double vapPres[]);
  120. double dropletmass(UserData data, double *ydata, const std::vector<std::string>& composition);
  121. void printIddata(UserData data, double* iddata);
  122. void printPsidata(UserData data,double* psidata);
  123. void setLiquidTransport(UserData data,
  124. double *ydata,
  125. int gridPoint,
  126. const std::vector<std::string> &composition,
  127. double *rho,
  128. double *lambda,
  129. double *YV);