00001 
00002 
00003 module weight_midpoint_grav
00004   use phys_constant,           only : nnrg, nntg, nnpg, long
00005   use grid_parameter,          only : nrg, ntg, npg 
00006   use coordinate_grav_r,       only : drg, rg, hrg
00007   use coordinate_grav_theta,   only : dthg
00008   use coordinate_grav_phi,     only : dphig
00009   use trigonometry_grav_theta, only : sinthg, hsinthg
00010   use make_array_2d
00011   use make_array_3d
00012   implicit none
00013 
00014   Real(long)          ::  hwdrg(nnrg), hwdtg(nntg), hwdpg(nnpg)
00015   Real(long)          ::  tzwdrg(0:nnrg), tzwdtg(0:nntg), tzwdpg(0:nnpg)
00016   Real(long)          ::  wdxg(0:nnrg)
00017   Real(long),pointer  ::  hwrtpg(:,:,:), tzwrtpg(:,:,:), hwtpgsf(:,:)
00018 contains
00019 subroutine allocate_weight_midpoint_grav
00020   implicit none
00021   call alloc_array2d(hwtpgsf,1,ntg,1,npg)
00022   call alloc_array3d(hwrtpg,1,nrg,1,ntg,1,npg)
00023   call alloc_array3d(tzwrtpg,0,nrg,1,ntg,1,npg)
00024 end subroutine allocate_weight_midpoint_grav
00025 subroutine weight_calc_midpoint_grav
00026   implicit none
00027   integer             ::  ir, it, ip
00028   hwdrg(1:nrg) = hrg(1:nrg)**2*drg(1:nrg)
00029   hwdtg(1:ntg) = hsinthg(1:ntg)*dthg
00030   hwdpg(1:npg) = dphig
00031 
00032   tzwdrg(1:nrg-1) = rg(1:nrg-1)**2*0.5d0*(drg(1:nrg-1) + drg(2:nrg))
00033   tzwdrg(0)   = 0.5d0*rg(0)**2*drg(1)
00034   tzwdrg(nrg) = 0.5d0*rg(nrg)**2*drg(nrg)
00035   tzwdtg(1:ntg-1) = sinthg(1:ntg-1)*dthg
00036   tzwdtg(0)   = 0.5d0*sinthg(0)*dthg
00037   tzwdtg(ntg) = 0.5d0*sinthg(ntg)*dthg
00038   tzwdpg(1:npg-1) = dphig
00039   tzwdpg(0)   = 0.5d0*dphig
00040   tzwdpg(npg) = 0.5d0*dphig
00041 
00042   wdxg(1:nrg-1) = 0.5d0*(drg(1:nrg-1) + drg(2:nrg))
00043   wdxg(0)   = 0.5d0*drg(1)
00044   wdxg(nrg) = 0.5d0*drg(nrg)
00045 
00046   do ip = 1, npg
00047     do it = 1, ntg
00048       hwtpgsf(it,ip) = hwdtg(it)*hwdpg(ip)
00049       tzwrtpg(0,it,ip) = tzwdrg(0)*hwdtg(it)*hwdpg(ip)
00050       do ir = 1, nrg
00051         hwrtpg(ir,it,ip) = hwdrg(ir)*hwdtg(it)*hwdpg(ip)
00052         tzwrtpg(ir,it,ip) = tzwdrg(ir)*hwdtg(it)*hwdpg(ip)
00053       end do
00054     end do
00055   end do
00056 
00057 end subroutine weight_calc_midpoint_grav
00058 subroutine weight_calc_midpoint_grav_th4th
00059   implicit none
00060   integer             ::  ir, it, ip
00061 
00062   hwdrg(1:nrg) = hrg(1:nrg)**2*drg(1:nrg)
00063   do it = 1, ntg, 4
00064     hwdtg(it  ) = hsinthg(it  )*dthg*13.0d0/12.0d0
00065     hwdtg(it+1) = hsinthg(it+1)*dthg*11.0d0/12.0d0
00066     hwdtg(it+2) = hsinthg(it+2)*dthg*11.0d0/12.0d0
00067     hwdtg(it+3) = hsinthg(it+3)*dthg*13.0d0/12.0d0
00068   end do
00069 
00070 
00071 
00072 
00073 
00074   hwdpg(1:npg) = dphig
00075 
00076   tzwdrg(1:nrg-1) = rg(1:nrg-1)**2*0.5d0*(drg(1:nrg-1) + drg(2:nrg))
00077   tzwdrg(0)   = 0.5d0*rg(0)**2*drg(1)
00078   tzwdrg(nrg) = 0.5d0*rg(nrg)**2*drg(nrg)
00079   tzwdtg(1:ntg-1) = sinthg(1:ntg-1)*dthg
00080   tzwdtg(0)   = 0.5d0*sinthg(0)*dthg
00081   tzwdtg(ntg) = 0.5d0*sinthg(ntg)*dthg
00082   tzwdpg(1:npg-1) = dphig
00083   tzwdpg(0)   = 0.5d0*dphig
00084   tzwdpg(npg) = 0.5d0*dphig
00085 
00086   wdxg(1:nrg-1) = 0.5d0*(drg(1:nrg-1) + drg(2:nrg))
00087   wdxg(0)   = 0.5d0*drg(1)
00088   wdxg(nrg) = 0.5d0*drg(nrg)
00089 
00090   do ip = 1, npg
00091     do it = 1, ntg
00092       hwtpgsf(it,ip) = hwdtg(it)*hwdpg(ip)
00093       tzwrtpg(0,it,ip) = tzwdrg(0)*hwdtg(it)*hwdpg(ip)
00094       do ir = 1, nrg
00095         hwrtpg(ir,it,ip) = hwdrg(ir)*hwdtg(it)*hwdpg(ip)
00096         tzwrtpg(ir,it,ip) = tzwdrg(ir)*hwdtg(it)*hwdpg(ip)
00097       end do
00098     end do
00099   end do
00100 
00101 end subroutine weight_calc_midpoint_grav_th4th
00102 end module weight_midpoint_grav