12#include "../include/var_struc.h"
13#include "../include/file_io.h"
24#define STR_FLU_INI(sfv, err_exit) \
26 strcpy(add, add_in); \
27 strcat(add, #sfv ".txt"); \
28 if((fp = fopen(add, "r")) == NULL) \
30 strcpy(add, add_in); \
31 strcat(add, #sfv ".dat"); \
33 if((fp = fopen(add, "r")) == NULL) \
35 printf("Cannot open initial data file: %s!\n", #sfv); \
42 num_cell = flu_var_count(fp, add); \
45 printf("Error in counting fluid variables in initial data file: %s!\n", #sfv); \
49 if(isinf(config[3])) \
50 config[3] = (double)num_cell; \
51 else if(num_cell != (int)config[3]) \
53 printf("Input unequal! num_%s=%d, num_cell=%d.\n", #sfv, num_cell, (int)config[3]); \
56 FV0.sfv = (double*)malloc(num_cell * sizeof(double)); \
59 printf("NOT enough memory! %s\n", #sfv); \
62 if(flu_var_read(fp, FV0.sfv, num_cell)) \
71 FV0.sfv = (double*)malloc(num_cell * sizeof(double)); \
74 printf("NOT enough memory! %s\n", #sfv); \
97 char add_in[FILENAME_MAX+40];
107 printf(
" delta_x\t= %g\n",
config[10]);
108 printf(
" bondary\t= %d\n", (
int)
config[17]);
112 char add[FILENAME_MAX+40];
114 int num_cell = (int)
config[3];
121#ifdef MULTIFLUID_BASICS
122#ifdef MULTIPHASE_BASICS
133 for(
int i = 0; i < num_cell; i++)
135 printf(
"\t Initial volume fraction 'Z_a' is initialized by mass fraction 'PHI'.\n");
141 for(
int i = 0; i < num_cell; i++)
143 printf(
"\t Initial specific heat rate 'gamma' is initialized by volume fraction 'Z_a'.\n");
149 printf(
"'%s' data initialized, grid cell number = %d.\n", add_in, num_cell);
void configurate(const char *add_in)
This function controls configuration data reading and validation.
#define STR_FLU_INI(sfv, err_exit)
Count out and read in 1-D data of the initial fluid variable 'sfv'. If the initial data file does not...
#define N_MAX_1D
The maximum number of 1-D data dimension storing fluid variables in memory.
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 in...
double config[N_CONF]
Initial configuration data array.
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 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_pl...
pointer structure of FLUid VARiables array.