Skip to content

Commit ee64da0

Browse files
author
mohdsaid497566
committed
removed dir_idx indexing from the definition of wave speed subroutine
1 parent fede1c1 commit ee64da0

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

src/common/m_variables_conversion.fpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,50 +1751,50 @@ contains
17511751

17521752
if (wave_speeds == 1) then
17531753
if (mhd) then
1754-
s_L = min(vel_L(dir_idx(1)) - c_fast_L, vel_R(dir_idx(1)) - c_fast_R)
1755-
s_R = max(vel_R(dir_idx(1)) + c_fast_R, vel_L(dir_idx(1)) + c_fast_L)
1754+
s_L = min(vel_L - c_fast_L, vel_R - c_fast_R)
1755+
s_R = max(vel_R + c_fast_R, vel_L + c_fast_L)
17561756
elseif (hypoelasticity .or. elasticity) then
1757-
s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + &
1757+
s_L = min(vel_L - sqrt(c_L*c_L + &
17581758
(((4._wp*G_L)/3._wp) + &
1759-
tau_e_L(dir_idx_tau(1)))/rho_L) &
1760-
, vel_R(dir_idx(1)) - sqrt(c_R*c_R + &
1759+
tau_e_L)/rho_L) &
1760+
, vel_R - sqrt(c_R*c_R + &
17611761
(((4._wp*G_R)/3._wp) + &
1762-
tau_e_R(dir_idx_tau(1)))/rho_R))
1763-
s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + &
1762+
tau_e_R)/rho_R))
1763+
s_R = max(vel_R + sqrt(c_R*c_R + &
17641764
(((4._wp*G_R)/3._wp) + &
1765-
tau_e_R(dir_idx_tau(1)))/rho_R) &
1766-
, vel_L(dir_idx(1)) + sqrt(c_L*c_L + &
1765+
tau_e_R)/rho_R) &
1766+
, vel_L + sqrt(c_L*c_L + &
17671767
(((4._wp*G_L)/3._wp) + &
1768-
tau_e_L(dir_idx_tau(1)))/rho_L))
1768+
tau_e_L)/rho_L))
17691769
else if (hyperelasticity) then
1770-
s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L) &
1771-
, vel_R(dir_idx(1)) - sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R))
1772-
s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R) &
1773-
, vel_L(dir_idx(1)) + sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L))
1770+
s_L = min(vel_L - sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L) &
1771+
, vel_R - sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R))
1772+
s_R = max(vel_R + sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R) &
1773+
, vel_L + sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L))
17741774
else
1775-
s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R)
1776-
s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L)
1775+
s_L = min(vel_L - c_L, vel_R - c_R)
1776+
s_R = max(vel_R + c_R, vel_L + c_L)
17771777
end if
1778-
s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))* &
1779-
(s_L - vel_L(dir_idx(1))) - &
1780-
rho_R*vel_R(dir_idx(1))* &
1781-
(s_R - vel_R(dir_idx(1)))) &
1782-
/(rho_L*(s_L - vel_L(dir_idx(1))) - &
1783-
rho_R*(s_R - vel_R(dir_idx(1))))
1778+
s_S = (pres_R - pres_L + rho_L*vel_L* &
1779+
(s_L - vel_L) - &
1780+
rho_R*vel_R* &
1781+
(s_R - vel_R)) &
1782+
/(rho_L*(s_L - vel_L) - &
1783+
rho_R*(s_R - vel_R))
17841784
elseif (wave_speeds == 2) then
17851785
pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* &
1786-
(vel_L(dir_idx(1)) - &
1787-
vel_R(dir_idx(1))))
1786+
(vel_L - &
1787+
vel_R))
17881788
pres_SR = pres_SL
17891789
Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* &
17901790
(pres_SL/pres_L - 1._wp)*pres_L/ &
17911791
((pres_L + pi_inf_L/(1._wp + gamma_L)))))
17921792
Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* &
17931793
(pres_SR/pres_R - 1._wp)*pres_R/ &
17941794
((pres_R + pi_inf_R/(1._wp + gamma_R)))))
1795-
s_L = vel_L(dir_idx(1)) - c_L*Ms_L
1796-
s_R = vel_R(dir_idx(1)) + c_R*Ms_R
1797-
s_S = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + &
1795+
s_L = vel_L - c_L*Ms_L
1796+
s_R = vel_R + c_R*Ms_R
1797+
s_S = 5e-1_wp*((vel_L + vel_R) + &
17981798
(pres_L - pres_R)/ &
17991799
(rho_avg*c_avg))
18001800
end if
@@ -1808,7 +1808,7 @@ contains
18081808
if (s_R <= s_L) then
18091809
print *, 'WARNING: Wave speed issue detected in s_compute_wave_speed'
18101810
print *, 'Left wave speed >= Right wave speed:', s_L, s_R
1811-
print *, 'Input velocities (dir_idx(1)):', vel_L(dir_idx(1)), vel_R(dir_idx(1))
1811+
print *, 'Input velocities :', vel_L, vel_R
18121812
print *, 'Sound speeds:', c_L, c_R
18131813
print *, 'Densities:', rho_L, rho_R
18141814
print *, 'Pressures:', pres_L, pres_R

