00001 subroutine current_MHD
00002 use phys_constant, only : long
00003 use grid_parameter
00004 use coordinate_grav_r, only : rg
00005 use trigonometry_grav_phi, only : sinphig, cosphig
00006 use def_matter, only : emd, hhf, utf, uxdf, uydf, uzdf
00007 use def_matter_parameter, only : ome, ber
00008 use def_metric_on_SFC_CF, only : alphf, psif
00009 use def_emfield, only : vaxd, vayd, vazd, jtuf, jxuf, jyuf, jzuf
00010 use def_vector_phi, only : vec_phif
00011 use integrability_fnc_MHD
00012 use make_array_3d
00013 use interface_interpo_gr2fl
00014 use interface_flgrad_4th_gridpoint
00015 implicit none
00016 real(long), pointer :: vaphidf(:,:,:)
00017 real(long), pointer :: vaxdf(:,:,:), vaydf(:,:,:), vazdf(:,:,:)
00018 real(long), pointer :: huxdf(:,:,:), huzdf(:,:,:), huphidf(:,:,:)
00019 real(long) :: vecphif(3)
00020 real(long) :: Aphi, dxAphi, dyAphi, dzAphi
00021 real(long) :: Bphi, dxAx, dyAx, dzAx, dxAz, dyAz, dzAz
00022 real(long) :: vorphi, dxhux, dyhux, dzhux, dxhuz, dyhuz, dzhuz
00023 real(long) :: huphi, dxhuphi, dyhuphi, dzhuphi
00024 real(long) :: hh, ut, ux, uy, uz, vx, vy, vz, pre, rho, ene, qq
00025 real(long) :: alphff, psiff, alps6f, jphiuf
00026 integer :: irf, itf, ipf
00027
00028 call alloc_array3d(vaxdf, 0, nrf, 0, ntf, 0, npf)
00029 call alloc_array3d(vaydf, 0, nrf, 0, ntf, 0, npf)
00030 call alloc_array3d(vazdf, 0, nrf, 0, ntf, 0, npf)
00031 call alloc_array3d(vaphidf, 0, nrf, 0, ntf, 0, npf)
00032 call alloc_array3d(huxdf, 0, nrf, 0, ntf, 0, npf)
00033 call alloc_array3d(huzdf, 0, nrf, 0, ntf, 0, npf)
00034 call alloc_array3d(huphidf, 0, nrf, 0, ntf, 0, npf)
00035
00036 call interpo_gr2fl(vaxd, vaxdf)
00037 call interpo_gr2fl(vayd, vaydf)
00038 call interpo_gr2fl(vazd, vazdf)
00039 vaphidf(0:nrf,0:ntf,0:npf)=vaydf(0:nrf,0:ntf,0:npf) &
00040 & *vec_phif(0:nrf,0:ntf,0:npf,2)
00041 huxdf(0:nrf,0:ntf,0:npf) = hhf(0:nrf,0:ntf,0:npf)*uxdf(0:nrf,0:ntf,0:npf)
00042 huzdf(0:nrf,0:ntf,0:npf) = hhf(0:nrf,0:ntf,0:npf)*uzdf(0:nrf,0:ntf,0:npf)
00043 huphidf(0:nrf,0:ntf,0:npf)=hhf(0:nrf,0:ntf,0:npf)*uydf(0:nrf,0:ntf,0:npf) &
00044 & *vec_phif(0:nrf,0:ntf,0:npf,2)
00045
00046
00047 ipf = 0
00048 do itf = 0, ntf
00049 do irf = 0, nrf
00050
00051 psiff = psif(irf,itf,ipf)
00052 alphff = alphf(irf,itf,ipf)
00053 alps6f = alphff*psiff**6
00054 Aphi = vaphidf(irf,itf,ipf)
00055 huphi = huphidf(irf,itf,ipf)
00056 ut = utf(irf,itf,ipf)
00057 vecphif(1)= vec_phif(irf,itf,ipf,1)
00058 vecphif(2)= vec_phif(irf,itf,ipf,2)
00059 vecphif(3)= vec_phif(irf,itf,ipf,3)
00060 call calc_integrability_fnc_MHD(Aphi)
00061 call flgrad_4th_gridpoint(vaphidf,dxAphi,dyAphi,dzAphi,irf,itf,ipf)
00062 call flgrad_4th_gridpoint(huphidf,dxhuphi,dyhuphi,dzhuphi,irf,itf,ipf)
00063 call flgrad_4th_gridpoint(vaxdf,dxAx,dyAx,dzAx,irf,itf,ipf)
00064 call flgrad_4th_gridpoint(vazdf,dxAz,dyAz,dzAz,irf,itf,ipf)
00065 Bphi = -(dxAz - dzAx)
00066 call flgrad_4th_gridpoint(huxdf,dxhux,dyhux,dzhux,irf,itf,ipf)
00067 call flgrad_4th_gridpoint(huzdf,dxhuz,dyhuz,dzhuz,irf,itf,ipf)
00068 vorphi = dxhuz - dzhux
00069 qq = emd(irf,itf,ipf)
00070 call peos_q2hprho(qq, hh, pre, rho, ene)
00071
00072
00073
00074 jxuf(irf,itf,ipf) = 1.0d0/alps6f &
00075 & *((MHDfnc_d2Psi*huphi + MHDfnc_dLambda_phi)*(-dzAphi) &
00076 & - MHDfnc_dPSI*(+dzhuphi))
00077 jzuf(irf,itf,ipf) = 1.0d0/alps6f &
00078 & *((MHDfnc_d2Psi*huphi + MHDfnc_dLambda_phi)*(+dxAphi) &
00079 & - MHDfnc_dPSI*(-dxhuphi))
00080
00081
00082
00083 jphiuf = 1.0d0/alps6f &
00084 & *((MHDfnc_d2Psi*huphi + MHDfnc_dLambda_phi)*Bphi &
00085 & - MHDfnc_dPSI*vorphi) &
00086 & -(MHDfnc_d2At*huphi + MHDfnc_dLambda)*rho*ut
00087 jyuf(irf,itf,ipf) = jphiuf*vecphif(2)
00088
00089
00090 jtuf(irf,itf,ipf) = 0.0d0
00091
00092
00093 end do
00094 end do
00095
00096
00097
00098 do ipf = 1, npf
00099 do itf = 0, ntf
00100 do irf = 0, nrf
00101 jtuf(irf,itf,ipf) = jtuf(irf,itf,0)
00102 jxuf(irf,itf,ipf) = cosphig(ipf)*jxuf(irf,itf,0) &
00103 & - sinphig(ipf)*jyuf(irf,itf,0)
00104 jyuf(irf,itf,ipf) = sinphig(ipf)*jxuf(irf,itf,0) &
00105 & + cosphig(ipf)*jyuf(irf,itf,0)
00106 jzuf(irf,itf,ipf) = jzuf(irf,itf,0)
00107 end do
00108 end do
00109 end do
00110
00111 deallocate(vaxdf)
00112 deallocate(vaydf)
00113 deallocate(vazdf)
00114 deallocate(vaphidf)
00115 deallocate(huxdf)
00116 deallocate(huzdf)
00117 deallocate(huphidf)
00118
00119 end subroutine current_MHD