-
Notifications
You must be signed in to change notification settings - Fork 1
/
Flux.c
102 lines (54 loc) · 1.26 KB
/
Flux.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Global.h"
#include "par.h"
int Godunov(){
int i,p;
float UL,UR;
float rFluxL, rFluxR, test, test2;
for(i=1;i<(INODE-1);i++){
UL=0; UR=0;
for(p=0;p<IORDER;p++){
UL=UL + rRKInt[i-1][p][0]*Basis(p,1.0);
UR=UR + rRKInt[i][p][0]*Basis(p,-1.0);
}
rFluxL=UL;
rFluxR=UR;
if(WaveSpeed >0){
rFaceFlux[i-1][0] = rFluxL;
}
else{
rFaceFlux[i][0] = rFluxR;
}
//if(i==6) printf("flux %f \n", rFluxL);
}
}
int VolumeFlux(){
int i,p,j,recon;
float rUCurrent, rFluxCurrent;
GaussPoints(); // gaussian points
for(i=0; i<(IELEM -1); i++){
for(p=0; p<IORDER; p++){
rVolumeFlux[i][p][0] = 0.0;
for(j=0; j<6; j++){
rUCurrent =0.0;
for(recon =0; recon<IORDER; recon++){
rUCurrent = rUCurrent + rRKInt[i][recon][0]*Basis(recon,rXg[j]) ;
}
rVolumeFlux[i][p][0] = rVolumeFlux[i][p][0] + rUCurrent*rWg[j]*Basis_X(p,rXg[j]);
} //quad
//if(i==0) printf("vol %d %f \n", p, rVolumeFlux[i][p][0]);
} // order
} // ielem
} // end of function
int FluxDriver(){
switch(IFLOWNUM){
case 1: // godunov flux
Godunov();
break;
default:
printf("wrong flux");
break;
}
} //