Skip to content

Commit 7340b87

Browse files
committed
HLL[C] & Gamma Methods Testing
1 parent 8eee506 commit 7340b87

File tree

22 files changed

+1325
-85
lines changed

22 files changed

+1325
-85
lines changed

examples/1D_inert_shocktube/case.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
L = 0.10
2929
Nx = 400
3030
dx = L / Nx
31-
dt = 5e-9
31+
dt = 20e-8
3232
Tend = 40e-6
3333

3434
NT = int(Tend / dt)
@@ -66,9 +66,9 @@
6666
'weno_avg' : 'F',
6767
'mapped_weno' : 'T',
6868
'mp_weno' : 'T',
69-
'riemann_solver' : 1,
70-
'wave_speeds' : 1,
71-
'avg_state' : 2,
69+
'riemann_solver' : 2,
70+
'wave_speeds' : 2,
71+
'avg_state' : 1,
7272
'bc_x%beg' :-2,
7373
'bc_x%end' :-3,
7474
# ==========================================================================
@@ -106,7 +106,7 @@
106106
# ==========================================================================
107107

108108
# Fluids Physical Parameters ===============================================
109-
'fluid_pp(1)%gamma' : 1.0E+00/(4.4E+00-1.0E+00),
109+
'fluid_pp(1)%gamma' : 1.0E+00/(1.55E+00-1.0E+00),
110110
'fluid_pp(1)%pi_inf' : 0,
111111
# ==========================================================================
112112

examples/1D_reactive_shocktube/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
u_r = -487.34
3131

3232
L = 0.12
33-
Nx = 800 * args.scale
33+
Nx = 400 * args.scale
3434
dx = L/Nx
35-
dt = dx/abs(u_r)*0.01
35+
dt = dx/abs(u_r)*0.02
3636
Tend=230e-6
3737

3838
NT=int(Tend/dt)
@@ -55,7 +55,7 @@
5555
't_step_stop' : NT,
5656
't_step_save' : NS,
5757
't_step_print' : NS,
58-
'parallel_io' : 'T' if args.mfc.get("mpi", True) else 'F',
58+
'parallel_io' : 'F' if args.mfc.get("mpi", True) else 'F',
5959

6060
# Simulation Algorithm Parameters ==========================================
6161
'model_eqns' : 2,
@@ -69,7 +69,7 @@
6969
'weno_avg' : 'F',
7070
'mapped_weno' : 'T',
7171
'mp_weno' : 'T',
72-
'riemann_solver' : 1,
72+
'riemann_solver' : 2,
7373
'wave_speeds' : 1,
7474
'avg_state' : 2,
7575
'bc_x%beg' :-2,

src/common/m_variables_conversion.fpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ contains
13981398
end subroutine s_finalize_variables_conversion_module
13991399

14001400
#ifndef MFC_PRE_PROCESS
1401-
subroutine s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_sum, c, c_avggg)
1401+
subroutine s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_sum, c_avggg, c)
14021402
#ifdef CRAY_ACC_WAR
14031403
!DIR$ INLINEALWAYS s_compute_speed_of_sound
14041404
#else
@@ -1409,18 +1409,15 @@ contains
14091409
real(kind(0d0)), intent(in) :: H
14101410
real(kind(0d0)), dimension(num_fluids), intent(in) :: adv
14111411
real(kind(0d0)), intent(in) :: vel_sum
1412+
real(kind(0d0)), intent(in) :: c_avggg
14121413
real(kind(0d0)), intent(out) :: c
14131414

14141415
real(kind(0d0)) :: blkmod1, blkmod2
14151416
real(kind(0d0)) :: Tolerance, c_c
1416-
real(kind(0d0)), optional, intent(in) :: c_avggg
14171417
integer :: q
1418+
14181419
if (chemistry) then
1419-
if (present(c_avggg)) then
1420-
c_c = c_avggg
1421-
else
1422-
c_c = 0.0d0 ! Default value if 'b' is absent
1423-
end if
1420+
c_c = c_avggg
14241421

14251422
if (avg_state == 1 .and. abs(c_c) > Tolerance) then
14261423
c = sqrt(c_c - (gamma - 1.0d0)*(vel_sum - H))

