@@ -116,55 +116,55 @@ contains
116116 logical :: celloutside
117117 integer :: smearGrid, smearGridz
118118
119- smearGrid = mapCells - (- mapCells) + 1 ! Include the cell that contains the bubble (3+1+3 )
119+ smearGrid = mapCells - (- mapCells) ! Include the cell that contains the bubble (3+1+3 )
120120 smearGridz = smearGrid
121- if (p == 0 ) smearGridz = 1
121+ if (p == 0 ) smearGridz = 0
122122
123123 print * , ' s_gaussian'
124124
125- !$acc parallel loop gang vector default(present) private(nodecoord, l, s_coord, cell, center) copyin(smearGrid, smearGridz)
125+ !$acc parallel loop collapse(4 ) gang vector default(present) private(l, s_coord, cell, center, cellaux, nodecoord) &
126+ !$acc copyin(smearGrid, smearGridz)
126127 do l = 1 , nBubs
127- nodecoord( 1 : 3 ) = 0
128- center( 1 : 3 ) = 0._wp
129- volpart = 4._wp / 3._wp * pi * lbk_rad(l, 2 ) ** 3._wp
130- s_coord( 1 : 3 ) = lbk_s(l, 1 : 3 , 2 )
131- center (1 :2 ) = lbk_pos(l, 1 : 2 , 2 )
132- if (p > 0 ) center(3 ) = lbk_pos(l, 3 , 2 )
133- print * , ' reading initial state '
134- call s_get_cell( s_coord, cell )
135- call s_compute_stddsv(cell, volpart, stddsv )
136- print * , ' s_compute_stddsv '
137- strength_vol = volpart
138- strength_vel = 4._wp * pi * lbk_rad(l, 2 ) ** 2._wp * lbk_vel(l, 2 )
139-
140- !$acc loop collapse( 3 ) private(cellaux, nodecoord)
141- do i = 1 , smearGrid
142- do j = 1 , smearGrid
143- do k = 1 , smearGridz
144- cellaux(1 ) = cell(1 ) + i - ( mapCells + 1 )
145- cellaux(2 ) = cell(2 ) + j - ( mapCells + 1 )
146- cellaux(3 ) = cell(3 ) + k - ( mapCells + 1 )
128+ do i = 0 , smearGrid
129+ do j = 0 , smearGrid
130+ do k = 0 , smearGridz
131+
132+ nodecoord (1 :3 ) = 0
133+ center(1 : 3 ) = 0._wp
134+ volpart = 4._wp / 3._wp * pi * lbk_rad(l, 2 ) ** 3._wp
135+ s_coord( 1 : 3 ) = lbk_s(l, 1 : 3 , 2 )
136+ center( 1 : 2 ) = lbk_pos(l, 1 : 2 , 2 )
137+ print * , ' reading initial state '
138+ if (p > 0 ) center( 3 ) = lbk_pos(l, 3 , 2 )
139+ call s_get_cell(s_coord, cell )
140+ call s_compute_stddsv(cell, volpart, stddsv)
141+ strength_vol = volpart
142+ strength_vel = 4._wp * pi * lbk_rad(l, 2 ) ** 2._wp * lbk_vel(l, 2 )
143+ print * , ' s_compute_stddsv '
144+
145+ cellaux(1 ) = cell(1 ) + i - mapCells
146+ cellaux(2 ) = cell(2 ) + j - mapCells
147+ cellaux(3 ) = cell(3 ) + k - mapCells
147148 if (p == 0 ) cellaux(3 ) = 0
148149
149150 !Check if the cells intended to smear the bubbles in are in the computational domain
150151 !and redefine the cells for symmetric boundary
151- print * , ' s_check_celloutside'
152152 call s_check_celloutside(cellaux, celloutside)
153+ print * , ' s_check_celloutside'
153154
154155 if (.not. celloutside) then
155156
156157 nodecoord(1 ) = x_cc(cellaux(1 ))
157158 nodecoord(2 ) = y_cc(cellaux(2 ))
158159 if (p > 0 ) nodecoord(3 ) = z_cc(cellaux(3 ))
159- print * , ' s_applygaussian'
160160 call s_applygaussian(center, cellaux, nodecoord, stddsv, 0._wp , func)
161- if (lag_params%cluster_type >= 4 ) call s_applygaussian(center, cellaux, nodecoord, stddsv, 1._wp , func2)
161+ if (p == 0 ) call s_applygaussian(center, cellaux, nodecoord, stddsv, 1._wp , func2)
162+ print * , ' s_applygaussian'
162163
163164 ! Relocate cells for bubbles intersecting symmetric boundaries
164165 if (bc_x%beg == - 2 .or. bc_x%end == - 2 .or. bc_y%beg == - 2 .or. bc_y%end == - 2 &
165166 .or. bc_z%beg == - 2 .or. bc_z%end == - 2 ) then
166167 call s_shift_cell_symmetric_bc(cellaux, cell)
167- print * , ' s_shift_cell_symmetric_bc'
168168 end if
169169 else
170170 func = 0._wp
@@ -175,15 +175,13 @@ contains
175175 if (p == 0 ) cellaux(3 ) = 0
176176 end if
177177
178- print * , ' Update 1'
179178 !Update void fraction field
180179 addFun1 = func* strength_vol
181180 !$acc atomic update
182181 updatedvar%vf(1 )%sf(cellaux(1 ), cellaux(2 ), cellaux(3 )) = &
183182 updatedvar%vf(1 )%sf(cellaux(1 ), cellaux(2 ), cellaux(3 )) &
184183 + addFun1
185184
186- print * , ' Update 2'
187185 !Update time derivative of void fraction
188186 addFun2 = func* strength_vel
189187 !$acc atomic update
@@ -193,14 +191,16 @@ contains
193191
194192 !Product of two smeared functions
195193 !Update void fraction * time derivative of void fraction
196- if (lag_params%cluster_type > = 4 ) then
194+ if (p == 0 ) then
197195 addFun3 = func2* strength_vol* strength_vel
198196 !$acc atomic update
199197 updatedvar%vf(5 )%sf(cellaux(1 ), cellaux(2 ), cellaux(3 )) = &
200198 updatedvar%vf(5 )%sf(cellaux(1 ), cellaux(2 ), cellaux(3 )) &
201199 + addFun3
202200 end if
203- print * , ' Update 3'
201+
202+ print * , ' Update 1-2-3'
203+
204204 end do
205205 end do
206206 end do
0 commit comments