00001 subroutine gauge_hiju(conv_gra)
00002 use grid_parameter, only : nrg, ntg, npg
00003 use coordinate_grav_r, only : rg
00004 use def_metric_hij, only : hxxd, hxyd, hxzd, hyyd, hyzd, hzzd, &
00005 & hxxu, hxyu, hxzu, hyyu, hyzu, hzzu, &
00006 & gaugex, gaugey, gaugez
00007 use def_vector_x, only : hvec_xg
00008 use interface_poisson_solver_1bh_homosol
00009 use interface_grgrad_gridpoint_type0
00010 use interface_grgrad_midpoint_type0
00011 use interface_update_grfield
00012 use make_array_2d
00013 use make_array_3d
00014 implicit none
00015
00016 real(long), pointer :: gx(:,:,:), gy(:,:,:), gz(:,:,:)
00017 real(long), pointer :: sou_bhsurf(:,:), dsou_bhsurf(:,:)
00018 real(long), pointer :: sou_outsurf(:,:), dsou_outsurf(:,:)
00019 real(long), pointer :: divg(:,:,:),
00020 sougx(:,:,:), sougy(:,:,:), sougz(:,:,:)
00021 real(long) :: dgxdx, dgxdy, dgxdz, dgydx, dgydy, dgydz,
00022 dgzdx, dgzdy, dgzdz, &
00023 dhxxux, dhxxuy, dhxxuz, dhxyux, dhxyuy, dhxyuz, &
00024 dhxzux, dhxzuy, dhxzuz, &
00025 dhyxux, dhyxuy, dhyxuz, dhyyux, dhyyuy, dhyyuz, &
00026 dhyzux, dhyzuy, dhyzuz, &
00027 dhzxux, dhzxuy, dhzxuz, dhzyux, dhzyuy, dhzyuz, &
00028 dhzzux, dhzzuy, dhzzuz, &
00029 divgg, dlgxdx, dlgxdy, dlgxdz, dlgydy, dlgydz, dlgzdz, &
00030 hxidiv, hxxuc, hxyuc, hxzuc, &
00031 hyidiv, hyxuc, hyyuc, hyzuc, hzidiv, hzxuc, hzyuc, hzzuc
00032 real(long) :: dxdivg, dydivg, dzdivg, fac13, fac23, conv_gra
00033 real(long) :: dgamma(3), x, y, z
00034 integer :: ipg, irg, itg
00035
00036 call alloc_array3d(gx,0,nrg,0,ntg,0,npg)
00037 call alloc_array3d(gy,0,nrg,0,ntg,0,npg)
00038 call alloc_array3d(gz,0,nrg,0,ntg,0,npg)
00039 call alloc_array3d(divg,0,nrg,0,ntg,0,npg)
00040 call alloc_array3d(sougx,0,nrg,0,ntg,0,npg)
00041 call alloc_array3d(sougy,0,nrg,0,ntg,0,npg)
00042 call alloc_array3d(sougz,0,nrg,0,ntg,0,npg)
00043 call alloc_array2d(sou_bhsurf,0,ntg,0,npg)
00044 call alloc_array2d(dsou_bhsurf,0,ntg,0,npg)
00045 call alloc_array2d(sou_outsurf,0,ntg,0,npg)
00046 call alloc_array2d(dsou_outsurf,0,ntg,0,npg)
00047
00048
00049
00050 do ipg = 0, npg
00051 do itg = 0, ntg
00052 do irg = 0, nrg
00053 call grgrad_gridpoint_type0(gaugex,dgxdx,dgxdy,dgxdz,irg,itg,ipg)
00054 call grgrad_gridpoint_type0(gaugey,dgydx,dgydy,dgydz,irg,itg,ipg)
00055 call grgrad_gridpoint_type0(gaugez,dgzdx,dgzdy,dgzdz,irg,itg,ipg)
00056 divg(irg,itg,ipg) = dgxdx + dgydy + dgzdz
00057 end do
00058 end do
00059 end do
00060
00061 fac13 = 1.0d0/3.0d0
00062 do ipg = 1, npg
00063 do itg = 1, ntg
00064 do irg = 1, nrg
00065
00066 call grgrad_midpoint_type0(divg,dxdivg,dydivg,dzdivg,irg,itg,ipg)
00067 call grgrad_midpoint_type0(hxxu,dhxxux,dhxxuy,dhxxuz,irg,itg,ipg)
00068 call grgrad_midpoint_type0(hxyu,dhxyux,dhxyuy,dhxyuz,irg,itg,ipg)
00069 call grgrad_midpoint_type0(hxzu,dhxzux,dhxzuy,dhxzuz,irg,itg,ipg)
00070 call grgrad_midpoint_type0(hyyu,dhyyux,dhyyuy,dhyyuz,irg,itg,ipg)
00071 call grgrad_midpoint_type0(hyzu,dhyzux,dhyzuy,dhyzuz,irg,itg,ipg)
00072 call grgrad_midpoint_type0(hzzu,dhzzux,dhzzuy,dhzzuz,irg,itg,ipg)
00073 hxidiv = dhxxux + dhxyuy + dhxzuz
00074 hyidiv = dhxyux + dhyyuy + dhyzuz
00075 hzidiv = dhxzux + dhyzuy + dhzzuz
00076 x = hvec_xg(irg,itg,ipg,1)
00077 y = hvec_xg(irg,itg,ipg,2)
00078 z = hvec_xg(irg,itg,ipg,3)
00079 call kerr_schild_transverse_part(x,y,z,dgamma)
00080
00081 sougx(irg,itg,ipg) = hxidiv - dgamma(1) - fac13*dxdivg
00082 sougy(irg,itg,ipg) = hyidiv - dgamma(2) - fac13*dydivg
00083 sougz(irg,itg,ipg) = hzidiv - dgamma(3) - fac13*dzdivg
00084
00085
00086
00087
00088
00089
00090 end do
00091 end do
00092 end do
00093
00094 sou_bhsurf( 0:ntg,0:npg) = 0.0d0
00095 dsou_bhsurf( 0:ntg,0:npg) = 0.0d0
00096 sou_outsurf(0:ntg,0:npg) = 0.0d0
00097 dsou_outsurf(0:ntg,0:npg) = 0.0d0
00098
00099
00100 call poisson_solver_1bh_homosol('nd',sougx, &
00101 & sou_bhsurf,dsou_bhsurf, &
00102 & sou_outsurf,dsou_outsurf,gx)
00103
00104 call poisson_solver_1bh_homosol('nd',sougy, &
00105 & sou_bhsurf,dsou_bhsurf, &
00106 & sou_outsurf,dsou_outsurf,gy)
00107
00108 call poisson_solver_1bh_homosol('nd',sougz, &
00109 & sou_bhsurf,dsou_bhsurf, &
00110 & sou_outsurf,dsou_outsurf,gz)
00111
00112
00113 call update_grfield(gx,gaugex,conv_gra)
00114 call update_grfield(gy,gaugey,conv_gra)
00115 call update_grfield(gz,gaugez,conv_gra)
00116
00117
00118
00119
00120
00121
00122 open(16,file='test_gauge',status='unknown')
00123
00124 fac23 = 2.0d0/3.0d0
00125 do ipg = 0, npg
00126 do itg = 0, ntg
00127 do irg = 0, nrg
00128
00129 call grgrad_gridpoint_type0(gaugex,dgxdx,dgxdy,dgxdz,irg,itg,ipg)
00130 call grgrad_gridpoint_type0(gaugey,dgydx,dgydy,dgydz,irg,itg,ipg)
00131 call grgrad_gridpoint_type0(gaugez,dgzdx,dgzdy,dgzdz,irg,itg,ipg)
00132
00133 divgg = dgxdx + dgydy + dgzdz
00134 dlgxdx = dgxdx + dgxdx - fac23*divgg
00135 dlgxdy = dgxdy + dgydx
00136 dlgxdz = dgxdz + dgzdx
00137 dlgydy = dgydy + dgydy - fac23*divgg
00138 dlgydz = dgydz + dgzdy
00139 dlgzdz = dgzdz + dgzdz - fac23*divgg
00140
00141 if(itg.le.2.and.ipg.eq.2) write(16,'(1p,4e15.6)') &
00142 & rg(irg),hxxu(irg,itg,ipg),dlgxdx
00143
00144 hxxu(irg,itg,ipg) = hxxu(irg,itg,ipg) - dlgxdx
00145 hxyu(irg,itg,ipg) = hxyu(irg,itg,ipg) - dlgxdy
00146 hxzu(irg,itg,ipg) = hxzu(irg,itg,ipg) - dlgxdz
00147 hyyu(irg,itg,ipg) = hyyu(irg,itg,ipg) - dlgydy
00148 hyzu(irg,itg,ipg) = hyzu(irg,itg,ipg) - dlgydz
00149 hzzu(irg,itg,ipg) = hzzu(irg,itg,ipg) - dlgzdz
00150
00151 end do
00152 end do
00153 end do
00154
00155 close(16)
00156
00157 deallocate(gx)
00158 deallocate(gy)
00159 deallocate(gz)
00160 deallocate(divg)
00161 deallocate(sougx)
00162 deallocate(sougy)
00163 deallocate(sougz)
00164 deallocate(sou_bhsurf)
00165 deallocate(dsou_bhsurf)
00166 deallocate(sou_outsurf)
00167 deallocate(dsou_outsurf)
00168 end subroutine gauge_hiju