00001 subroutine calc_vector_phi_matter(sb)
00002   use phys_constant, only : long
00003   use grid_parameter, only : nrf, ntf, npf, nrg, ntg, npg
00004   use def_matter, only  : rs
00005   use coordinate_grav_r, only : rg, hrg
00006   use trigonometry_grav_theta, only : sinthg, hsinthg
00007   use trigonometry_grav_phi, only : sinphig, cosphig, hsinphig, hcosphig
00008   use def_vector_phi, only : vec_phif, hvec_phif, hvec_phif_surface
00009   use def_binary_parameter, only : dis
00010   use interface_interpo_linear_type0_2Dsurf
00011   implicit none
00012   real(long) :: rrgg, rrss, sth, sphi, cphi, dis_bin
00013   integer :: irf, itf, ipf, sb
00014 
00015   dis_bin = dis
00016   if(sb.eq.1) dis_bin = 0.0d0   
00017 
00018   do ipf = 0, npf
00019     do itf = 0, ntf
00020       do irf = 0, nrf
00021         rrss = rs(itf,ipf)
00022         rrgg = rg(irf)
00023         sth  = sinthg(itf)
00024         sphi = sinphig(ipf)
00025         cphi = cosphig(ipf)
00026         vec_phif(irf,itf,ipf,1) =           - rrss*rrgg*sth*sphi
00027         vec_phif(irf,itf,ipf,2) = - dis_bin + rrss*rrgg*sth*cphi
00028         vec_phif(irf,itf,ipf,3) = 0.0d0
00029         if (irf.eq.0.or.itf.eq.0.or.ipf.eq.0) cycle
00030         call interpo_linear_type0_2Dsurf(rrss,rs,itf,ipf)
00031         rrgg = hrg(irf)
00032         sth  = hsinthg(itf)
00033         sphi = hsinphig(ipf)
00034         cphi = hcosphig(ipf)
00035         hvec_phif(irf,itf,ipf,1) =           - rrss*rrgg*sth*sphi
00036         hvec_phif(irf,itf,ipf,2) = - dis_bin + rrss*rrgg*sth*cphi
00037         hvec_phif(irf,itf,ipf,3) = 0.0d0
00038         rrgg = rg(nrf)  
00039         hvec_phif_surface(itf,ipf,1) =           - rrss*rrgg*sth*sphi
00040         hvec_phif_surface(itf,ipf,2) = - dis_bin + rrss*rrgg*sth*cphi
00041         hvec_phif_surface(itf,ipf,3) = 0.0d0
00042       end do
00043     end do
00044   end do
00045 end subroutine calc_vector_phi_matter