User: knarf Date: 2010/08/16 12:52 PM
Modified: /trunk/src/ GRHydro_Con2Prim.F90, GRHydro_EOS.c, GRHydro_EoSChangeGamma.F90
Log: some more #defines for EOS_Omni, use handle-function to get EOS_Handle from EOS_Omni
File Changes:
Directory: /trunk/src/ ======================
File [modified]: GRHydro_Con2Prim.F90 Delta lines: +15 -0 =================================================================== --- trunk/src/GRHydro_Con2Prim.F90 2010-07-30 03:20:39 UTC (rev 142) +++ trunk/src/GRHydro_Con2Prim.F90 2010-08-16 17:52:56 UTC (rev 143) @@ -48,10 +48,12 @@ DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS
+#if !USE_EOS_OMNI #ifdef _EOS_BASE_INC_ #undef _EOS_BASE_INC_ #endif #include "EOS_Base.inc" +#endif
integer :: i, j, k, itracer, nx, ny, nz CCTK_REAL :: uxx, uxy, uxz, uyy, uyz, uzz, det, psi4pt, pmin, epsmin @@ -284,10 +286,12 @@ character(len=200) warnline logical epsnegative
+#if !USE_EOS_OMNI #ifdef _EOS_BASE_INC_ #undef _EOS_BASE_INC_ #endif #include "EOS_Base.inc" +#endif
#if USE_EOS_OMNI @@ -565,10 +569,12 @@
CCTK_REAL :: local_min_tracer
+#if !USE_EOS_OMNI #ifdef _EOS_BASE_INC_ #undef _EOS_BASE_INC_ #endif #include "EOS_Base.inc" +#endif
#if USE_EOS_OMNI @@ -920,10 +926,12 @@ enthalpy, denthalpy, sqrtdet, invsqrtdet, invfac, GRHydro_C2P_failed character(len=200) warnline
+#if !USE_EOS_OMNI #ifdef _EOS_BASE_INC_ #undef _EOS_BASE_INC_ #endif #include "EOS_Base.inc" +#endif
#if USE_EOS_OMNI @@ -1157,8 +1165,15 @@
rho = GRHydro_rho_min dens = sqrtdet * rho +#if USE_EOS_OMNI + call EOS_Omni_press(poly_eoskey,keytemp,n,& + rhonew,1.d0,xtemp,xye,press,keyerr,anyerr) + call EOS_Omni_EpsFromPress(poly_eoskey,keytemp,n,& + rhonew,xeps,xtemp,xye,press,epsilon,keyerr,anyerr) +#else press = EOS_Pressure(handle, rhonew, 1.d0) epsilon = EOS_SpecificIntEnergy(handle, rhonew, press) +#endif ! w_lorentz=1, so the expression for tau reduces to: tau = sqrtdet * (rho+rho*epsilon) - dens usx = 0.d0
File [modified]: GRHydro_EOS.c Delta lines: +19 -29 =================================================================== --- trunk/src/GRHydro_EOS.c 2010-07-30 03:20:39 UTC (rev 142) +++ trunk/src/GRHydro_EOS.c 2010-08-16 17:52:56 UTC (rev 143) @@ -15,7 +15,9 @@ #include <stdio.h> #include <stdlib.h>
+#if !USE_EOS_OMNI #include "EOS_Base.h" +#endif
/*@@ @routine GRHydro_EOSHandle @@ -38,34 +40,22 @@ DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
-#ifndef USE_EOS_OMNI - int ierr = 0; - char *infoline; - - *GRHydro_eos_handle = EOS_Handle(GRHydro_eos_table); - - if (*GRHydro_eos_handle < 0) { - ierr = *GRHydro_eos_handle; - CCTK_WARN(0, "Table handle is incorrect"); - } - - *GRHydro_polytrope_handle = EOS_Handle("2D_Polytrope"); - - if (*GRHydro_polytrope_handle < 0) { - ierr = *GRHydro_polytrope_handle; - CCTK_WARN(0, "GRHydro requires the 2D_Polytrope or the 2D_HybridPolytrope EoSs to be registered, for the atmosphere"); - } - - infoline = (char *)malloc(100*sizeof(char)); - if (!infoline) { - CCTK_WARN(0, "Failed to malloc an array of 100 chars in GRHydro_EOS."); - } - else { - sprintf(infoline,"GRHydro will use the %s equation of state.", - GRHydro_eos_table); - CCTK_INFO(infoline); - } - free(infoline); - infoline = NULL; +#ifdef USE_EOS_OMNI + CCTK_INFO("Trying to get EOS handles"); + EOS_Omni_GetHandle("2D_Polytrope"); + CCTK_INFO("Trying to get EOS handles"); + if (!(*GRHydro_eos_handle = EOS_Omni_GetHandle(GRHydro_eos_table))) + CCTK_WARN(0, "Cannot get EOS handle, aborting."); + if (!(*GRHydro_polytrope_handle = EOS_Omni_GetHandle("2D_Polytrope"))) + CCTK_WARN(0, "Cannot get polytrope EOS handle, aborting."); + CCTK_VInfo(CCTK_THORNSTRING, "GRHydro will use the %s equation of state.", + GRHydro_eos_table); +#else + if ((*GRHydro_eos_handle = EOS_Handle(GRHydro_eos_table)) < 0) + CCTK_WARN(0, "Cannot get EOS handle, aborting."); + if ((*GRHydro_polytrope_handle = EOS_Handle("2D_Polytrope")) < 0); + CCTK_WARN(0, "Cannot get polytrope EOS handle, aborting."); + CCTK_VInfo(CCTK_THORNSTRING, "GRHydro will use the %s equation of state.", + GRHydro_eos_table); #endif }
File [modified]: GRHydro_EoSChangeGamma.F90 Delta lines: +8 -0 =================================================================== --- trunk/src/GRHydro_EoSChangeGamma.F90 2010-07-30 03:20:39 UTC (rev 142) +++ trunk/src/GRHydro_EoSChangeGamma.F90 2010-08-16 17:52:56 UTC (rev 143) @@ -54,7 +54,9 @@
CCTK_REAL :: local_gamma
+#if !USE_EOS_OMNI #include "EOS_Base.inc" +#endif
!!$ Set up the fluid constants #if USE_EOS_OMNI @@ -135,7 +137,9 @@
subroutine GRHydro_EoSChangeK(CCTK_ARGUMENTS)
+#if !USE_EOS_OMNI USE EOS_Polytrope_Scalars +#endif
implicit none
@@ -149,7 +153,9 @@
CCTK_REAL, dimension(cctk_lsh(1),cctk_lsh(2),cctk_lsh(3)) :: Q
+#if !USE_EOS_OMNI #include "EOS_Base.inc" +#endif
!!$ Set up the fluid constants #if USE_EOS_OMNI @@ -253,7 +259,9 @@
character(len=100) infoline
+#if !USE_EOS_OMNI #include "EOS_Base.inc" +#endif
!!$ Set up the fluid constants #if USE_EOS_OMNI