src/simulation/m_riemann_solvers.fpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,9 @@ contains
668668
end do
669669
end if
670670

671-
call s_compute_wave_speed(wave_speeds, vel_L, vel_R, pres_L, pres_R, rho_L, rho_R, rho_avg, &
671+
call s_compute_wave_speed(wave_speeds, vel_L(dir_idx(1)), vel_R(dir_idx(1)), pres_L, pres_R, rho_L, rho_R, rho_avg, &
672672
c_L, c_R, c_avg, c_fast%L, c_fast%R, G_L, G_R, &
673-
tau_e_L, tau_e_R, &
673+
tau_e_L(dir_idx_tau(1)), tau_e_R(dir_idx_tau(1)), &
674674
s_L, s_R, s_S)
675675

676676
xi_M = (5e-1_wp + sign(5e-1_wp, s_L)) &
@@ -1402,9 +1402,9 @@ contains
14021402
end if
14031403

14041404
! COMPUTING THE DIRECT WAVE SPEEDS
1405-
call s_compute_wave_speed(wave_speeds, vel_L, vel_R, pres_L, pres_R, rho_L, rho_R, rho_avg, &
1405+
call s_compute_wave_speed(wave_speeds, vel_L(dir_idx(1)), vel_R(dir_idx(1)), pres_L, pres_R, rho_L, rho_R, rho_avg, &
14061406
c_L, c_R, c_avg, c_fast%L, c_fast%R, G_L, G_R, &
1407-
tau_e_L, tau_e_R, &
1407+
tau_e_L(dir_idx_tau(1)), tau_e_R(dir_idx_tau(1)), &
14081408
s_L, s_R, s_S)
14091409

14101410
! goes with q_star_L/R = xi_L/R * (variable)
@@ -1637,10 +1637,10 @@ contains
16371637
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
16381638
vel_avg_rms, 0._wp, c_avg)
16391639

1640-
call s_compute_wave_speed(wave_speeds, vel_L, vel_R, pres_L, pres_R, rho_L, rho_R, rho_avg, &
1640+
call s_compute_wave_speed(wave_speeds, vel_L(dir_idx(1)), vel_R(dir_idx(1)), pres_L, pres_R, rho_L, rho_R, rho_avg, &
16411641
c_L, c_R, c_avg, c_fast%L, c_fast%R, G_L, G_R, &
1642-
tau_e_L, tau_e_R, &
1643-
s_L, s_R, s_S, s_M, s_P)
1642+
tau_e_L(dir_idx_tau(1)), tau_e_R(dir_idx_tau(1)), &
1643+
s_L, s_R, s_S)
16441644

16451645
! goes with q_star_L/R = xi_L/R * (variable)
16461646
! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) )
@@ -1963,10 +1963,10 @@ contains
19631963
@:compute_low_Mach_correction()
19641964
end if
19651965

1966-
call s_compute_wave_speed(wave_speeds, vel_L, vel_R, pres_L, pres_R, rho_L, rho_R, rho_avg, &
1966+
call s_compute_wave_speed(wave_speeds, vel_L(dir_idx(1)), vel_R(dir_idx(1)), pres_L, pres_R, rho_L, rho_R, rho_avg, &
19671967
c_L, c_R, c_avg, c_fast%L, c_fast%R, G_L, G_R, &
1968-
tau_e_L, tau_e_R, &
1969-
s_L, s_R, s_S, s_M, s_P)
1968+
tau_e_L(dir_idx_tau(1)), tau_e_R(dir_idx_tau(1)), &
1969+
s_L, s_R, s_S)
19701970

19711971
! goes with q_star_L/R = xi_L/R * (variable)
19721972
! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) )
@@ -2329,10 +2329,10 @@ contains
23292329
@:compute_low_Mach_correction()
23302330
end if
23312331

2332-
call s_compute_wave_speed(wave_speeds, vel_L, vel_R, pres_L, pres_R, rho_L, rho_R, rho_avg, &
2332+
call s_compute_wave_speed(wave_speeds, vel_L(dir_idx(1)), vel_R(dir_idx(1)), pres_L, pres_R, rho_L, rho_R, rho_avg, &
23332333
c_L, c_R, c_avg, c_fast%L, c_fast%R, G_L, G_R, &
2334-
tau_e_L, tau_e_R, &
2335-
s_L, s_R, s_S, s_M, s_P)
2334+
tau_e_L(dir_idx_tau(1)), tau_e_R(dir_idx_tau(1)), &
2335+
s_L, s_R, s_S)
23362336

23372337
! goes with q_star_L/R = xi_L/R * (variable)
23382338
! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) )

0 commit comments

Comments
 (0)