00001 SUBROUTINE quark_h2rho(quark_rho2h,quark_rho2h_dot,rho1,rho2,quarkh,rho)
00002 IMPLICIT NONE
00003 interface
00004 function quark_rho2h(rho)
00005 real(8), intent(in) :: rho
00006
00007 real(8) :: quark_rho2h
00008 end function quark_rho2h
00009 function quark_rho2h_dot(rho)
00010 real(8), intent(in) :: rho
00011
00012 real(8) :: quark_rho2h_dot
00013 end function
00014 end interface
00015 real(8), intent(in) :: rho1, rho2, quarkh
00016 real(8), intent(inout) :: rho
00017 real(8) :: quarkh_tmp, rhomax, rhomin
00018 integer :: time
00019
00020
00021
00022
00023 time = 0
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 quarkh_tmp = quark_rho2h(rho)
00043 do
00044
00045 rho = rho + (quarkh-quarkh_tmp)/quark_rho2h_dot(rho)
00046 quarkh_tmp = quark_rho2h(rho)
00047
00048 if (abs(quarkh_tmp-quarkh)/quarkh.lt.1e-10) then
00049
00050
00051 return
00052 end if
00053 time = time +1
00054 if (time.gt.20) then
00055
00056 exit
00057 end if
00058 end do
00059 time = 0
00060 rhomin = rho1
00061 rhomax = rho2
00062 do
00063 rho = 0.5d0*(rhomin+rhomax)
00064 quarkh_tmp = quark_rho2h(rho)
00065 if (abs(quarkh_tmp-quarkh)/quarkh.lt.1e-10) then
00066
00067 return
00068 end if
00069 if (quarkh_tmp.gt.quarkh) then
00070 rhomax = rho
00071 end if
00072 if (quarkh_tmp.lt.quarkh) then
00073 rhomin = rho
00074 end if
00075
00076
00077 end do
00078 end SUBROUTINE quark_h2rho