100#include "../include/var_struc.h"
101#include "../include/file_io.h"
102#include "../include/finite_volume.h"
105#ifdef DOXYGEN_PREDEFINED
128#define CV_INIT_MEM(v, N) \
130 for(k = 0; k < N; ++k) \
132 CV[k].v = (double **)malloc(n_x * sizeof(double *)); \
133 if(CV[k].v == NULL) \
135 printf("NOT enough memory! CV[%d].%s\n", k, #v); \
139 for(j = 0; j < n_x; ++j) \
141 CV[k].v[j] = (double *)malloc(n_y * sizeof(double)); \
142 if(CV[k].v[j] == NULL) \
144 printf("NOT enough memory! CV[%d].%s[%d]\n", k, #v, j); \
164int main(
int argc,
char *argv[])
166 int k, i, j, retval = 0;
168 for(k = 1; k <
N_CONF; k++)
170 char * scheme = NULL;
194 const int order = (int)
config[9];
195 const _Bool dim_split = (_Bool)
config[33];
200 double * cpu_time = (
double *)malloc(N *
sizeof(
double));
201 X = (
double **)malloc((n_x+1) *
sizeof(
double *));
202 Y = (
double **)malloc((n_x+1) *
sizeof(
double *));
205 printf(
"NOT enough memory! CPU_time\n");
209 if(X == NULL || Y == NULL)
211 printf(
"NOT enough memory! X or Y\n");
215 for(j = 0; j <= n_x; ++j)
217 X[j] = (
double *)malloc((n_y+1) *
sizeof(double));
218 Y[j] = (
double *)malloc((n_y+1) *
sizeof(double));
219 if(X[j] == NULL || Y[j] == NULL)
221 printf(
"NOT enough memory! X[%d] or Y[%d]\n", j, j);
228 printf(
"NOT enough memory! Cell Variables\n");
239 for(j = 0; j <= n_x; ++j)
240 for(i = 0; i <= n_y; ++i)
245 for(j = 0; j < n_x; ++j)
246 for(i = 0; i < n_y; ++i)
248 CV[0].
RHO[j][i] = FV0.
RHO[i*n_x + j];
249 CV[0].
U[j][i] = FV0.
U[i*n_x + j];
250 CV[0].
V[j][i] = FV0.
V[i*n_x + j];
251 CV[0].
P[j][i] = FV0.
P[i*n_x + j];
252 CV[0].
E[j][i] = 0.5*CV[0].
U[j][i]*CV[0].
U[j][i] + CV[0].
P[j][i]/(gamma - 1.0)/CV[0].
RHO[j][i];
253 CV[0].
E[j][i] += 0.5*CV[0].
V[j][i]*CV[0].
V[j][i];
256 if (strcmp(argv[4],
"EUL") == 0)
270 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
277 printf(
"NOT appropriate coordinate framework! The framework is %s.\n", argv[4]);
284 file_2D_write(n_x, n_y, N_plot, CV, X, Y, cpu_time, argv[2], time_plot);
302 for(k = 0; k < N; ++k)
304 for(j = 0; j < n_x; ++j)
330 for(j = 0; j <= n_x; ++j)
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.
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[])
This function write the 2-D solution into output '.dat' files.
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[])
This function write the 2-D solution into Tecplot output files with point data.
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 GRP_solver_2D_EUL_source(const int m, const int n, struct cell_var_stru *CV, double **X, double **Y, double *cpu_time, const char *problem, int N_T, int *N_plot, double time_plot[])
This function use GRP scheme to solve 2-D Euler equations of motion on Eulerian coordinate without di...
void GRP_solver_2D_split_EUL_source(const int m, const int n, struct cell_var_stru *CV, double **X, double **Y, double *cpu_time, const char *problem, int N_T, int *N_plot, double time_plot[])
This function use GRP scheme to solve 2-D Euler equations of motion on Eulerian coordinate with dimen...
int main(int argc, char *argv[])
This is the main function which constructs the main structure of the 2-D Eulerian hydrocode.
double config[N_CONF]
Initial configuration data array.
#define CV_INIT_MEM(v, N)
N memory allocations to the initial fluid variable 'v' in the structure cell_var_stru.
pointer structure of VARiables on STRUctural computational grid CELLs.
double ** E
specific total energy.
double ** P
density, velocity components in direction x and y, pressure.
pointer structure of FLUid VARiables array.
void arg_preprocess(const int argc_least, const int argc, char *argv[], char *scheme)
This is a functions preprocesses ARGuments.
#define N_CONF
Define the number of configuration parameters.