00001 subroutine calc_vector_x_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, costhg, hcosthg
00007   use trigonometry_grav_phi, only : sinphig, cosphig, hsinphig, hcosphig
00008   use def_vector_x, only : vec_xf, hvec_xf
00009   use def_binary_parameter, only : dis
00010   use interface_interpo_linear_type0_2Dsurf
00011   implicit none
00012   real(long) :: rrgg, rrss, sth, cth, 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         cth  = costhg(itf)
00025         sphi = sinphig(ipf)
00026         cphi = cosphig(ipf)
00027         vec_xf(irf,itf,ipf,1) = - dis_bin + rrss*rrgg*sth*cphi
00028         vec_xf(irf,itf,ipf,2) =             rrss*rrgg*sth*sphi
00029         vec_xf(irf,itf,ipf,3) =             rrss*rrgg*cth
00030         if (irf.eq.0.or.itf.eq.0.or.ipf.eq.0) cycle
00031         call interpo_linear_type0_2Dsurf(rrss,rs,itf,ipf)
00032         rrgg = hrg(irf)
00033         sth  = hsinthg(itf)
00034         cth  = hcosthg(itf)
00035         sphi = hsinphig(ipf)
00036         cphi = hcosphig(ipf)
00037         hvec_xf(irf,itf,ipf,1) = - dis_bin + rrss*rrgg*sth*cphi
00038         hvec_xf(irf,itf,ipf,2) =             rrss*rrgg*sth*sphi
00039         hvec_xf(irf,itf,ipf,3) =             rrss*rrgg*cth
00040       end do
00041     end do
00042   end do
00043 end subroutine calc_vector_x_matter