Skip to content

Commit 4be22db

Browse files
authored
Fixes #1656: preserve MHD calculations with case optimization (#1658)
1 parent f7747ab commit 4be22db

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/simulation/m_riemann_solver_hll.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ contains
258258
else if (mhd .and. relativity) then
259259
Ga%L = 1._wp/sqrt(1._wp - vel_L_rms)
260260
Ga%R = 1._wp/sqrt(1._wp - vel_R_rms)
261-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
261+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
262262
vdotB%L = vel_L(1)*B%L(1) + vel_L(2)*B%L(2) + vel_L(3)*B%L(3)
263263
vdotB%R = vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3)
264264

@@ -274,15 +274,15 @@ contains
274274
! Hard-coded EOS
275275
H_L = 1._wp + (gamma_L + 1)*pres_L/rho_L
276276
H_R = 1._wp + (gamma_R + 1)*pres_R/rho_R
277-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
277+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
278278
cm%L(1:3) = (rho_L*H_L*Ga%L**2 + B2%L)*vel_L(1:3) - vdotB%L*B%L(1:3)
279279
cm%R(1:3) = (rho_R*H_R*Ga%R**2 + B2%R)*vel_R(1:3) - vdotB%R*B%R(1:3)
280280
#:endif
281281

282282
E_L = rho_L*H_L*Ga%L**2 - pres_L + 0.5_wp*(B2%L + vel_L_rms*B2%L - vdotB%L**2._wp) - rho_L*Ga%L
283283
E_R = rho_R*H_R*Ga%R**2 - pres_R + 0.5_wp*(B2%R + vel_R_rms*B2%R - vdotB%R**2._wp) - rho_R*Ga%R
284284
else if (mhd .and. .not. relativity) then
285-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
285+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
286286
pres_mag%L = 0.5_wp*(B%L(1)**2._wp + B%L(2)**2._wp + B%L(3)**2._wp)
287287
pres_mag%R = 0.5_wp*(B%R(1)**2._wp + B%R(2)**2._wp + B%R(3)**2._wp)
288288
#:endif
@@ -490,7 +490,7 @@ contains
490490
! Energy
491491
if (mhd .and. (.not. relativity)) then
492492
! energy flux = (E + p + p_mag) * v_${XYZ}$ - B_${XYZ}$ * (v_x*B_x + v_y*B_y + v_z*B_z)
493-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
493+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
494494
flux_rsx_vf(${SF('')}$, &
495495
& eqn_idx%E) = (s_M*(vel_R(norm_dir)*(E_R + pres_R + pres_mag%R) - B%R(norm_dir) &
496496
& *(vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3))) - s_P*(vel_L(norm_dir) &

src/simulation/m_riemann_solver_lf.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ contains
251251
H_L = (E_L + pres_L)/rho_L
252252
H_R = (E_R + pres_R)/rho_R
253253
else if (mhd .and. relativity) then
254-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
254+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
255255
Ga%L = 1._wp/sqrt(1._wp - vel_L_rms)
256256
Ga%R = 1._wp/sqrt(1._wp - vel_R_rms)
257257
vdotB%L = vel_L(1)*B%L(1) + vel_L(2)*B%L(2) + vel_L(3)*B%L(3)
@@ -392,7 +392,7 @@ contains
392392
! Energy
393393
if (mhd .and. (.not. relativity)) then
394394
! energy flux = (E + p + p_mag) * v_${XYZ}$ - B_${XYZ}$ * (v_x*B_x + v_y*B_y + v_z*B_z)
395-
#:if not MFC_CASE_OPTIMIZATION or num_dims > 1
395+
#:if not MFC_CASE_OPTIMIZATION or num_vels > 2
396396
flux_rsx_vf(${SF('')}$, &
397397
& eqn_idx%E) = (s_M*(vel_R(norm_dir)*(E_R + pres_R + pres_mag%R) - B%R(norm_dir) &
398398
& *(vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3))) - s_P*(vel_L(norm_dir) &

0 commit comments

Comments
 (0)