00001 subroutine adjust_multi_parameter_helm_test_mpt(flag_param,istep_niq)
00002 use phys_constant, only : long
00003 use grid_parameter, only : mass_eps, eps
00004 use interface_minv
00005 use interface_adjust_copy_helm_test_from_mpt
00006 use interface_adjust_copy_helm_test_to_mpt
00007 use interface_adjust_calc_fncval_helm_test_mpt
00008 use interface_error_adjust_parameter
00009 implicit none
00010 integer, parameter :: niq = 1
00011 integer :: flag_param, istep_niq
00012 integer :: ii, i, j, k
00013 integer, save :: count_adj
00014 real(long) :: fac0, error_param
00015 real(long), save :: msec_x_oold(niq), msec_x_old(niq)
00016 real(long), save :: msec_f_oold(niq), msec_f_old(niq)
00017 real(long), save :: msec_dx(niq), msec_x_der(niq), msec_f_der(niq)
00018 real(long), save :: msec_ff(niq,niq)
00019 real(long) :: jacobian_at_x_old(niq+1,niq+1), rhs_at_x_old(niq)
00020 real(long) :: jacobian
00021
00022 real(long) :: facp(5) = (/ 2.0d-1, 5.0d-1, 1.0d-0, 1.0d-0, 1.0d-0 /)
00023
00024 if (istep_niq.eq.-1) then
00025 call adjust_copy_helm_test_from_mpt(niq,msec_x_oold)
00026 call adjust_calc_fncval_helm_test_mpt(niq,msec_f_oold)
00027 msec_x_old(1:niq) = msec_x_oold(1:niq) + 0.05*msec_x_oold(1:niq)
00028 call adjust_copy_helm_test_to_mpt(niq,msec_x_old)
00029 istep_niq = istep_niq + 1
00030 flag_param = 1
00031 count_adj = 0
00032 return
00033 end if
00034
00035 i = 1
00036 call adjust_calc_fncval_helm_test_mpt(niq,msec_f_old)
00037 msec_dx(i) = msec_x_old(i) - msec_x_oold(i)
00038 jacobian =(msec_f_old(i) - msec_f_oold(i))/msec_dx(i)
00039 rhs_at_x_old(1:niq) = msec_x_old(1:niq) - msec_f_old(1:niq)/jacobian
00040
00041 write(6,'(1a20,1p,2e12.4)')' -- OLD -> NEW -- ', &
00042 & msec_x_oold(i), msec_x_old(i)
00043 write(6,'(1a20,1p,2e12.4)')' -- OLD -> NEW -- ', &
00044 & msec_f_oold(i), msec_f_old(i)
00045
00046
00047 count_adj = count_adj + 1
00048 ii = min0(5,count_adj)
00049 fac0 = facp(ii)
00050 msec_x_der(1:niq) = msec_x_oold(1:niq)
00051 msec_x_oold(1:niq) = msec_x_old(1:niq)
00052 msec_f_oold(1:niq) = msec_f_old(1:niq)
00053 msec_x_old( 1:niq) = fac0*rhs_at_x_old(1:niq)+(1.0d0-fac0)*msec_x_old(1:niq)
00054 call adjust_copy_helm_test_to_mpt(niq,msec_x_old)
00055 istep_niq = 0
00056
00057 call error_adjust_parameter(niq,msec_x_old,msec_x_der, &
00058 & error_param,flag_param)
00059
00060 write(6,'(1a30,2(7x,i5))') ' -- parameter iteration # -- ',count_adj
00061 do ii = 1, niq
00062 write(6,'(1a20,1p,2e12.4)')' -- OLD -> NEW -- ', &
00063 & msec_x_oold(ii), msec_x_old(ii)
00064 end do
00065
00066
00067
00068
00069 end subroutine adjust_multi_parameter_helm_test_mpt