Droplet Lagrangian Transient One-dimensional Reacting Code Implementation of both liquid and gas phase governing equations.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

main.cpp 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "gridRoutines.h"
  2. typedef struct UserDataTag{
  3. UserGrid grid;
  4. FILE* gridOutput;
  5. } *UserData;
  6. int main(){
  7. int ier=0;
  8. UserData data;
  9. data = (UserData) malloc(sizeof *data);
  10. data->grid=(UserGrid) malloc(sizeof *data->grid);
  11. FILE *input;input=fopen("input.dat","r");
  12. ier=getGridSettings(input,data->grid);
  13. if(ier==-1)return(-1);
  14. fclose(input);
  15. ier=initializeGrid(data->grid);
  16. if(ier==-1)return(-1);
  17. ier=reGrid(data->grid, data->grid->position);
  18. if(ier==-1)return(-1);
  19. FILE* output1;output1=fopen("grid.dat","w");
  20. for(size_t i=0;i<data->grid->nPts;i++){
  21. if(i==0){
  22. fprintf(output1, "%ld\t%15.15e\t%15.15e\n",i,data->grid->x[i],data->grid->x[1]-data->grid->x[0]);
  23. }
  24. else{
  25. fprintf(output1, "%ld\t%15.15e\t%15.15e\n",i,data->grid->x[i],data->grid->x[i]-data->grid->x[i-1]);
  26. }
  27. }
  28. fclose(output1);
  29. if(data->grid->xOld!=NULL){
  30. delete[] data->grid->xOld;
  31. printf("old grid array Deleted!\n");
  32. }
  33. if(data->grid->x!=NULL){
  34. delete[] data->grid->x;
  35. printf("current grid array Deleted!\n");
  36. }
  37. if(data->grid!=NULL){
  38. free(data->grid);
  39. printf("grid object Freed!\n");
  40. }
  41. return(0);
  42. }