Determine the minimum wall distance from the wall surface node points
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(nodetype), | intent(in), | dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3) | :: | nodes | ||
type(extent), | intent(in) | :: | dims |
subroutine find_wall_dist(nodes, dims)
!< Determine the minimum wall distance from the wall surface node points
implicit none
type(extent), intent(in) :: dims
type(nodetype), dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3), intent(in) :: nodes
integer :: i,j,k,n
real(wp) :: current_dist
real(wp), dimension(:,:,:), allocatable :: node_dist
DebugCall('find_wall_dist')
call alloc(node_dist,-2,imx+3,-2,jmx+3,-2,kmx+3)
do k = -2,dims%kmx+3
do j = -2,dims%jmx+3
do i = -2,dims%imx+3
node_dist(i,j,k) = 1.e+20
do n = 1,n_surfnodes
current_dist = sqrt((wall_x(n)-nodes(i,j,k)%x)**2&
+(wall_y(n)-nodes(i,j,k)%y)**2&
+(wall_z(n)-nodes(i,j,k)%z)**2&
)
node_dist(i,j,k) = min(node_dist(i,j,k),current_dist)
end do
end do
end do
end do
do k=-2,dims%kmx+2
do j=-2,dims%jmx+2
do i=-2,dims%imx+2
dist(i,j,k) = 0.125*(node_dist(i ,j ,k )&
+node_dist(i ,j+1,k )&
+node_dist(i ,j+1,k+1)&
+node_dist(i ,j ,k+1)&
+node_dist(i+1,j ,k+1)&
+node_dist(i+1,j ,k )&
+node_dist(i+1,j+1,k )&
+node_dist(i+1,j+1,k+1)&
)
end do
end do
end do
deallocate(node_dist)
DebugCall('find_wall_dist-> complete')
end subroutine find_wall_dist