-
Notifications
You must be signed in to change notification settings - Fork 7
/
ffd_data_reader.c
56 lines (50 loc) · 1.79 KB
/
ffd_data_reader.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
///////////////////////////////////////////////////////////////////////////////
///
/// \file ffd_data_reader.c
///
/// \brief Read the previous FFD result file (Tecplot format)
///
/// \author Wangda Zuo
/// University of Miami
/// W.Zuo@miami.edu
/// Mingang Jin, Qingyan Chen
/// Purdue University
/// Jin55@purdue.edu, YanChen@purdue.edu
///
/// \date 8/3/2013
///
///////////////////////////////////////////////////////////////////////////////
#include "ffd_data_reader.h"
///////////////////////////////////////////////////////////////////////////////
/// Read the previous FFD simulation data in a format of standard output
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int read_ffd_data(PARA_DATA *para, REAL **var) {
int i,j, k;
int imax = para->geom->imax;
int jmax = para->geom->jmax;
int kmax = para->geom->kmax;
int IMAX = imax+2, IJMAX = (imax+2)*(jmax+2);
char string[400];
if((file_old_ffd=fopen(para->inpu->old_ffd_file_name,"r"))==NULL) {
sprintf(msg, "ffd_data_reader.c: Can not open %s.",
para->inpu->old_ffd_file_name);
ffd_log("ffd_data_reader.c: Can not open %s.", FFD_ERROR);
return 1;
}
FOR_ALL_CELL
fgets(string, 400, file_old_ffd);
sscanf(string,"%f%f%f%f%f%f", &var[VX][IX(i,j,k)], &var[VY][IX(i,j,k)],
&var[VZ][IX(i,j,k)], &var[TEMP][IX(i,j,k)],
&var[TRACE][IX(i,j,k)], &var[IP][IX(i,j,k)]);
END_FOR
fclose(file_old_ffd);
sprintf(msg, "read_ffd_data(): Read previous ffd simulation data file %s.",
para->inpu->old_ffd_file_name);
ffd_log(msg, FFD_NORMAL);
return 0;
} // End of read_ffd_data()