HydroCODE_1D 0.1
This is a implementation of fully explict forward Euler scheme for 1-D Euler equations of motion on Lagrangian/Eulerian coordinate
file_io.h 文件参考

This file is the header file that controls data input and output. 更多...

此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

函数

void example_io (const char *example, char *add_mkdir, const int i_or_o)
 This function produces folder path for data input or output. 更多...
 
int flu_var_count (FILE *fp, const char *add)
 This function counts how many numbers are there in the initial data file. 更多...
 
int flu_var_count_line (FILE *fp, const char *add, int *n_x)
 This function counts the line and column number of the numbers are there in the initial data file. 更多...
 
int flu_var_read (FILE *fp, double *U, const int num)
 This function reads the initial data file to generate the initial data. 更多...
 
int time_plot_read (const char *add_in, const int N_max, int *N_plot, double *time_plot[])
 This function reads the time data file for plotting 'time_plot.dat' and initialize tha array 'time_plot[]'. 更多...
 
void arg_preprocess (const int argc_least, const int argc, char *argv[], char *scheme)
 This is a functions preprocesses ARGuments. 更多...
 
void configurate (const char *name)
 This function controls configuration data reading and validation. 更多...
 
void config_write (const char *add_out, const double *cpu_time, const char *name)
 This function write configuration data and program record into the file 'log.dat'. 更多...
 
struct flu_var initialize_1D (const char *name, int *N, int *N_plot, double *time_plot[])
 This function reads the 1-D initial data file of density/velocity/pressure and performs some other initialization function procedures. 更多...
 
struct flu_var initialize_2D (const char *name, int *N, int *N_plot, double *time_plot[])
 
void file_1D_write (const int m, const int N, const struct cell_var_stru CV, double *X[], const double *cpu_time, const char *problem, const double time_plot[])
 This function write the 1-D solution into output '.dat' files. 更多...
 
void file_2D_write (const int n_x, const int n_y, const int N, const struct cell_var_stru CV[], double **X, double **Y, const double *cpu_time, const char *problem, const double time_plot[])
 
void file_2D_write_POINT_TEC (const int n_x, const int n_y, const int N, const struct cell_var_stru CV[], double **X, double **Y, const double *cpu_time, const char *problem, const double time_plot[])
 
void file_1D_write_HDF5 (const int m, const int N, const struct cell_var_stru CV, double *X[], const double *cpu_time, const char *problem, double time_plot[])
 This function write the 1-D solution into HDF5 output '.h5' files. 更多...
 
void file_2D_write_HDF5 (const int n_x, const int n_y, const int N, const struct cell_var_stru CV[], double **X, double **Y, const double *cpu_time, const char *problem, double time_plot[])
 This function write the 2-D solution into HDF5 output '.h5' files. 更多...
 
void file_radial_write_TEC (const struct flu_var FV, const double *R, const char *problem, const double time)
 
void file_write_2D_BLOCK_TEC (const struct flu_var FV, const struct mesh_var mv, const char *problem, const double time)
 
void file_write_3D_VTK (const struct flu_var FV, const struct mesh_var mv, const char *problem, const double time)
 

详细描述

This file is the header file that controls data input and output.

This header file declares functions in the folder 'file_io'.

在文件 file_io.h 中定义.

函数说明

◆ arg_preprocess()

void arg_preprocess ( const int  argc_least,
const int  argc,
char *  argv[],
char *  scheme 
)

This is a functions preprocesses ARGuments.

This function prints out all ARGuments, checks for the right ARGument Counter, loads argv[3], argv[4] and argv[argc_least+1,argc_least+2,…] as configuration, and puts the scheme name into the pointer 'scheme'.

参数
[in]argc_leastThe least value of the ARGument Counter.
[in]argcARGument Counter.
[in]argvARGument Values.
[in]schemeScheme name.
  • argv[1]: Folder name of test example (input path).
  • argv[3]: Order of numerical scheme[_scheme name] (= 1[_Riemann_exact] or 2[_GRP]).
  • argv[argc_least+1,argc_least+2,…]: Configuration supplement config[n]=(double)C (= n=C).

