HydroCODE_2D 0.1
This is a implementation of fully explict forward Euler scheme for 2-D Euler equations of motion on Eulerian coordinate
fluid_var_check.c
浏览该文件的文档.
1
5#include <stdio.h>
6#include <math.h>
7
8#include "../include/var_struc.h"
9
10
21int ifvar_check(struct i_f_var *ifv_L, struct i_f_var *ifv_R, const int dim)
22{
23 double const eps = config[4];
24 if(ifv_L->P < eps || ifv_R->P < eps || ifv_L->RHO < eps || ifv_R->RHO < eps)
25 {
26 printf("<0.0 error - Reconstruction");
27 return 1;
28 }
29 if(dim == 1)
30 {
31 if(!isfinite(ifv_L->d_p)|| !isfinite(ifv_R->d_p)|| !isfinite(ifv_L->d_u)|| !isfinite(ifv_R->d_u)|| !isfinite(ifv_L->d_rho)|| !isfinite(ifv_R->d_rho))
32 {
33 printf("NAN or INFinite error - Slope");
34 return 2;
35 }
36 }
37 else if (dim == 2)
38 {
39 if(!isfinite(ifv_L->d_p)|| !isfinite(ifv_R->d_p)|| !isfinite(ifv_L->d_u)|| !isfinite(ifv_R->d_u)|| !isfinite(ifv_L->d_v)|| !isfinite(ifv_R->d_v)|| !isfinite(ifv_L->d_rho)|| !isfinite(ifv_R->d_rho))
40 {
41 printf("NAN or INFinite error - d_Slope_x");
42 return 2;
43 }
44 if(!isfinite(ifv_L->t_p)|| !isfinite(ifv_R->t_p)|| !isfinite(ifv_L->t_u)|| !isfinite(ifv_R->t_u)|| !isfinite(ifv_L->t_v)|| !isfinite(ifv_R->t_v)|| !isfinite(ifv_L->t_rho)|| !isfinite(ifv_R->t_rho))
45 {
46 printf("NAN or INFinite error - t_Slope_x");
47 return 2;
48 }
49 }
50 return 0;
51}
52
53
65int star_dire_check(double *mid, double *dire, const int dim)
66{
67 double const eps = config[4];
68 int const el = (int)config[8];
69 double * star = NULL;
70 if (dim == 1)
71 {
72 switch(el)
73 {
74 case 1:
75 star = mid;
76 if(star[2] < eps || star[0] < eps || star[3] < eps)
77 {
78 printf("<0.0 error - STAR");
79 return 1;
80 }
81 if(!isfinite(star[1])|| !isfinite(star[2])|| !isfinite(star[0])|| !isfinite(star[3]))
82 {
83 printf("NAN or INFinite error - STAR");
84 return 2;
85 }
86 if(!isfinite(dire[1])|| !isfinite(dire[2])|| !isfinite(dire[0])|| !isfinite(dire[3]))
87 {
88 printf("NAN or INFinite error - DIRE");
89 return 3;
90 }
91 break;
92 default:
93 if(mid[2] < eps || mid[0] < eps)
94 {
95 printf("<0.0 error - STAR");
96 return 1;
97 }
98 if(!isfinite(mid[1])|| !isfinite(mid[2])|| !isfinite(mid[0]))
99 {
100 printf("NAN or INFinite error - STAR");
101 return 2;
102 }
103 if(!isfinite(dire[1])|| !isfinite(dire[2])|| !isfinite(dire[0]))
104 {
105 printf("NAN or INFinite error - DIRE");
106 return 3;
107 }
108 break;
109 }
110 }
111 else if(dim == 2)
112 {
113 if(mid[3] < eps || mid[0] < eps)
114 {
115 printf("<0.0 error - STAR");
116 return 1;
117 }
118 if(!isfinite(mid[1])|| !isfinite(mid[2])|| !isfinite(mid[0])|| !isfinite(mid[3]))
119 {
120 printf("NAN or INFinite error - STAR");
121 return 2;
122 }
123 if(!isfinite(dire[1])|| !isfinite(dire[2])|| !isfinite(dire[0])|| !isfinite(dire[3]))
124 {
125 printf("NAN or INFinite error - DIRE");
126 return 3;
127 }
128 }
129
130 return 0;
131}
int star_dire_check(double *mid, double *dire, const int dim)
This function checks whether fluid variables of mid[] and dire[] are within the value range.
int ifvar_check(struct i_f_var *ifv_L, struct i_f_var *ifv_R, const int dim)
This function checks whether interfacial fluid variables are within the value range.
double config[N_CONF]
Initial configuration data array.
Definition: hydrocode.c:123
Interfacial Fluid VARiables.
Definition: var_struc.h:116
double t_rho
Definition: var_struc.h:127
double RHO
Definition: var_struc.h:122
double t_v
Definition: var_struc.h:127
double d_p
normal spatial derivatives.
Definition: var_struc.h:126
double t_p
tangential spatial derivatives OR spatial derivatives in Lagrangian coordinate ξ.
Definition: var_struc.h:127
double P
Definition: var_struc.h:122
double d_rho
Definition: var_struc.h:126
double d_u
Definition: var_struc.h:126
double t_u
Definition: var_struc.h:127
double d_v
Definition: var_struc.h:126