@@ -304,6 +304,7 @@ contains
304304 real (wp), dimension (:,:), intent (in ) :: pos, posPrev
305305 integer :: bubID
306306 integer :: i, j, k
307+ integer :: dx, dy, dz
307308
308309 do k = nidx(3 )%beg, nidx(3 )%end
309310 do j = nidx(2 )%beg, nidx(2 )%end
@@ -314,129 +315,29 @@ contains
314315 end do
315316
316317 do k = 1 , nbub
318+ dx = 0 ; dy = 0 ; dz = 0
317319 if (f_crosses_boundary(k, 1 , - 1 , pos, posPrev)) then
318- call s_add_particle_to_direction(k, - 1 , 0 , 0 )
319- if (n > 0 ) then
320- if (f_crosses_boundary(k, 2 , - 1 , pos, posPrev)) then
321- call s_add_particle_to_direction(k, - 1 , - 1 , 0 )
322- call s_add_particle_to_direction(k, 0 , - 1 , 0 )
323- if (p > 0 ) then
324- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
325- call s_add_particle_to_direction(k, - 1 , - 1 , - 1 )
326- call s_add_particle_to_direction(k, 0 , - 1 , - 1 )
327- call s_add_particle_to_direction(k, - 1 , 0 , - 1 )
328- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
329- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
330- call s_add_particle_to_direction(k, - 1 , - 1 , 1 )
331- call s_add_particle_to_direction(k, 0 , - 1 , 1 )
332- call s_add_particle_to_direction(k, - 1 , 0 , 1 )
333- call s_add_particle_to_direction(k, 0 , 0 , 1 )
334- end if
335- end if
336- else if (f_crosses_boundary(k, 2 , 1 , pos, posPrev)) then
337- call s_add_particle_to_direction(k, - 1 , 1 , 0 )
338- call s_add_particle_to_direction(k, 0 , 1 , 0 )
339- if (p > 0 ) then
340- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
341- call s_add_particle_to_direction(k, - 1 , 1 , - 1 )
342- call s_add_particle_to_direction(k, 0 , 1 , - 1 )
343- call s_add_particle_to_direction(k, - 1 , 0 , - 1 )
344- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
345- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
346- call s_add_particle_to_direction(k, - 1 , 1 , 1 )
347- call s_add_particle_to_direction(k, 0 , 1 , 1 )
348- call s_add_particle_to_direction(k, - 1 , 0 , 1 )
349- call s_add_particle_to_direction(k, 0 , 0 , 1 )
350- end if
351- end if
352- else
353- if (p > 0 ) then
354- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
355- call s_add_particle_to_direction(k, - 1 , 0 , - 1 )
356- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
357- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
358- call s_add_particle_to_direction(k, - 1 , 0 , 1 )
359- call s_add_particle_to_direction(k, 0 , 0 , 1 )
360- end if
361- end if
362- end if
363- end if
320+ dx = - 1
364321 else if (f_crosses_boundary(k, 1 , 1 , pos, posPrev)) then
365- call s_add_particle_to_direction(k, 1 , 0 , 0 )
366- if (n > 0 ) then
367- if (f_crosses_boundary(k, 2 , - 1 , pos, posPrev)) then
368- call s_add_particle_to_direction(k, 1 , - 1 , 0 )
369- call s_add_particle_to_direction(k, 0 , - 1 , 0 )
370- if (p > 0 ) then
371- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
372- call s_add_particle_to_direction(k, 1 , - 1 , - 1 )
373- call s_add_particle_to_direction(k, 0 , - 1 , - 1 )
374- call s_add_particle_to_direction(k, 1 , 0 , - 1 )
375- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
376- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
377- call s_add_particle_to_direction(k, 1 , - 1 , 1 )
378- call s_add_particle_to_direction(k, 0 , - 1 , 1 )
379- call s_add_particle_to_direction(k, 1 , 0 , 1 )
380- call s_add_particle_to_direction(k, 0 , 0 , 1 )
381- end if
382- end if
383- else if (f_crosses_boundary(k, 2 , 1 , pos, posPrev)) then
384- call s_add_particle_to_direction(k, 1 , 1 , 0 )
385- call s_add_particle_to_direction(k, 0 , 1 , 0 )
386- if (p > 0 ) then
387- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
388- call s_add_particle_to_direction(k, 1 , 1 , - 1 )
389- call s_add_particle_to_direction(k, 0 , 1 , - 1 )
390- call s_add_particle_to_direction(k, 1 , 0 , - 1 )
391- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
392- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
393- call s_add_particle_to_direction(k, 1 , 1 , 1 )
394- call s_add_particle_to_direction(k, 0 , 1 , 1 )
395- call s_add_particle_to_direction(k, 1 , 0 , 1 )
396- call s_add_particle_to_direction(k, 0 , 0 , 1 )
397- end if
398- end if
399- else
400- if (p > 0 ) then
401- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
402- call s_add_particle_to_direction(k, 1 , 0 , - 1 )
403- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
404- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
405- call s_add_particle_to_direction(k, 1 , 0 , 1 )
406- call s_add_particle_to_direction(k, 0 , 0 , 1 )
407- end if
408- end if
409- end if
410- end if
411- else if (f_crosses_boundary(k, 2 , - 1 , pos, posPrev)) then
412- call s_add_particle_to_direction(k, 0 , - 1 , 0 )
413- if (p > 0 ) then
414- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
415- call s_add_particle_to_direction(k, 0 , - 1 , - 1 )
416- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
417- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
418- call s_add_particle_to_direction(k, 0 , - 1 , 1 )
419- call s_add_particle_to_direction(k, 0 , 0 , 1 )
420- end if
421- end if
422- else if (f_crosses_boundary(k, 2 , 1 , pos, posPrev)) then
423- call s_add_particle_to_direction(k, 0 , 1 , 0 )
424- if (p > 0 ) then
425- if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
426- call s_add_particle_to_direction(k, 0 , 1 , - 1 )
427- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
428- else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
429- call s_add_particle_to_direction(k, 0 , 1 , 1 )
430- call s_add_particle_to_direction(k, 0 , 0 , 1 )
431- end if
322+ dx = 1
323+ end if
324+ if (n > 0 ) then
325+ if (f_crosses_boundary(k, 2 , - 1 , pos, posPrev)) then
326+ dy = - 1
327+ else if (f_crosses_boundary(k, 2 , 1 , pos, posPrev)) then
328+ dy = 1
432329 end if
433- else if (p > 0 ) then
330+ end if
331+ if (p > 0 ) then
434332 if (f_crosses_boundary(k, 3 , - 1 , pos, posPrev)) then
435- call s_add_particle_to_direction(k, 0 , 0 , - 1 )
333+ dz = - 1
436334 else if (f_crosses_boundary(k, 3 , 1 , pos, posPrev)) then
437- call s_add_particle_to_direction(k, 0 , 0 , 1 )
335+ dz = 1
438336 end if
439337 end if
338+ if (abs (dx) + abs (dy) + abs (dz) /= 0 ) then
339+ call s_add_particle_to_direction(k, dx, dy, dz)
340+ end if
440341 end do
441342
442343 contains
0 commit comments