在文件 terminal_io.c26 行定义.

这是这个函数的调用关系图:

◆ config_write()

void config_write ( const char *  add_out,
const double *  cpu_time,
const char *  name 
)

This function write configuration data and program record into the file 'log.dat'.

The parameters in the log file refer to 'doc/config.csv'.

备注
The code of recording CPU time is commented out.
参数
[in]add_outAddress of the output data folder of the test example.
[in]cpu_timeArray of the CPU time recording.
[in]nameName of the test example.

在文件 config_handle.c253 行定义.

这是这个函数的调用关系图:

◆ configurate()

void configurate ( const char *  add_in)

This function controls configuration data reading and validation.

The parameters in the configuration data file refer to 'doc/config.csv'.

参数
[in]add_inAdress of the initial data folder of the test example.

在文件 config_handle.c208 行定义.

函数调用图:
这是这个函数的调用关系图:

◆ example_io()

void example_io ( const char *  example,
char *  add_mkdir,
const int  i_or_o 
)

This function produces folder path for data input or output.

参数
[in]exampleName of the test example/numerical results.
[out]add_mkdirFolder path for data input or output.
[in]i_or_oConversion parameters for data input/output.
  • 0: data output.
  • 1(non-0 value): data input.

在文件 io_control.c40 行定义.

函数调用图:
这是这个函数的调用关系图:

◆ file_1D_write()

void file_1D_write ( const int  m,
const int  N,
const struct cell_var_stru  CV,
double *  X[],
const double *  cpu_time,
const char *  problem,
const double  time_plot[] 
)

This function write the 1-D solution into output '.dat' files.

注解
It is quite simple so there will be no more comments.
参数
[in]mThe number of spatial points in the output data.
[in]NThe number of time steps in the output data.
[in]CVStructure of grid variable data in computational grid cells.
[in]X[]Array of the coordinate data.
[in]cpu_timeArray of the CPU time recording.
[in]problemName of the numerical results for the test problem.
[in]time_plotArray of the plotting time recording.

在文件 file_1D_out.c49 行定义.

函数调用图:
这是这个函数的调用关系图:

◆ file_1D_write_HDF5()

void file_1D_write_HDF5 ( const int  m,
const int  N,
const struct cell_var_stru  CV,
double *  X[],
const double *  cpu_time,
const char *  problem,
double  time_plot[] 
)

This function write the 1-D solution into HDF5 output '.h5' files.

参数
[in]mThe number of spatial points in the output data.
[in]NThe number of time steps in the output data.
[in]CVStructure of grid variable data in computational grid cells.
[in]X[]Array of the coordinate data.
[in]cpu_timeArray of the CPU time recording.
[in]problemName of the numerical results for the test problem.
[in]time_plotArray of the plotting time recording.

在文件 file_out_hdf5.c54 行定义.

函数调用图:
这是这个函数的调用关系图:

◆ file_2D_write()

void file_2D_write ( const int  n_x,
const int  n_y,
const int  N,
const struct cell_var_stru  CV[],
double **  X,
double **  Y,
const double *  cpu_time,
const char *  problem,
const double  time_plot[] 
)

◆ file_2D_write_HDF5()

void file_2D_write_HDF5 ( const int  n_x,
const int  n_y,
const int  N,
const struct cell_var_stru  CV[],
double **  X,
double **  Y,
const double *  cpu_time,
const char *  problem,
double  time_plot[] 
)

This function write the 2-D solution into HDF5 output '.h5' files.

参数
[in]n_xThe number of x-spatial points in the output data.
[in]n_yThe number of y-spatial points in the output data.
[in]NThe number of time steps in the output data.
[in]CVStructure of variable data in computational grid cells.
[in]XArray of the x-coordinate data.
[in]YArray of the y-coordinate data.
[in]cpu_timeArray of the CPU time recording.
[in]problemName of the numerical results for the test problem.
[in]time_plotArray of the plotting time recording.

