Extract and write the wall surface node points in a file shared by all the MPI processes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(filetype), | intent(in) | :: | files | |||
type(nodetype), | intent(in), | dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3) | :: | nodes | ||
type(controltype), | intent(in) | :: | control | |||
type(boundarytype), | intent(in) | :: | bc | |||
type(extent), | intent(in) | :: | dims |
subroutine write_surfnode(files, nodes, control, bc, dims)
!< Extract and write the wall surface node points
!< in a file shared by all the MPI processes
implicit none
type(filetype), intent(in) :: files
type(controltype), intent(in) :: control
type(extent), intent(in) :: dims
type(boundarytype), intent(in) :: bc
type(nodetype), dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3), intent(in) :: nodes
integer :: count
integer :: i
imx = dims%imx
jmx = dims%jmx
kmx = dims%kmx
call setup_surface(files, control, bc)
call surface_points(nodes)
call MPI_GATHER(n_wall, 1, MPI_Integer, n_wall_buf, 1, &
MPI_integer,0, MPI_COMM_WORLD, ierr)
total_n_wall = sum(n_wall_buf(:))
call MPI_Bcast(total_n_wall,1, MPI_Integer, 0, &
MPI_COMM_WORLD, ierr)
call MPI_Bcast(n_wall_buf, control%total_process, MPI_Integer, 0, &
MPI_COMM_WORLD, ierr)
write_flag=0
count=0
do i=1,control%total_process
if(n_wall_buf(i)>0) then
write_flag(i)=count
count = count+1
end if
end do
call MPI_TYPE_CONTIGUOUS(maxlen,MPI_Character, new_type, ierr)
call MPI_TYPE_COMMIT(new_type, ierr)
if(process_id==0)then
write(line, '(I0)') total_n_wall
line(len(line):len(line))=lf
call MPI_FILE_WRITE_shared(thisfile, line, 1, &
new_type, &
MPI_STATUS_IGNORE, ierr)
end if
call mpi_barrier(MPI_COMM_WORLD,ierr)
if(n_wall>0)then
do i=1,n_wall
write(line, '(3(ES18.10E3,4x))') wall_x(i), wall_y(i), wall_z(i)
line(len(line):len(line))=lf
call MPI_FILE_WRITE_shared(thisfile, line, 1, &
new_type, &
MPI_STATUS_IGNORE, ierr)
end do
end if
call mpi_barrier(MPI_COMM_WORLD,ierr)
call MPI_FILE_CLOSE(thisfile, ierr)
end subroutine write_surfnode