00001 subroutine source_circ_line_peos(cline, ia, ib, souf)
00002   use phys_constant, only :  long
00003   use grid_parameter
00004   use def_matter, only : utf, omef, jomef, jomef_int
00005   use def_matter_parameter, only : ome, ber
00006   use def_metric
00007   use def_metric_on_SFC_CF
00008   use coordinate_grav_r, only : rg
00009   use def_vector_phi, only : vec_phif
00010   use interface_interpo_gr2fl
00011   use make_array_2d
00012   implicit none
00013   character(len=2), intent(in) :: cline
00014   integer,          intent(in) :: ia, ib
00015   real(long), pointer :: souf(:,:)
00016   real(long), pointer :: fph(:,:), fth(:,:)
00017   real(long) :: omefc, jomef_intfc, ui(3), vphif(3)
00018   real(long) :: hh, ut, pre, rho, ene, qq, psif4
00019   integer    :: irf, itf, ipf, irs, j, it
00020 
00021 
00022   call interpo_gr2fl(psi , psif )
00023   call interpo_gr2fl(bvxd, bvxdf)
00024   call interpo_gr2fl(bvyd, bvydf)
00025   call interpo_gr2fl(bvzd, bvzdf)
00026 
00027   if (cline=="ph") then         
00028     call alloc_array2d(fph, 0, npf, 1, 3)
00029     irf = ia
00030     itf = ib
00031     souf = 0.0d0;   fph=0.0d0
00032     do ipf = 0, npf
00033       psif4 = psif(irf,itf,ipf)**4
00034       vphif(1) = vec_phif(irf,itf,ipf,1)
00035       vphif(2) = vec_phif(irf,itf,ipf,2)
00036       vphif(3) = vec_phif(irf,itf,ipf,3)
00037       omefc    = omef(irf,itf,ipf)
00038       ut       = utf(irf,itf,ipf) 
00039 
00040       jomef_intfc = jomef_int(irf,itf,ipf)
00041       hh = ber*ut*dexp(-jomef_intfc)
00042 
00043       ui(1) = psif4*ut*(bvxdf(irf,itf,ipf) + omefc*vphif(1))
00044       ui(2) = psif4*ut*(bvydf(irf,itf,ipf) + omefc*vphif(2))
00045       ui(3) = psif4*ut*(bvzdf(irf,itf,ipf) + omefc*vphif(3))
00046 
00047       fph(ipf,1) = hh*ui(1)
00048       fph(ipf,2) = hh*ui(2)
00049       fph(ipf,3) = hh*ui(3)
00050     end do
00051     do ipf = 1, npf
00052       souf(ipf,1) = 0.5d0*( fph(ipf,1) + fph(ipf-1,1) )
00053       souf(ipf,2) = 0.5d0*( fph(ipf,2) + fph(ipf-1,2) )
00054       souf(ipf,3) = 0.5d0*( fph(ipf,3) + fph(ipf-1,3) )
00055     end do 
00056     deallocate(fph)
00057   end if
00058 
00059   if (cline=="th") then         
00060     call alloc_array2d(fth, 0, 2*ntf, 1, 3)
00061     irf = ia
00062     ipf = ib
00063     souf = 0.0d0;   fth=0.0d0
00064     do it = 0, 2*ntf
00065       itf = it
00066       if (it > ntf) then
00067         itf = ntf - (it - ntf)  
00068         ipf = ib + npf/2        
00069       end if
00070 
00071 
00072       psif4 = psif(irf,itf,ipf)**4
00073       vphif(1) = vec_phif(irf,itf,ipf,1)
00074       vphif(2) = vec_phif(irf,itf,ipf,2)
00075       vphif(3) = vec_phif(irf,itf,ipf,3)
00076       omefc    = omef(irf,itf,ipf)
00077       ut       = utf(irf,itf,ipf) 
00078 
00079       jomef_intfc = jomef_int(irf,itf,ipf)
00080       hh = ber*ut*dexp(-jomef_intfc)
00081 
00082       ui(1) = psif4*ut*(bvxdf(irf,itf,ipf) + omefc*vphif(1))
00083       ui(2) = psif4*ut*(bvydf(irf,itf,ipf) + omefc*vphif(2))
00084       ui(3) = psif4*ut*(bvzdf(irf,itf,ipf) + omefc*vphif(3))
00085 
00086       fth(it,1) = hh*ui(1)
00087       fth(it,2) = hh*ui(2)
00088       fth(it,3) = hh*ui(3)
00089     end do 
00090     do it = 1, 2*ntf
00091       souf(it,1) = 0.5d0*( fth(it,1) + fth(it-1,1) )
00092       souf(it,2) = 0.5d0*( fth(it,2) + fth(it-1,2) )
00093       souf(it,3) = 0.5d0*( fth(it,3) + fth(it-1,3) )
00094     end do 
00095     deallocate(fth)
00096   end if
00097 
00098 
00099 end subroutine source_circ_line_peos