src/post_process/m_start_up.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ subroutine s_save_data(t_step, varname, pres, c, H)
500500

501501
call s_compute_speed_of_sound(pres, rho_sf(i, j, k), &
502502
gamma_sf(i, j, k), pi_inf_sf(i, j, k), &
503-
H, adv, 0d0, c)
503+
H, adv, 0d0, 0d0, c)
504504

505505
q_sf(i, j, k) = c
506506
end do

src/simulation/include/inline_riemann.fpp

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,21 @@
4444
h_avg_2 = (sqrt(rho_L)*h_iL + sqrt(rho_R)*h_iR)/(sqrt(rho_L) + sqrt(rho_R))
4545
Yi_avg = (sqrt(rho_L)*Ys_L + sqrt(rho_R)*Ys_R)/(sqrt(rho_L) + sqrt(rho_R))
4646
T_avg = (sqrt(rho_L)*T_L + sqrt(rho_R)*T_R)/(sqrt(rho_L) + sqrt(rho_R))
47-
Cp_avg = 0.0d0
48-
Cv_avg = 0.0d0
49-
50-
do i = 1, num_species
51-
if (abs(T_L - T_R) < eps) then
52-
! Case when T_L and T_R are very close
53-
Cp_avg = Cp_avg + Yi_avg(i)*(0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(i))*gas_constant/mol_weights(i)
54-
Cv_avg = Cv_avg + Yi_avg(i)*((0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(i))*gas_constant/mol_weights(i) - gas_constant/mol_weights(i))
55-
else
56-
! Normal calculation when T_L and T_R are sufficiently different
57-
Cp_avg = Cp_avg + Yi_avg(i)*(h_iR(i) - h_iL(i))/(T_R - T_L)
58-
Cv_avg = Cv_avg + Yi_avg(i)*((h_iR(i) - h_iL(i))/(T_R - T_L) - gas_constant/mol_weights(i))
59-
end if
60-
end do
47+
48+
if (abs(T_L - T_R) < eps) then
49+
! Case when T_L and T_R are very close
50+
Cp_avg = sum(Yi_avg(:)*(0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(:))*gas_constant/mol_weights(:))
51+
Cv_avg = sum(Yi_avg(:)*((0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(:))*gas_constant/mol_weights(:) - gas_constant/mol_weights(:)))
52+
else
53+
! Normal calculation when T_L and T_R are sufficiently different
54+
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L))
55+
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/mol_weights(:)))
56+
end if
57+
6158
gamma_avg = Cp_avg/Cv_avg
62-
c_avggg = 0.0d0
6359

64-
do i = 1, num_species
65-
Phi_avg(i) = (gamma_avg - 1.d0)*(vel_avg_rms/2.0d0 - h_avg_2(i)) + gamma_avg*gas_constant/mol_weights(i)*T_avg
66-
c_avggg = c_avggg + Yi_avg(i)*Phi_avg(i)
67-
end do
60+
Phi_avg(:) = (gamma_avg - 1.d0)*(vel_avg_rms/2.0d0 - h_avg_2(:)) + gamma_avg*gas_constant/mol_weights(:)*T_avg
61+
c_avggg = sum(Yi_avg(:)*Phi_avg(:))
6862
#:endif
6963

7064
#:enddef roe_avg

src/simulation/m_cbc.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ contains
807807
H = (E + pres)/rho
808808

809809
! Compute mixture sound speed
810-
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_K_sum, c)
810+
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_K_sum, 0d0, c)
811811
! ============================================================
812812

813813
! First-Order Spatial Derivatives of Primitive Variables =====

src/simulation/m_data_output.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ contains
264264
call s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel, vel_sum, j, k, l)
265265

266266
! Compute mixture sound speed
267-
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, c)
267+
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0d0, c)
268268

269269
if (any(Re_size > 0)) then
270270
call s_compute_stability_from_dt(vel, c, rho, Re, j, k, l, icfl_sf, vcfl_sf, Rc_sf)
@@ -1116,7 +1116,7 @@ contains
11161116

11171117
! Compute mixture sound Speed
11181118
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, &
1119-
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, c)
1119+
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c)
11201120

11211121
accel = accel_mag(j - 2, k, l)
11221122
end if
@@ -1202,7 +1202,7 @@ contains
12021202

12031203
! Compute mixture sound speed
12041204
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, &
1205-
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, c)
1205+
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c)
12061206

12071207
accel = accel_mag(j - 2, k - 2, l)
12081208
end if
@@ -1263,7 +1263,7 @@ contains
12631263

12641264
! Compute mixture sound speed
12651265
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, &
1266-
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, c)
1266+
((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c)
12671267

12681268
accel = accel_mag(j - 2, k - 2, l - 2)
12691269
end if

src/simulation/m_riemann_solvers.fpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -571,16 +571,16 @@ contains
571571
@:compute_average_state()
572572

573573
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
574-
vel_L_rms, c_L)
574+
vel_L_rms, 0d0, c_L)
575575

576576
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
577-
vel_R_rms, c_R)
577+
vel_R_rms, 0d0, c_R)
578578

579579
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
580580
! variables are placeholders to call the subroutine.
581581

582582
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
583-
vel_avg_rms, c_avg, c_avggg)
583+
vel_avg_rms, c_avggg, c_avg)
584584

585585
if (any(Re_size > 0)) then
586586
!$acc loop seq
@@ -1118,16 +1118,16 @@ contains
11181118
@:compute_average_state()
11191119
11201120
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
1121-
vel_L_rms, c_L)
1121+
vel_L_rms, 0d0, c_L)
11221122
11231123
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
1124-
vel_R_rms, c_R)
1124+
vel_R_rms, 0d0, c_R)
11251125
11261126
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
11271127
! variables are placeholders to call the subroutine.
11281128
11291129
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
1130-
vel_avg_rms, c_avg)
1130+
vel_avg_rms, 0d0, c_avg)
11311131
11321132
if (any(Re_size > 0)) then
11331133
!$acc loop seq
@@ -1417,16 +1417,16 @@ contains
14171417
@:compute_average_state()
14181418
14191419
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
1420-
vel_L_rms, c_L)
1420+
vel_L_rms, 0d0, c_L)
14211421
14221422
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
1423-
vel_R_rms, c_R)
1423+
vel_R_rms, 0d0, c_R)
14241424
14251425
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
14261426
! variables are placeholders to call the subroutine.
14271427
14281428
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
1429-
vel_avg_rms, c_avg)
1429+
vel_avg_rms, 0d0, c_avg)
14301430
14311431
if (wave_speeds == 1) then
14321432
s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R)
@@ -1833,16 +1833,16 @@ contains
18331833
end if
18341834
18351835
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
1836-
vel_L_rms, c_L)
1836+
vel_L_rms, 0d0, c_L)
18371837
18381838
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
1839-
vel_R_rms, c_R)
1839+
vel_R_rms, 0d0, c_R)
18401840
18411841
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
18421842
! variables are placeholders to call the subroutine.
18431843
18441844
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
1845-
vel_avg_rms, c_avg)
1845+
vel_avg_rms, 0d0, c_avg)
18461846
18471847
if (any(Re_size > 0)) then
18481848
!$acc loop seq
@@ -2241,16 +2241,16 @@ contains
22412241
!print *, c_avggg
22422242
22432243
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
2244-
vel_L_rms, c_L)
2244+
vel_L_rms, 0d0, c_L)
22452245
22462246
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
2247-
vel_R_rms, c_R)
2247+
vel_R_rms, 0d0, c_R)
22482248
22492249
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
22502250
! variables are placeholders to call the subroutine.
22512251
22522252
call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, &
2253-
vel_avg_rms, c_avg, c_avggg)
2253+
vel_avg_rms, c_avggg, c_avg)
22542254
22552255
if (any(Re_size > 0)) then
22562256
!$acc loop seq

src/simulation/m_time_steppers.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ contains
939939
call s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel, vel_sum, j, k, l)
940940

941941
! Compute mixture sound speed
942-
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, c)
942+
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0d0, c)
943943

944944
call s_compute_dt_from_cfl(vel, c, max_dt, rho, Re, j, k, l)
945945
end do

0 commit comments

Comments
 (0)