-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroe.F90
50 lines (36 loc) · 1.38 KB
/
roe.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
subroutine roe(vL,vR,Flux)
#include "definition.h"
use grid_data
use primconsflux, only : prim2flux,prim2cons
use eigensystem
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, dimension(NUMB_VAR) :: vAvg
real, dimension(NUMB_WAVE) :: lambda
real, dimension(NSYS_VAR,NUMB_WAVE) :: reig, leig
logical :: conservative
real, dimension(NSYS_VAR) :: vec, sigma
integer :: kWaveNum
! set the initial sum to be zero
sigma(DENS_VAR:ENER_VAR) = 0.
vec(DENS_VAR:ENER_VAR) = 0.
! we need conservative eigenvectors
conservative = .true.
call averageState(vL,vR,vAvg)
call eigenvalues(vAvg,lambda)
call mhd_eigenvectors(vAvg,conservative,reig,leig)
call prim2flux(vL,FL)
call prim2flux(vR,FR)
call prim2cons(vL,uL)
call prim2cons(vR,uR)
do kWaveNum = 1, NUMB_WAVE
! STUDENTS: PLEASE FINISH THIS ROE SOLVER
vec(DENS_VAR:ENER_VAR) = uR(DENS_VAR:ENER_VAR) - uL(DENS_VAR:ENER_VAR)
sigma(DENS_VAR:ENER_VAR) = sigma(DENS_VAR:ENER_VAR) + dot_product(leig(DENS_VAR:ENER_VAR,kWaveNum), vec(DENS_VAR:ENER_VAR))*ABS(lambda(kWaveNum))*reig(DENS_VAR:ENER_VAR, kWaveNum)
end do
! numerical flux
Flux(DENS_VAR:ENER_VAR) = 0.5*(FL(DENS_VAR:ENER_VAR) + FR(DENS_VAR:ENER_VAR)) - 0.5*sigma
return
end subroutine roe