00001 subroutine interpo_gr2gr_4th_mpt(fnc,cfn,rc,thc,phic)
00002 use phys_constant, only : long, pi
00003 use grid_parameter_interpo, only : nrg_itp, ntg_itp, npg_itp, rgin_itp
00004 use grid_parameter_binary_excision_interpo, only : ex_radius_itp
00005 use coordinate_grav_extended_interpo
00006 implicit none
00007 real(long), pointer :: fnc(:,:,:)
00008 real(long), intent(out) :: cfn
00009 real(long) :: rc, thc, phic
00010 real(long) :: r4(4), th4(4), phi4(4), fr4(4), ft4(4), fp4(4)
00011 integer :: irg, itg, ipg, irgex, itgex, ipgex
00012 integer :: ir0, it0, ip0, irg0 , itg0 , ipg0, ii, jj, kk
00013 real(long), external :: lagint_4th
00014
00015
00016
00017
00018 cfn = 0.0d0
00019 if (rc.lt.rgin_itp) return
00020 if (rc.gt.ex_radius_itp) stop 'interpo_gr2gr_4th_mpt'
00021
00022 do irg = 0, nrg_itp+1
00023 if (rc.lt.rgex_itp(irg).and.rc.ge.rgex_itp(irg-1)) &
00024 & ir0 = min0(irg-2,nrg_itp-3)
00025 end do
00026 do itg = 0, ntg_itp+1
00027 if (thc.lt.thgex_itp(itg).and.thc.ge.thgex_itp(itg-1)) it0 = itg-2
00028 end do
00029 do ipg = 0, npg_itp+1
00030 if (phic.lt.phigex_itp(ipg).and.phic.ge.phigex_itp(ipg-1)) ip0 = ipg-2
00031 end do
00032
00033 do ii = 1, 4
00034 irg0 = ir0 + ii - 1
00035 itg0 = it0 + ii - 1
00036 ipg0 = ip0 + ii - 1
00037 r4(ii) = rgex_itp(irg0)
00038 th4(ii) = thgex_itp(itg0)
00039 phi4(ii) = phigex_itp(ipg0)
00040 end do
00041
00042 do kk = 1, 4
00043 ipg0 = ip0 + kk - 1
00044 do jj = 1, 4
00045 itg0 = it0 + jj - 1
00046 do ii = 1, 4
00047 irg0 = ir0 + ii - 1
00048 irgex = irgex_r_itp(irg0)
00049 itgex = itgex_r_itp(itgex_th_itp(itg0),irg0)
00050 ipgex = ipgex_r_itp(ipgex_th_itp(ipgex_phi_itp(ipg0),itg0),irg0)
00051 fr4(ii) = fnc(irgex,itgex,ipgex)
00052 end do
00053 ft4(jj) = lagint_4th(r4,fr4,rc)
00054 end do
00055 fp4(kk) = lagint_4th(th4,ft4,thc)
00056 end do
00057 cfn = lagint_4th(phi4,fp4,phic)
00058
00059 end subroutine interpo_gr2gr_4th_mpt