00001 subroutine source_circ_surf_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 trigonometry_grav_phi, only : sinphig, cosphig
00011 use interface_interpo_gr2fl
00012 use interface_flgrad_midpoint_type0_parallel
00013 use interface_flgrad_midpoint_type0_meridian
00014 use make_array_2d
00015 implicit none
00016 character(len=2), intent(in) :: cline
00017 integer, intent(in) :: ia, ib
00018 real(long), pointer :: souf(:,:)
00019 real(long), pointer :: fx(:,:), fy(:,:), fz(:,:)
00020 real(long), pointer :: gx(:,:), gy(:,:), gz(:,:)
00021 real(long) :: dfxdx, dfxdy, dfxdz
00022 real(long) :: dfydx, dfydy, dfydz
00023 real(long) :: dfzdx, dfzdy, dfzdz
00024 real(long) :: omefc, jomef_intfc, ui(3), vphif(3)
00025 real(long) :: hh, ut, pre, rho, ene, qq, psif4
00026 integer :: irf, itf, ipf, irs, j, ir, it
00027
00028 call interpo_gr2fl(psi , psif )
00029 call interpo_gr2fl(bvxd, bvxdf)
00030 call interpo_gr2fl(bvyd, bvydf)
00031 call interpo_gr2fl(bvzd, bvzdf)
00032
00033 if (cline=="ph") then
00034 call alloc_array2d(fx, 0, ia, 0, npf)
00035 call alloc_array2d(fy, 0, ia, 0, npf)
00036
00037 itf = ib
00038 souf = 0.0d0; fx=0.0d0; fy=0.0d0
00039 do irf = 0, ia
00040 do ipf = 0, npf
00041 psif4 = psif(irf,itf,ipf)**4
00042 vphif(1) = vec_phif(irf,itf,ipf,1)
00043 vphif(2) = vec_phif(irf,itf,ipf,2)
00044 vphif(3) = vec_phif(irf,itf,ipf,3)
00045 omefc = omef(irf,itf,ipf)
00046 ut = utf(irf,itf,ipf)
00047
00048 jomef_intfc = jomef_int(irf,itf,ipf)
00049 hh = ber*ut*dexp(-jomef_intfc)
00050
00051 ui(1) = psif4*ut*(bvxdf(irf,itf,ipf) + omefc*vphif(1))
00052 ui(2) = psif4*ut*(bvydf(irf,itf,ipf) + omefc*vphif(2))
00053 ui(3) = psif4*ut*(bvzdf(irf,itf,ipf) + omefc*vphif(3))
00054
00055 fx(irf,ipf) = hh*ui(1)
00056 fy(irf,ipf) = hh*ui(2)
00057
00058 end do
00059 end do
00060 do irf = 1, ia
00061 do ipf = 1, npf
00062 call flgrad_midpoint_type0_parallel(fx,dfxdx,dfxdy,dfxdz,irf,itf,ipf)
00063 call flgrad_midpoint_type0_parallel(fy,dfydx,dfydy,dfydz,irf,itf,ipf)
00064 souf(irf,ipf) = dfydx - dfxdy
00065 end do
00066 end do
00067 deallocate(fx); deallocate(fy);
00068 end if
00069
00070 if (cline=="th") then
00071 call alloc_array2d(fx, 0, ia, 0, ntf)
00072 call alloc_array2d(fy, 0, ia, 0, ntf)
00073 call alloc_array2d(fz, 0, ia, 0, ntf)
00074 call alloc_array2d(gx, 0, ia, 0, ntf)
00075 call alloc_array2d(gy, 0, ia, 0, ntf)
00076 call alloc_array2d(gz, 0, ia, 0, ntf)
00077 souf = 0.0d0;
00078 fx=0.0d0; fy=0.0d0; fz=0.0d0
00079 gx=0.0d0; gy=0.0d0; gz=0.0d0
00080
00081 do irf = 0, ia
00082 ipf = ib
00083 do itf = 0, ntf
00084 psif4 = psif(irf,itf,ipf)**4
00085 vphif(1) = vec_phif(irf,itf,ipf,1)
00086 vphif(2) = vec_phif(irf,itf,ipf,2)
00087 vphif(3) = vec_phif(irf,itf,ipf,3)
00088 omefc = omef(irf,itf,ipf)
00089 ut = utf(irf,itf,ipf)
00090
00091 jomef_intfc = jomef_int(irf,itf,ipf)
00092 hh = ber*ut*dexp(-jomef_intfc)
00093
00094 ui(1) = psif4*ut*(bvxdf(irf,itf,ipf) + omefc*vphif(1))
00095 ui(2) = psif4*ut*(bvydf(irf,itf,ipf) + omefc*vphif(2))
00096 ui(3) = psif4*ut*(bvzdf(irf,itf,ipf) + omefc*vphif(3))
00097
00098 fx(irf,itf) = hh*ui(1)
00099 fy(irf,itf) = hh*ui(2)
00100 fz(irf,itf) = hh*ui(3)
00101 end do
00102
00103 ipf = ib + npf/2
00104
00105 do it = ntf, 2*ntf
00106 itf = ntf - (it - ntf)
00107
00108 psif4 = psif(irf,itf,ipf)**4
00109 vphif(1) = vec_phif(irf,itf,ipf,1)
00110 vphif(2) = vec_phif(irf,itf,ipf,2)
00111 vphif(3) = vec_phif(irf,itf,ipf,3)
00112 omefc = omef(irf,itf,ipf)
00113 ut = utf(irf,itf,ipf)
00114
00115 jomef_intfc = jomef_int(irf,itf,ipf)
00116 hh = ber*ut*dexp(-jomef_intfc)
00117
00118 ui(1) = psif4*ut*(bvxdf(irf,itf,ipf) + omefc*vphif(1))
00119 ui(2) = psif4*ut*(bvydf(irf,itf,ipf) + omefc*vphif(2))
00120 ui(3) = psif4*ut*(bvzdf(irf,itf,ipf) + omefc*vphif(3))
00121
00122 gx(irf,itf) = hh*ui(1)
00123 gy(irf,itf) = hh*ui(2)
00124 gz(irf,itf) = hh*ui(3)
00125 end do
00126 end do
00127
00128
00129 do ir = 1, ia
00130 irf = ir
00131 ipf = ib
00132 do it = 1, ntf
00133 itf = it
00134 call flgrad_midpoint_type0_meridian(fx,dfxdx,dfxdy,dfxdz,irf,itf,ipf)
00135 call flgrad_midpoint_type0_meridian(fy,dfydx,dfydy,dfydz,irf,itf,ipf)
00136 call flgrad_midpoint_type0_meridian(fz,dfzdx,dfzdy,dfzdz,irf,itf,ipf)
00137
00138
00139 souf(ir,it) = -sinphig(ib) * (dfzdy - dfydz) + &
00140 & cosphig(ib) * (dfxdz - dfzdx)
00141 end do
00142
00143 ipf = ib + npf/2
00144 do it = ntf+1, 2*ntf
00145 itf = ntf - (it - ntf) + 1
00146 call flgrad_midpoint_type0_meridian(gx,dfxdx,dfxdy,dfxdz,irf,itf,ipf)
00147 call flgrad_midpoint_type0_meridian(gy,dfydx,dfydy,dfydz,irf,itf,ipf)
00148 call flgrad_midpoint_type0_meridian(gz,dfzdx,dfzdy,dfzdz,irf,itf,ipf)
00149
00150 souf(ir,it) = -sinphig(ib) * (dfzdy - dfydz) + &
00151 & cosphig(ib) * (dfxdz - dfzdx)
00152 end do
00153 end do
00154 deallocate(fx); deallocate(fy); deallocate(fz);
00155 deallocate(gx); deallocate(gy); deallocate(gz);
00156 end if
00157
00158 end subroutine source_circ_surf_peos