在文件 file_out_hdf5.c162 行定义.

函数调用图:

◆ file_2D_write_POINT_TEC()

void file_2D_write_POINT_TEC ( const int  n_x,
const int  n_y,
const int  N,
const struct cell_var_stru  CV[],
double **  X,
double **  Y,
const double *  cpu_time,
const char *  problem,
const double  time_plot[] 
)

◆ file_radial_write_TEC()

void file_radial_write_TEC ( const struct flu_var  FV,
const double *  R,
const char *  problem,
const double  time 
)

◆ file_write_2D_BLOCK_TEC()

void file_write_2D_BLOCK_TEC ( const struct flu_var  FV,
const struct mesh_var  mv,
const char *  problem,
const double  time 
)

◆ file_write_3D_VTK()

void file_write_3D_VTK ( const struct flu_var  FV,
const struct mesh_var  mv,
const char *  problem,
const double  time 
)

◆ flu_var_count()

int flu_var_count ( FILE *  fp,
const char *  add 
)

This function counts how many numbers are there in the initial data file.

参数
[in]fpThe pointer to the input file.
[in]addThe address of the input file.
返回
num: The number of the numbers in the initial data file.

在文件 io_control.c124 行定义.

这是这个函数的调用关系图:

◆ flu_var_count_line()

int flu_var_count_line ( FILE *  fp,
const char *  add,
int *  n_x 
)

This function counts the line and column number of the numbers are there in the initial data file.

参数
[in]fpThe pointer to the input file.
[in]addThe address of the input file.
[out]n_xThe colume number of the numbers in the initial data file.
返回
line: The line number of the numbers in the initial data file.

在文件 io_control.c163 行定义.

◆ flu_var_read()

int flu_var_read ( FILE *  fp,
double *  U,
const int  num 
)

This function reads the initial data file to generate the initial data.

参数
[in]fpThe pointer to the input file.
[out]UThe pointer to the data array of fluid variables.
[in]numThe number of the numbers in the input file.
返回
It returns 0 if successfully read the file, while returns the index of the wrong entry.

在文件 io_control.c221 行定义.

这是这个函数的调用关系图:

◆ initialize_1D()

struct flu_var initialize_1D ( const char *  name,
int *  N,
int *  N_plot,
double *  time_plot[] 
)

This function reads the 1-D initial data file of density/velocity/pressure and performs some other initialization function procedures.

The function initialize the extern pointer FV0.RHO/U/P pointing to the position of a block of memory consisting m variables* of type double. These m variables are the initial value and the value of m is stored in config[3].

参数
[in]nameName of the test example.
[in]NPointer to the number of 1-D data dimension storing fluid variables in memory.
[out]N_plotPointer to the number of time steps for plotting.
[out]time_plotPointer to the array of the plotting time recording.
返回
FV0: Structure of initial fluid variable data array pointer.
注解
This function contains the function procedures 'time_plot_read()' and 'configurate()'.

在文件 file_1D_in.c93 行定义.

函数调用图:
这是这个函数的调用关系图:

◆ initialize_2D()

struct flu_var initialize_2D ( const char *  name,
int *  N,
int *  N_plot,
double *  time_plot[] 
)

◆ time_plot_read()

int time_plot_read ( const char *  add_in,
const int  N_max,
int *  N_plot,
double *  time_plot[] 
)

This function reads the time data file for plotting 'time_plot.dat' and initialize tha array 'time_plot[]'.

参数
[in]add_inAdress of the initial data folder of the test example.
[in]N_maxThe maximum number of data dimension storing fluid variables in memory.
[out]N_plotPointer to the number of time steps for plotting.
[out]time_plotPointer to the array of the plotting time recording.
返回
It returns the proper number of data dimension storing fluid variables in memory.

在文件 io_control.c288 行定义.

函数调用图:
这是这个函数的调用关系图: