diff options
Diffstat (limited to 'src/EOS_Omni_SingleVarCalls.F90')
-rw-r--r-- | src/EOS_Omni_SingleVarCalls.F90 | 70 |
1 files changed, 53 insertions, 17 deletions
diff --git a/src/EOS_Omni_SingleVarCalls.F90 b/src/EOS_Omni_SingleVarCalls.F90 index 72abe97..7f1f825 100644 --- a/src/EOS_Omni_SingleVarCalls.F90 +++ b/src/EOS_Omni_SingleVarCalls.F90 @@ -509,38 +509,43 @@ subroutine EOS_Omni_EOS_eps_from_press(eoskey,keytemp,rf_precision,npoints,& end subroutine EOS_Omni_EOS_eps_from_press -subroutine EOS_Omni_EOS_RestMassDensityFromEpsPress(eoskey,keytemp,rf_precision,& - npoints,rho,eps,temp,ye,press,keyerr,anyerr) +subroutine EOS_Omni_EOS_RhoFromPressEpsTempEnt(eoskey,& + ikeytemp,rf_precision,& + npoints,rho,eps,temp,entropy,ye,press,keyerr,anyerr) use EOS_Omni_Module implicit none DECLARE_CCTK_PARAMETERS - CCTK_INT, intent(in) :: eoskey,keytemp,npoints + CCTK_INT, intent(in) :: eoskey,ikeytemp,npoints CCTK_INT, intent(out) :: keyerr(npoints) CCTK_INT, intent(out) :: anyerr CCTK_REAL, intent(in) :: rf_precision - CCTK_REAL, intent(in) :: ye(npoints),press(npoints),eps(npoints) - CCTK_REAL, intent(inout) :: rho(npoints),temp(npoints) + CCTK_REAL, intent(in) :: ye(npoints),press(npoints) + CCTK_REAL, intent(inout) :: rho(npoints),temp(npoints),eps(npoints) + CCTK_REAL, intent(inout) :: entropy(npoints) ! local vars integer :: i character(256) :: warnstring + integer :: keytemp + ! temporary vars for nuc_eos + real*8 :: xrho,xye,xtemp,xenr,xent + real*8 :: xprs,xmunu,xcs2 + real*8 :: xdedt,xdpderho,xdpdrhoe + + keytemp = ikeytemp - if(keytemp.eq.1) then - anyerr = 1 - keyerr(:) = -1 - else - anyerr = 0 - keyerr(:) = 0 - endif + anyerr = 0 + keyerr(:) = 0 select case (eoskey) case (1) ! polytropic EOS do i=1,npoints - rho(i) = press(i) / ((poly_gamma - 1.0d0)*eps(i)) + rho(i) = (press(i) / poly_k)**(1.0/poly_gamma) + eps(i) = press(i) / (poly_gamma - 1.0d0) / rho(i) enddo case (2) ! gamma-law EOS @@ -549,15 +554,46 @@ subroutine EOS_Omni_EOS_RestMassDensityFromEpsPress(eoskey,keytemp,rf_precision, enddo case (3) ! hybrid EOS - write(warnstring,*) "EOS_Omni_RestMassDensityFromEpsPress not supported for hybrid EOS" + write(warnstring,*) "EOS_Omni_RestMassDensityFromPressEpsTemp not supported for hybrid EOS" call CCTK_WARN(0,warnstring) case (4) ! nuc EOS - write(warnstring,*) "EOS_Omni_RestMassDensityFromEpsPress call not supported for nuc_eos yet" - call CCTK_WARN(0,warnstring) + if(ikeytemp.eq.2) then + call CCTK_WARN(0,"This function does not work yet when coming in with entropy") + else if(ikeytemp.eq.1) then + keytemp = 3 + else + call CCTK_WARN(0,"This function does not work yet when coming in with this keytemp") + endif + + do i=1,npoints + ! initial guess + xprs = press(i) * inv_press_gf + xrho = rho(i) * inv_rho_gf + xtemp = temp(i) + xent = entropy(i) + xye = ye(i) + xenr = eps(i) * inv_eps_gf + call nuc_eos_short(xrho,xtemp,xye,xenr,xprs,& + xent,xcs2,xdedt,xdpderho,xdpdrhoe,xmunu,& + keytemp,keyerr(i),rf_precision) + + if(keyerr(i).ne.0) then + anyerr = 1 + endif + + if(keytemp.eq.3) then + eps(i) = xenr * eps_gf + rho(i) = xrho * rho_gf + entropy(i) = xent + else + call CCTK_WARN(0, "This keytemp is not implemented yet") + endif + + enddo case DEFAULT write(warnstring,*) "eoskey ",eoskey," not implemented!" call CCTK_WARN(0,warnstring) end select -end subroutine EOS_Omni_EOS_RestMassDensityFromEpsPress +end subroutine EOS_Omni_EOS_RhoFromPressEpsTempEnt |