10#include "../include/var_struc.h"
27 const double gamma = ifv_L->
gamma;
28 const double P_L = ifv_L->
P, P_R = ifv_R->
P;
29 const double RHO_L = ifv_L->
RHO, RHO_R = ifv_R->
RHO;
30 const double U_L = ifv_L->
U, U_R = ifv_R->
U;
33 C_L = sqrt(gamma*P_L/RHO_L);
34 C_R = sqrt(gamma*P_R/RHO_R);
35 double z = 0.5 * (gamma-1.0) / gamma;
36 double P_star, U_star_L, U_star_R, C_star_L, C_star_R, lambda_L_1, lambda_R_1, lambda_L_3, lambda_R_3;
37 P_star = pow((C_L + C_R - (gamma-1.0)/2.0*(U_R - U_L))/(C_L/pow(P_L,z) + C_R/pow(P_R,z)), 1.0/z);
38 C_star_L = C_L * pow(P_star/P_L, z);
39 U_star_L = U_L + 2.0/(gamma - 1.0)*(C_L - C_star_L);
40 C_star_R = C_R * pow(P_star/P_R, z);
41 U_star_R = U_R + 2.0/(gamma - 1.0)*(C_star_R - C_R);
42 lambda_L_1 = U_L - C_L;
43 lambda_R_1 = U_star_L - C_star_L;
44 lambda_L_3 = U_star_R + C_star_R;
45 lambda_R_3 = U_R + C_R;
48 H_L = gamma/(gamma-1.0)*P_L/RHO_L + 0.5*(U_L*U_L);
49 H_R = gamma/(gamma-1.0)*P_R/RHO_R + 0.5*(U_R*U_R);
51 F[0] = 0.5*(RHO_L*U_L+RHO_R*U_R);
52 F[1] = 0.5*(RHO_L*U_L*U_L+P_L+RHO_R*U_R*U_R+P_R);
53 F[2] = 0.5*(RHO_L*U_L*H_L+RHO_R*U_R*H_R);
55 double RHO_S, U_S, H_S, C_S;
56 RHO_S = sqrt(RHO_L*RHO_R);
57 U_S = (U_L*sqrt(RHO_L)+U_R*sqrt(RHO_R)) / (sqrt(RHO_L)+sqrt(RHO_R));
58 H_S = (H_L*sqrt(RHO_L)+H_R*sqrt(RHO_R)) / (sqrt(RHO_L)+sqrt(RHO_R));
59 C_S = sqrt((gamma-1.0)*(H_S-0.5*U_S*U_S));
62 double lambda[3], W[3];
69 R[2][0] = H_S - U_S*C_S;
70 R[2][1] = 0.5*(U_S*U_S);
71 R[2][2] = H_S + U_S*C_S;
75 W[0] = 0.5*((P_R-P_L)-RHO_S*C_S*(U_R-U_L))/(C_S*C_S);
76 W[1] = (RHO_R-RHO_L)-(P_R-P_L)/(C_S*C_S);
77 W[2] = 0.5*((P_R-P_L)+RHO_S*C_S*(U_R-U_L))/(C_S*C_S);
79 lambda[0] = fabs(U_S - C_S);
80 lambda[1] = fabs(U_S);
81 lambda[2] = fabs(U_S + C_S);
83 *lambda_max = fabs(U_S) + C_S;
85 if(lambda_L_1<0&&lambda_R_1>0)
88 F[1] = RHO_L*U_L*U_L+P_L;
90 lambda[0] = lambda_L_1*(lambda_R_1-(U_S-C_S))/(lambda_R_1-lambda_L_1);
91 for(i = 0; i < 3; i++)
93 F[i] += lambda[0]*W[0]*R[i][0];
96 else if(lambda_L_3<0&&lambda_R_3>0)
99 F[1] = RHO_R*U_R*U_R+P_R;
100 F[2] = RHO_R*U_R*H_R;
101 lambda[2] = lambda_R_3*((U_S+C_S)-lambda_L_3)/(lambda_R_3-lambda_L_3);
102 for(i = 0; i < 3; i++)
104 F[i] += -lambda[2]*W[2]*R[i][2];
109 for(i = 0; i < 3; i++)
111 for(j = 0; j < 3 ; j++)
113 F[i] += -0.5*lambda[j]*W[j]*R[i][j];
void Roe_solver(double *F, double *lambda_max, const struct i_f_var *ifv_L, const struct i_f_var *ifv_R, const double delta)
An approxiamate Riemann solver of Roe for unsteady compressible inviscid single-component flow in one...
Interfacial Fluid VARiables.
double gamma
specific heat ratio.