HydroCODE_2D 0.1
This is a implementation of fully explict forward Euler scheme for 2-D Euler equations of motion on Eulerian coordinate
file_2D_in.c 文件参考

This is a set of functions which control the read-in of two-dimensional data. 更多...

#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "../include/var_struc.h"
#include "../include/file_io.h"
file_2D_in.c 的引用(Include)关系图:

浏览源代码.

宏定义

#define N_MAX_2D   5
 The maximum number of 2-D data dimension storing fluid variables in memory. 更多...
 
#define STR_FLU_INI(sfv, err_exit)
 Count out and read in 2-D data of the initial fluid variable 'sfv' using function 'flu_var_init()'. If the initial data file does not exist, 'err_exit=1' means the program exits, while 'err_exit=0' means the program continues. 更多...
 

函数

static double * flu_var_init (const char *add, FILE *fp)
 This function count out and read in 2-D data file with (line*column) data and initialize pointer to these data. 更多...
 
struct flu_var initialize_2D (const char *name, int *N, int *N_plot, double *time_plot[])
 This function reads the 2-D initial data file of density/velocity/pressure. 更多...
 

详细描述

This is a set of functions which control the read-in of two-dimensional data.

在文件 file_2D_in.c 中定义.

宏定义说明

◆ N_MAX_2D

#define N_MAX_2D   5

The maximum number of 2-D data dimension storing fluid variables in memory.

在文件 file_2D_in.c17 行定义.

◆ STR_FLU_INI

#define STR_FLU_INI (   sfv,
  err_exit 
)
值:
do { \
strcpy(add, add_in); \
strcat(add, #sfv ".txt"); \
if((fp = fopen(add, "r")) == NULL) \
{ \
strcpy(add, add_in); \
strcat(add, #sfv ".dat"); \
} \
if((fp = fopen(add, "r")) == NULL) \
{ \
printf("Cannot open initial data file: %s!\n", #sfv); \
if(err_exit) \
exit(1); \
r = false; \
} \
if(r) \
{ \
FV0.sfv = flu_var_init(add, fp); \
fclose(fp); \
} \
else \
{ \
FV0.sfv = (double*)malloc((int)config[3] * sizeof(double)); \
if(FV0.sfv == NULL) \
{ \
printf("NOT enough memory! %s\n", #sfv); \
exit(5); \
} \
} \
} while(0)
static double * flu_var_init(const char *add, FILE *fp)
This function count out and read in 2-D data file with (line*column) data and initialize pointer to t...
Definition: file_2D_in.c:28
double config[N_CONF]
Initial configuration data array.
Definition: hydrocode.c:123

Count out and read in 2-D data of the initial fluid variable 'sfv' using function 'flu_var_init()'. If the initial data file does not exist, 'err_exit=1' means the program exits, while 'err_exit=0' means the program continues.

在文件 file_2D_in.c75 行定义.

函数说明

◆ flu_var_init()

static double * flu_var_init ( const char *  add,
FILE *  fp 
)
static

This function count out and read in 2-D data file with (line*column) data and initialize pointer to these data.

The value of (line*column) is stored in config[3]; the value (line) number is stored in config[13]; the value (column) number is stored in config[14];

参数
[in]addAdress of the initial data file.
[in]fpPointer to the input data file.
返回
Pointer to the position of a block of memory consisting (line*column) variables of type double.

在文件 file_2D_in.c28 行定义.

函数调用图:

◆ initialize_2D()

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

This function reads the 2-D initial data file of density/velocity/pressure.

The function initialize the extern pointer FV0.RHO/U/V/P pointing to the position of a block of memory consisting (line*column) variables* of type double. These (line*column) variables are the initial value.

参数
[in]nameName of the test example.
[in]NPointer to the number of 2-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_2D_in.c119 行定义.

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