@@ -453,14 +453,25 @@ function flux_hll(u_ll, u_rr, orientation, equation::IdealGlmMhdEquations2D)
453
453
return SVector (f1, f2, f3, f4, f5, f6, f7, f8, f9)
454
454
end
455
455
456
-
457
- # strong form of nonconservative flux on a side, e.g., the Powell term
458
- # phi^L 1/2 (B^L+B^R) normal - phi^L B^L normal = phi^L 1/2 (B^R-B^L) normal
459
- # OBS! 1) "weak" formulation of split DG already includes the contribution -1/2(phi^L B^L normal)
460
- # so this routine only adds 1/2(phi^L B^R normal)
461
- # analogously for the Galilean nonconservative term
462
- # 2) this is non-unique along an interface! normal direction is super important
463
- function noncons_interface_flux (u_left, u_right, orientation, equation:: IdealGlmMhdEquations2D )
456
+ """
457
+ noncons_interface_flux(u_left, u_right, orientation, mode, equation::IdealGlmMhdEquations2D)
458
+
459
+ Strong form of non-conservative flux on a surface (Powell and GLM terms)
460
+ ```math
461
+ phi^L 1/2 (B^L + B^R)_{normal} - phi^L B^L+{normal} = phi^L 1/2 (B^R - B^L)_{normal}
462
+ ```
463
+ !!! note
464
+ The non-conservative interface flux depends on the discretization. Following "modes" are available:
465
+ * `:weak`: 'weak' formulation of split DG already includes the contribution
466
+ ``-1/2 (phi^L B^L_{normal})`` so this mode only adds ``1/2 (phi^L B^R_{normal})``,
467
+ analogously for the Galilean nonconservative term
468
+ * `:whole`: This mode adds the whole non-conservative term: phi^L 1/2 (B^R-B^L)
469
+ * `:inner`: This mode adds the split-form DG volume integral contribution: This is equivalent to
470
+ ``(2)-(1) - 1/2 (phi^L B^L)``
471
+ !!! warning
472
+ This is non-unique along an interface! The normal direction is super important.
473
+ """
474
+ @inline function noncons_interface_flux (u_left, u_right, orientation, mode, equation:: IdealGlmMhdEquations2D )
464
475
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, _, B1_ll, B2_ll, B3_ll, psi_ll = u_left
465
476
_, _, _, _, _, B1_rr, B2_rr, _, psi_rr = u_right
466
477
@@ -471,27 +482,48 @@ function noncons_interface_flux(u_left, u_right, orientation, equation::IdealGlm
471
482
v_dot_B_ll = v1_ll* B1_ll + v2_ll* B2_ll + v3_ll* B3_ll
472
483
# extract magnetic field variable from the right and set the normal velocity
473
484
# Note, both depend upon the orientation and need psi_rr
474
- if orientation == 1 # x-direction
475
- v_normal = v1_ll
476
- B_normal = B1_rr
477
- else # y-direction
478
- v_normal = v2_ll
479
- B_normal = B2_rr
485
+ if mode== :weak
486
+ if orientation == 1 # x-direction
487
+ v_normal = v1_ll
488
+ B_normal = B1_rr
489
+ else # y-direction
490
+ v_normal = v2_ll
491
+ B_normal = B2_rr
492
+ end
493
+ psi_norm = psi_rr
494
+ elseif mode== :whole
495
+ if orientation == 1 # x-direction
496
+ v_normal = v1_ll
497
+ B_normal = B1_rr - B1_ll
498
+ else # y-direction
499
+ v_normal = v2_ll
500
+ B_normal = B2_rr - B2_ll
501
+ end
502
+ psi_norm = psi_rr - psi_ll
503
+ else # mode==:inner
504
+ if orientation == 1 # x-direction
505
+ v_normal = v1_ll
506
+ B_normal = - B1_ll
507
+ else # y-direction
508
+ v_normal = v2_ll
509
+ B_normal = - B2_ll
510
+ end
511
+ psi_norm = - psi_ll
480
512
end
513
+
481
514
# compute the nonconservative flux: Powell (with B_normal) and Galilean (with v_normal)
482
515
noncons2 = 0.5 * B_normal * B1_ll
483
516
noncons3 = 0.5 * B_normal * B2_ll
484
517
noncons4 = 0.5 * B_normal * B3_ll
485
- noncons5 = 0.5 * B_normal * v_dot_B_ll + 0.5 * v_normal * psi_ll * psi_rr
518
+ noncons5 = 0.5 * B_normal * v_dot_B_ll + 0.5 * v_normal * psi_ll * psi_norm
486
519
noncons6 = 0.5 * B_normal * v1_ll
487
520
noncons7 = 0.5 * B_normal * v2_ll
488
521
noncons8 = 0.5 * B_normal * v3_ll
489
- noncons9 = 0.5 * v_normal * psi_rr
522
+ noncons9 = 0.5 * v_normal * psi_norm
490
523
491
524
return SVector (0 , noncons2, noncons3, noncons4, noncons5, noncons6, noncons7, noncons8, noncons9)
492
525
end
493
526
494
-
495
527
# 1) Determine maximum stable time step based on polynomial degree and CFL number
496
528
# 2) Update the GLM cleaning wave speed c_h to be the largest value of the fast
497
529
# magnetoacoustic over the entire domain (note this routine is called in a loop
0 commit comments