00001 subroutine peos_initialize
00002
00003 use phys_constant
00004 use def_peos_parameter
00005 implicit none
00006
00007 real(8) :: rho_0, pre_0, facrho, facpre, fac2, gg, cc, ss
00008 integer :: ii, iphase
00009
00010 open(850,file='peos_parameter.dat',status='old')
00011
00012 read(850,'(8x,1i5,es13.5)') nphase, rhoini_cgs
00013 read(850,'(2es13.5)') rho_0, pre_0
00014 do ii = nphase, 0, -1
00015 read(850,'(2es13.5)') rhocgs(ii), abi(ii)
00016 end do
00017
00018 close(850)
00019
00020
00021
00022
00023
00024
00025
00026 facrho = (g/c**2)**3*solmas**2
00027 facpre = g**3*solmas**2/c**8
00028
00029 do ii = 0, nphase
00030 rhoi(ii) = facrho*rhocgs(ii)
00031 end do
00032
00033 call peos_lookup(rho_0,rhocgs,iphase)
00034
00035 abc(iphase) = pre_0/rho_0**abi(iphase)
00036 abc(iphase) = facpre/facrho**abi(iphase)*abc(iphase)
00037 abccgs(iphase) = pre_0/(rho_0**abi(iphase))
00038
00039 if (iphase.gt.0) then
00040 do ii = iphase-1, 0, -1
00041 abc( ii) = rhoi( ii)**(abi(ii+1)-abi(ii))*abc( ii+1)
00042 abccgs(ii) = rhocgs(ii)**(abi(ii+1)-abi(ii))*abccgs(ii+1)
00043 end do
00044 end if
00045 if (iphase.lt.nphase) then
00046 do ii = iphase+1, nphase
00047 abc( ii) = rhoi( ii-1)**(abi(ii-1)-abi(ii))*abc( ii-1)
00048 abccgs(ii) = rhocgs(ii-1)**(abi(ii-1)-abi(ii))*abccgs(ii-1)
00049 end do
00050 end if
00051
00052 do ii = 0, nphase
00053 qi(ii) = abc(ii)*rhoi(ii)**(abi(ii)-1.0d0)
00054 end do
00055
00056 hi(0) = 1.0d0
00057 do ii = 1, nphase
00058 fac2 = abi(ii)/(abi(ii) - 1.0d0)
00059 hi(ii) = hi(ii-1) + fac2*(qi(ii) - qi(ii-1))
00060 end do
00061
00062 open(860,file='peos_parameter_output.dat',status='unknown')
00063 write(860,'(a1,8x,i5)')'#', nphase
00064 do ii = 0, nphase
00065 write(860,'(i5,10es13.5)') ii, abc(ii), abi(ii), rhoi(ii), &
00066 & qi(ii), hi(ii), abccgs(ii), rhocgs(ii), &
00067 & abccgs(ii)*rhocgs(ii)**abi(ii)
00068 end do
00069 close(860)
00070
00071 rhoini_gcm1 = facrho*rhoini_cgs
00072 call peos_lookup(rhoini_gcm1,rhoi,iphase)
00073 emdini_gcm1 = abc(iphase)*rhoini_gcm1**(abi(iphase)-1.0d0)
00074
00075 end subroutine peos_initialize
00076
00077
00078 subroutine peos_initialize_cactus(dir_path)
00079
00080 use phys_constant
00081 use def_peos_parameter
00082 implicit none
00083 character*400, intent(in) :: dir_path
00084 real(8) :: rho_0, pre_0, facrho, facpre, fac2, gg, cc, ss
00085 integer :: ii, iphase
00086
00087 open(850,file=trim(dir_path)//'/'//'peos_parameter.dat',status='old')
00088 read(850,'(8x,1i5,es13.5)') nphase, rhoini_cgs
00089 read(850,'(2es13.5)') rho_0, pre_0
00090 do ii = nphase, 0, -1
00091 read(850,'(2es13.5)') rhocgs(ii), abi(ii)
00092 end do
00093 close(850)
00094
00095
00096
00097
00098
00099
00100
00101 facrho = (g/c**2)**3*solmas**2
00102 facpre = g**3*solmas**2/c**8
00103
00104 do ii = 0, nphase
00105 rhoi(ii) = facrho*rhocgs(ii)
00106 end do
00107
00108 call peos_lookup(rho_0,rhocgs,iphase)
00109
00110 abc(iphase) = pre_0/rho_0**abi(iphase)
00111 abc(iphase) = facpre/facrho**abi(iphase)*abc(iphase)
00112 abccgs(iphase) = pre_0/(rho_0**abi(iphase))
00113
00114 if (iphase.gt.0) then
00115 do ii = iphase-1, 0, -1
00116 abc( ii) = rhoi( ii)**(abi(ii+1)-abi(ii))*abc( ii+1)
00117 abccgs(ii) = rhocgs(ii)**(abi(ii+1)-abi(ii))*abccgs(ii+1)
00118 end do
00119 end if
00120 if (iphase.lt.nphase) then
00121 do ii = iphase+1, nphase
00122 abc( ii) = rhoi( ii-1)**(abi(ii-1)-abi(ii))*abc( ii-1)
00123 abccgs(ii) = rhocgs(ii-1)**(abi(ii-1)-abi(ii))*abccgs(ii-1)
00124 end do
00125 end if
00126
00127 do ii = 0, nphase
00128 qi(ii) = abc(ii)*rhoi(ii)**(abi(ii)-1.0d0)
00129 end do
00130
00131 hi(0) = 1.0d0
00132 do ii = 1, nphase
00133 fac2 = abi(ii)/(abi(ii) - 1.0d0)
00134 hi(ii) = hi(ii-1) + fac2*(qi(ii) - qi(ii-1))
00135 end do
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 rhoini_gcm1 = facrho*rhoini_cgs
00147 call peos_lookup(rhoini_gcm1,rhoi,iphase)
00148 emdini_gcm1 = abc(iphase)*rhoini_gcm1**(abi(iphase)-1.0d0)
00149
00150 end subroutine peos_initialize_cactus