96#include "../include/var_struc.h"
97#include "../include/file_io.h"
98#include "../include/finite_volume.h"
104#ifdef DOXYGEN_PREDEFINED
111#ifdef DOXYGEN_PREDEFINED
120#define CV_INIT_MEM(v, N) \
122 for(k = 0; k < N; ++k) \
124 CV[k].v = (double **)malloc(n_x * sizeof(double *)); \
125 if(CV[k].v == NULL) \
127 printf("NOT enough memory! CV[%d].%s\n", k, #v); \
131 for(j = 0; j < n_x; ++j) \
133 CV[k].v[j] = (double *)malloc(n_y * sizeof(double)); \
134 if(CV[k].v[j] == NULL) \
136 printf("NOT enough memory! CV[%d].%s[%d]\n", k, #v, j); \
157int main(
int argc,
char *argv[])
160 int k, i, j, retval = 0;
161 for (k = 0; k < argc; k++)
162 printf(
"%s ", argv[k]);
164 printf(
"TEST:\n %s\n", argv[1]);
167 printf(
"Test Beginning: ARGuments Counter %d is less than 5.\n", argc);
171 printf(
"Test Beginning: ARGuments Counter = %d.\n", argc);
174 for(k = 1; k <
N_CONF; k++)
182 printf(
"No appropriate dimension was entered!\n");
187 printf(
"Configurating:\n");
190 for (k = 6; k < argc; k++)
193 j = strtoul(argv[k], &endptr, 10);
194 if (errno != ERANGE && *endptr ==
'=')
198 conf_tmp = strtod(endptr, &endptr);
199 if (errno != ERANGE && *endptr ==
'\0')
202 printf(
"%3d-th configuration: %g (ARGument)\n", j, conf_tmp);
206 printf(
"Configuration error in ARGument variable %d! ERROR after '='!\n", k);
212 printf(
"Configuration error in ARGument variable %d! ERROR before '='!\n", k);
220 printf(
"Order[_Scheme]: %s\n",argv[4]);
222 order = strtoul(argv[4], &scheme, 10);
225 else if (*scheme !=
'\0' || errno == ERANGE)
227 printf(
"No order or Wrog scheme!\n");
230 config[9] = (double)order;
246 const int n_x = (int)FV0.
RHO[1], n_y = (
int)FV0.
RHO[0];
255 double * cpu_time = malloc(N *
sizeof(
double));
256 X = (
double **)malloc((n_x+1) *
sizeof(
double *));
257 Y = (
double **)malloc((n_x+1) *
sizeof(
double *));
260 printf(
"NOT enough memory! CPU_time\n");
265 if(X == NULL || Y == NULL)
267 printf(
"NOT enough memory! X or Y\n");
271 for(j = 0; j <= n_x; ++j)
273 X[j] = (
double *)malloc((n_y+1) *
sizeof(double));
274 Y[j] = (
double *)malloc((n_y+1) *
sizeof(double));
275 if(X[j] == NULL || Y[j] == NULL)
277 printf(
"NOT enough memory! X[%d] or Y[%d]\n", j, j);
284 printf(
"NOT enough memory! Cell Variables\n");
295 for(j = 0; j <= n_x; ++j)
296 for(i = 0; i <= n_y; ++i)
301 for(j = 0; j < n_x; ++j)
302 for(i = 0; i < n_y; ++i)
304 CV[0].
RHO[j][i] = FV0.
RHO[i*n_x + j + 2];
305 CV[0].
U[j][i] = FV0.
U[i*n_x + j + 2];
306 CV[0].
V[j][i] = FV0.
V[i*n_x + j + 2];
307 CV[0].
P[j][i] = FV0.
P[i*n_x + j + 2];
308 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];
309 CV[0].
E[j][i] += 0.5*CV[0].
V[j][i]*CV[0].
V[j][i];
312 _Bool
const dim_split = (_Bool)
config[33];
313 if (strcmp(argv[5],
"EUL") == 0)
330 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
337 printf(
"NOT appropriate coordinate framework! The framework is %s.\n", argv[5]);
344 _2D_file_write(n_x, n_y, N, CV, X, Y, cpu_time, argv[2], time_plot);
359 for(k = 0; k < N; ++k)
361 for(j = 0; j < n_x; ++j)
387 for(j = 0; j <= n_x; ++j)
struct flu_var _2D_initialize(const char *name)
This function reads the 2-D initial data file of velocity/pressure/density.
void _2D_file_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 *name, const double *time_plot)
This function write the 2-D solution into output .dat files.
void _2D_TEC_file_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 Tecplot output files.
void GRP_solver_2D_split_EUL_source(const int m, const int n, struct cell_var_stru *CV, double *cpu_time, double *time_plot)
This function use GRP scheme to solve 2-D Euler equations of motion on Eulerian coordinate with dimen...
void GRP_solver_2D_EUL_source(const int m, const int n, struct cell_var_stru *CV, double *cpu_time, double *time_plot)
This function use GRP scheme to solve 2-D Euler equations of motion on Eulerian coordinate without di...
int main(int argc, char *argv[])
This is the main function which constructs the main structure of the 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
density, velocity components in direction x and y, pressure, specific total energy.
pointer structure of FLUid VARiables.
#define N_CONF
Define the number of configuration parameters.