93#include "../include/var_struc.h"
94#include "../include/file_io.h"
95#include "../include/finite_volume.h"
98#ifdef DOXYGEN_PREDEFINED
116#define CV_INIT_MEM(v, N) \
118 CV.v = (double **)malloc(N * sizeof(double *)); \
121 printf("NOT enough memory! %s\n", #v); \
126 for(k = 1; k < N; ++k) \
128 CV.v[k] = (double *)malloc(m * sizeof(double)); \
129 if(CV.v[k] == NULL) \
131 printf("NOT enough memory! %s[%d]\n", #v, k); \
150int main(
int argc,
char *argv[])
152 int k, j, retval = 0;
154 for(k = 1; k <
N_CONF; k++)
157 char * scheme = NULL;
179 const int m = (int)
config[3];
181 const int order = (int)
config[9];
186 double * cpu_time = (
double *)malloc(N *
sizeof(
double));
187 X = (
double **)malloc(N *
sizeof(
double *));
190 printf(
"NOT enough memory! CPU_time\n");
196 printf(
"NOT enough memory! X\n");
200 for(k = 0; k < N; ++k)
202 X[k] = (
double *)malloc((m+1) *
sizeof(double));
205 printf(
"NOT enough memory! X[%d]\n", k);
214 CV.
E = (
double **)malloc(N *
sizeof(
double *));
217 printf(
"NOT enough memory! E\n");
221 for(k = 0; k < N; ++k)
223 CV.
E[k] = (
double *)malloc(m *
sizeof(
double));
226 printf(
"NOT enough memory! E[%d]\n", k);
232 for(j = 0; j <= m; ++j)
234 for(j = 0; j < m; ++j)
235 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];
237 if (strcmp(argv[4],
"LAG") == 0)
249 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
254 else if (strcmp(argv[4],
"EUL") == 0)
257 for (k = 1; k < N; ++k)
258 for (j = 0; j <= m; ++j)
269 printf(
"NOT appropriate order of the scheme! The order is %d.\n", order);
276 printf(
"NOT appropriate coordinate framework! The framework is %s.\n", argv[4]);
296 for(k = 1; k < N; ++k)
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...
void file_1D_write(const int m, const int N, const struct cell_var_stru CV, double *X[], const double *cpu_time, const char *problem, const double time_plot[])
This function write the 1-D solution into output '.dat' files.
void file_1D_write_HDF5(const int m, const int N, const struct cell_var_stru CV, double *X[], const double *cpu_time, const char *problem, double time_plot[])
This function write the 1-D solution into HDF5 output '.h5' files.
void Godunov_solver_EUL_source(const int m, struct cell_var_stru CV, double *cpu_time, int *N_plot, double time_plot[])
This function use Godunov 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, int *N_plot, double time_plot[])
This function use Godunov scheme to solve 1-D Euler equations of motion on Lagrangian coordinate.
void GRP_solver_EUL_source(const int m, struct cell_var_stru CV, double *cpu_time, int *N_plot, double time_plot[])
This function use GRP scheme to solve 1-D Euler equations of motion on Eulerian coordinate.
void GRP_solver_LAG_source(const int m, struct cell_var_stru CV, double *X[], double *cpu_time, int *N_plot, double time_plot[])
This function use GRP 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 1-D Lagrangian/Eulerian hydrocod...
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.