Skip to content

Commit cb2d236

Browse files
author
Anand Radhakrishnan
committed
Fixing some minor bugs
1 parent 68075ec commit cb2d236

File tree

2 files changed

+36
-30
lines changed

2 files changed

+36
-30
lines changed

src/simulation/m_monopole.f90

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ module m_monopole
3535
real(kind(0d0)), allocatable, dimension(:) :: gammas, pi_infs
3636
!$acc declare create(gammas, pi_infs)
3737

38+
integer :: momxb, momxe
39+
integer :: advxb, advxe
40+
integer :: contxb, contxe
41+
integer :: intxb, intxe
42+
!$acc declare create(momxb, momxe, advxb, advxe, contxb, contxe, intxb, intxe)
43+
3844
contains
3945

4046
subroutine s_initialize_monopole_module()
@@ -65,9 +71,20 @@ subroutine s_initialize_monopole_module()
6571
pi_infs(i) = fluid_pp(i)%pi_inf
6672
end do
6773
!$acc update device(gammas, pi_infs)
74+
75+
momxb = mom_idx%beg
76+
momxe = mom_idx%end
77+
advxb = adv_idx%beg
78+
advxe = adv_idx%end
79+
contxb = cont_idx%beg
80+
contxe = cont_idx%end
81+
intxb = internalEnergies_idx%beg
82+
intxe = internalEnergies_idx%end
83+
!$acc update device(momxb, momxe, advxb, advxe, contxb, contxe, intxb, intxe)
84+
6885
end subroutine
6986

70-
subroutine s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myalpha_rho, myalpha, q_cons_vf, &
87+
subroutine s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, q_cons_vf, &
7188
q_prim_vf, t_step, id, rhs_vf)
7289

7390
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf !<
@@ -81,42 +98,29 @@ subroutine s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myal
8198
!! of the volume fractions, q_cons_qp and gm_alpha_qp, respectively.
8299

83100
type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf
101+
!> @name Monopole source terms
102+
!> @{
103+
real(kind(0d0)), dimension(0:m, 0:n, 0:p), intent(inout) :: mono_mass_src, mono_e_src
104+
real(kind(0d0)), dimension(1:num_dims, 0:m, 0:n, 0:p), intent(inout) :: mono_mom_src
105+
!> @}
84106

107+
integer, intent(IN) :: t_step, id
85108

86109
real(kind(0d0)) :: myR, myV, alf, myP, myRho, R2Vav
87-
integer, intent(IN) :: t_step
88110

89-
integer :: i, j, k, l, q, ii, id !< generic loop variables
111+
integer :: i, j, k, l, q, ii !< generic loop variables
90112
integer :: term_index
91113

92-
!> @name Monopole source terms
93-
!> @{
94-
real(kind(0d0)), dimension(0:m, 0:n, 0:p), intent(inout) :: mono_mass_src, mono_e_src
95-
real(kind(0d0)), dimension(1:num_dims, 0:m, 0:n, 0:p), intent(inout) :: mono_mom_src
96-
!> @}
97114
real(kind(0d0)), dimension(num_fluids) :: myalpha_rho, myalpha
98115

99116
real(kind(0d0)) :: n_tait, B_tait, angle, angle_z
100117

101-
integer :: momxb, momxe
102-
integer :: advxb, advxe
103-
integer :: contxb, contxe
104-
integer :: intxb, intxe
105-
!$acc declare create(intxb, intxe)
106118

107119
integer :: ndirs
108120

109121
real(kind(0d0)) :: mytime, sound
110122
real(kind(0d0)) :: s2, const_sos, s1
111123

112-
momxb = mom_idx%beg
113-
momxe = mom_idx%end
114-
advxb = adv_idx%beg
115-
advxe = adv_idx%end
116-
contxb = cont_idx%beg
117-
contxe = cont_idx%end
118-
intxb = internalEnergies_idx%beg
119-
intxe = internalEnergies_idx%end
120124

121125
if (id == 1) then
122126
!$acc parallel loop collapse(3) gang vector default(present)
@@ -170,6 +174,10 @@ subroutine s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myal
170174
n_tait = n_tait + myalpha(ii)*gammas(ii)
171175
B_tait = B_tait + myalpha(ii)*pi_infs(ii)
172176
end do
177+
else
178+
myRho = myalpha_rho(1)
179+
n_tait = gammas(1)
180+
end do
173181
else
174182
myRho = myalpha_rho(1)
175183
n_tait = gammas(1)
@@ -744,10 +752,6 @@ function f_delta(j, k, l, mono_loc, mono_leng, nm, angle, angle_z)
744752
else if (support(nm) == 5) then
745753
! Support along 'transducer'
746754
hx = x_cc(j) - mono_loc(1)
747-
hy = y_cc(k) - mono_loc(2)
748-
749-
hxnew = foc_length(nm) - dsqrt(hy**2.d0 + (foc_length(nm) - hx)**2.d0)
750-
if ((abs(hy) < aperture(nm)/2.d0) .and. (hx < foc_length(nm))) then
751755
f_delta = 1.d0/(dsqrt(2.d0*pi)*sig/2.d0)* &
752756
dexp(-0.5d0*(hxnew/(sig/2.d0))**2.d0)
753757
angle = -atan(hy/(foc_length(nm) - hx))
@@ -800,4 +804,4 @@ function f_delta(j, k, l, mono_loc, mono_leng, nm, angle, angle_z)
800804

801805
end function f_delta
802806

803-
end module
807+
end module

src/simulation/m_rhs.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ subroutine s_compute_rhs(q_cons_vf, q_prim_vf, rhs_vf, t_step) ! -------
814814
integer :: ndirs
815815

816816
real(kind(0d0)) :: mytime, sound
817+
real(kind(0d0)) :: start, finish
817818
real(kind(0d0)) :: s2, const_sos, s1
818819

819820
integer :: i, j, k, l, r, q, ii, id !< Generic loop iterators
@@ -1323,9 +1324,9 @@ subroutine s_compute_rhs(q_cons_vf, q_prim_vf, rhs_vf, t_step) ! -------
13231324
end if
13241325

13251326
if (monopole) then
1326-
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myalpha_rho, myalpha,&
1327+
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, &
13271328
q_cons_qp%vf(1:sys_size), q_prim_qp%vf(1:sys_size), t_step, id, &
1328-
rhs_vf)
1329+
rhs_vf)
13291330
end if
13301331

13311332
if (model_eqns == 3) then
@@ -1645,7 +1646,7 @@ subroutine s_compute_rhs(q_cons_vf, q_prim_vf, rhs_vf, t_step) ! -------
16451646
end if
16461647

16471648
if (monopole) then
1648-
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myalpha_rho, myalpha,&
1649+
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, &
16491650
q_cons_qp%vf(1:sys_size), q_prim_qp%vf(1:sys_size), t_step, id, &
16501651
rhs_vf)
16511652
end if
@@ -2168,7 +2169,8 @@ subroutine s_compute_rhs(q_cons_vf, q_prim_vf, rhs_vf, t_step) ! -------
21682169
call nvtxStartRange("Monopole")
21692170

21702171
if (monopole) then
2171-
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, myalpha_rho, myalpha,&
2172+
2173+
call s_monopole_calculations(mono_mass_src, mono_mom_src, mono_e_src, &
21722174
q_cons_qp%vf(1:sys_size), q_prim_qp%vf(1:sys_size), t_step, id, &
21732175
rhs_vf)
21742176
end if

0 commit comments

Comments
 (0)