@@ -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+
3844contains
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
0 commit comments