From f7ba48cd52e5ba7243700c04f09c99a439dfdf24 Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 12 Jan 2010 20:51:22 +0000 Subject: move development of EOS_Polytrope and EOS_Hybrid from Whisky to Cactus git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEOS/EOS_Polytrope/trunk@2 e0339e42-4067-4b95-aae0-d9cd08a24254 --- src/EOS_Polytrope.F | 153 ++++++++++++++++++++++++++++++++++++++++++++ src/EOS_Polytrope_Scalars.F | 21 ++++++ src/EOS_Polytrope_Startup.F | 91 ++++++++++++++++++++++++++ src/make.code.defn | 11 ++++ src/make.code.deps | 4 ++ 5 files changed, 280 insertions(+) create mode 100644 src/EOS_Polytrope.F create mode 100644 src/EOS_Polytrope_Scalars.F create mode 100644 src/EOS_Polytrope_Startup.F create mode 100644 src/make.code.defn create mode 100644 src/make.code.deps (limited to 'src') diff --git a/src/EOS_Polytrope.F b/src/EOS_Polytrope.F new file mode 100644 index 0000000..feda337 --- /dev/null +++ b/src/EOS_Polytrope.F @@ -0,0 +1,153 @@ + /*@@ + @file EOS_Polytrope.F + @date Wed Mar 20 14:56:35 2002 + @author Ian Hawke + @desc + Routines to calculate a polytropic EOS. This is a faked + 2d version that ALWAYS assumes you want the pressure from + the density. As such the specific internal energy is not set. + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_Parameters.h" + + /*@@ + @routine EOS_Polytrope + @date Mon Aug 26 15:12:39 2002 + @author Ian Hawke + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + CCTK_REAL function EOS_Polytrope_Pressure(rho, eps) + + USE EOS_Polytrope_Scalars + + implicit none + DECLARE_CCTK_PARAMETERS + + CCTK_REAL rho, eps + + EOS_Polytrope_Pressure = p_geom_factor * eos_k_cgs * + . (rho * rho_geom_factor_inv) ** eos_gamma + + end function EOS_Polytrope_Pressure + + /*@@ + @routine EOS_Polytrope + @date Mon Aug 26 15:12:39 2002 + @author Ian Hawke + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + CCTK_REAL function EOS_Polytrope_SpecificIE(rho, press) + + USE EOS_Polytrope_Scalars + + implicit none + DECLARE_CCTK_PARAMETERS + + CCTK_REAL rho, press, EOS_Polytrope_Pressure + + EOS_Polytrope_SpecificIE = EOS_Polytrope_Pressure(rho, press) + . / rho / (eos_gamma - 1.d0) + + end function EOS_Polytrope_SpecificIE + + /*@@ + @routine EOS_Polytrope + @date Mon Aug 26 15:12:39 2002 + @author Ian Hawke + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + CCTK_REAL function EOS_Polytrope_RestMassDens(eps, press) + + USE EOS_Polytrope_Scalars + + implicit none + DECLARE_CCTK_PARAMETERS + + CCTK_REAL eps, press + + EOS_Polytrope_RestMassDens = press / ((eos_gamma - 1.d0) * eps) + + end function EOS_Polytrope_RestMassDens + + /*@@ + @routine EOS_Polytrope + @date Mon Aug 26 15:12:39 2002 + @author Ian Hawke + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + CCTK_REAL function EOS_Polytrope_DPressByDRho(rho, eps) + + USE EOS_Polytrope_Scalars + + implicit none + DECLARE_CCTK_PARAMETERS + + CCTK_REAL rho, eps + + EOS_Polytrope_DPressByDRho = p_geom_factor * eos_k_cgs * + . eos_gamma * rho_geom_factor_inv * + . (rho*rho_geom_factor_inv) ** (eos_gamma - 1.d0) + + end function EOS_Polytrope_DPressByDRho + + /*@@ + @routine EOS_Polytrope + @date Mon Aug 26 15:12:39 2002 + @author Ian Hawke + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + CCTK_REAL function EOS_Polytrope_DPressByDEps(rho, eps) + + USE EOS_Polytrope_Scalars + + implicit none + DECLARE_CCTK_PARAMETERS + + CCTK_REAL rho, eps + + EOS_Polytrope_DPressByDEps = 0.d0 + + end function EOS_Polytrope_DPressByDEps + diff --git a/src/EOS_Polytrope_Scalars.F b/src/EOS_Polytrope_Scalars.F new file mode 100644 index 0000000..7675aae --- /dev/null +++ b/src/EOS_Polytrope_Scalars.F @@ -0,0 +1,21 @@ + /*@@ + @file EOS_Polytrope_Scalars.F + @date Mon Aug 26 12:03:33 2002 + @author Ian Hawke + @desc + Constants for EOS routines + @enddesc + @@*/ + +#include "cctk.h" + + module EOS_Polytrope_Scalars + + implicit none + + CCTK_REAL :: p_geom_factor, rho_geom_factor, + . rho_geom_factor_inv, eos_k_cgs + + CCTK_REAL :: m_solar_geom, m_solar_cgs, c_cgs, G_cgs + + end module EOS_Polytrope_Scalars diff --git a/src/EOS_Polytrope_Startup.F b/src/EOS_Polytrope_Startup.F new file mode 100644 index 0000000..156cc8c --- /dev/null +++ b/src/EOS_Polytrope_Startup.F @@ -0,0 +1,91 @@ + /*@@ + @file EOS_Polytrope_Startup.F + @date Wed Mar 20 14:50:22 2002 + @author Ian Hawke + @desc + Startup for EOS_Polytrope. A 2d routine so that all the standard + functionality is retained. Based on EOS_Ideal_Fluid. + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + + /*@@ + @routine EOS_Polytrope_Startup + @date Wed Mar 20 14:52:41 2002 + @author Ian Hawke + @desc + Startup for EOS_Polytrope + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ + + integer function EOS_Polytrope_Startup() + + USE EOS_Polytrope_Scalars + + implicit none + + DECLARE_CCTK_PARAMETERS + + integer handle, ierr + + external EOS_Polytrope_Pressure + external EOS_Polytrope_SpecificIE + external EOS_Polytrope_RestMassDens + external EOS_Polytrope_DPressByDRho + external EOS_Polytrope_DPressByDEps + + call EOS_RegisterMethod(handle,"2D_Polytrope") + + if (handle .ge. 0) then + + call EOS_RegisterPressure(ierr, handle, EOS_Polytrope_Pressure) + call EOS_RegisterSpecificIntEnergy(ierr, handle, + . EOS_Polytrope_SpecificIE) + call EOS_RegisterRestMassDens(ierr, handle, + . EOS_Polytrope_RestMassDens) + call EOS_RegisterDPressByDRho(ierr, handle, + . EOS_Polytrope_DPressByDRho) + call EOS_RegisterDPressByDEps(ierr, handle, + . EOS_Polytrope_DPressByDEps) + + else + + call CCTK_WARN(0, "Unable to register the EOS method!") + + end if + + EOS_Polytrope_Startup = 0 + +c$$$ These constants match the values in RNSID: consts.h + + m_solar_cgs = 1.987d33 + c_cgs = 2.9979d10 + G_cgs = 6.6732d-8 + m_solar_geom = G_cgs / c_cgs**2 * m_solar_cgs + + if (use_cgs .ne. 0) then + + p_geom_factor = G_cgs / c_cgs**4 * m_solar_geom**2 + rho_geom_factor = p_geom_factor * c_cgs**2 + rho_geom_factor_inv = 1.d0 / rho_geom_factor + + eos_k_cgs = eos_k * rho_geom_factor**gamma_ini / p_geom_factor + + else + + p_geom_factor = 1.d0 + rho_geom_factor = 1.d0 + rho_geom_factor_inv = 1.d0 + eos_k_cgs = eos_k + + end if + + end function EOS_Polytrope_Startup diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..639da45 --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,11 @@ +# Main make.code.defn file for thorn EOS_Polytrope +# $Header$ + +# Source files in this directory +SRCS = EOS_Polytrope_Startup.F \ + EOS_Polytrope.F \ + EOS_Polytrope_Scalars.F + +# Subdirectories containing source files +SUBDIRS = + diff --git a/src/make.code.deps b/src/make.code.deps new file mode 100644 index 0000000..1af95e4 --- /dev/null +++ b/src/make.code.deps @@ -0,0 +1,4 @@ +# Module dependencies for thorn EOS_Polytrope + +EOS_Polytrope.F.o: EOS_Polytrope_Scalars.F.o +EOS_Polytrope_Startup.F.o: EOS_Polytrope_Scalars.F.o -- cgit v1.2.3