00001
00002
00003 module radial_green_fn_grav_bhex_sd
00004 use phys_constant, only : long
00005 use grid_parameter, only : nrg, nlg, rgin, rgout
00006 use coordinate_grav_r, only : rg, rginv, hrg, hrginv
00007 use make_array_3d
00008 implicit none
00009 real(long), pointer :: hgfn_sd(:,:,:), gfnsf_sd(:,:,:)
00010 contains
00011 subroutine allocate_hgfn_bhex_sd
00012 implicit none
00013 call alloc_array3d(hgfn_sd,1,nrg,0,nlg,0,nrg)
00014 call alloc_array3d(gfnsf_sd,0,nlg,0,nrg,1,4)
00015 end subroutine allocate_hgfn_bhex_sd
00016
00017
00018
00019
00020
00021
00022
00023 subroutine calc_hgfn_bhex_sd
00024 implicit none
00025 integer :: ir, irr, il
00026 real(long) :: radext, radextinv, radsq
00027 real(long) :: fac1, fac2, fac3, dil1, dil2
00028
00029 do ir = 0, nrg
00030 do il = 0, nlg
00031 do irr = 1, nrg
00032 hgfn_sd(irr,il,ir) = 0.d0
00033 end do
00034 end do
00035 end do
00036
00037
00038
00039 radext = rgout
00040 radextinv = 1.0d0/rgout
00041
00042 do ir = 0, nrg
00043 do irr = 1, nrg
00044 if (hrg(irr).lt.rg(ir)) then
00045 do il = 0, nlg
00046 fac1 = 1.0d0
00047 fac2 = radextinv**(il+1)
00048 hgfn_sd(irr,il,ir) = fac1*fac2 &
00049 & *hrg(irr)**il &
00050 & *((radext*rginv(ir))**(il+1) - (rg(ir)*radextinv)**il)
00051 end do
00052 end if
00053 if (hrg(irr).ge.rg(ir)) then
00054 do il = 0, nlg
00055 fac1 = 1.0d0
00056 fac2 = radextinv**(il+1)
00057 hgfn_sd(irr,il,ir) = fac1*fac2 &
00058 & *rg(ir)**il &
00059 & *((radext*hrginv(irr))**(il+1) - (hrg(irr)*radextinv)**il)
00060 end do
00061 end if
00062 end do
00063 end do
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 radext = rgout
00074 radextinv = 1.0d0/rgout
00075 radsq = radext**2
00076
00077 do ir = 0, nrg
00078 il = 0
00079
00080 fac1 = 1.0d0
00081 fac2 = 0.0d0
00082 fac3 = dble(2*il+1)*radextinv**(il+2)
00083 gfnsf_sd(il,ir,1) = - 0.0d0
00084 gfnsf_sd(il,ir,2) = - 0.0d0
00085 gfnsf_sd(il,ir,3) = 0.0d0
00086 gfnsf_sd(il,ir,4) = - fac1*fac3*radsq
00087
00088 do il = 1, nlg
00089
00090 fac1 = 1.0d0
00091 fac2 = 0.0d0
00092 fac3 = dble(2*il+1)*radextinv**(il+2)
00093 gfnsf_sd(il,ir,1) = - 0.0d0
00094 gfnsf_sd(il,ir,2) = - 0.0d0
00095 gfnsf_sd(il,ir,3) = 0.0d0
00096 gfnsf_sd(il,ir,4) = - fac1*fac3 &
00097 & *rg(ir)**il*radsq
00098
00099 end do
00100 end do
00101
00102 end subroutine calc_hgfn_bhex_sd
00103 end module radial_green_fn_grav_bhex_sd