@@ -442,35 +442,24 @@ contains
442442 end do
443443
444444 if (any (time_stepper == (/ 1 , 2 , 3 / ))) then
445- ! Time stepper index
445+ ! temporary array index for TVD RK
446446 if (time_stepper == 1 ) then
447447 stor = 1
448448 else
449449 stor = 2
450450 end if
451451
452- @:ALLOCATE (rk_coef(time_stepper, 3 ))
452+ ! TVD RK coefficients
453+ @:ALLOCATE (rk_coef(time_stepper, 4 ))
453454 if (time_stepper == 1 ) then
454- rk_coef(1 , 1 ) = 1._wp
455- rk_coef(1 , 2 ) = 0._wp
456- rk_coef(1 , 3 ) = 1._wp
455+ rk_coef(1 , :) = (/ 1._wp , 0._wp , 1._wp , 1._wp / )
457456 else if (time_stepper == 2 ) then
458- rk_coef(1 , 1 ) = 1._wp
459- rk_coef(1 , 2 ) = 0._wp
460- rk_coef(1 , 3 ) = 1._wp
461- rk_coef(2 , 1 ) = 0.5_wp
462- rk_coef(2 , 2 ) = 0.5_wp
463- rk_coef(2 , 3 ) = 0.5_wp
457+ rk_coef(1 , :) = (/ 1._wp , 0._wp , 1._wp , 1._wp / )
458+ rk_coef(2 , :) = (/ 1._wp , 1._wp , 1._wp , 2._wp / )
464459 else if (time_stepper == 3 ) then
465- rk_coef(1 , 1 ) = 1._wp
466- rk_coef(1 , 2 ) = 0._wp
467- rk_coef(1 , 3 ) = 1._wp
468- rk_coef(2 , 1 ) = 1._wp / 4._wp
469- rk_coef(2 , 2 ) = 3._wp / 4._wp
470- rk_coef(2 , 3 ) = 1._wp / 4._wp
471- rk_coef(3 , 1 ) = 2._wp / 3._wp
472- rk_coef(3 , 2 ) = 1._wp / 3._wp
473- rk_coef(3 , 3 ) = 2._wp / 3._wp
460+ rk_coef(1 , :) = (/ 1._wp , 0._wp , 1._wp , 1._wp / )
461+ rk_coef(2 , :) = (/ 1._wp , 3._wp , 1._wp , 4._wp / )
462+ rk_coef(3 , :) = (/ 2._wp , 1._wp , 2._wp , 3._wp / )
474463 end if
475464 end if
476465
@@ -497,22 +486,24 @@ contains
497486 do s = 1 , nstage
498487 call s_compute_rhs(q_cons_ts(1 )%vf, q_T_sf, q_prim_vf, bc_type, rhs_vf, pb_ts(1 )%sf, rhs_pb, mv_ts(1 )%sf, rhs_mv, t_step, time_avg, s)
499488
500- if (s == 1 .and. run_time_info) then
489+ if (s == 1 ) then
490+ if (run_time_info) then
501491 if (igr) then
502492 call s_write_run_time_information(q_cons_ts(1 )%vf, t_step)
503493 else
504494 call s_write_run_time_information(q_prim_vf, t_step)
505495 end if
506- end if
496+ end if
507497
508- if (probe_wrt) then
509- call s_time_step_cycling(t_step)
510- end if
498+ if (probe_wrt) then
499+ call s_time_step_cycling(t_step)
500+ end if
511501
512- if (cfl_dt) then
513- if (mytime >= t_stop) return
514- else
515- if (t_step == t_step_stop) return
502+ if (cfl_dt) then
503+ if (mytime >= t_stop) return
504+ else
505+ if (t_step == t_step_stop) return
506+ end if
516507 end if
517508
518509 if (bubbles_lagrange .and. .not. adap_dt) call s_update_lagrange_tdv_rk(stage= s)
@@ -527,9 +518,9 @@ contains
527518 q_cons_ts(1 )%vf(i)%sf(j, k, l)
528519 end if
529520 q_cons_ts(1 )%vf(i)%sf(j, k, l) = &
530- rk_coef(s, 1 )* q_cons_ts(1 )%vf(i)%sf(j, k, l) &
521+ ( rk_coef(s, 1 )* q_cons_ts(1 )%vf(i)%sf(j, k, l) &
531522 + rk_coef(s, 2 )* q_cons_ts(stor)%vf(i)%sf(j, k, l) &
532- + rk_coef(s, 3 )* dt* rhs_vf(i)%sf(j, k, l)
523+ + rk_coef(s, 3 )* dt* rhs_vf(i)%sf(j, k, l)) / rk_coef(s, 4 )
533524 end do
534525 end do
535526 end do
@@ -550,21 +541,21 @@ contains
550541 mv_ts(1 )%sf(j, k, l, q, i)
551542 end if
552543 pb_ts(1 )%sf(j, k, l, q, i) = &
553- rk_coef(s, 1 )* pb_ts(1 )%sf(j, k, l, q, i) &
544+ ( rk_coef(s, 1 )* pb_ts(1 )%sf(j, k, l, q, i) &
554545 + rk_coef(s, 2 )* pb_ts(stor)%sf(j, k, l, q, i) &
555- + rk_coef(s, 3 )* dt* rhs_pb(j, k, l, q, i)
546+ + rk_coef(s, 3 )* dt* rhs_pb(j, k, l, q, i)) / rk_coef(s, 4 )
556547 mv_ts(1 )%sf(j, k, l, q, i) = &
557- rk_coef(s, 1 )* mv_ts(1 )%sf(j, k, l, q, i) &
548+ ( rk_coef(s, 1 )* mv_ts(1 )%sf(j, k, l, q, i) &
558549 + rk_coef(s, 2 )* mv_ts(stor)%sf(j, k, l, q, i) &
559- + rk_coef(s, 3 )* dt* rhs_mv(j, k, l, q, i)
550+ + rk_coef(s, 3 )* dt* rhs_mv(j, k, l, q, i)) / rk_coef(s, 4 )
560551 end do
561552 end do
562553 end do
563554 end do
564555 end do
565556 end if
566557
567- if (bodyForces) call s_apply_bodyforces(q_cons_ts(1 )%vf, q_prim_vf, rhs_vf, rk_coef(s, 3 )* dt)
558+ if (bodyForces) call s_apply_bodyforces(q_cons_ts(1 )%vf, q_prim_vf, rhs_vf, rk_coef(s, 3 )* dt/ rk_coef(s, 4 ) )
568559
569560 if (grid_geometry == 3 ) call s_apply_fourier_filter(q_cons_ts(1 )%vf)
570561
0 commit comments