00001 subroutine calc_surface_qeos(rsnew,rhof) 00002 use phys_constant, only : long 00003 use grid_parameter, only : nrf, ntf, npf 00004 use coordinate_grav_r, only : drg, rg 00005 use def_matter, only : rs 00006 use def_matter_parameter, only : rhos_qs 00007 ! use def_matter_parameter, only : emdc 00008 implicit none 00009 real(long), pointer :: rhof(:,:,:) 00010 real(long), pointer :: rsnew(:,:) 00011 real(long) :: delta 00012 ! real(8), external :: quark_rho2p 00013 ! real(long) :: rhotmp1, rhotmp2, emdtmp1, emdtmp2 00014 integer :: itf, ipf 00015 !quad real(long) :: sgg(1:4), gg(1:4,1:4) 00016 !quad real(long) :: r1,r2,r3,q1,q2,q3, aa,bb,cc,det,rs1,rs2,rs2a,rs2b 00017 ! 00018 do ipf = 0, npf 00019 do itf = 0, ntf 00020 ! if (rhos_qs.ne.0.0d0) then 00021 delta = drg(nrf)*(rhos_qs - rhof(nrf ,itf,ipf)) & 00022 & /(rhof(nrf,itf,ipf) - rhof(nrf-1,itf,ipf)) 00023 !robust delta = (drg(nrf)+drg(nrf-1)) & 00024 !robust & *(rhos_qs - rhof(nrf ,itf,ipf)) & 00025 !robust & /(rhof(nrf,itf,ipf) - rhof(nrf-2,itf,ipf)) 00026 00027 rsnew(itf,ipf) = rs(itf,ipf)*(1.0d0 + delta) 00028 ! end if 00029 ! if (rhos_qs.eq.0.0d0) then 00030 ! rhotmp1 = rhof(nrf,itf,ipf) 00031 ! emdtmp1 = rhotmp1 00032 ! if (rhotmp1.gt.0.0d0) emdtmp1 = quark_rho2p(rhotmp1)/rhotmp1 00033 ! rhotmp2 = rhof(nrf-1,itf,ipf) 00034 ! emdtmp2 = rhotmp2 00035 ! if (rhotmp2.gt.0.0d0) emdtmp2 = quark_rho2p(rhotmp2)/rhotmp2 00036 ! delta = drg(nrf)*(0.0d0 - emdtmp1) & 00037 ! & /(emdtmp1 - emdtmp2) 00038 ! rsnew(itf,ipf) = rs(itf,ipf)*(1.0d0 + delta) 00039 ! end if 00040 00041 !------------------------------------------------------- 00042 ! These commented lines are left here in case any one wants to 00043 !use this _qeos codes to build neutron stars. Otherwise they are 00044 !not needed any more. See the message in ../EOS/Subroutine/quark_h2rho.f90 00045 ! Enping Zhou July 2016 00046 !------------------------------------------------------- 00047 ! 00048 ! =============== 3 point interpolation ============================ 00049 !quad q1 = rhof(nrf ,itf,ipf)- rhos_qs; r1 = rs(itf,ipf)*rg(nrf ) 00050 !quad q2 = rhof(nrf-1,itf,ipf)- rhos_qs; r2 = rs(itf,ipf)*rg(nrf-1) 00051 !quad q3 = rhof(nrf-2,itf,ipf)- rhos_qs; r3 = rs(itf,ipf)*rg(nrf-2) 00052 !quad 00053 !quad sgg(1) = q1 00054 !quad sgg(2) = q2 00055 !quad sgg(3) = q3 00056 !quad 00057 !quad gg(1,1) = r1*r1 00058 !quad gg(1,2) = r1 00059 !quad gg(1,3) = 1.0d0 00060 !quad 00061 !quad gg(2,1) = r2*r2 00062 !quad gg(2,2) = r2 00063 !quad gg(2,3) = 1.0d0 00064 !quad 00065 !quad gg(3,1) = r3*r3 00066 !quad gg(3,2) = r3 00067 !quad gg(3,3) = 1.0d0 00068 !quad 00069 !quad call minv(gg,sgg,3,4) 00070 !quad aa = sgg(1) 00071 !quad bb = sgg(2) 00072 !quad cc = sgg(3) 00073 !quad det = bb*bb-4.0d0*aa*cc 00074 !quad 00075 !quad rs1 = rs(itf,ipf)*(1.0d0 + delta) 00076 !quad 00077 !quad rs2 = 0.0d0 00078 !quad !rs2a = (-bb+sqrt(det))/2.0d0/aa 00079 !quad!uryu if( det >= 0 ) then 00080 !quad if( det >= 0 .and. aa > 0 ) then 00081 !quad rs2 = (-bb-sqrt(det))/2.0d0/aa ! Correct solution 00082 !quad!uryu if ((itf==(ntf/2).or.itf==(ntf/4)).and.ipf<=2) & 00083 !quad!uryu write(6,'(2i4,1p,10e15.5)') & 00084 !quad!uryu itf,ipf,rs1,rs2,r1,r2,r3,aa,bb,cc,det 00085 !quad else 00086 !quad!uryu rs2 = -bb/2.0d0/aa ! Approximate solution. Connect to minimum. 00087 !quad rs2 = rsnew(itf,ipf) 00088 !quad!uryu if ((itf==(ntf/2).or.itf==(ntf/4)).and.ipf<=2) & 00089 !quad!uryu write(6,'(2i4,1p,e15.5,1p,10e15.5)') & 00090 !quad!uryu itf,ipf, rs1, rs2, r1,r2,r3, aa,bb,cc,det 00091 !quad end if 00092 !quad rsnew(itf,ipf) = rs2 00093 ! ================================================================== 00094 00095 end do 00096 end do 00097 rsnew(0,1:npf) = rsnew(0,0) 00098 end subroutine calc_surface_qeos