00001 subroutine source_rest_mass_peos_spin(souf)
00002 use phys_constant, only : long, pi
00003 use grid_parameter, only : nrg, ntg, npg, nrf, ntf, npf
00004 use def_matter, only : emdg, emd, vep, vepxf, vepyf, vepzf
00005 use def_metric_on_SFC_CF
00006 use def_velocity_rot
00007 use def_vector_phi, only : hvec_phif, vec_phif
00008 use def_matter_parameter, only : radi, ber, ome
00009 use def_metric, only : tfkijkij, psi, alph
00010 use make_array_3d
00011 use interface_flgrad_4th_gridpoint
00012 use interface_flgrad_2nd_gridpoint
00013 use interface_interpo_gr2fl
00014 implicit none
00015 real(long),pointer :: souf(:,:,:)
00016 real(long) :: psiwm6
00017 real(long) :: emdw, alphw, psiw, rhow, hhw, utw, rhoHw, esseS
00018 real(long) :: zfac, small = 1.0d-15
00019 real(long) :: otermx, otermy, otermz, prew, ene
00020 real(long) :: dxvep, dyvep, dzvep, lam, alphw2, ovdfc(3)
00021 integer :: ir,it,ip
00022 real(long) :: wx,wy,wz,psiw4,psiwp,dvep2,wdvep,w2,wterm,uih2,hut
00023
00024 do ip = 0, npf
00025 do it = 0, ntf
00026 do ir = 0, nrf
00027 emdw = emd(ir,it,ip)
00028 if (emdw <= small) emdw = small
00029 psiw = psif(ir,it,ip)
00030 alphw = alphf(ir,it,ip)
00031 call peos_q2hprho(emdw, hhw, prew, rhow, ene)
00032
00033 ovdfc(1) = bvxdf(ir,it,ip) + ome*vec_phif(ir,it,ip,1)
00034 ovdfc(2) = bvydf(ir,it,ip) + ome*vec_phif(ir,it,ip,2)
00035 ovdfc(3) = bvzdf(ir,it,ip) + ome*vec_phif(ir,it,ip,3)
00036 dxvep = vepxf(ir,it,ip)
00037 dyvep = vepyf(ir,it,ip)
00038 dzvep = vepzf(ir,it,ip)
00039
00040 wx = wxspf(ir,it,ip)
00041 wy = wyspf(ir,it,ip)
00042 wz = wzspf(ir,it,ip)
00043 psiw4 = psiw**4
00044 psiwp = psiw**confpow
00045 alphw2 = alphw**2
00046 lam = ber + ovdfc(1)*dxvep + ovdfc(2)*dyvep + ovdfc(3)*dzvep
00047 dvep2 = (dxvep**2 + dyvep**2 + dzvep**2)/psiw4
00048 wdvep = (wx*dxvep + wy*dyvep + wz*dzvep)*psiwp
00049 w2 = psiw4*(wx*wx + wy*wy + wz*wz)*psiwp**2.0d0
00050 wterm = wdvep + w2
00051 uih2 = dvep2 + 2.0d0*wdvep + w2
00052 if ( (lam*lam + 4.0d0*alphw2*wterm)<0.0d0 ) then
00053 write(6,*) "hut imaginary....exiting"
00054 stop
00055 end if
00056 hut = (lam + sqrt(lam*lam + 4.0d0*alphw2*wterm))/(2.0d0*alphw2)
00057 utw = hut/hhw
00058
00059 souf(ir,it,ip) = rhow*alphw*utw*psiw**6
00060 end do
00061 end do
00062 end do
00063
00064 end subroutine source_rest_mass_peos_spin