92#include "../include/var_struc.h"
93#include "../include/file_io.h"
94#include "../include/finite_volume.h"
102#define CV_INIT_MEM(v, N) \
104 CV.v = (double **)malloc(N * sizeof(double *)); \
107 printf("NOT enough memory! %s\n", #v); \
111 CV.v[0] = FV0.v + 1; \
112 for(k = 1; k < N; ++k) \
114 CV.v[k] = (double *)malloc(m * sizeof(double)); \
115 if(CV.v[k] == NULL) \
117 printf("NOT enough memory! %s[%d]\n", #v, k); \
137int main(
int argc,
char *argv[])
140 int k, j, retval = 0;
141 for (k = 0; k < argc; k++)
142 printf(
"%s ", argv[k]);
144 printf(
"TEST:\n %s\n", argv[1]);
147 printf(
"Test Beginning: ARGuments Counter %d is less than 5.\n", argc);
151 printf(
"Test Beginning: ARGuments Counter = %d.\n", argc);
154 for(k = 1; k <
N_CONF; k++)
162 printf(
"No appropriate dimension was entered!\n");
167 printf(
"Configurating:\n");
170 for (k = 6; k < argc; k++)
173 j = strtoul(argv[k], &endptr, 10);
174 if (errno != ERANGE && *endptr ==
'=')
178 conf_tmp = strtod(endptr, &endptr);
179 if (errno != ERANGE && *endptr ==
'\0')
182 printf(
"%3d-th configuration: %g (ARGument)\n", j, conf_tmp);
186 printf(
"Configuration error in ARGument variable %d! ERROR after '='!\n", k);
192 printf(
"Configuration error in ARGument variable %d! ERROR before '='!\n", k);
200 printf(
"Order[_Scheme]: %s\n",argv[4]);
202 order = strtoul(argv[4], &scheme, 10);
205 else if (*scheme !=
'\0' || errno == ERANGE)
207 printf(
"No order or Wrog scheme!\n");
210 config[9] = (double)order;
226 const int m = (int)FV0.
RHO[0];
234 double * cpu_time = malloc(N *
sizeof(
double));
235 X = (
double **)malloc(N *
sizeof(
double *));
238 printf(
"NOT enough memory! CPU_time\n");
244 printf(
"NOT enough memory! X\n");
248 for(k = 0; k < N; ++k)
250 X[k] = (
double *)malloc((m+1) *
sizeof(double));
253 printf(
"NOT enough memory! X[%d]\n", k);
262 CV.E = (
double **)malloc(N *
sizeof(
double *));
265 printf(
"NOT enough memory! E\n");
269 for(k = 0; k < N; ++k)
271 CV.E[k] = (
double *)malloc(m *
sizeof(
double));
274 printf(
"NOT enough memory! E[%d]\n", k);
280 for(j = 0; j <= m; ++j)
282 for(j = 0; j < m; ++j)
283 CV.E[0][j] = 0.5*CV.U[0][j]*CV.U[0][j] + CV.P[0][j]/(gamma - 1.0)/CV.RHO[0][j];
285 if (strcmp(argv[5],
"LAG") == 0)
297 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
302 else if (strcmp(argv[5],
"EUL") == 0)
305 for (k = 1; k < N; ++k)
306 for (j = 0; j <= m; ++j)
317 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
324 printf(
"NOT appropriate coordinate framework! The framework is %s.\n", argv[5]);
339 for(k = 1; k < N; ++k)
struct flu_var _1D_initialize(const char *name)
This function reads the 1-D initial data file of velocity/pressure/density.
void _1D_file_write(const int m, const int N, const struct cell_var_stru CV, double *X[], const double *cpu_time, const char *name, const double *time_plot)
This function write the 1-D solution into output .dat files.
void GRP_solver_LAG_source(const int m, struct cell_var_stru CV, double *X[], double *cpu_time, double *time_plot)
This function use GRP scheme to solve 1-D Euler equations of motion on Lagrangian coordinate.
void Godunov_solver_EUL_source(const int m, struct cell_var_stru CV, double *cpu_time, double *time_plot)
This function use Godunov scheme to solve 1-D Euler equations of motion on Eulerian coordinate.
void GRP_solver_EUL_source(const int m, struct cell_var_stru CV, double *cpu_time, double *time_plot)
This function use GRP scheme to solve 1-D Euler equations of motion on Eulerian coordinate.
void Godunov_solver_LAG_source(const int m, struct cell_var_stru CV, double *X[], double *cpu_time, double *time_plot)
This function use Godunov scheme to solve 1-D Euler equations of motion on Lagrangian coordinate.
int main(int argc, char *argv[])
This is the main function which constructs the main structure of the Lagrangian/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.
pointer structure of FLUid VARiables.
#define N_CONF
Define the number of configuration parameters.