@@ -365,6 +365,13 @@ program main
365365CHECK_CUDECOMP_EXIT(cudecompUpdateHalosX(handle, grid_desc, w, work_halo_d, CUDECOMP_DOUBLE, piX% halo_extents, halo_periods, 3 ))
366366! $acc end host_data
367367
368+ ! find local maximum velocity (for ACDI)
369+ uc= maxval (u)
370+ vc= maxval (v)
371+ wc= maxval (w)
372+ umax= max (wc,max (uc,vc))
373+ call MPI_Allreduce(umax,gumax,1 ,MPI_DOUBLE_PRECISION,MPI_MAX,MPI_COMM_WORLD, ierr)
374+
368375! initialize phase-field
369376#if phiflag == 1
370377 if (restart .eq. 0 ) then
@@ -441,7 +448,6 @@ program main
441448! First step use Euler
442449alpha= 1.0d0
443450beta= 0.0d0
444- gumax= 1.d0
445451tstart= tstart+1
446452gamma= 1.d0 * gumax
447453! $acc data copyin(piX)
@@ -460,11 +466,9 @@ program main
460466 write (itcount,' (i4)' ) t
461467 ! Range with custom color (uncomment for profiling)
462468 ! call nvtxStartRange("Iteration "//itcount,t)
463-
464469 if (rank.eq. 0 ) write (* ,* ) " Time step" ,t," of" ,tfin
465470 call cpu_time(times)
466471
467-
468472 ! ########################################################################################################################################
469473 ! START STEP 4: PARTICLES (TRACERS)
470474 ! ########################################################################################################################################
@@ -514,10 +518,6 @@ program main
514518 ! END STEP 4: PARTICLES
515519 ! ########################################################################################################################################
516520
517-
518-
519-
520-
521521
522522 ! (uncomment for profiling)
523523 ! call nvtxStartRange("Phase-field")
@@ -587,7 +587,7 @@ program main
587587 do j= 1 , piX% shape (2 )
588588 do i= 1 ,nx
589589 ! compute distance function psi (used to compute normals)
590- val = min (phi_eval(i,j,k),1.0d0 )
590+ val = max ( 0.0d0 , min (phi_eval(i,j,k), 1.0d0 ))
591591 psidi(i,j,k) = eps* log ((val+ enum)/ (1.d0 - val+ enum))
592592 enddo
593593 enddo
0 commit comments