Compute cell center of all cell including ghost cells
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(celltype), | intent(out), | dimension(-2:imx+2,-2:jmx+2,-2:kmx+2) | :: | cells | Cell center quanties: volume and coordiantes of cell center |
|
type(nodetype), | intent(in), | dimension(-2:imx+3,-2:jmx+3,-2:kmx+3) | :: | nodes | Grid points |
subroutine compute_ghost_cell_centroid(cells, nodes)
!< Compute cell center of all cell including ghost cells
implicit none
type(celltype), dimension(-2:imx+2,-2:jmx+2,-2:kmx+2), intent(out) :: cells
!< Cell center quanties: volume and coordiantes of cell center
type(nodetype), dimension(-2:imx+3,-2:jmx+3,-2:kmx+3), intent(in) :: nodes
!< Grid points
integer :: i,j,k
do k = -2, kmx+2
do j = -2, jmx+2
do i = -2, imx+2
cells(i,j,k)%centerx = 0.125 *( nodes(i ,j ,k )%x &
+ nodes(i+1,j ,k )%x &
+ nodes(i+1,j+1,k )%x &
+ nodes(i+1,j+1,k+1)%x &
+ nodes(i+1,j ,k+1)%x &
+ nodes(i ,j+1,k )%x &
+ nodes(i ,j+1,k+1)%x &
+ nodes(i ,j ,k+1)%x &
)
cells(i,j,k)%centery = 0.125 *( nodes(i ,j ,k )%y &
+ nodes(i+1,j ,k )%y &
+ nodes(i+1,j+1,k )%y &
+ nodes(i+1,j+1,k+1)%y &
+ nodes(i+1,j ,k+1)%y &
+ nodes(i ,j+1,k )%y &
+ nodes(i ,j+1,k+1)%y &
+ nodes(i ,j ,k+1)%y &
)
cells(i,j,k)%centerz = 0.125 *( nodes(i ,j ,k )%z &
+ nodes(i+1,j ,k )%z &
+ nodes(i+1,j+1,k )%z &
+ nodes(i+1,j+1,k+1)%z &
+ nodes(i+1,j ,k+1)%z &
+ nodes(i ,j+1,k )%z &
+ nodes(i ,j+1,k+1)%z &
+ nodes(i ,j ,k+1)%z &
)
end do
end do
end do
end subroutine compute_ghost_cell_centroid