@@ -94,7 +94,7 @@ contains
94
94
integer :: nBubs_glb, i
95
95
96
96
! Setting number of time-stages for selected time-stepping scheme
97
- lag_num_ts = 1
97
+ lag_num_ts = time_stepper
98
98
if (time_stepper == 4) lag_num_ts = num_ts_rkck
99
99
100
100
! Allocate space for the Eulerian fields needed to map the effect of the bubbles
@@ -463,26 +463,20 @@ contains
463
463
!! @param q_cons_vf Conservative variables
464
464
!! @param q_prim_vf Primitive variables
465
465
!! @param rhs_vf Calculated change of conservative variables
466
- !! @param step_rkck Current step in the RKCK algorithm
467
- subroutine s_compute_el_coupled_solver (q_cons_vf , q_prim_vf , rhs_vf , step_rkck )
466
+ !! @param stage Current stage in the time - stepper algorithm
467
+ subroutine s_compute_el_coupled_solver (q_cons_vf , q_prim_vf , rhs_vf , stage )
468
468
469
469
type(scalar_field), dimension (sys_size), intent (inout ) :: q_cons_vf
470
470
type(scalar_field), dimension (sys_size), intent (inout ) :: q_prim_vf
471
471
type(scalar_field), dimension (sys_size), intent (inout ) :: rhs_vf
472
- integer , intent (in ), optional :: step_rkck
472
+ integer , intent (in ) :: stage
473
473
474
474
real (kind (0.d0 )) :: gammaparticle, vaporflux, heatflux
475
- integer :: i, j, k, l, step
475
+ integer :: i, j, k, l
476
476
real (kind (0.d0 )) :: preterm1, term2, paux, pint, Romega, term1_fac, Rb
477
477
478
478
call nvtxStartRange(" DYNAMICS-LAGRANGE-BUBBLES" )
479
479
480
- if (present (step_rkck)) then
481
- step = step_rkck
482
- else
483
- step = 1
484
- end if
485
-
486
480
!< BUBBLE DYNAMICS
487
481
488
482
! Subgrid p_inf model from Maeda and Colonius (2018 ).
@@ -506,36 +500,36 @@ contains
506
500
end if
507
501
508
502
! Gaseous core evolution
509
- !$acc parallel loop gang vector default(present) private(k) copyin(step )
503
+ !$acc parallel loop gang vector default(present) private(k) copyin(stage )
510
504
do k = 1 , nBubs
511
505
call s_compute_interface_fluxes(k, vaporflux, heatflux, gammaparticle)
512
- gas_dpdt(k, step ) = - 3.0d0 * gammaparticle/ intfc_rad(k, 2 )* &
513
- (gas_p(k, 2 )* intfc_vel(k, 2 ) - &
514
- heatflux - (lag_params%Rvapor* lag_params%Thost)* vaporflux)
515
- gas_dmvdt(k, step ) = 4.0d0 * pi* intfc_rad(k, 2 )** 2 * vaporflux
506
+ gas_dpdt(k, stage ) = - 3.0d0 * gammaparticle/ intfc_rad(k, 2 )* &
507
+ (gas_p(k, 2 )* intfc_vel(k, 2 ) - &
508
+ heatflux - (lag_params%Rvapor* lag_params%Thost)* vaporflux)
509
+ gas_dmvdt(k, stage ) = 4.0d0 * pi* intfc_rad(k, 2 )** 2 * vaporflux
516
510
end do
517
511
518
512
! Radial motion model
519
513
if (lag_params%bubble_model == 1 ) then
520
- !$acc parallel loop gang vector default(present) private(k) copyin(step )
514
+ !$acc parallel loop gang vector default(present) private(k) copyin(stage )
521
515
do k = 1 , nBubs
522
- call s_compute_KM(k, step , q_prim_vf)
523
- intfc_draddt(k, step ) = intfc_vel(k, 2 )
516
+ call s_compute_KM(k, stage , q_prim_vf)
517
+ intfc_draddt(k, stage ) = intfc_vel(k, 2 )
524
518
end do
525
519
else
526
- !$acc parallel loop gang vector default(present) private(k) copyin(step )
520
+ !$acc parallel loop gang vector default(present) private(k) copyin(stage )
527
521
do k = 1 , nBubs
528
- intfc_dveldt(k, step ) = 0.0d0
529
- intfc_draddt(k, step ) = 0.0d0
522
+ intfc_dveldt(k, stage ) = 0.0d0
523
+ intfc_draddt(k, stage ) = 0.0d0
530
524
end do
531
525
end if
532
526
533
527
! Bubbles remain in a fixed position
534
- !$acc parallel loop collapse(2 ) gang vector default(present) private(k) copyin(step )
528
+ !$acc parallel loop collapse(2 ) gang vector default(present) private(k) copyin(stage )
535
529
do k = 1 , nBubs
536
530
do l = 1 , 3
537
- mtn_dposdt(k, l, step ) = 0.0d0
538
- mtn_dveldt(k, l, step ) = 0.0d0
531
+ mtn_dposdt(k, l, stage ) = 0.0d0
532
+ mtn_dveldt(k, l, stage ) = 0.0d0
539
533
end do
540
534
end do
541
535
@@ -933,6 +927,7 @@ contains
933
927
if (time_stepper == 1) then ! 1st order TVD RK
934
928
!$acc parallel loop gang vector default(present) private(k)
935
929
do k = 1, nBubs
930
+ !u{1} = u{n} + dt * RHS{n}
936
931
intfc_rad(k, 1) = intfc_rad(k, 1) + dt*intfc_draddt(k, 1)
937
932
intfc_vel(k, 1) = intfc_vel(k, 1) + dt*intfc_dveldt(k, 1)
938
933
mtn_pos(k, 1:3, 1) = mtn_pos(k, 1:3, 1) + dt*mtn_dposdt(k, 1:3, 1)
@@ -955,6 +950,7 @@ contains
955
950
if (stage == 1) then
956
951
!$acc parallel loop gang vector default(present) private(k)
957
952
do k = 1, nBubs
953
+ !u{1} = u{n} + dt * RHS{n}
958
954
intfc_rad(k, 2) = intfc_rad(k, 1) + dt*intfc_draddt(k, 1)
959
955
intfc_vel(k, 2) = intfc_vel(k, 1) + dt*intfc_dveldt(k, 1)
960
956
mtn_pos(k, 1:3, 2) = mtn_pos(k, 1:3, 1) + dt*mtn_dposdt(k, 1:3, 1)
@@ -967,12 +963,13 @@ contains
967
963
elseif (stage == 2) then
968
964
!$acc parallel loop gang vector default(present) private(k)
969
965
do k = 1, nBubs
970
- intfc_rad(k, 1) = (intfc_rad(k, 1) + intfc_rad(k, 2) + dt*intfc_draddt(k, 1))/2d0
971
- intfc_vel(k, 1) = (intfc_vel(k, 1) + intfc_vel(k, 2) + dt*intfc_dveldt(k, 1))/2d0
972
- mtn_pos(k, 1:3, 1) = (mtn_pos(k, 1:3, 1) + mtn_pos(k, 1:3, 2) + dt*mtn_dposdt(k, 1:3, 1))/2d0
973
- mtn_vel(k, 1:3, 1) = (mtn_vel(k, 1:3, 1) + mtn_vel(k, 1:3, 2) + dt*mtn_dveldt(k, 1:3, 1))/2d0
974
- gas_p(k, 1) = (gas_p(k, 1) + gas_p(k, 2) + dt*gas_dpdt(k, 1))/2d0
975
- gas_mv(k, 1) = (gas_mv(k, 1) + gas_mv(k, 2) + dt*gas_dmvdt(k, 1))/2d0
966
+ !u{1} = u{n} + (1/2) * dt * (RHS{n} + RHS{1})
967
+ intfc_rad(k, 1) = intfc_rad(k, 1) + dt*(intfc_draddt(k, 1) + intfc_draddt(k, 2))/2d0
968
+ intfc_vel(k, 1) = intfc_vel(k, 1) + dt*(intfc_dveldt(k, 1) + intfc_dveldt(k, 2))/2d0
969
+ mtn_pos(k, 1:3, 1) = mtn_pos(k, 1:3, 1) + dt*(mtn_dposdt(k, 1:3, 1) + mtn_dposdt(k, 1:3, 2))/2d0
970
+ mtn_vel(k, 1:3, 1) = mtn_vel(k, 1:3, 1) + dt*(mtn_dveldt(k, 1:3, 1) + mtn_dveldt(k, 1:3, 2))/2d0
971
+ gas_p(k, 1) = gas_p(k, 1) + dt*(gas_dpdt(k, 1) + gas_dpdt(k, 2))/2d0
972
+ gas_mv(k, 1) = gas_mv(k, 1) + dt*(gas_dmvdt(k, 1) + gas_dmvdt(k, 2))/2d0
976
973
if (intfc_rad(k, 1) <= 0.0d0) stop "Negative bubble radius encountered, please reduce dt"
977
974
end do
978
975
@@ -991,35 +988,38 @@ contains
991
988
if (stage == 1) then
992
989
!$acc parallel loop gang vector default(present) private(k)
993
990
do k = 1, nBubs
994
- intfc_rad(k, 2) = intfc_rad(k, 2) + dt*intfc_draddt(k, 1)
995
- intfc_vel(k, 2) = intfc_vel(k, 2) + dt*intfc_dveldt(k, 1)
996
- mtn_pos(k, 1:3, 2) = mtn_pos(k, 1:3, 2) + dt*mtn_dposdt(k, 1:3, 1)
997
- mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 2) + dt*mtn_dveldt(k, 1:3, 1)
998
- gas_p(k, 2) = gas_p(k, 2) + dt*gas_dpdt(k, 1)
999
- gas_mv(k, 2) = gas_mv(k, 2) + dt*gas_dmvdt(k, 1)
991
+ !u{1} = u{n} + dt * RHS{n}
992
+ intfc_rad(k, 2) = intfc_rad(k, 1) + dt*intfc_draddt(k, 1)
993
+ intfc_vel(k, 2) = intfc_vel(k, 1) + dt*intfc_dveldt(k, 1)
994
+ mtn_pos(k, 1:3, 2) = mtn_pos(k, 1:3, 1) + dt*mtn_dposdt(k, 1:3, 1)
995
+ mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 1) + dt*mtn_dveldt(k, 1:3, 1)
996
+ gas_p(k, 2) = gas_p(k, 1) + dt*gas_dpdt(k, 1)
997
+ gas_mv(k, 2) = gas_mv(k, 1) + dt*gas_dmvdt(k, 1)
1000
998
if (intfc_rad(k, 2) <= 0.0d0) stop "Negative bubble radius encountered, please reduce dt"
1001
999
end do
1002
1000
1003
1001
elseif (stage == 2) then
1004
1002
!$acc parallel loop gang vector default(present) private(k)
1005
1003
do k = 1, nBubs
1006
- intfc_rad(k, 2) = (3d0*intfc_rad(k, 1) + intfc_rad(k, 2) + dt*intfc_draddt(k, 1))/4d0
1007
- intfc_vel(k, 2) = (3d0*intfc_vel(k, 1) + intfc_vel(k, 2) + dt*intfc_dveldt(k, 1))/4d0
1008
- mtn_pos(k, 1:3, 2) = (3d0*mtn_pos(k, 1:3, 1) + mtn_pos(k, 1:3, 2) + dt*mtn_dposdt(k, 1:3, 1))/4d0
1009
- mtn_vel(k, 1:3, 2) = (3d0*mtn_vel(k, 1:3, 1) + mtn_vel(k, 1:3, 2) + dt*mtn_dveldt(k, 1:3, 1))/4d0
1010
- gas_p(k, 2) = (3d0*gas_p(k, 1) + gas_p(k, 2) + dt*gas_dpdt(k, 1))/4d0
1011
- gas_mv(k, 2) = (3d0*gas_mv(k, 1) + dt*gas_dmvdt(k, 1))/4d0
1004
+ !u{2} = u{n} + (1/4) * dt * [RHS{n} + RHS{1}]
1005
+ intfc_rad(k, 2) = intfc_rad(k, 1) + dt*(intfc_draddt(k, 1) + intfc_draddt(k, 2))/4d0
1006
+ intfc_vel(k, 2) = intfc_vel(k, 1) + dt*(intfc_dveldt(k, 1) + intfc_dveldt(k, 2))/4d0
1007
+ mtn_pos(k, 1:3, 2) = mtn_pos(k, 1:3, 1) + dt*(mtn_dposdt(k, 1:3, 1) + mtn_dposdt(k, 1:3, 2))/4d0
1008
+ mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 1) + dt*(mtn_dveldt(k, 1:3, 1) + mtn_dveldt(k, 1:3, 2))/4d0
1009
+ gas_p(k, 2) = gas_p(k, 1) + dt*(gas_dpdt(k, 1) + gas_dpdt(k, 2))/4d0
1010
+ gas_mv(k, 2) = gas_mv(k, 1) + dt*(gas_dmvdt(k, 1) + gas_dmvdt(k, 2))/4d0
1012
1011
if (intfc_rad(k, 2) <= 0.0d0) stop "Negative bubble radius encountered, please reduce dt"
1013
1012
end do
1014
1013
elseif (stage == 3) then
1015
1014
!$acc parallel loop gang vector default(present) private(k)
1016
1015
do k = 1, nBubs
1017
- intfc_rad(k, 1) = (intfc_rad(k, 1) + 2d0*intfc_rad(k, 2) + 2d0*dt*intfc_draddt(k, 1))/3d0
1018
- intfc_vel(k, 1) = (intfc_vel(k, 1) + 2d0*intfc_vel(k, 2) + 2d0*dt*intfc_dveldt(k, 1))/3d0
1019
- mtn_pos(k, 1:3, 1) = (mtn_pos(k, 1:3, 1) + 2d0*mtn_pos(k, 1:3, 2) + 2d0*dt*mtn_dposdt(k, 1:3, 1))/3d0
1020
- mtn_vel(k, 1:3, 1) = (mtn_vel(k, 1:3, 1) + 2d0*mtn_vel(k, 1:3, 2) + 2d0*dt*mtn_dveldt(k, 1:3, 1))/3d0
1021
- gas_p(k, 1) = (gas_p(k, 1) + 2d0*gas_p(k, 2) + 2d0*dt*gas_dpdt(k, 1))/3d0
1022
- gas_mv(k, 1) = (gas_mv(k, 1) + 2d0*gas_mv(k, 2) + 2d0*dt*gas_dmvdt(k, 1))/3d0
1016
+ !u{n+1} = u{n} + (2/3) * dt * [(1/4)* RHS{n} + (1/4)* RHS{1} + RHS{2}]
1017
+ intfc_rad(k, 1) = intfc_rad(k, 1) + (2d0/3d0)*dt*(intfc_draddt(k, 1)/4d0 + intfc_draddt(k, 2)/4d0 + intfc_draddt(k, 3))
1018
+ intfc_vel(k, 1) = intfc_vel(k, 1) + (2d0/3d0)*dt*(intfc_dveldt(k, 1)/4d0 + intfc_dveldt(k, 2)/4d0 + intfc_dveldt(k, 3))
1019
+ mtn_pos(k, 1:3, 1) = mtn_pos(k, 1:3, 1) + (2d0/3d0)*dt*(mtn_dposdt(k, 1:3, 1)/4d0 + mtn_dposdt(k, 1:3, 2)/4d0 + mtn_dposdt(k, 1:3, 3))
1020
+ mtn_vel(k, 1:3, 1) = mtn_vel(k, 1:3, 1) + (2d0/3d0)*dt*(mtn_dveldt(k, 1:3, 1)/4d0 + mtn_dveldt(k, 1:3, 2)/4d0 + mtn_dveldt(k, 1:3, 3))
1021
+ gas_p(k, 1) = gas_p(k, 1) + (2d0/3d0)*dt*(gas_dpdt(k, 1)/4d0 + gas_dpdt(k, 2)/4d0 + gas_dpdt(k, 3))
1022
+ gas_mv(k, 1) = gas_mv(k, 1) + (2d0/3d0)*dt*(gas_dmvdt(k, 1)/4d0 + gas_dmvdt(k, 2)/4d0 + gas_dmvdt(k, 3))
1023
1023
if (intfc_rad(k, 1) <= 0.0d0) stop "Negative bubble radius encountered, please reduce dt"
1024
1024
end do
1025
1025
0 commit comments