[Commits] [svn:einsteintoolkit] EOS_Omni/trunk/ (Rev. 57)

cott at tapir.caltech.edu cott at tapir.caltech.edu
Wed Mar 7 18:19:43 CST 2012


User: cott
Date: 2012/03/07 06:19 PM

Modified:
 /trunk/
  interface.ccl
 /trunk/src/
  EOS_Omni_MultiVarCalls.F90

Log:
 * add aliased routine to compute deps/drho|p and deps/dp|rho

File Changes:

Directory: /trunk/src/
======================

File [modified]: EOS_Omni_MultiVarCalls.F90
Delta lines: +101 -0
===================================================================
--- trunk/src/EOS_Omni_MultiVarCalls.F90	2012-02-06 02:50:28 UTC (rev 56)
+++ trunk/src/EOS_Omni_MultiVarCalls.F90	2012-03-08 00:19:42 UTC (rev 57)
@@ -202,3 +202,104 @@
    end select
 
  end subroutine EOS_Omni_EOS_dpderho_dpdrhoe
+
+
+ subroutine EOS_Omni_EOS_DEpsByDRho_DEpsByDPress(eoskey,keytemp,rf_precision,npoints,&
+     rho,eps,temp,ye,depsdrho,depsdpress,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rf_precision
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: depsdrho(npoints)
+  CCTK_REAL, intent(out)   :: depsdpress(npoints)
+
+  ! local vars
+  integer          :: i
+  character(256)   :: warnstring
+  real*8           :: hybrid_local_gamma
+  real*8           :: hybrid_local_k_cgs
+  real*8           :: hybrid_dp_poly,hybrid_dp_th1,hybrid_dp_th2
+  ! temporary vars for nuc_eos
+  real*8           :: xrho,xye,xtemp,xenr,xent
+  real*8           :: xprs,xmunu,xcs2
+  real*8           :: xdedt,xdpderho,xdpdrhoe
+
+
+  anyerr    = 0
+  keyerr(:) = 0
+
+  select case (eoskey)
+  case (1)
+     ! polytropic EOS                                                                                      
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * poly_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(poly_gamma) / &
+                   (poly_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           depsdpress(i) = 1.0d0/(poly_gamma - 1.0d0)/rho(i)
+           depsdrho(i) = depsdpress(i) * press_gf * poly_k_cgs *  &
+                poly_gamma * inv_rho_gf *        &
+                (rho(i)*inv_rho_gf) ** (poly_gamma - 1.d0)
+        enddo
+  case (2)
+     ! gamma-law EOS                                                                                       
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * gl_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(gl_gamma) / &
+                   (gl_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           depsdpress(i) = 1.0/( (gl_gamma - 1.0d0) * &
+                rho(i))
+           depsdrho(i) = -eps(i)/rho(i)
+       enddo
+  case (3)
+     ! hybrid EOS                                                                                          
+        do i=1,npoints
+           if(rho(i).gt.hybrid_rho_nuc) then
+              hybrid_local_gamma = hybrid_gamma2
+              hybrid_local_k_cgs = hybrid_k2_cgs
+           else
+              hybrid_local_gamma = hybrid_gamma1
+              hybrid_local_k_cgs = hybrid_k1_cgs
+           endif
+           hybrid_dp_poly = hybrid_local_gamma * press_gf *                 &
+                hybrid_local_k_cgs * rho(i)**(hybrid_local_gamma - 1.0d0) * &
+                inv_rho_gf**hybrid_local_gamma
+
+           hybrid_dp_th1 = - hybrid_local_gamma * press_gf * hybrid_local_k_cgs * &
+                (hybrid_gamma_th - 1.d0) / (hybrid_local_gamma - 1.d0) *      &
+                rho(i)**(hybrid_local_gamma - 1.d0) * inv_rho_gf**hybrid_local_gamma
+
+           hybrid_dp_th2  = (hybrid_gamma_th - 1.d0) * eps(i)                        &
+                - (hybrid_gamma_th - 1.d0) * (hybrid_local_gamma - hybrid_gamma1) /  &
+                (hybrid_gamma1 - 1.d0) / (hybrid_gamma2 - 1.d0) *                    &
+                press_gf * hybrid_k1_cgs * inv_rho_gf**hybrid_gamma1 *               &
+                hybrid_rho_nuc**(hybrid_gamma1 - 1.d0)
+
+           xdpdrhoe = hybrid_dp_poly + hybrid_dp_th1 + hybrid_dp_th2
+           xdpderho = (hybrid_gamma_th - 1.0d0) * rho(i)
+           depsdpress(i) = 1.0 / xdpderho
+           depsdrho(i) = - xdpdrhoe * depsdpress(i)
+        enddo
+    case (4)
+      write(warnstring,*) "depsdrho and depsdpress not implemented yet for hot nuclear EOS"
+      call CCTK_WARN(0,warnstring)
+   case DEFAULT
+      write(warnstring,*) "eoskey ",eoskey," not implemented!"
+      call CCTK_WARN(0,warnstring)
+   end select
+
+ end subroutine EOS_Omni_EOS_DEpsByDRho_DEpsByDPress

Directory: /trunk/
==================

File [modified]: interface.ccl
Delta lines: +15 -0
===================================================================
--- trunk/interface.ccl	2012-02-06 02:50:28 UTC (rev 56)
+++ trunk/interface.ccl	2012-03-08 00:19:42 UTC (rev 57)
@@ -138,8 +138,23 @@
 
 PROVIDES FUNCTION EOS_Omni_short WITH EOS_Omni_EOS_short LANGUAGE Fortran
 
+################################################################################
+# the following routines are needed for MHD con2prim using the 2D Z-P scheme
 
+void FUNCTION EOS_Omni_DEpsByDRho_DEpsByDPress(CCTK_INT IN eoskey,         \
+			     CCTK_INT IN havetemp,              \
+			     CCTK_REAL IN rf_precision,         \
+                             CCTK_INT IN npoints,               \
+			     CCTK_REAL IN ARRAY rho,     	\
+			     CCTK_REAL INOUT ARRAY eps,  	\
+			     CCTK_REAL INOUT ARRAY temp, 	\
+			     CCTK_REAL IN ARRAY ye,      	\
+			     CCTK_REAL OUT ARRAY DEpsByDRho,    \
+			     CCTK_REAL OUT ARRAY DEpsByDPress,  \
+			     CCTK_INT OUT ARRAY keyerr,   	\
+                             CCTK_INT OUT anyerr)
 
+PROVIDES FUNCTION EOS_Omni_DEpsByDRho_DEpsByDPress WITH EOS_Omni_EOS_DEpsByDRho_DEpsByDPress LANGUAGE Fortran
 ################################################################################
 # the following routines are needed for MHD con2prim based on the Harm Code
 



More information about the Commits mailing list