Skip to content

Commit

Permalink
[bugfix] nfluid ALLREDUCE
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zhong authored and Kevin Zhong committed Dec 11, 2024
1 parent 4711aec commit ca9afc0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions diss.f90
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ subroutine CalcDissipation

call MpiAllSumRealScalar(diss_volAvg)
call MpiAllSumRealScalar(kenerg)
call MpiAllSumIntScalar(nfluid)

! kenerg =0.5d0* kenerg / (dble(n1m*n2m*n3m))
! nu=1.0d0/ren
Expand Down
3 changes: 2 additions & 1 deletion gcurv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ subroutine gcurv
call calcRelShellVel

time=time+dt
if((ntime.eq.ntst).or.(mod(ntime,1000).eq.0)) then !to perform when needed not only at the end
!if((ntime.eq.ntst).or.(mod(ntime,1000).eq.0)) then !to perform when needed not only at the end
if( (ntime.eq.ntst) ) then !to perform when needed not only at the end
call mpi_write_continua
call mpi_write_field
call WriteRandForcCoef
Expand Down
17 changes: 17 additions & 0 deletions mpiauxroutines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ subroutine MpiAllSumRealScalar(var)

return
end subroutine MpiAllSumRealScalar


!==============================================================================

subroutine MpiAllSumIntScalar(var)
use mpih
implicit none
integer, intent(inout) :: var
integer :: buf

call MPI_ALLREDUCE(var,buf,1, &
MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,ierr)

var = buf

return
end subroutine MpiAllSumIntScalar
!==============================================================================

subroutine MpiMaxRealScalar(var)
Expand Down
17 changes: 17 additions & 0 deletions pencil_rayTag.f90
Original file line number Diff line number Diff line change
Expand Up @@ -784,3 +784,20 @@ subroutine get_bbox_inds(bbox_inds,inp)

end subroutine get_bbox_inds

subroutine get_periodic_indices(k,x)
use param
implicit none
integer :: k
real :: x(3)

if (k .ge. n3) then
k = k - n3m
x(3) = x(3) - zlen
end if

if (k .lt. 1) then
k = k + n3m
x(3) = x(3) + zlen
end if
end subroutine

0 comments on commit ca9afc0

Please sign in to comment.