aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@a192deed-9f5d-41fb-bb60-7f59df5b1b8d>2009-12-02 22:22:53 +0000
committerknarf <knarf@a192deed-9f5d-41fb-bb60-7f59df5b1b8d>2009-12-02 22:22:53 +0000
commit9bdbc9209f0004429393aad47d0973046a4ee0dc (patch)
tree1468bb1aa622e40126a1f25dd42b7ffe6b23ccdc
parent794e79d409732b82bb8871444d6e17c80b0e879c (diff)
thorns for general eos interface (moved from Whisky_Dev repositories)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEOS/EOSG_Polytrope/trunk@2 a192deed-9f5d-41fb-bb60-7f59df5b1b8d
-rwxr-xr-xREADME11
-rwxr-xr-xconfiguration.ccl8
-rwxr-xr-xdoc/documentation.tex144
-rwxr-xr-xinterface.ccl80
-rwxr-xr-xparam.ccl23
-rwxr-xr-xschedule.ccl12
-rwxr-xr-xsrc/EOS_GP.F90189
-rwxr-xr-xsrc/EOS_GP.c140
-rwxr-xr-xsrc/EOS_GP.h21
-rwxr-xr-xsrc/EOS_GP_Scalars.F9021
-rwxr-xr-xsrc/EOS_GP_Setup.F9046
-rwxr-xr-xsrc/EOS_GP_Setup.c59
-rwxr-xr-xsrc/make.code.defn12
-rwxr-xr-xsrc/make.code.deps4
14 files changed, 770 insertions, 0 deletions
diff --git a/README b/README
new file mode 100755
index 0000000..85a4608
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+CVS info : $Header$
+
+Cactus Code Thorn EOS_GeneralPolytrope
+Thorn Author(s) : Ian Hawke <ih@maths.soton.ac.uk>
+Thorn Maintainer(s) : Ian Hawke <ih@maths.soton.ac.uk>
+--------------------------------------------------------------------------
+
+Purpose of the thorn:
+
+Implements the simple polytropic EOS through the general EOS
+interface.
diff --git a/configuration.ccl b/configuration.ccl
new file mode 100755
index 0000000..4923282
--- /dev/null
+++ b/configuration.ccl
@@ -0,0 +1,8 @@
+# Configuration definitions for thorn EOS_GeneralPolytrope
+# $Header$
+
+PROVIDES EOS_GeneralPolytrope
+{
+ SCRIPT
+ LANG
+}
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100755
index 0000000..ee52b8c
--- /dev/null
+++ b/doc/documentation.tex
@@ -0,0 +1,144 @@
+% *======================================================================*
+% Cactus Thorn template for ThornGuide documentation
+% Author: Ian Kelley
+% Date: Sun Jun 02, 2002
+% $Header$
+%
+% Thorn documentation in the latex file doc/documentation.tex
+% will be included in ThornGuides built with the Cactus make system.
+% The scripts employed by the make system automatically include
+% pages about variables, parameters and scheduling parsed from the
+% relevant thorn CCL files.
+%
+% This template contains guidelines which help to assure that your
+% documentation will be correctly added to ThornGuides. More
+% information is available in the Cactus UsersGuide.
+%
+% Guidelines:
+% - Do not change anything before the line
+% % START CACTUS THORNGUIDE",
+% except for filling in the title, author, date, etc. fields.
+% - Each of these fields should only be on ONE line.
+% - Author names should be separated with a \\ or a comma.
+% - You can define your own macros, but they must appear after
+% the START CACTUS THORNGUIDE line, and must not redefine standard
+% latex commands.
+% - To avoid name clashes with other thorns, 'labels', 'citations',
+% 'references', and 'image' names should conform to the following
+% convention:
+% ARRANGEMENT_THORN_LABEL
+% For example, an image wave.eps in the arrangement CactusWave and
+% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps
+% - Graphics should only be included using the graphicx package.
+% More specifically, with the "\includegraphics" command. Do
+% not specify any graphic file extensions in your .tex file. This
+% will allow us to create a PDF version of the ThornGuide
+% via pdflatex.
+% - References should be included with the latex "\bibitem" command.
+% - Use \begin{abstract}...\end{abstract} instead of \abstract{...}
+% - Do not use \appendix, instead include any appendices you need as
+% standard sections.
+% - For the benefit of our Perl scripts, and for future extensions,
+% please use simple latex.
+%
+% *======================================================================*
+%
+% Example of including a graphic image:
+% \begin{figure}[ht]
+% \begin{center}
+% \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}
+% \end{center}
+% \caption{Illustration of this and that}
+% \label{MyArrangement_MyThorn_MyLabel}
+% \end{figure}
+%
+% Example of using a label:
+% \label{MyArrangement_MyThorn_MyLabel}
+%
+% Example of a citation:
+% \cite{MyArrangement_MyThorn_Author99}
+%
+% Example of including a reference
+% \bibitem{MyArrangement_MyThorn_Author99}
+% {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999),
+% 1--16. {\tt http://www.nowhere.com/}}
+%
+% *======================================================================*
+
+% If you are using CVS use this line to give version information
+% $Header$
+
+\documentclass{article}
+
+% Use the Cactus ThornGuide style file
+% (Automatically used from Cactus distribution, if you have a
+% thorn without the Cactus Flesh download this from the Cactus
+% homepage at www.cactuscode.org)
+\usepackage{../../../../doc/latex/cactus}
+
+\begin{document}
+
+% The author of the documentation
+\author{Ian Hawke \textless ih@maths.soton.ac.uk\textgreater}
+
+% The title of the document (not necessarily the name of the Thorn)
+\title{}
+
+% the date your document was last changed, if your document is in CVS,
+% please use:
+% \date{$ $Date$ $}
+\date{March 14 2005}
+
+\maketitle
+
+% Do not delete next line
+% START CACTUS THORNGUIDE
+
+% Add all definitions used in this documentation here
+% \def\mydef etc
+
+% Add an abstract for this thorn's documentation
+\begin{abstract}
+
+\end{abstract}
+
+% The following sections are suggestive only.
+% Remove them or add your own.
+
+\section{Introduction}
+
+\section{Physical System}
+
+\section{Numerical Implementation}
+
+\section{Using This Thorn}
+
+\subsection{Obtaining This Thorn}
+
+\subsection{Basic Usage}
+
+\subsection{Special Behaviour}
+
+\subsection{Interaction With Other Thorns}
+
+\subsection{Examples}
+
+\subsection{Support and Feedback}
+
+\section{History}
+
+\subsection{Thorn Source Code}
+
+\subsection{Thorn Documentation}
+
+\subsection{Acknowledgements}
+
+
+\begin{thebibliography}{9}
+
+\end{thebibliography}
+
+% Do not delete next line
+% END CACTUS THORNGUIDE
+
+\end{document}
diff --git a/interface.ccl b/interface.ccl
new file mode 100755
index 0000000..8eb9f5c
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,80 @@
+# Interface definition for thorn EOS_GeneralPolytrope
+# $Header$
+
+implements: EOS_GeneralPolytrope
+
+void FUNCTION EOS_Poly_Pressure(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN rho,\
+ CCTK_POINTER ARRAY OUT press)
+
+PROVIDES FUNCTION EOS_Poly_Pressure WITH EOS_GP_Pressure LANGUAGE Fortran
+
+
+
+CCTK_INT FUNCTION EOS_RegisterCall(CCTK_INT IN table_handle, \
+ CCTK_INT IN CCTK_FPOINTER \
+ EOS_fn(CCTK_INT IN param_table, \
+ CCTK_INT IN n_elems, \
+ CCTK_POINTER ARRAY IN indeps, \
+ CCTK_INT ARRAY IN which_deps, \
+ CCTK_POINTER ARRAY OUT deps))
+USES FUNCTION EOS_RegisterCall
+
+
+void FUNCTION EOS_Poly_IntEn(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN rho,\
+ CCTK_POINTER ARRAY OUT IntEn)
+
+PROVIDES FUNCTION EOS_Poly_IntEn WITH EOS_GP_IntEn LANGUAGE Fortran
+
+
+void FUNCTION EOS_Poly_DPDRho(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN rho,\
+ CCTK_POINTER ARRAY OUT dpdrho)
+
+PROVIDES FUNCTION EOS_Poly_DPDrho WITH EOS_GP_DPDRho LANGUAGE Fortran
+
+
+void FUNCTION EOS_Poly_DPDIE(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN rho,\
+ CCTK_POINTER ARRAY OUT dpdie)
+
+PROVIDES FUNCTION EOS_Poly_DPDIE WITH EOS_GP_DPDIE LANGUAGE Fortran
+
+void FUNCTION EOS_Poly_cs2(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN rho,\
+ CCTK_POINTER ARRAY OUT cs2)
+
+PROVIDES FUNCTION EOS_Poly_cs2 WITH EOS_GP_cs2 LANGUAGE Fortran
+
+void FUNCTION EOS_Poly_Inv_Rho(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN press,\
+ CCTK_POINTER ARRAY OUT rho)
+
+PROVIDES FUNCTION EOS_Poly_Inv_Rho WITH EOS_GP_Inv_Rho LANGUAGE Fortran
+
+void FUNCTION EOS_Poly_Inv_IntEn(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN press,\
+ CCTK_POINTER ARRAY OUT IntEn)
+
+PROVIDES FUNCTION EOS_Poly_Inv_IntEn WITH EOS_GP_Inv_IntEn LANGUAGE Fortran
+
+
+void FUNCTION EOS_Poly_Inv_DPDRho(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN press,\
+ CCTK_POINTER ARRAY OUT DPDRho)
+
+PROVIDES FUNCTION EOS_Poly_Inv_DPDRho WITH EOS_GP_Inv_DPDRho LANGUAGE Fortran
+
+
+void FUNCTION EOS_Poly_Inv_DPDIE(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN press,\
+ CCTK_POINTER ARRAY OUT DPDIE)
+
+PROVIDES FUNCTION EOS_Poly_Inv_DPDIE WITH EOS_GP_Inv_DPDIE LANGUAGE Fortran
+
+void FUNCTION EOS_Poly_Inv_cs2(CCTK_INT IN nelemns, \
+ CCTK_POINTER ARRAY IN press,\
+ CCTK_POINTER ARRAY OUT cs2)
+
+PROVIDES FUNCTION EOS_Poly_Inv_cs2 WITH EOS_GP_Inv_cs2 LANGUAGE Fortran
diff --git a/param.ccl b/param.ccl
new file mode 100755
index 0000000..7c278b7
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,23 @@
+# Parameter definitions for thorn EOS_GeneralPolytrope
+# $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 100755
index 0000000..29e8c50
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,12 @@
+# Schedule definitions for thorn EOS_GeneralPolytrope
+# $Header$
+
+schedule EOS_GP_Startup IN EOSBase_GeneralRegister
+{
+ LANGUAGE: C
+} "Register the polytropic EOS"
+
+schedule EOS_GP_Setup IN EOSBase_GeneralRegister
+{
+ LANGUAGE: Fortran
+} "Set up scalars for the polytropic EOS"
diff --git a/src/EOS_GP.F90 b/src/EOS_GP.F90
new file mode 100755
index 0000000..283b9ac
--- /dev/null
+++ b/src/EOS_GP.F90
@@ -0,0 +1,189 @@
+ /*@@
+ @file EOS_GP.F90
+ @date Mon Mar 14 16:42:15 2005
+ @author Ian Hawke
+ @desc
+ The functions that actually set the polytropic EOS
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+
+subroutine EOS_GP_Pressure(nelems, rho, press)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(out) :: press
+
+ press = p_geom_factor * eos_k_cgs * &
+ (rho * rho_geom_factor_inv) ** eos_gamma_local
+
+end subroutine EOS_GP_Pressure
+
+subroutine EOS_GP_IntEn(nelems, rho, IntEn)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(out) :: IntEn
+
+ IntEn = p_geom_factor * eos_k_cgs * &
+ (rho * rho_geom_factor_inv) ** eos_gamma_local / &
+ (rho * (eos_gamma_local - 1.d0) )
+
+end subroutine EOS_GP_IntEn
+
+subroutine EOS_GP_DPDRho(nelems, rho, dpdrho)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdrho
+
+ dpdrho = p_geom_factor * eos_k_cgs * &
+ eos_gamma_local * rho_geom_factor_inv * &
+ (rho * rho_geom_factor_inv) ** (eos_gamma_local - 1.d0)
+
+end subroutine EOS_GP_DPDRho
+
+subroutine EOS_GP_DPDIE(nelems, rho, dpdie)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdie
+
+ dpdie = 0.d0
+
+end subroutine EOS_GP_DPDIE
+
+subroutine EOS_GP_cs2(nelems, rho, cs2)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(out) :: cs2
+
+ cs2 = (p_geom_factor * eos_k_cgs * eos_gamma_local * rho_geom_factor_inv * &
+ (rho * rho_geom_factor_inv) ** (eos_gamma_local - 1.d0)) / &
+ (1.d0 + p_geom_factor * eos_k_cgs * eos_gamma_local * &
+ rho_geom_factor_inv / (eos_gamma_local - 1.d0) * &
+ (rho * rho_geom_factor_inv) ** (eos_gamma_local - 1.d0))
+
+end subroutine EOS_GP_cs2
+
+ /*@@
+ @routine Inverse functions
+ @date Mon Apr 4 11:03:04 2005
+ @author Ian Hawke
+ @desc
+ Give P find the results...
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+
+subroutine EOS_GP_Inv_Rho(nelems, press, rho)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: press
+ CCTK_REAL, dimension(nelems), intent(out) :: rho
+
+ rho = rho_geom_factor * &
+ (press / p_geom_factor / eos_k_cgs) ** (1.d0 / eos_gamma_local)
+
+end subroutine EOS_GP_Inv_Rho
+
+subroutine EOS_GP_Inv_IntEn(nelems, press, IntEn)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: press
+ CCTK_REAL, dimension(nelems), intent(out) :: IntEn
+
+ IntEn = press / &
+ ( (eos_gamma_local - 1.d0) * rho_geom_factor * &
+ (press / p_geom_factor / eos_k_cgs) ** (1.d0 / eos_gamma_local) )
+
+end subroutine EOS_GP_Inv_IntEn
+
+subroutine EOS_GP_Inv_DPDRho(nelems, press, dpdrho)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: press
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdrho
+
+ dpdrho = p_geom_factor * eos_k_cgs * &
+ eos_gamma_local * rho_geom_factor_inv * &
+ (press / (p_geom_factor * eos_k_cgs) ) ** &
+ ( (eos_gamma_local - 1.d0) / eos_gamma_local )
+
+end subroutine EOS_GP_Inv_DPDRho
+
+subroutine EOS_GP_Inv_DPDIE(nelems, press, dpdie)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: press
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdie
+
+ dpdie = 0.d0
+
+end subroutine EOS_GP_Inv_DPDIE
+
+subroutine EOS_GP_Inv_cs2(nelems, press, cs2)
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: press
+ CCTK_REAL, dimension(nelems), intent(out) :: cs2
+
+ cs2 = (p_geom_factor * eos_k_cgs * eos_gamma_local * rho_geom_factor_inv * &
+ (press / (p_geom_factor * eos_k_cgs) ) ** &
+ ( (eos_gamma_local - 1.d0) / eos_gamma_local ) ) / &
+ (1.d0 + p_geom_factor * eos_k_cgs * eos_gamma_local * &
+ rho_geom_factor_inv / (eos_gamma_local - 1.d0) * &
+ (press / (p_geom_factor * eos_k_cgs) ) ** &
+ ( (eos_gamma_local - 1.d0) / eos_gamma_local ) )
+
+end subroutine EOS_GP_Inv_cs2
+
diff --git a/src/EOS_GP.c b/src/EOS_GP.c
new file mode 100755
index 0000000..a9ea0b6
--- /dev/null
+++ b/src/EOS_GP.c
@@ -0,0 +1,140 @@
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+
+#include "EOS_GP.h"
+
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Pressure) (const CCTK_INT* nelems,
+ const CCTK_REAL* rho,
+ const CCTK_REAL* press);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_IntEn) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* inten);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_DPDRho) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* dpdrho);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_DPDIE) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* dpdie);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_cs2) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* cs2);
+
+CCTK_INT EOS_GP_SetArray(const CCTK_INT param_table,
+ const CCTK_INT n_elems,
+ const CCTK_POINTER* indep_vars,
+ const CCTK_INT* which_deps_to_set,
+ CCTK_POINTER* dep_vars)
+{
+
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0, var;
+
+ for (var = 0; var < N_DEPS; ++var)
+ {
+ if (which_deps_to_set[var])
+ {
+ switch (var)
+ {
+ case (0):
+ CCTK_FNAME(EOS_GP_Pressure) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[0]);
+ break;
+ case (1):
+ CCTK_FNAME(EOS_GP_IntEn) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[1]);
+ break;
+ case (2):
+ CCTK_FNAME(EOS_GP_DPDRho) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[2]);
+ break;
+ case (3):
+ CCTK_FNAME(EOS_GP_DPDIE) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[3]);
+ break;
+ case (4):
+ CCTK_FNAME(EOS_GP_cs2) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[4]);
+ break;
+ }
+ }
+ }
+
+ return ierr;
+}
+
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_Rho) (const CCTK_INT* nelems,
+ const CCTK_REAL* rho,
+ const CCTK_REAL* press);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_IntEn) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* inten);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_DPDRho) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* dpdrho);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_DPDIE) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* dpdie);
+void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_cs2) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* cs2);
+
+CCTK_INT EOS_GP_Inverse_SetArray(const CCTK_INT param_table,
+ const CCTK_INT n_elems,
+ const CCTK_POINTER* indep_vars,
+ const CCTK_INT* which_deps_to_set,
+ CCTK_POINTER* dep_vars)
+{
+
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0, var, dim;
+
+ for (var = 0; var < N_DEPS; ++var)
+ {
+ if (which_deps_to_set[var])
+ {
+ switch (var)
+ {
+ case (0):
+ CCTK_FNAME(EOS_GP_Inv_Rho) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[0]);
+ break;
+ case (1):
+ CCTK_FNAME(EOS_GP_Inv_IntEn) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[1]);
+ break;
+ case (2):
+ CCTK_FNAME(EOS_GP_Inv_DPDRho) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[2]);
+ break;
+ case (3):
+ CCTK_FNAME(EOS_GP_Inv_DPDIE) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[3]);
+ break;
+ case (4):
+ CCTK_FNAME(EOS_GP_Inv_cs2) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)dep_vars[4]);
+ break;
+ }
+ }
+ }
+
+ return ierr;
+}
diff --git a/src/EOS_GP.h b/src/EOS_GP.h
new file mode 100755
index 0000000..6fb5eb4
--- /dev/null
+++ b/src/EOS_GP.h
@@ -0,0 +1,21 @@
+#ifndef EOS_GP_H
+#define EOS_GP_H
+
+#include "cctk.h"
+
+#define N_INDEPS 1
+#define N_DEPS 5
+
+CCTK_INT EOS_GP_SetArray(const CCTK_INT param_table,
+ const CCTK_INT n_elems,
+ const CCTK_POINTER* indep_vars,
+ const CCTK_INT* which_deps_to_set,
+ CCTK_POINTER* dep_vars);
+
+CCTK_INT EOS_GP_Inverse_SetArray(const CCTK_INT param_table,
+ const CCTK_INT n_elems,
+ const CCTK_POINTER* indep_vars,
+ const CCTK_INT* which_deps_to_set,
+ CCTK_POINTER* dep_vars);
+
+#endif
diff --git a/src/EOS_GP_Scalars.F90 b/src/EOS_GP_Scalars.F90
new file mode 100755
index 0000000..c82e1d6
--- /dev/null
+++ b/src/EOS_GP_Scalars.F90
@@ -0,0 +1,21 @@
+ /*@@
+ @file EOS_GP_Scalars.F90
+ @date Mon Mar 14 17:39:50 2005
+ @author Ian Hawke
+ @desc
+ Constants for the EOS routines.
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+
+module EOS_GP_Scalars
+
+ implicit none
+
+ CCTK_REAL :: p_geom_factor, rho_geom_factor, &
+ rho_geom_factor_inv, eos_k_cgs, eos_gamma_local
+
+ CCTK_REAL :: m_solar_geom, m_solar_cgs, c_cgs, G_cgs
+
+end module EOS_GP_Scalars
diff --git a/src/EOS_GP_Setup.F90 b/src/EOS_GP_Setup.F90
new file mode 100755
index 0000000..4601e92
--- /dev/null
+++ b/src/EOS_GP_Setup.F90
@@ -0,0 +1,46 @@
+ /*@@
+ @file EOS_GP_Setup.F90
+ @date Mon Mar 14 17:41:20 2005
+ @author Ian Hawke
+ @desc
+ Setup the scalar variables
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+subroutine EOS_GP_Setup()
+
+ USE EOS_GP_Scalars
+
+ implicit none
+
+ DECLARE_CCTK_PARAMETERS
+
+ 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
+
+ eos_gamma_local = eos_gamma
+
+ 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 subroutine EOS_GP_Setup
diff --git a/src/EOS_GP_Setup.c b/src/EOS_GP_Setup.c
new file mode 100755
index 0000000..7bc3aa2
--- /dev/null
+++ b/src/EOS_GP_Setup.c
@@ -0,0 +1,59 @@
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+#include "util_String.h"
+#include "util_ErrorCodes.h"
+#include "util_Table.h"
+
+#include "EOS_GP.h"
+
+void EOS_GP_Startup (CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr, table_handle;
+
+ table_handle = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+
+ Util_TableSetInt(table_handle,
+ N_INDEPS,
+ "N independent variables");
+ Util_TableSetInt(table_handle,
+ N_DEPS,
+ "N dependent variables");
+ Util_TableSetString(table_handle,
+ "Rho",
+ "Independent variable names");
+ Util_TableSetString(table_handle,
+ "Pressure SpecificInternalEnergy DPressureDRho DPressureDSpecificInternalEnergy c_s^2",
+ "Dependent variable names");
+ Util_TableSetString(table_handle,
+ "Polytrope",
+ "EOS Name");
+
+ ierr = EOS_RegisterCall(table_handle,
+ EOS_GP_SetArray);
+ if (ierr)
+ {
+ CCTK_WARN(0, "Failed to set up EOS_Polytrope call");
+ }
+
+ Util_TableSetString(table_handle,
+ "Pressure",
+ "Independent variable names");
+ Util_TableSetString(table_handle,
+ "Rho SpecificInternalEnergy DPressureDRho DPressureDSpecificInternalEnergy c_s^2",
+ "Dependent variable names");
+ Util_TableSetString(table_handle,
+ "Inverse Polytrope",
+ "EOS Name");
+
+ ierr = EOS_RegisterCall(table_handle,
+ EOS_GP_Inverse_SetArray);
+ if (ierr)
+ {
+ CCTK_WARN(0, "Failed to set up EOS_Polytrope (inverse) call");
+ }
+}
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100755
index 0000000..ba6d0b4
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,12 @@
+# Main make.code.defn file for thorn EOS_GeneralPolytrope
+# $Header$
+
+# Source files in this directory
+SRCS = EOS_GP_Setup.c \
+ EOS_GP.c \
+ EOS_GP.F90 \
+ EOS_GP_Scalars.F90 \
+ EOS_GP_Setup.F90
+
+# Subdirectories containing source files
+SUBDIRS =
diff --git a/src/make.code.deps b/src/make.code.deps
new file mode 100755
index 0000000..111d0db
--- /dev/null
+++ b/src/make.code.deps
@@ -0,0 +1,4 @@
+# Module dependencies for thorn EOS_GeneralPolytrope
+
+EOS_GP.F90.o: EOS_GP_Scalars.F90.o
+EOS_GP_Setup.F90.o: EOS_GP_Scalars.F90.o