00001 module grid_points_asymptotic_patch
00002 use phys_constant, only : long
00003 implicit none
00004
00005 real(long), pointer :: ra(:,:,:), tha(:,:,:), phia(:,:,:)
00006 real(long), pointer :: hra(:,:,:), htha(:,:,:), hphia(:,:,:)
00007
00008 contains
00009
00010 subroutine allocate_grid_points_asymptotic_patch
00011 use phys_constant, only : long, pi
00012 use grid_parameter, only : nrg, ntg, npg
00013 use make_array_3d
00014 implicit none
00015
00016
00017
00018 call alloc_array3d(ra,-2,nrg+2,0,ntg,0,npg)
00019 call alloc_array3d(tha,-2,nrg+2,0,ntg,0,npg)
00020 call alloc_array3d(phia,-2,nrg+2,0,ntg,0,npg)
00021 call alloc_array3d(hra,1,nrg,1,ntg,1,npg)
00022 call alloc_array3d(htha,1,nrg,1,ntg,1,npg)
00023 call alloc_array3d(hphia,1,nrg,1,ntg,1,npg)
00024
00025 end subroutine allocate_grid_points_asymptotic_patch
00026
00027
00028
00029 subroutine calc_grid_points_asymptotic_patch(impt_bin,impt_apt)
00030 use phys_constant, only : long, pi
00031 use coordinate_grav_r, only : rg, hrg
00032 use coordinate_grav_extended, only : rgex, hrgex
00033 use coordinate_grav_theta, only : thg
00034 use coordinate_grav_phi, only : phig
00035 use grid_parameter, only : nrg, ntg, npg, ntgxy, npgxzp, npgxzm, rgout
00036 use def_binary_parameter, only : dis
00037 use grid_parameter_binary_excision, only : ex_radius
00038 use trigonometry_grav_theta, only : sinthg, costhg, hsinthg, hcosthg
00039 use trigonometry_grav_phi, only : sinphig, cosphig, hsinphig, hcosphig
00040 implicit none
00041
00042 real(long) :: small = 1.0d-10
00043 real(long) :: rrgg, sth, cth, sphi, cphi
00044 real(long) :: point_line_dis2, root_det, dis_bin
00045 real(long) :: x0, y0, z0, rg_exc_dis2, xxyy2, phi_rot
00046 integer :: irg, itg, ipg, impt_bin, impt_apt
00047
00048
00049
00050 call copy_def_binary_parameter_from_mpt(impt_bin)
00051 if (impt_bin.eq.1) dis_bin = dis
00052 if (impt_bin.eq.2) dis_bin = - dis
00053 call copy_def_binary_parameter_from_mpt(impt_apt)
00054 phi_rot = 0.0d0
00055 if (impt_bin.eq.2) phi_rot = pi
00056
00057
00058 do ipg = 0, npg
00059 do itg = 0, ntg
00060 do irg = -2, nrg + 2
00061 ra(irg,itg,ipg) = 0.0d0
00062 tha(irg,itg,ipg) = 0.0d0
00063 phia(irg,itg,ipg) = 0.0d0
00064
00065 rrgg = rgex(irg)
00066 sth = sinthg(itg)
00067 cth = costhg(itg)
00068 sphi = sinphig(ipg)
00069 cphi = cosphig(ipg)
00070 x0 = rrgg*sth*cphi
00071 y0 = rrgg*sth*sphi
00072 z0 = rrgg*cth
00073
00074 rg_exc_dis2 = (x0 + dis_bin)**2 + y0**2 + z0**2
00075 xxyy2 = (x0 + dis_bin)**2 + y0**2
00076
00077 ra(irg,itg,ipg) = sqrt(rg_exc_dis2)
00078 tha(irg,itg,ipg) = atan2(sqrt(xxyy2),z0)
00079 phia(irg,itg,ipg)= &
00080 & dmod(2.0d0*pi+datan2(y0,x0+dis_bin)+phi_rot,2.0d0*pi)
00081
00082 end do
00083 end do
00084 end do
00085
00086
00087
00088 do ipg = 1, npg
00089 do itg = 1, ntg
00090 do irg = 1, nrg
00091 hra(irg,itg,ipg) = 0.0d0
00092 htha(irg,itg,ipg) = 0.0d0
00093 hphia(irg,itg,ipg) = 0.0d0
00094
00095 rrgg = hrgex(irg)
00096 sth = hsinthg(itg)
00097 cth = hcosthg(itg)
00098 sphi = hsinphig(ipg)
00099 cphi = hcosphig(ipg)
00100 x0 = rrgg*sth*cphi
00101 y0 = rrgg*sth*sphi
00102 z0 = rrgg*cth
00103
00104 rg_exc_dis2 = (x0 + dis_bin)**2 + y0**2 + z0**2
00105 xxyy2 = (x0 + dis_bin)**2 + y0**2
00106
00107 hra(irg,itg,ipg) = sqrt(rg_exc_dis2)
00108 htha(irg,itg,ipg) = atan2(sqrt(xxyy2),z0)
00109 hphia(irg,itg,ipg)= &
00110 & dmod(2.0d0*pi+datan2(y0,x0+dis_bin)+phi_rot,2.0d0*pi)
00111
00112 end do
00113 end do
00114 end do
00115
00116 end subroutine calc_grid_points_asymptotic_patch
00117 end module grid_points_asymptotic_patch