00001 subroutine source_quad_pole_peos(souf5d, iquad)
00002 use phys_constant, only : long
00003 use grid_parameter, only : nrf, ntf, npf
00004 use def_matter, only : emd, rs, utf
00005 use def_matter_parameter, only : ber
00006 use def_metric, only : psi, alph
00007 use coordinate_grav_r, only : rg
00008 use trigonometry_grav_phi, only : sinphig, cosphig
00009 use trigonometry_grav_theta, only : sinthg, costhg
00010 use def_vector_x, only : vec_xf
00011 use def_vector_phi, only : vec_phif
00012 use make_array_3d
00013 use interface_interpo_gr2fl
00014 implicit none
00015 real(long), pointer :: souf5d(:,:,:,:,:)
00016 real(long), pointer :: alphf(:,:,:), psif(:,:,:)
00017 real(long) :: emdw, alphw, psiw, rhow, hhw, utw
00018 real(long) :: small = 1.0d-15
00019 real(long) :: prew, ene
00020 real(long) :: xx(1:3), rr, ox(1:3), px(1:3)
00021 integer :: ir, it, ip, i, j, iquad
00022
00023 call alloc_array3d(psif, 0, nrf, 0, ntf, 0, npf)
00024 call alloc_array3d(alphf, 0, nrf, 0, ntf, 0, npf)
00025 call interpo_gr2fl(alph, alphf)
00026 call interpo_gr2fl(psi, psif)
00027
00028 do ip = 0, npf
00029 do it = 0, ntf
00030 do ir = 0, nrf
00031 emdw = emd(ir,it,ip)
00032 if (emdw <= small) emdw = small
00033 psiw = psif(ir,it,ip)
00034 alphw = alphf(ir,it,ip)
00035 call peos_q2hprho(emdw, hhw, prew, rhow, ene)
00036
00037 utw = utf(ir,it,ip)
00038
00039 xx(1) = vec_xf(ir,it,ip,1)
00040 xx(2) = vec_xf(ir,it,ip,2)
00041 xx(3) = vec_xf(ir,it,ip,3)
00042 rr = xx(1)**2+xx(2)**2+xx(3)**2
00043 ox(1:2) = xx(1:2)
00044 ox(3) = 0.0d0
00045 px(1) = vec_phif(ir,it,ip,1)
00046 px(2) = vec_phif(ir,it,ip,2)
00047 px(3) = vec_phif(ir,it,ip,3)
00048
00049 do i=1, 3
00050 do j=1, 3
00051 if (iquad == 0 .or. iquad == 1) &
00052 & souf5d(ir,it,ip,i,j) = xx(i)*xx(j)
00053 if (iquad == 1 .and. i == j) &
00054 & souf5d(ir,it,ip,i,j) = xx(i)*xx(j) - rr/3.0d0
00055 if (iquad == 2) &
00056 & souf5d(ir,it,ip,i,j) = px(i)*xx(j) + xx(i)*px(j)
00057 if (iquad == 3) &
00058 & souf5d(ir,it,ip,i,j) = &
00059 & ox(i)*xx(j) + xx(i)*ox(j) - 2.0d0*px(i)*px(j)
00060 if (iquad == 4) &
00061 & souf5d(ir,it,ip,i,j) = &
00062 & px(i)*xx(j) + 3.0d0*ox(i)*px(j) + 3.0d0*px(i)*ox(j) + xx(i)*px(j)
00063 souf5d(ir,it,ip,i,j) = souf5d(ir,it,ip,i,j)*rhow*alphw*utw*psiw**6
00064 end do
00065 end do
00066
00067 end do
00068 end do
00069 end do
00070
00071 deallocate(alphf)
00072 deallocate(psif)
00073 end subroutine source_quad_pole_peos