00001 subroutine iteration_poisson_bbh_2pot_test(iter_count)
00002 use phys_constant, only : long, nnrg, nntg, nnpg
00003 use grid_parameter
00004 use coordinate_grav_r
00005 use coordinate_grav_phi
00006 use coordinate_grav_theta
00007 use weight_midpoint_grav
00008 use def_metric, only : psi, alph, bvxd, bvyd
00009 use make_array_2d
00010 use make_array_3d
00011 use interface_poisson_solver
00012 use interface_update_grfield
00013 use interface_error_metric_type0
00014 use interface_error_metric_type1
00015 use interface_interpo_fl2gr
00016 use interface_sourceterm_poisson_solver_test
00017 use interface_sourceterm_exsurf_eqm_binary
00018 use interface_sourceterm_surface_int
00019 use interface_sourceterm_volume_int_bbh_2pot_test
00020 use interface_poisson_solver_binary_bhex_homosol
00021
00022
00023 use interface_bh_boundary_nh_psi_test
00024 use interface_bh_boundary_nh_alph_test
00025 use interface_bh_boundary_dh_psi_test
00026 use interface_bh_boundary_dh_alph_test
00027
00028 implicit none
00029 real(long), pointer :: sou(:,:,:)
00030 real(long), pointer :: pot(:,:,:), psi_bak(:,:,:), alph_bak(:,:,:)
00031 real(long), pointer :: sou_exsurf(:,:), dsou_exsurf(:,:)
00032 real(long), pointer :: sou_bhsurf(:,:), dsou_bhsurf(:,:)
00033 real(long), pointer :: sou_outsurf(:,:), dsou_outsurf(:,:)
00034 real(long) :: error_psi, count, error_alph
00035 integer :: iter_count, flag_psi = 0, flag_alph = 0, irg
00036 integer :: ire_psi=0, ite_psi=0, ipe_psi=0, ire_alph=0, ite_alph=0, ipe_alph=0
00037
00038 call alloc_array3d(sou,0,nrg,0,ntg,0,npg)
00039 call alloc_array3d(pot,0,nrg,0,ntg,0,npg)
00040 call alloc_array3d(psi_bak,0,nrg,0,ntg,0,npg)
00041 call alloc_array3d(alph_bak,0,nrg,0,ntg,0,npg)
00042 call alloc_array2d(sou_exsurf,0,ntg,0,npg)
00043 call alloc_array2d(dsou_exsurf,0,ntg,0,npg)
00044 call alloc_array2d(sou_bhsurf,0,ntg,0,npg)
00045 call alloc_array2d(dsou_bhsurf,0,ntg,0,npg)
00046 call alloc_array2d(sou_outsurf,0,ntg,0,npg)
00047 call alloc_array2d(dsou_outsurf,0,ntg,0,npg)
00048
00049 iter_count = 0
00050 do
00051 iter_count = iter_count + 1
00052 count = dble(iter_count)
00053 conv_gra = dmin1(conv0_gra,conv_ini*count)
00054
00055 conv_den = dmin1(conv0_den,conv_ini*count)
00056
00057 call calc_vector_x_grav(1)
00058
00059 call calc_vector_phi_grav(1)
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 psi = bvxd
00087
00088
00089
00090 sou(0:nrg,0:ntg,0:npg) = 0.0d0
00091 call reset_bh_boundary('n')
00092 call sourceterm_volume_int_bbh_2pot_test(sou)
00093 call sourceterm_exsurf_eqm_binary(alph,sou_exsurf,dsou_exsurf)
00094 call sourceterm_surface_int(alph,0,sou_bhsurf,dsou_bhsurf)
00095 call sourceterm_surface_int(alph,nrg,sou_outsurf,dsou_outsurf)
00096
00097
00098
00099
00100
00101
00102
00103
00104 call bh_boundary_nh_alph_test(dsou_bhsurf)
00105 call poisson_solver_binary_bhex_homosol('nh', sou,sou_exsurf,dsou_exsurf, &
00106 & sou_bhsurf,dsou_bhsurf, &
00107 & sou_outsurf,dsou_outsurf,pot)
00108 alph_bak = alph
00109 call update_grfield(pot,alph,conv_gra)
00110
00111 call error_metric_type1(alph,alph_bak,error_alph,ire_alph,ite_alph,ipe_alph,flag_alph,'bh')
00112
00113 call reset_bh_boundary('n')
00114
00115 call printout_error_all_metric(iter_count,error_psi,ire_psi,ite_psi,ipe_psi, &
00116 & error_alph,ire_alph,ite_alph,ipe_alph )
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 if ((flag_psi==0).and.(flag_alph==0)) exit
00127 if (iter_count >= iter_max) exit
00128 if (iter_count >= 10 .and. error_psi > 1.5d0) exit
00129 if (iter_count >= 10 .and. error_alph > 1.5d0) exit
00130 flag_psi = 0
00131 flag_alph = 0
00132 end do
00133
00134 deallocate(sou)
00135 deallocate(pot)
00136 deallocate(psi_bak)
00137 deallocate(alph_bak)
00138 deallocate(sou_exsurf)
00139 deallocate(dsou_exsurf)
00140 deallocate(sou_bhsurf)
00141 deallocate(dsou_bhsurf)
00142 deallocate(sou_outsurf)
00143 deallocate(dsou_outsurf)
00144 end subroutine iteration_poisson_bbh_2pot_test