00001 subroutine IO_output_2D_general(filename,fg,mg,pot,pl)
00002 use phys_constant, only : long
00003 use grid_parameter, only : nrg, ntg, npg, nrf, ntf, npf
00004 use trigonometry_grav_theta, only : sinthg, costhg
00005 use trigonometry_grav_phi, only : sinphig, cosphig
00006 use coordinate_grav_r, only : rg
00007 implicit none
00008 integer :: ir, it, ip, nrtmp, nttmp, nptmp, ii, ir0,it0,ip0
00009 real(long), pointer :: pot(:,:,:)
00010 real(long) :: xx, yy, zz
00011 character(len=1), intent(in) :: fg,mg
00012 character(len=2), intent(in) :: pl
00013 character(len=30), intent(in) :: filename
00014
00015 if(fg == 'f') then
00016 nrtmp=nrf; nttmp=ntf; nptmp=npf
00017 else
00018 nrtmp=nrg; nttmp=ntg; nptmp=npg
00019 end if
00020
00021 if (mg=='m') then
00022 ir0=1; it0=1; ip0=1
00023 else
00024 ir0=0; it0=0; ip0=0
00025 end if
00026
00027 open(12,file=filename, status='unknown')
00028 if (pl=='xy' .or. pl=='yx') then
00029 it = nttmp/2
00030 do ip = ip0, nptmp
00031 do ir = ir0, nrtmp
00032 xx = rg(ir)*sinthg(it)*cosphig(ip)
00033 yy = rg(ir)*sinthg(it)*sinphig(ip)
00034 write(12,'(1p,3e23.15)') xx, yy, pot(ir,it,ip)
00035 end do
00036 end do
00037 end if
00038
00039 if (pl=='yz' .or. pl=='zy') then
00040 ip = nptmp/4
00041 do it = it0, nttmp
00042 do ir = ir0, nrtmp
00043 yy = rg(ir)*sinthg(it)*sinphig(ip)
00044 zz = rg(ir)*costhg(it)
00045 write(12,'(1p,3e23.15)') yy, zz, pot(ir,it,ip)
00046 end do
00047 end do
00048
00049 ip = 3*nptmp/4
00050 do it = it0, nttmp
00051 do ir = ir0, nrtmp
00052 yy = rg(ir)*sinthg(it)*sinphig(ip)
00053 zz = rg(ir)*costhg(it)
00054 write(12,'(1p,3e23.15)') yy, zz, pot(ir,it,ip)
00055 end do
00056 end do
00057 end if
00058
00059 if (pl=='zx' .or. pl=='xz') then
00060 ip = 0
00061 do it = it0, nttmp
00062 do ir = ir0, nrtmp
00063 xx = rg(ir)*sinthg(it)*cosphig(ip)
00064 zz = rg(ir)*costhg(it)
00065 write(12,'(1p,3e23.15)') xx, zz, pot(ir,it,ip)
00066 end do
00067 end do
00068
00069 ip = nptmp/2
00070 do it = it0, nttmp
00071 do ir = ir0, nrtmp
00072 xx = rg(ir)*sinthg(it)*cosphig(ip)
00073 zz = rg(ir)*costhg(it)
00074 write(12,'(1p,3e23.15)') xx, zz, pot(ir,it,ip)
00075 end do
00076 end do
00077 end if
00078
00079 close(12)
00080
00081 end subroutine IO_output_2D_general