Calculate the spectral radius
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(1:n_var) | :: | ql | ||
real(kind=wp), | intent(in), | dimension(1:n_var) | :: | qr | ||
real(kind=wp), | intent(in), | dimension(1:7) | :: | inputs | ||
real(kind=wp), | intent(in), | dimension(1:3) | :: | c1 | ||
real(kind=wp), | intent(in), | dimension(1:3) | :: | c2 |
function SpectralRadius(ql, qr, inputs, c1, c2)
!< Calculate the spectral radius
implicit none
real(wp), dimension(1:n_var), intent(in) :: ql
real(wp), dimension(1:n_var), intent(in) :: qr
real(wp), dimension(1:7) , intent(in) :: inputs
real(wp), dimension(1:3) , intent(in) :: c1
real(wp), dimension(1:3) , intent(in) :: c2
! local variables
real(wp) :: SpectralRadius
real(wp) :: NormalSpeed
real(wp) :: SpeedOfSound
real(wp) :: vis
real(wp) :: mu
real(wp) :: rho
real(wp) :: distance
!extract inputs
real(wp) :: Area
real(wp) :: nx
real(wp) :: ny
real(wp) :: nz
real(wp) :: volume
real(wp) :: mm
real(wp) :: tm
Area = inputs(1)
nx = inputs(2)
ny = inputs(3)
nz = inputs(4)
volume = inputs(5)
mm = inputs(6)
tm = inputs(7)
! in state vector q (2-4) are the cell center velocity
NormalSpeed = 0.5 * ( ( ( ql(2) + qr(2) ) * nx ) &
+ ( ( ql(3) + qr(3) ) * ny ) &
+ ( ( ql(4) + qr(4) ) * nz ) &
)
NormalSpeed = abs(NormalSpeed)
SpeedOfSound = 0.5*( sqrt(gm*ql(5)/ql(1)) + sqrt(gm*qr(5)/qr(1)) )
! visocus part
mu = mm/Pr + tm/tPr
rho = 0.5*( ql(1) + qr(1) )
distance = sqrt((c1(1)-c2(1))**2 + (c1(2)-c2(2))**2 +(c1(3)-c2(3))**2)
vis = gm * (mm/pr + tm/tpr) / ( rho * distance )
SpectralRadius = ( NormalSpeed + SpeedOfSound + vis) * Area
end function SpectralRadius