00001 subroutine calc_omega_drot_bisection(vphiy,alphw,psiw,bvydw,hyydw,omega)
00002 use phys_constant, only : long
00003 use coordinate_grav_r, only : rg
00004 use def_matter_parameter
00005
00006 implicit none
00007 real(long), intent(in):: vphiy, alphw, psiw, bvydw, hyydw
00008 real(long), intent(inout):: omega
00009
00010
00011
00012 real(long) :: Jome, omega0, omega1, omegam
00013 real(long) :: sgg0, sgg1, sggm, sgg0m, sgg1m
00014 real(long) :: p4a2, ovyu, ov2, ovphi, term1, term2, term3
00015 real(long) :: ddomega
00016 real(long) :: error, small, smallome = 1.0d-30
00017 integer :: i, numero
00018
00019
00020
00021 if (ome.eq.0.0d0) ome = 0.01d0
00022 small = ome*0.001
00023 p4a2 = psiw**4/alphw**2
00024 numero = 1
00025
00026 if (vphiy.lt.0.001d0*rg(1)) then
00027 omega = ome
00028 else
00029 omega0 = smallome
00030 omega1 = ome
00031 do
00032 omegam = (omega0 + omega1)*0.5d0
00033 do i = 0, 2
00034 if (i.eq.0) omega = omega0
00035 if (i.eq.1) omega = omega1
00036 if (i.eq.2) omega = omegam
00037
00038 Jome = A2DR*omega*((ome/omega)**index_DR - 1.0d0)
00039 ovyu = bvydw + omega*vphiy
00040
00041
00042 ov2 = ovyu**2*(1.0d0 + hyydw)
00043 ovphi = ovyu*vphiy*(1.0d0 + hyydw)
00044 term1 = 1.0d0 - p4a2*ov2
00045 term2 = p4a2*ovphi
00046
00047 if (i.eq.0) sgg0 = Jome*term1 - term2
00048 if (i.eq.1) sgg1 = Jome*term1 - term2
00049 if (i.eq.2) sggm = Jome*term1 - term2
00050 end do
00051 sgg0m = sgg0*sggm
00052 sgg1m = sgg1*sggm
00053
00054 ddomega = omega1 - omega0
00055 omega = omegam
00056 if (sggm.eq.0.0d0) then
00057 ddomega = 0.0d0
00058 else if (sgg0m.gt.0.0d0.and.sgg1m.lt.0.0d0) then
00059 omega0 = omegam
00060 else if (sgg0m.lt.0.0d0.and.sgg1m.gt.0.0d0) then
00061 omega1 = omegam
00062 else
00063 write(6,*) omega0, omegam, omega1
00064 write(6,*) sgg0, sggm, sgg1
00065 stop 'rotation law'
00066 end if
00067
00068 if (omega.gt.ome) omega = ome
00069 if (omega.le.0.0d0) omega = small
00070
00071 error = dabs(ddomega/omega)
00072 numero = numero + 1
00073 if (numero>1000) then
00074 write(6,*) omega0, omegam, omega1
00075 write(6,*) vphiy, ome, ddomega
00076 write(6,*) ome, p4a2, bvydw
00077 write(6,*) Jome, ovyu, omega
00078 write(6,*)' numero = ', numero, ' error =',error
00079 end if
00080
00081 if (numero>1010) stop 'rotation law'
00082 if (dabs(error)<1.0d-14) exit
00083
00084
00085
00086
00087
00088 end do
00089 end if
00090
00091
00092 end subroutine calc_omega_drot_bisection