subroutine mirror_grid_local_new(local_tile, tileno)
real(ESMF_KIND_R8) , intent(INOUT) :: local_tile(:,:,:)
integer, intent(IN) :: tileno
integer :: i,j,n,n1,n2,nreg, npx, npy
real(ESMF_KIND_R8) :: x1,y1,z1, x2,y2,z2, ang, sa, ca
if (tileno == 1) then
! no op
else
do j = 1, size(local_tile,2)
do i = 1, size(local_tile,1)
x1 = local_tile(i,j,1)
y1 = local_tile(i,j,2)
z1 = radius
select case (tileno)
case (2)
ang = -90.
sa = -1
ca = 0
call rot_3d_new( 3, x1, y1, z1, sa, ca, x2, y2, z2, 1) ! rotate about the z-axis
case (3)
ang = -90.
sa = -1
ca = 0
call rot_3d_new( 3, x1, y1, z1, sa, ca, x2, y2, z2, 1) ! rotate about the z-axis
ang = 90.
sa = +1
ca = 0
call rot_3d_new( 1, x2, y2, z2, sa, ca, x1, y1, z1, 1) ! rotate about the x-axis
x2=x1
y2=y1
z2=z1
case (4)
ang = -180.
sa = 0
ca = -1
call rot_3d_new( 3, x1, y1, z1, sa, ca, x2, y2, z2, 1) ! rotate about the z-axis
ang = 90.
sa = 1
ca = 0
call rot_3d_new( 1, x2, y2, z2, sa, ca, x1, y1, z1, 1) ! rotate about the x-axis
x2=x1
y2=y1
z2=z1
case (5)
ang = 90.
sa = 1
ca = 0
call rot_3d_new( 3, x1, y1, z1, sa, ca, x2, y2, z2, 1) ! rotate about the z-axis
ang = 90.
sa = 1
ca = 0
call rot_3d_new( 2, x2, y2, z2, sa, ca, x1, y1, z1, 1) ! rotate about the y-axis
x2=x1
y2=y1
z2=z1
case (6)
ang = 90.
sa = 1
ca = 0
call rot_3d_new( 2, x1, y1, z1, sa, ca, x2, y2, z2, 1) ! rotate about the y-axis
ang = 0.
sa = 0
ca = 1
call rot_3d_new( 3, x2, y2, z2, sa, ca, x1, y1, z1, 1) ! rotate about the z-axis
x2=x1
y2=y1
z2=z1
end select
local_tile(i,j,1) = x2
local_tile(i,j,2) = y2
enddo
enddo
endif
end subroutine mirror_grid_local_new