00001 
00002 
00003 module weight_midpoint_binary_excision
00004   use phys_constant, only : long
00005   implicit none
00006 
00007   real(long), pointer :: hwrtpg_ex(:,:,:)
00008   real(long), pointer :: hwtpg_ex(:,:)
00009 
00010 contains
00011 
00012 subroutine allocate_weight_midpoint_binary_excision
00013   use grid_parameter, only : nrg, ntg, npg 
00014   use make_array_2d
00015   use make_array_3d
00016   implicit none
00017   call alloc_array3d(hwrtpg_ex,1,nrg,1,ntg,1,npg)
00018   call alloc_array2d(hwtpg_ex       ,1,ntg,1,npg)
00019 end subroutine allocate_weight_midpoint_binary_excision
00020 
00021 subroutine calc_weight_midpoint_binary_excision
00022   use grid_parameter,       only : nrg, ntg, npg 
00023   use weight_midpoint_grav, only : hwdrg, hwdtg, hwdpg, tzwdtg, tzwdpg
00024   use coordinate_grav_theta,   only : dthg
00025   use coordinate_grav_phi,     only : dphig, phig
00026   use grid_points_binary_excision, only : hphig_exin, hphig_exout
00027   use trigonometry_grav_theta, only : hsinthg
00028   implicit none
00029   integer :: irg, itg, ipg
00030   real(long) :: wgr, wgt, wgp, phi_in, phi_out, small = 1.0d-14
00031 
00032 
00033 
00034 
00035   do itg = 1, ntg
00036     do irg = 1, nrg
00037       do ipg = 1, npg
00038 
00039         wgr = hwdrg(irg)
00040         wgt = hwdtg(itg)
00041         wgp = hwdpg(ipg)
00042         phi_in  = hphig_exin(irg,itg)
00043         phi_out = hphig_exout(irg,itg)
00044         if (phi_in.ge.small) then
00045           if (phi_in.ge.phig(ipg-1).and.phi_in.le.phig(ipg)) then 
00046             wgp = phig(ipg) - phi_in
00047           end if
00048           if (phi_out.ge.phig(ipg-1).and.phi_out.le.phig(ipg)) then 
00049             wgp = phi_out - phig(ipg-1)
00050           end if
00051           if (phig(ipg).le.phi_in.or.phig(ipg-1).ge.phi_out) then 
00052             wgr = 0.0d0
00053             wgt = 0.0d0
00054             wgp = 0.0d0
00055           end if
00056         end if
00057 
00058         hwrtpg_ex(irg,itg,ipg) = wgr*wgt*wgp
00059 
00060       end do
00061     end do
00062   end do
00063 
00064   do ipg = 1, npg
00065     do itg = 1, ntg
00066       wgt = hwdtg(itg)
00067       wgp = hwdpg(ipg)
00068       hwtpg_ex(itg,ipg) = wgt*wgp
00069     end do
00070   end do
00071 
00072 end subroutine calc_weight_midpoint_binary_excision
00073 
00074 subroutine calc_weight_midpoint_binary_excision_hybrid
00075   use grid_parameter,       only : nrg, ntg, npg, ntgeq, nrf
00076   use weight_midpoint_grav, only : hwdrg, hwdtg, hwdpg, tzwdtg, tzwdpg, hwrtpg
00077   use coordinate_grav_theta,   only : dthg
00078   use coordinate_grav_phi,     only : dphig, phig
00079   use grid_points_binary_excision, only : hphig_exin, hphig_exout, &
00080   &                                       irg_exin, irg_exout
00081   use trigonometry_grav_theta, only : hsinthg
00082   implicit none
00083   integer :: irg, itg, ipg, nrg_exin, nrg_exout
00084   real(long) :: wgr, wgt, wgp, phi_in, phi_out, small = 1.0d-14
00085 
00086 
00087 
00088 
00089   nrg_exin  = irg_exin(ntgeq,0) 
00090   nrg_exout = irg_exin(ntgeq,0) 
00091   do itg = 1, ntg
00092     do irg = 1, nrg
00093       do ipg = 1, npg
00094 
00095         wgr = hwdrg(irg)
00096 
00097         wgt = hsinthg(itg)*dthg
00098 
00099         wgp = hwdpg(ipg)
00100         phi_in  = hphig_exin(irg,itg)
00101         phi_out = hphig_exout(irg,itg)
00102         if (phi_in.ge.small) then
00103           if (phi_in.ge.phig(ipg-1).and.phi_in.le.phig(ipg)) then 
00104             wgp = phig(ipg) - phi_in
00105           end if
00106           if (phi_out.ge.phig(ipg-1).and.phi_out.le.phig(ipg)) then 
00107             wgp = phi_out - phig(ipg-1)
00108           end if
00109           if (phig(ipg).le.phi_in.or.phig(ipg-1).ge.phi_out) then 
00110             wgr = 0.0d0
00111             wgt = 0.0d0
00112             wgp = 0.0d0
00113           end if
00114         end if
00115 
00116         hwrtpg_ex(irg,itg,ipg) = wgr*wgt*wgp
00117 
00118       end do
00119     end do
00120   end do
00121 
00122   do ipg = 1, npg
00123     do itg = 1, ntg
00124       wgt = hwdtg(itg)
00125       wgp = hwdpg(ipg)
00126 
00127 
00128       do irg = 1, nrg
00129         wgt = hsinthg(itg)*dthg
00130         wgr = hwdrg(irg)
00131         hwrtpg(irg,itg,ipg) = wgr*wgt*wgp
00132       end do
00133     end do
00134   end do
00135 
00136 end subroutine calc_weight_midpoint_binary_excision_hybrid
00137 end module weight_midpoint_binary_excision