summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@0a999221-0efe-4d2d-b270-2ec6803ffb49>2009-12-02 22:22:52 +0000
committerknarf <knarf@0a999221-0efe-4d2d-b270-2ec6803ffb49>2009-12-02 22:22:52 +0000
commit009e6b85882170b646ee8ef895b82d77c5ca2505 (patch)
treee4ddc81c8871e16a00368ceb1952e1fc4b37f68f
parent04d9e2af959e28cad9f8fea508e35c393228a265 (diff)
thorns for general eos interface (moved from Whisky_Dev repositories)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEOS/EOSG_Hybrid/trunk@2 0a999221-0efe-4d2d-b270-2ec6803ffb49
-rwxr-xr-xconfiguration.ccl4
-rwxr-xr-xdoc/documentation.tex144
-rwxr-xr-xinterface.ccl23
-rwxr-xr-xparam.ccl25
-rwxr-xr-xschedule.ccl22
-rwxr-xr-xsrc/EOS_GeneralHybrid.F90228
-rwxr-xr-xsrc/EOS_GeneralHybrid.c76
-rwxr-xr-xsrc/EOS_GeneralHybrid.h15
-rwxr-xr-xsrc/EOS_GeneralHybrid_Analysis.F9074
-rwxr-xr-xsrc/EOS_GeneralHybrid_Scalars.F9018
-rwxr-xr-xsrc/EOS_GeneralHybrid_Setup.F9040
-rwxr-xr-xsrc/EOS_GeneralHybrid_Startup.c42
-rwxr-xr-xsrc/make.code.defn11
-rwxr-xr-xsrc/make.code.deps5
-rwxr-xr-xsrc/make.configuration.deps5
15 files changed, 732 insertions, 0 deletions
diff --git a/configuration.ccl b/configuration.ccl
new file mode 100755
index 0000000..e5fd117
--- /dev/null
+++ b/configuration.ccl
@@ -0,0 +1,4 @@
+# Configuration definition for thorn EOS_GeneralHybrid
+# $Header$
+
+REQUIRES EOSBase_General EOS_GeneralPolytrope
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100755
index 0000000..e5df9d7
--- /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{Christian D. Ott \textless cott@aei.mpg.de\textgreater \\ Ian Hawke \textless ih@maths.soton.ac.uik\textgreater \\ Harald Dimmelmeier \textless harrydee@mpa-garching.mpg.de\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{April 27 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..8d165df
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,23 @@
+# Interface definition for thorn EOS_GeneralHybrid
+# $Header$
+
+implements: EOS_GeneralHybrid
+inherits: HydroBase
+friend: EOS_GeneralPolytrope
+
+real pressure_contributions type = GF tags='Prolongation="None"'
+{
+ pressure_poly, pressure_th
+} "Polytropic and thermal contributions to the pressure"
+
+
+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
+
+
diff --git a/param.ccl b/param.ccl
new file mode 100755
index 0000000..de3862d
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,25 @@
+# Parameter definitions for thorn EOS_GeneralHybrid
+# $Header$
+
+shares: EOS_GeneralPolytrope
+
+USES REAL eos_k
+USES REAL eos_gamma
+USES REAL gamma_ini
+
+private:
+
+REAL eos_gamma_th "Gamma_th for EOS"
+{
+ : :: ""
+} 1.5
+
+REAL eos_gamma_supernuclear "Gamma_2 for EOS"
+{
+ : :: ""
+} 1.66666666666666
+
+REAL rho_nuc "Nuclear matter density"
+{
+ : :: ""
+} 1.e-10
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100755
index 0000000..6f9e0fe
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,22 @@
+# Schedule definitions for thorn EOS_GeneralHybrid
+# $Header$
+
+STORAGE: pressure_contributions
+
+schedule EOS_GeneralHybrid_Startup IN EOSBase_GeneralRegister AFTER EOS_GP_Setup
+{
+ LANG: C
+} "Register EOS_GeneralHybrid"
+
+
+schedule EOS_GeneralHybrid_Setup IN EOSBase_GeneralRegister AFTER EOS_GeneralHybrid_Startup
+{
+ LANG: Fortran
+} "Setup the EOS used by Dimmelmeier et al. in core collapse"
+
+
+schedule Check_Poly_Contrib_General AT CCTK_ANALYSIS
+{
+ LANG: Fortran
+ TRIGGERS: pressure_contributions
+} "Output the polytropic and thermal contributions"
diff --git a/src/EOS_GeneralHybrid.F90 b/src/EOS_GeneralHybrid.F90
new file mode 100755
index 0000000..e842600
--- /dev/null
+++ b/src/EOS_GeneralHybrid.F90
@@ -0,0 +1,228 @@
+ /*@@
+ @file EOS_GeneralHybrid.F90
+ @date
+ @author Ian Hawke, Christian D. Ott
+ @desc
+ Routines to calculate the EOS used by Dimmelmeier et al.
+ in supernova core collapse simulations.
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+
+subroutine EOS_GeneralHybrid_Pressure(nelems, rho, eps, press)
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+
+ DECLARE_CCTK_PARAMETERS
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(in) :: eps
+ CCTK_REAL, dimension(nelems), intent(out) :: press
+
+ CCTK_REAL, allocatable, dimension(:) :: p_poly
+ CCTK_REAL, allocatable, dimension(:) :: p_th
+ CCTK_REAL, allocatable, dimension(:) :: local_eos_gamma
+ CCTK_REAL, allocatable, dimension(:) :: local_eos_k_cgs
+
+ CCTK_REAL zero
+
+ allocate(p_poly(1:nelems))
+ allocate(p_th(1:nelems))
+ allocate(local_eos_gamma(1:nelems))
+ allocate(local_eos_k_cgs(1:nelems))
+
+ zero = 0.d0
+
+ where (rho > rho_nuc)
+ local_eos_gamma = eos_gamma_supernuclear
+ local_eos_k_cgs = eos_k_supernuclear_cgs
+ elsewhere
+ local_eos_gamma = eos_gamma
+ local_eos_k_cgs = eos_k_cgs
+ end where
+
+ p_poly = p_geom_factor * local_eos_k_cgs * &
+ (rho * rho_geom_factor_inv)**local_eos_gamma
+
+ p_th = - p_geom_factor * local_eos_k_cgs * (eos_gamma_th - 1.d0) / &
+ (local_eos_gamma - 1.d0) * (rho * rho_geom_factor_inv)**local_eos_gamma + &
+ (eos_gamma_th - 1.d0) * rho * eps - &
+ (eos_gamma_th - 1.d0) * (local_eos_gamma - eos_gamma) / &
+ (eos_gamma - 1.d0) / (eos_gamma_supernuclear - 1.d0) * &
+ p_geom_factor * eos_k_cgs * rho_geom_factor_inv**eos_gamma * &
+ rho_nuc**(eos_gamma - 1.d0) * rho
+
+ p_th = max(zero, p_th)
+
+ press = p_poly + p_th
+
+ deallocate(p_poly)
+ deallocate(p_th)
+ deallocate(local_eos_gamma)
+ deallocate(local_eos_k_cgs)
+
+
+end subroutine EOS_GeneralHybrid_Pressure
+
+subroutine EOS_GeneralHybrid_DPDRho(nelems, rho, eps, dpdrho)
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+ DECLARE_CCTK_PARAMETERS
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(in) :: eps
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdrho
+
+ CCTK_REAL, allocatable,dimension(:) :: d_p_poly
+ CCTK_REAL, allocatable,dimension(:) :: d_p_th_1
+ CCTK_REAL, allocatable,dimension(:) :: d_p_th_2
+ CCTK_REAL, allocatable,dimension(:) :: local_eos_gamma
+ CCTK_REAL, allocatable,dimension(:) :: local_eos_k_cgs
+
+ CCTK_REAL zero
+
+ allocate(d_p_poly(1:nelems))
+ allocate(d_p_th_1(1:nelems))
+ allocate(d_p_th_2(1:nelems))
+ allocate(local_eos_gamma(1:nelems))
+ allocate(local_eos_k_cgs(1:nelems))
+
+
+ zero = 0.d0
+
+ where (rho > rho_nuc)
+ local_eos_gamma = eos_gamma_supernuclear
+ local_eos_k_cgs = eos_k_supernuclear_cgs
+ elsewhere
+ local_eos_gamma = eos_gamma
+ local_eos_k_cgs = eos_k_cgs
+ end where
+
+ d_p_poly = local_eos_gamma * p_geom_factor * local_eos_k_cgs * &
+ rho**(local_eos_gamma - 1.d0) * rho_geom_factor_inv**local_eos_gamma
+
+ d_p_th_1 = - local_eos_gamma * p_geom_factor * local_eos_k_cgs * &
+ (eos_gamma_th - 1.d0) / (local_eos_gamma - 1.d0) * &
+ rho**(local_eos_gamma - 1.d0) * rho_geom_factor_inv**local_eos_gamma
+
+ d_p_th_2 = (eos_gamma_th - 1.d0) * eps &
+ - (eos_gamma_th - 1.d0) * (local_eos_gamma - eos_gamma) / &
+ (eos_gamma - 1.d0) / (eos_gamma_supernuclear - 1.d0) * &
+ p_geom_factor * eos_k_cgs * rho_geom_factor_inv**eos_gamma * &
+ rho_nuc**(eos_gamma - 1.d0)
+
+! d_p_th_1 = max(d_p_th_1, zero)
+! d_p_th_2 = max(d_p_th_2, zero)
+
+ dpdrho = d_p_poly + d_p_th_1 + d_p_th_2
+
+ deallocate(d_p_poly)
+ deallocate(d_p_th_1)
+ deallocate(d_p_th_2)
+ deallocate(local_eos_gamma)
+ deallocate(local_eos_k_cgs)
+
+
+end subroutine EOS_GeneralHybrid_DPDRho
+
+
+subroutine EOS_GeneralHybrid_cs2(nelems, rho, eps, cs2)
+
+! This is an ugly and quick hack.
+! Uses way to many operations and memory.
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+ DECLARE_CCTK_PARAMETERS
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(in) :: eps
+ CCTK_REAL, dimension(nelems), intent(out) :: cs2
+ CCTK_REAL, allocatable,dimension(:) :: p_poly
+ CCTK_REAL, allocatable,dimension(:) :: p_th
+ CCTK_REAL, allocatable,dimension(:) :: pressure
+
+ CCTK_REAL, allocatable,dimension(:) :: local_eos_gamma
+ CCTK_REAL, allocatable,dimension(:) :: local_eos_k_cgs
+
+ CCTK_REAL zero
+
+ allocate(p_poly(1:nelems))
+ allocate(p_th(1:nelems))
+ allocate(pressure(1:nelems))
+ allocate(local_eos_gamma(1:nelems))
+ allocate(local_eos_k_cgs(1:nelems))
+
+
+ zero = 0.d0
+
+ where (rho > rho_nuc)
+ local_eos_gamma = eos_gamma_supernuclear
+ local_eos_k_cgs = eos_k_supernuclear_cgs
+ elsewhere
+ local_eos_gamma = eos_gamma
+ local_eos_k_cgs = eos_k_cgs
+ end where
+
+! First calculate the pressure
+ p_poly = p_geom_factor * local_eos_k_cgs * &
+ (rho * rho_geom_factor_inv)**local_eos_gamma
+
+ p_th = - p_geom_factor * local_eos_k_cgs * (eos_gamma_th - 1.d0) / &
+ (local_eos_gamma - 1.d0) * (rho * rho_geom_factor_inv)**local_eos_gamma + &
+ (eos_gamma_th - 1.d0) * rho * eps - &
+ (eos_gamma_th - 1.d0) * (local_eos_gamma - eos_gamma) / &
+ (eos_gamma - 1.d0) / (eos_gamma_supernuclear - 1.d0) * &
+ p_geom_factor * eos_k_cgs * rho_geom_factor_inv**eos_gamma * &
+ rho_nuc**(eos_gamma - 1.d0) * rho
+
+ pressure = p_poly + p_th
+
+ p_th = max(zero, p_th)
+
+! This may look incorrect; It's in Harry's code; in his thesis and I worked it out as well.
+! Should be okay...
+ cs2 = (local_eos_gamma * p_poly + eos_gamma_th * p_th) / &
+ rho / (1.0d0 + eps + pressure/rho)
+
+ deallocate(pressure)
+ deallocate(p_poly)
+ deallocate(p_th)
+ deallocate(local_eos_gamma)
+ deallocate(local_eos_k_cgs)
+
+end subroutine EOS_GeneralHybrid_cs2
+
+
+
+subroutine EOS_GeneralHybrid_DPDIE(nelems, rho, eps, dpdie)
+
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+ DECLARE_CCTK_PARAMETERS
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho
+ CCTK_REAL, dimension(nelems), intent(in) :: eps
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdie
+
+ dpdie = (eos_gamma_th - 1.d0) * rho
+
+end subroutine EOS_GeneralHybrid_DPDIE
+
diff --git a/src/EOS_GeneralHybrid.c b/src/EOS_GeneralHybrid.c
new file mode 100755
index 0000000..9e4d443
--- /dev/null
+++ b/src/EOS_GeneralHybrid.c
@@ -0,0 +1,76 @@
+#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_GeneralHybrid.h"
+
+void CCTK_FCALL CCTK_FNAME(EOS_GeneralHybrid_Pressure) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* press);
+void CCTK_FCALL CCTK_FNAME(EOS_GeneralHybrid_DPDRho) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* dpdrho);
+void CCTK_FCALL CCTK_FNAME(EOS_GeneralHybrid_DPDIE) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* dpdie);
+void CCTK_FCALL CCTK_FNAME(EOS_GeneralHybrid_cs2) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* cs2);
+
+CCTK_INT EOS_GeneralHybrid_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_GeneralHybrid_Pressure) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[0]);
+ break;
+ case (1):
+ CCTK_FNAME(EOS_GeneralHybrid_DPDRho) (&n_elems,
+
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[1]);
+ break;
+ case (2):
+ CCTK_FNAME(EOS_GeneralHybrid_DPDIE) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[2]);
+ break;
+ case (3):
+ CCTK_FNAME(EOS_GeneralHybrid_cs2) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[3]);
+ break;
+ }
+ }
+ }
+
+ return ierr;
+}
diff --git a/src/EOS_GeneralHybrid.h b/src/EOS_GeneralHybrid.h
new file mode 100755
index 0000000..8c98260
--- /dev/null
+++ b/src/EOS_GeneralHybrid.h
@@ -0,0 +1,15 @@
+#ifndef EOS_GENERALHYBRID_H
+#define EOS_GENERALHYBRID_H
+
+#include "cctk.h"
+
+#define N_INDEPS 2
+#define N_DEPS 4
+
+CCTK_INT EOS_GeneralHybrid_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_GeneralHybrid_Analysis.F90 b/src/EOS_GeneralHybrid_Analysis.F90
new file mode 100755
index 0000000..3fea75e
--- /dev/null
+++ b/src/EOS_GeneralHybrid_Analysis.F90
@@ -0,0 +1,74 @@
+ /*@@
+ @file EOS_GeneralHybrid_Analysis.F
+ @date
+ @author Harry Dimmelmeier, Ian Hawke, Christian Ott
+ @desc
+ Calculates the polytropic and thermal contributions to the
+ total pressure.
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+ /*@@
+ @routine Check_Poly_Contrib_General
+ @date
+ @author Harry Dimmelmeier, Ian Hawke, Christian Ott
+ @desc
+ The routine that calculates the contributions.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+@@*/
+
+subroutine Check_Poly_Contrib_General(CCTK_ARGUMENTS)
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+
+ DECLARE_CCTK_ARGUMENTS
+ DECLARE_CCTK_PARAMETERS
+
+ CCTK_INT :: i,j,k
+
+
+ CCTK_REAL local_eos_gamma, local_eos_k_cgs, d_p_poly, d_p_th_1, &
+ d_p_th_2, zero
+
+ do k = 1, cctk_lsh(3)
+ do j = 1, cctk_lsh(2)
+ do i = 1, cctk_lsh(1)
+
+ if (rho(i,j,k) > rho_nuc) then
+ local_eos_gamma = eos_gamma_supernuclear
+ local_eos_k_cgs = eos_k_supernuclear_cgs
+ else
+ local_eos_gamma = eos_gamma
+ local_eos_k_cgs = eos_k_cgs
+ end if
+
+ pressure_poly(i,j,k) = p_geom_factor * local_eos_k_cgs * &
+ (rho(i,j,k) * rho_geom_factor_inv)**local_eos_gamma
+
+ pressure_th(i,j,k) = - p_geom_factor * local_eos_k_cgs * &
+ (eos_gamma_th - 1.d0) / (local_eos_gamma - 1.d0) * &
+ (rho(i,j,k) * rho_geom_factor_inv)**local_eos_gamma + &
+ (eos_gamma_th - 1.d0) * rho(i,j,k) * eps(i,j,k) - &
+ (eos_gamma_th - 1.d0) * (local_eos_gamma - eos_gamma) / &
+ (eos_gamma - 1.d0) / (eos_gamma_supernuclear - 1.d0) * &
+ p_geom_factor * eos_k_cgs * &
+ rho_geom_factor_inv**eos_gamma * &
+ rho_nuc**(eos_gamma - 1.d0) * rho(i,j,k)
+
+ end do
+ end do
+ end do
+
+ end subroutine Check_Poly_Contrib_General
diff --git a/src/EOS_GeneralHybrid_Scalars.F90 b/src/EOS_GeneralHybrid_Scalars.F90
new file mode 100755
index 0000000..382e70e
--- /dev/null
+++ b/src/EOS_GeneralHybrid_Scalars.F90
@@ -0,0 +1,18 @@
+ /*@@
+ @file EOS_GeneralHybrid_Scalars.F
+ @date Fri Apr 26 13:14:18 2002
+ @author Harry Dimmelmeier, Ian Hawke, Christian Ott
+ @desc
+ Constant for the EOS routines.
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+
+ module EOS_GeneralHybrid_Scalars
+
+ implicit none
+
+ CCTK_REAL :: eos_k_supernuclear_cgs
+
+ end module EOS_GeneralHybrid_Scalars
diff --git a/src/EOS_GeneralHybrid_Setup.F90 b/src/EOS_GeneralHybrid_Setup.F90
new file mode 100755
index 0000000..1bb8439
--- /dev/null
+++ b/src/EOS_GeneralHybrid_Setup.F90
@@ -0,0 +1,40 @@
+ /*@@
+ @file EOS_GeneralHybrid_Setup.F90
+ @date
+ @author Ian Hawke, Christian D. Ott
+ @desc
+ Startup for EOS_Hybrid.
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+
+ /*@@
+ @routine EOS_GeneralHybrid_Setup
+ @date
+ @author Ian Hawkem, Christian d. Ott
+ @desc
+ Setup EOS_HybridScalars
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+@@*/
+
+subroutine EOS_GeneralHybrid_Setup()
+
+ USE EOS_GP_Scalars
+ USE EOS_GeneralHybrid_Scalars
+
+ implicit none
+
+ DECLARE_CCTK_PARAMETERS
+
+
+ eos_k_supernuclear_cgs = eos_k_cgs * (rho_nuc * rho_geom_factor_inv)** &
+ (eos_gamma - eos_gamma_supernuclear)
+
+end subroutine EOS_GeneralHybrid_Setup
diff --git a/src/EOS_GeneralHybrid_Startup.c b/src/EOS_GeneralHybrid_Startup.c
new file mode 100755
index 0000000..034aa11
--- /dev/null
+++ b/src/EOS_GeneralHybrid_Startup.c
@@ -0,0 +1,42 @@
+#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_GeneralHybrid.h"
+
+void EOS_GeneralHybrid_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 SpecificInternalEnergy",
+ "Independent variable names");
+ Util_TableSetString(table_handle,
+ "Pressure DPressureDRho DPressureDSpecificInternalEnergy c_s^2",
+ "Dependent variable names");
+ Util_TableSetString(table_handle,
+ "Hybrid",
+ "EOS Name");
+
+ ierr = EOS_RegisterCall(table_handle,
+ EOS_GeneralHybrid_SetArray);
+ if (ierr)
+ {
+ CCTK_WARN(0, "Failed to set up EOS_GeneralHybrid call");
+ }
+}
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100755
index 0000000..f5cab0a
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,11 @@
+# Main make.code.defn file for thorn EOS_GeneralHybrid
+# $Header$
+
+# Source files in this directory
+SRCS = EOS_GeneralHybrid.F90 EOS_GeneralHybrid_Scalars.F90 \
+ EOS_GeneralHybrid_Setup.F90 EOS_GeneralHybrid_Analysis.F90 \
+ EOS_GeneralHybrid.c EOS_GeneralHybrid_Startup.c \
+
+
+# Subdirectories containing source files
+SUBDIRS =
diff --git a/src/make.code.deps b/src/make.code.deps
new file mode 100755
index 0000000..b6bdb4b
--- /dev/null
+++ b/src/make.code.deps
@@ -0,0 +1,5 @@
+# Module dependencies for thorn EOS_GeneralHybrid
+
+EOS_GeneralHybrid.F90.o: EOS_GeneralHybrid_Scalars.F90.o
+EOS_GeneralHybrid_Analysis.F90.o: EOS_GeneralHybrid_Scalars.F90.o
+EOS_GeneralHybrid_Setup.F90.o: EOS_GeneralHybrid_Scalars.F90.o
diff --git a/src/make.configuration.deps b/src/make.configuration.deps
new file mode 100755
index 0000000..61740e1
--- /dev/null
+++ b/src/make.configuration.deps
@@ -0,0 +1,5 @@
+# Make sure that EOS_Polytrope is compiled first
+
+ifneq (,$(findstring Whisky_Dev/EOS_GeneralPolytrope,$(THORNS)))
+$(CCTK_LIBDIR)$(DIRSEP)libEOS_GeneralHybrid.a : $(CCTK_LIBDIR)$(DIRSEP)libEOS_GeneralPolytrope.a
+endif