-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhll.F90
69 lines (51 loc) · 1.71 KB
/
hll.F90
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
subroutine hll(vL,vR,Flux)
#include "definition.h"
use grid_data
use sim_data, only : sim_Bx
use primconsflux, only : prim2flux,prim2cons
implicit none
real, dimension(NUMB_VAR), intent(IN) :: vL,vR !prim vars
real, dimension(NSYS_VAR), intent(OUT):: Flux
real, dimension(NSYS_VAR) :: FL,FR,uL,uR
real :: sL,sR,aL2,aR2, Cax2, Ca2, CfL, CfR, Bx, By, Bz
call prim2flux(vL,FL)
call prim2flux(vR,FR)
call prim2cons(vL,uL)
call prim2cons(vR,uR)
!!$ print *, uL
!!$ print *, uR
!!$ print *,
! left and right sound speed a
aL2 = vL(GAMC_VAR)*vL(PRES_VAR)/vL(DENS_VAR)
aR2 = vR(GAMC_VAR)*vR(PRES_VAR)/vR(DENS_VAR)
Bx = sim_Bx
By = vL(MAGY_VAR)
Bz = vL(MAGZ_VAR)
Ca2 = Bx*Bx/vL(DENS_VAR)
Cax2 = (Bx*Bx + By*By + Bz*Bz)/vL(DENS_VAR)
CfL = sqrt(0.5*( aL2 + Cax2 + sqrt( (aL2+Cax2)*(aL2+Cax2) - 4.*aL2*Ca2 ) ))
By = vR(MAGY_VAR)
Bz = vR(MAGZ_VAR)
Ca2 = Bx*Bx/vR(DENS_VAR)
Cax2 = (Bx*Bx + By*By + Bz*Bz)/vR(DENS_VAR)
CfR = sqrt(0.5*( aR2 + Cax2 + sqrt( (aR2+Cax2)*(aR2+Cax2) - 4.*aR2*Ca2 ) ))
sL = min(vL(VELX_VAR) - CfL, vR(VELX_VAR) - cfR)
sR = max(vL(VELX_VAR) + CfL, vR(VELX_VAR) + cfR)
! numerical flux
if (sL >= 0.) then
Flux(DENS_VAR:ENER_VAR) = FL(DENS_VAR:ENER_VAR)
elseif ( (sL < 0.) .and. (sR >= 0.) ) then
Flux(DENS_VAR:ENER_VAR) = ( sR*FL(DENS_VAR:ENER_VAR) &
-sL*FR(DENS_VAR:ENER_VAR) &
+sR*sL*(uR(DENS_VAR:ENER_VAR) &
-uL(DENS_VAR:ENER_VAR)))/(sR-sL)
else
Flux(DENS_VAR:ENER_VAR) = FR(DENS_VAR:ENER_VAR)
endif
!print *, sL, sR, uR(2)-uL(2)
!!$ print *, FL
!!$ print *, Flux
!!$ print *, FR
!!$ print*,
return
end subroutine hll