00001 subroutine teos_initialize
00002
00003 use phys_constant
00004 use def_teos_parameter
00005 implicit none
00006
00007 real(8) :: rho_0, pre_0, facrho, facpre, fac2, gg, cc, ss
00008 real(8) :: ene, pre, hh, rho
00009 integer :: ii, iphase, iofile, idum, i0
00010 real(8), external :: fn_lagint
00011 real(8) :: x4(4), f4(4)
00012
00013
00014
00015
00016
00017
00018
00019 facrho = (g/c**2)**3*solmas**2
00020 facpre = g**3*solmas**2/c**8
00021
00022 open(850,file='teos_parameter.dat',status='old')
00023 nphase=0
00024 do
00025 read(850,*,iostat=iofile) rho_0
00026 if (iofile > 0) then
00027 write(6,*) "Problem reading file teos_parameter.dat...exiting"
00028 stop
00029 else if (iofile < 0) THEN
00030
00031 nphase = nphase - 1
00032 write(6,*) "Total number of lines is =", nphase+1
00033 write(6,*) "Total number of phases is =", nphase
00034 exit
00035 else
00036 nphase = nphase + 1
00037 end if
00038
00039 end do
00040 close(850)
00041
00042 open(850,file='teos_parameter.dat',status='old')
00043 do ii=0,nphase
00044 read(850,*) ene, pre, hh, rho
00045 enei(ii) = ene*facrho
00046 rhoi(ii) = rho*facrho
00047 prei(ii) = pre*facpre
00048 hi(ii) = hh
00049 qi(ii) = prei(ii)/rhoi(ii)
00050
00051
00052
00053 end do
00054 close(850)
00055
00056 open(850,file='peos_parameter.dat',status='old')
00057 read(850,'(8x,1i5,es13.5)') idum, rhoini_cgs
00058 close(850)
00059 write(6,'(a21,e20.12)') "******* rhoini_cgs = ", rhoini_cgs
00060 rhoini_gcm1 = facrho*rhoini_cgs
00061
00062
00063
00064
00065 call teos_lookup(rhoini_gcm1,rhoi,iphase)
00066 i0 = min0(max0(iphase-2,0),nphase-3)
00067 x4(1:4) = rhoi(i0:i0+3)
00068 f4(1:4) = qi(i0:i0+3)
00069 emdini_gcm1 = fn_lagint(x4,f4,rhoini_gcm1)
00070
00071
00072
00073 write(6,'(a26,2e23.15)') "(rhoini_gcm1,emdini_gcm1)=", rhoini_gcm1, emdini_gcm1
00074
00075 end subroutine teos_initialize