00001 subroutine source_MWspatial_WL(souvec)
00002 use grid_parameter, only : nrg, ntg, npg, nrf, ntf, npf, ntgeq
00003 use coordinate_grav_r, only : hrg
00004 use interface_sourceterm_MWspatial_current_CF
00005 use interface_sourceterm_MWspatial_current_WL
00006 use interface_sourceterm_MWspatial_CF
00007 use interface_sourceterm_MWspatial_WL
00008 use interface_interpo_fl2gr_midpoint
00009 use interface_correct_matter_source_midpoint
00010 use interface_correct_MW_source_C0At
00011 use make_array_3d
00012 use make_array_4d
00013 implicit none
00014 real(8), pointer :: souvec(:,:,:,:)
00015 real(8), pointer :: souvecf1(:,:,:,:), souvecf2(:,:,:,:)
00016 real(8), pointer :: sou(:,:,:), souf(:,:,:), souvecf(:,:,:,:)
00017 real(8), pointer :: souvec1(:,:,:,:), souvec2(:,:,:,:),
00018 souvec3(:,:,:,:)
00019 integer :: ia, irg, itg, ipg
00020
00021 call alloc_array3d(sou,0,nrg,0,ntg,0,npg)
00022 call alloc_array3d(souf,0,nrf,0,ntf,0,npf)
00023 call alloc_array4d(souvecf,0,nrf,0,ntf,0,npf,1,3)
00024 call alloc_array4d(souvecf1,0,nrf,0,ntf,0,npf,1,3)
00025 call alloc_array4d(souvecf2,0,nrf,0,ntf,0,npf,1,3)
00026 call alloc_array4d(souvec1,0,nrg,0,ntg,0,npg,1,3)
00027 call alloc_array4d(souvec2,0,nrg,0,ntg,0,npg,1,3)
00028 call alloc_array4d(souvec3,0,nrg,0,ntg,0,npg,1,3)
00029
00030 call sourceterm_MWspatial_current_CF(souvecf1)
00031 call sourceterm_MWspatial_current_WL(souvecf2)
00032 souvecf(0:nrf,0:ntf,0:npf,1:3) = souvecf1(0:nrf,0:ntf,0:npf,1:3) &
00033 & + souvecf2(0:nrf,0:ntf,0:npf,1:3)
00034 do ia = 1, 3
00035 souf(0:nrf,0:ntf,0:npf) = souvecf(0:nrf,0:ntf,0:npf,ia)
00036 call interpo_fl2gr_midpoint(souf,sou)
00037 call correct_matter_source_midpoint(sou)
00038 souvec1(0:nrg,0:ntg,0:npg,ia) = sou(0:nrg,0:ntg,0:npg)
00039 end do
00040
00041 call sourceterm_MWspatial_CF(souvec2)
00042 do ia = 1, 3
00043 sou(0:nrg,0:ntg,0:npg) = souvec2(0:nrg,0:ntg,0:npg,ia)
00044 call correct_MW_source_C0At(sou,2)
00045 souvec2(0:nrg,0:ntg,0:npg,ia) = sou(0:nrg,0:ntg,0:npg)
00046 end do
00047
00048 call sourceterm_MWspatial_WL(souvec3)
00049 do ia = 1, 3
00050 sou(0:nrg,0:ntg,0:npg) = souvec3(0:nrg,0:ntg,0:npg,ia)
00051 call correct_MW_source_C0At(sou,3)
00052 souvec3(0:nrg,0:ntg,0:npg,ia) = sou(0:nrg,0:ntg,0:npg)
00053 end do
00054
00055
00056
00057
00058
00059
00060 itg = ntgeq-2; ipg = 2
00061
00062
00063 open(15,file='test_vec_sou',status='unknown')
00064 do irg = 1, nrg
00065
00066
00067
00068
00069 write(15,'(1p,10e20.12)') hrg(irg), souvec1(irg,itg,ipg,2) &
00070 & , souvec2(irg,itg,ipg,2) &
00071 & , souvec3(irg,itg,ipg,2) &
00072 & , souvec1(irg,itg,ipg,3) &
00073 & , souvec2(irg,itg,ipg,3) &
00074 & , souvec3(irg,itg,ipg,3) &
00075 & , souvec1(irg,itg+1,ipg,3) &
00076 & , souvec2(irg,itg+1,ipg,3) &
00077 & , souvec3(irg,itg+1,ipg,3)
00078 end do
00079 close(15)
00080
00081 souvec(0:nrg,0:ntg,0:npg,1:3) = souvec1(0:nrg,0:ntg,0:npg,1:3) &
00082 & + souvec2(0:nrg,0:ntg,0:npg,1:3) &
00083 & + souvec3(0:nrg,0:ntg,0:npg,1:3)
00084
00085 deallocate(sou)
00086 deallocate(souf)
00087 deallocate(souvecf)
00088 deallocate(souvecf1)
00089 deallocate(souvecf2)
00090 deallocate(souvec1)
00091 deallocate(souvec2)
00092 deallocate(souvec3)
00093
00094 end subroutine source_MWspatial_WL