00001 subroutine peos_initialize_mpt(impt)
00002
00003 use phys_constant
00004 use def_peos_parameter
00005 implicit none
00006 integer,intent(in) :: impt
00007 character(len=1) :: np(2) = (/'1', '2'/)
00008
00009 real(8) :: rho_0, pre_0, facrho, facpre, fac2, gg, cc, ss
00010 integer :: ii, iphase
00011
00012 open(850,file='peos_parameter_mpt'//np(impt)//'.dat',status='old')
00013 read(850,'(8x,1i5,es13.5)') nphase, rhoini_cgs
00014 read(850,'(2es13.5)') rho_0, pre_0
00015 do ii = nphase, 0, -1
00016 read(850,'(2es13.5)') rhocgs(ii), abi(ii)
00017 end do
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_mpt'//np(impt)//'.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_mpt
00076
00077
00078 subroutine peos_initialize_mpt_cactus(impt, dir_path)
00079
00080 use phys_constant
00081 use def_peos_parameter
00082 implicit none
00083 integer,intent(in) :: impt
00084 character*400, intent(in) :: dir_path
00085 character(len=1) :: np(2) = (/'1', '2'/)
00086
00087 real(8) :: rho_0, pre_0, facrho, facpre, fac2, gg, cc, ss
00088 integer :: ii, iphase
00089
00090 open(850,file=trim(dir_path)//'/'//'peos_parameter_mpt'//np(impt)//'.dat',status='old')
00091 read(850,'(8x,1i5,es13.5)') nphase, rhoini_cgs
00092 read(850,'(2es13.5)') rho_0, pre_0
00093 do ii = nphase, 0, -1
00094 read(850,'(2es13.5)') rhocgs(ii), abi(ii)
00095 end do
00096 close(850)
00097
00098
00099
00100
00101
00102
00103
00104 facrho = (g/c**2)**3*solmas**2
00105 facpre = g**3*solmas**2/c**8
00106
00107 do ii = 0, nphase
00108 rhoi(ii) = facrho*rhocgs(ii)
00109 end do
00110
00111 call peos_lookup(rho_0,rhocgs,iphase)
00112
00113 abc(iphase) = pre_0/rho_0**abi(iphase)
00114 abc(iphase) = facpre/facrho**abi(iphase)*abc(iphase)
00115 abccgs(iphase) = pre_0/(rho_0**abi(iphase))
00116
00117 if (iphase.gt.0) then
00118 do ii = iphase-1, 0, -1
00119 abc( ii) = rhoi( ii)**(abi(ii+1)-abi(ii))*abc( ii+1)
00120 abccgs(ii) = rhocgs(ii)**(abi(ii+1)-abi(ii))*abccgs(ii+1)
00121 end do
00122 end if
00123 if (iphase.lt.nphase) then
00124 do ii = iphase+1, nphase
00125 abc( ii) = rhoi( ii-1)**(abi(ii-1)-abi(ii))*abc( ii-1)
00126 abccgs(ii) = rhocgs(ii-1)**(abi(ii-1)-abi(ii))*abccgs(ii-1)
00127 end do
00128 end if
00129
00130 do ii = 0, nphase
00131 qi(ii) = abc(ii)*rhoi(ii)**(abi(ii)-1.0d0)
00132 end do
00133
00134 hi(0) = 1.0d0
00135 do ii = 1, nphase
00136 fac2 = abi(ii)/(abi(ii) - 1.0d0)
00137 hi(ii) = hi(ii-1) + fac2*(qi(ii) - qi(ii-1))
00138 end do
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 rhoini_gcm1 = facrho*rhoini_cgs
00150 call peos_lookup(rhoini_gcm1,rhoi,iphase)
00151 emdini_gcm1 = abc(iphase)*rhoini_gcm1**(abi(iphase)-1.0d0)
00152
00153 end subroutine peos_initialize_mpt_cactus