hydrocode_Radial_Lag 0.3
This is an implementation of fully explict forward Euler scheme for multi-D radially symmetric compressible flows on Lagrangian coordinate
file_radial_out.c
浏览该文件的文档.
1
6#include <math.h>
7#include <string.h>
8#include <stdio.h>
9#include <stdlib.h>
10
11#include "../include/var_struc.h"
12#include "../include/file_io.h"
13
14
22void file_radial_write_TEC(const struct flu_var FV, const double * R, const char * problem, const double time)
23{
24 double const eps = config[4];
25 int const Ncell = (int)config[3]; // Number of computing cells in r direction
26 int const Tcell = (int)config[14]; // Number of computing cells in \theta direction
27 double const dtheta = config[11];
28
29 char file_data[FILENAME_MAX];
30 example_io(problem, file_data, 0);
31
32 FILE * out;
33 int i, j;
34 char str_tmp[40];
35
36 //===================Write solution File=========================
37 sprintf(str_tmp, "FLU_VAR_%.8g.tec", time + eps);
38 strcat(file_data, str_tmp);
39 if ((out = fopen(file_data, "w")) == NULL)
40 {
41 fprintf(stderr, "Cannot open solution output Tecplot file!\n");
42 exit(1);
43 }
44
45 fprintf(out, "TITLE = \"Planar Plot of Radially Symmetric Data\"\n");
46 fprintf(out, "VARIABLES = \"X\", \"Y\"");
47 fprintf(out, ", \"RHO\", \"U\", \"P\"");
48#ifdef MULTIFLUID_BASICS
49#ifndef MULTIPHASE_BASICS
50 fprintf(out, ", \"gamma\"");
51#endif
52#endif
53 fprintf(out, "\n");
54
55 fprintf(out, "ZONE I=%d, J=%d, F=POINT, SOLUTIONTIME=%.8g\n", Tcell+1, Ncell+1, time);
56 for(i=0; i<=Ncell; i++)
57 for(j=0; j<=Tcell; j++)
58 {
59 fprintf(out,"%.10g\t",R[i]*cos(j*dtheta));
60 fprintf(out,"%.10g\t",R[i]*sin(j*dtheta));
61 fprintf(out,"%.10g\t",FV.RHO[i]);
62 fprintf(out,"%.10g\t",FV.U[i]);
63 fprintf(out,"%.10g\t",FV.P[i]);
64#ifdef MULTIFLUID_BASICS
65#ifndef MULTIPHASE_BASICS
66 fprintf(out,"%.10g\t",FV.gamma[i]);
67#endif
68#endif
69 fprintf(out,"\n");
70 }
71 fclose(out);
72}
void file_radial_write_TEC(const struct flu_var FV, const double *R, const char *problem, const double time)
This function write the radially symmetric 2-D solution into Tecplot output '.tec' files.
double config[N_CONF]
Initial configuration data array.
Definition: hydrocode.c:123
void example_io(const char *example, char *add_mkdir, const int i_or_o)
This function produces folder path for data input or output.
Definition: io_control.c:40
pointer structure of FLUid VARiables array.
Definition: var_struc.h:48
double * P
Definition: var_struc.h:49
double * RHO
Definition: var_struc.h:49
double * U
Definition: var_struc.h:49
double * gamma
Definition: var_struc.h:52