aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@e0339e42-4067-4b95-aae0-d9cd08a24254>2010-01-12 20:51:22 +0000
committerknarf <knarf@e0339e42-4067-4b95-aae0-d9cd08a24254>2010-01-12 20:51:22 +0000
commitf7ba48cd52e5ba7243700c04f09c99a439dfdf24 (patch)
tree8c6744c4ed0876197f633fc1f5870b0d817385ec
parent886431f9a8e9e0d8da17692161377649aaf0b028 (diff)
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
-rw-r--r--README13
-rw-r--r--configuration.ccl11
-rw-r--r--doc/documentation.tex54
-rw-r--r--interface.ccl13
-rw-r--r--param.ccl23
-rw-r--r--schedule.ccl9
-rw-r--r--src/EOS_Polytrope.F153
-rw-r--r--src/EOS_Polytrope_Scalars.F21
-rw-r--r--src/EOS_Polytrope_Startup.F91
-rw-r--r--src/make.code.defn11
-rw-r--r--src/make.code.deps4
11 files changed, 403 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..85f4345
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+Cactus Code Thorn EOS_Polytrope
+Author(s) : Ian Hawke
+ Frank Löffler
+Maintainer(s): Cactus team
+Licence : LGPL
+--------------------------------------------------------------------------
+
+1. Purpose
+
+This is a "faked" polytropic equation of state. It is designed to work
+through the CactusEOS interface.
+The EoS reads Pressure = eos_k * rho ** (eos_gamma). The specific internal
+energy is given by the assumption of a perfect fluid.
diff --git a/configuration.ccl b/configuration.ccl
new file mode 100644
index 0000000..f2231bd
--- /dev/null
+++ b/configuration.ccl
@@ -0,0 +1,11 @@
+# Configuration definition for thorn EOS_Polytrope
+# $Header$
+
+PROVIDES EOS_Polytrope
+{
+ SCRIPT
+ LANG
+}
+
+REQUIRES EOS_Base
+
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100644
index 0000000..b8748ce
--- /dev/null
+++ b/doc/documentation.tex
@@ -0,0 +1,54 @@
+\documentclass{article}
+
+\begin{document}
+
+\title{EOS\_Polytrope}
+\author{Ian Hawke}
+\date{22/4/2002}
+\maketitle
+
+\abstract{EOS\_Polytrope}
+
+\section{The equations}
+\label{sec:eqn}
+
+This equation provides a polytropic equation of state to thorns using
+the CactusEOS interface found in EOS\_Base. As such it's a fake, as
+EOS\_Base assumes that, e.g., the pressure is a function of both
+density and specific internal energy. Here the pressure is just a
+function of the density, and is set appropriately (the specific
+internal energy is always ignored).
+
+The two fluid constants are $K$ ({\tt eos\_k}) and $\Gamma$ ({\tt
+ eos\_gamma}), which default to 100 and 2 respectively. The formulas
+that are applied under the appropriate EOS\_Base function calls are
+
+\begin{eqnarray}
+ \label{eq:eosformulas}
+ P & = & K \rho^{\Gamma} \\
+ \epsilon & = & \frac{K \rho^{\Gamma-1}}{\Gamma - 1} \\
+ \rho & = & \frac{P}{(\Gamma - 1) \epsilon} \\
+ \frac{\partial P}{\partial \rho} & = & K \Gamma \rho^{\Gamma-1} \\
+ \frac{\partial P}{\partial \epsilon} & = & 0.
+\end{eqnarray}
+
+To calculate the units of the Cactus quantities and back, remember that
+$G=c=M_{\odot}=1$ in Cactus.\\
+Here is one example how to calculate densities:
+\begin{equation}
+ \rho_{\mbox{\tiny Cactus}}=\frac{G^3M_{\odot}^2}{c^6}\cdot \rho
+ \approx1.6167\cdot10^{-21}\frac{\mbox{m}^3}{\mbox{kg}}\cdot\rho=
+ 1.6167\cdot10^{-18}\frac{\mbox{cm}^3}{\mbox{g}}\cdot\rho
+\end{equation}
+and one example for calculating $K$ (for $\Gamma=2$):
+\begin{equation}
+ K_{\mbox{\tiny Cactus}}=\frac{c^4}{G^3M_{\odot}^2}\cdot K
+ \approx6.8824\cdot10^{-11}\frac{\mbox{m}^5}{\mbox{kg}\cdot\mbox{s}^2}\cdot K=
+ 6.8824\cdot10^{-4}\frac{\mbox{cm}^5}{\mbox{g}\cdot\mbox{s}^2}\cdot K
+\end{equation}
+
+\include{interface}
+\include{param}
+\include{schedule}
+
+\end{document}
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..206d075
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,13 @@
+# Interface definition for thorn EOS_Polytrope
+# $Header$
+
+implements: EOS_2d_Polytrope
+inherits: EOS_Base
+
+USES INCLUDE: EOS_Base.h
+USES INCLUDE: EOS_Base.inc
+
+private:
+
+
+
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..4c2d617
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,23 @@
+# Parameter definitions for thorn EOS_Polytrope
+# $Header$
+
+restricted:
+
+REAL eos_gamma "Adiabatic Index for Ideal Fluid"
+{
+ : :: ""
+} 2.0
+
+REAL eos_k "Polytropic constant" STEERABLE=ALWAYS
+{
+ : :: ""
+} 80.0
+
+BOOLEAN use_cgs "Use the CGS units"
+{
+} "no"
+
+REAL gamma_ini "Polytropic Gamma used for the initial model (e.g., by RNSID)"
+{
+ : :: ""
+} 2.0
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..5a8943b
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,9 @@
+# Schedule definitions for thorn EOS_Polytrope
+# $Header$
+
+
+schedule EOS_Polytrope_Startup AT startup
+{
+ LANG: Fortran
+} "Setup the polytropic EOS"
+
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