[Commits] [svn:einsteintoolkit] incoming/EOS_Omni/ (Rev. 1)

cott at tapir.caltech.edu cott at tapir.caltech.edu
Tue Jun 29 09:59:02 CDT 2010


User: cott
Date: 2010/06/29 09:59 AM

Added:
 /EOS_Omni/
  README, interface.ccl, param.ccl, schedule.ccl
 /EOS_Omni/doc/
  documentation.tex
 /EOS_Omni/par/
 /EOS_Omni/src/
  EOS_Omni_Module.F90, EOS_Omni_SingleVarCalls.F90, EOS_Omni_Startup.F90, make.code.defn
 /EOS_Omni/test/

Log:
 * EOS_Omni thorn: 
     Initial implementation providing a polytrope and a gamma-law EOS for testing.

File Changes:

Directory: /EOS_Omni/
=====================

File [added]: README
Delta lines: +24 -0
===================================================================
--- EOS_Omni/README	                        (rev 0)
+++ EOS_Omni/README	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,24 @@
+Cactus Code Thorn EOS_Omni
+Author(s)    : Christian D. Ott <cott at tapir.caltech.edu>
+Maintainer(s): Christian D. Ott <cott at tapir.caltech.edu>
+Licence      : LGPL
+--------------------------------------------------------------------------
+
+This Thorn provides a one-fits-all EOS handler.
+All EOS are actually implemented right inside this single
+thorn without crazy interfaces and lots of function calls.
+
+eoskey controls the type of EOS being used:
+
+eoskey:
+
+1 --- polytropic EOS
+2 --- gamma-law EOS
+3 --- hybrid EOS
+4 --- finite-T microphysical NSE EOS
+
+
+keyerr settings:
+
+-1 -- called EOS routine with keytemp=1, but
+      routine does not allow such a call

File [added]: interface.ccl
Delta lines: +89 -0
===================================================================
--- EOS_Omni/interface.ccl	                        (rev 0)
+++ EOS_Omni/interface.ccl	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,89 @@
+# Interface definition for thorn EOS_Omni
+
+implements: EOS_Omni
+
+inherits: 
+
+void FUNCTION EOS_Omni_press(CCTK_INT IN eoskey,         \
+			     CCTK_INT IN havetemp,       \
+                             CCTK_INT IN npoints,        \
+			     CCTK_REAL IN ARRAY rho,     \
+			     CCTK_REAL INOUT ARRAY eps,  \
+			     CCTK_REAL INOUT ARRAY temp, \
+			     CCTK_REAL IN ARRAY ye,      \
+			     CCTK_REAL OUT ARRAY press,  \
+			     CCTK_INT OUT ARRAY keyerr,  \
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_press WITH EOS_Omni_EOS_Press LANGUAGE Fortran
+
+
+void FUNCTION EOS_Omni_DPressByDEps(CCTK_INT IN eoskey,         \
+			     CCTK_INT IN havetemp,              \
+                             CCTK_INT IN npoints,               \
+			     CCTK_REAL IN ARRAY rho,            \
+			     CCTK_REAL INOUT ARRAY eps,         \
+			     CCTK_REAL INOUT ARRAY temp,        \
+			     CCTK_REAL IN ARRAY ye,             \
+			     CCTK_REAL OUT ARRAY DPressByDEps,  \
+			     CCTK_INT OUT ARRAY keyerr,         \
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_DPressByDEps WITH EOS_Omni_EOS_DPressByDEps LANGUAGE Fortran
+
+
+void FUNCTION EOS_Omni_DPressByDRho(CCTK_INT IN eoskey,         \
+			     CCTK_INT IN havetemp,              \
+                             CCTK_INT IN npoints,               \
+			     CCTK_REAL IN ARRAY rho,     	\
+			     CCTK_REAL INOUT ARRAY eps,  	\
+			     CCTK_REAL INOUT ARRAY temp, 	\
+			     CCTK_REAL IN ARRAY ye,      	\
+			     CCTK_REAL OUT ARRAY DPressByDRho,  \
+			     CCTK_INT OUT ARRAY keyerr,   	\
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_DPressByDRho WITH EOS_Omni_EOS_DPressByDRho LANGUAGE Fortran
+
+
+void FUNCTION EOS_Omni_cs2(CCTK_INT IN eoskey,                  \
+			     CCTK_INT IN havetemp,              \
+                             CCTK_INT IN npoints,               \
+			     CCTK_REAL IN ARRAY rho,     	\
+			     CCTK_REAL INOUT ARRAY eps,  	\
+			     CCTK_REAL INOUT ARRAY temp, 	\
+			     CCTK_REAL IN ARRAY ye,      	\
+			     CCTK_REAL OUT ARRAY cs2,  		\
+			     CCTK_INT OUT ARRAY keyerr,   	\
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_cs2 WITH EOS_Omni_EOS_cs2 LANGUAGE Fortran
+
+
+void FUNCTION EOS_Omni_EpsFromPress(CCTK_INT IN eoskey,         \
+			     CCTK_INT IN havetemp,        	\
+                             CCTK_INT IN npoints,        	\
+			     CCTK_REAL IN ARRAY rho,     	\
+			     CCTK_REAL INOUT ARRAY eps,  	\
+			     CCTK_REAL INOUT ARRAY temp, 	\
+			     CCTK_REAL IN ARRAY ye,      	\
+			     CCTK_REAL IN ARRAY press,  	\
+			     CCTK_REAL OUT ARRAY xeps,  	\
+			     CCTK_INT OUT ARRAY keyerr,   	\
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_EpsFromPress WITH EOS_Omni_EOS_eps_from_press LANGUAGE Fortran
+
+
+void FUNCTION EOS_Omni_RestMassDensityFromEpsPress(CCTK_INT IN eoskey,       \
+			     CCTK_INT IN havetemp,           		     \
+                             CCTK_INT IN npoints,        		     \
+			     CCTK_REAL OUT ARRAY rho,     		     \
+			     CCTK_REAL IN ARRAY eps,  		     	     \
+			     CCTK_REAL INOUT ARRAY temp, 		     \
+			     CCTK_REAL IN ARRAY ye,      		     \
+			     CCTK_REAL IN ARRAY press,  		     \
+			     CCTK_INT OUT ARRAY keyerr,   		     \
+                             CCTK_INT OUT anyerr)
+
+PROVIDES FUNCTION EOS_Omni_RestMassDensityFromEpsPress WITH EOS_Omni_EOS_RestMassDensityFromEpsPress LANGUAGE Fortran

File [added]: param.ccl
Delta lines: +26 -0
===================================================================
--- EOS_Omni/param.ccl	                        (rev 0)
+++ EOS_Omni/param.ccl	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,26 @@
+# Parameter definitions for thorn EOS_Omni
+
+
+restricted:
+
+# poly EOS
+CCTK_REAL poly_gamma "Adiabatic Index for poly EOS"
+{
+ : :: ""
+} 2.0
+
+REAL poly_k "Polytropic constant in c=G=Msun=1" 
+{
+ : :: ""
+} 100.0
+
+# gamma-law EOS
+CCTK_REAL gl_gamma "Adiabatic Index for gamma-law EOS"
+{
+ : :: ""
+} 2.0
+
+REAL gl_k "Polytropic constant in c=G=Msun=1 for gamma-law EOS" 
+{
+ : :: ""
+} 100.0

File [added]: schedule.ccl
Delta lines: +8 -0
===================================================================
--- EOS_Omni/schedule.ccl	                        (rev 0)
+++ EOS_Omni/schedule.ccl	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,8 @@
+# Schedule definitions for thorn EOS_Omni
+
+
+schedule EOS_Omni_Startup AT WRAGH
+{
+ LANG: Fortran
+ OPTIONS: global
+} "Set up conversion factors and other fun stuff"

Directory: /EOS_Omni/doc/
=========================

File [added]: documentation.tex
Delta lines: +144 -0
===================================================================
--- EOS_Omni/doc/documentation.tex	                        (rev 0)
+++ EOS_Omni/doc/documentation.tex	2010-06-29 14:59:02 UTC (rev 1)
@@ -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 at tapir.caltech.edu\textgreater}
+
+% The title of the document (not necessarily the name of the Thorn)
+\title{EOS\_Omni}
+
+% the date your document was last changed, if your document is in CVS,
+% please use:
+%    \date{$ $Date: 2004-01-07 12:12:39 -0800 (Wed, 07 Jan 2004) $ $}
+\date{June 27 2010}
+
+\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}

Directory: /EOS_Omni/src/
=========================

File [added]: EOS_Omni_Module.F90
Delta lines: +22 -0
===================================================================
--- EOS_Omni/src/EOS_Omni_Module.F90	                        (rev 0)
+++ EOS_Omni/src/EOS_Omni_Module.F90	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,22 @@
+module EOS_Omni_Module
+
+  implicit none
+
+  real*8,parameter :: rho_gf = 1.61930347d-18
+  real*8,parameter :: press_gf = 1.80171810d-39
+  real*8,parameter :: eps_gf = 1.11265006d-21
+  real*8,parameter :: time_gf = 2.03001708d+05
+  real*8,parameter :: mass_gf = 5.02765209d-34
+  real*8,parameter :: length_gf = 6.77140812d-06
+  
+  real*8,parameter :: inv_rho_gf = 6.17549470205236d17
+  real*8,parameter :: inv_press_gf = 5.55025783445257d38
+  real*8,parameter :: inv_eps_gf = 8.98755175549085d20
+  real*8,parameter :: inv_time_gf = 4.92606692747629d-6
+  real*8,parameter :: inv_mass_gf = 1.98899999860571d33
+  real*8,parameter :: inv_length_gf = 147679.77092481d0
+
+  real*8 :: poly_k_cgs = 0.0d0
+  real*8 :: gl_k_cgs   = 0.0d0
+
+end module EOS_Omni_Module

File [added]: EOS_Omni_SingleVarCalls.F90
Delta lines: +333 -0
===================================================================
--- EOS_Omni/src/EOS_Omni_SingleVarCalls.F90	                        (rev 0)
+++ EOS_Omni/src/EOS_Omni_SingleVarCalls.F90	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,333 @@
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
+
+! eoskey:
+! 1 --- polytropic EOS
+! 2 --- gamma-law EOS
+! 3 --- hybrid EOS
+! 4 --- finite-T microphysical NSE EOS
+
+subroutine EOS_Omni_EOS_Press(eoskey,keytemp,npoints,&
+                              rho,eps,temp,ye,press,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: press(npoints)
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+
+  anyerr    = 0
+  keyerr(:) = 0
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * poly_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(poly_gamma) / &
+                   (poly_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           press(i) = press_gf * poly_k_cgs * &
+                (rho(i)*inv_rho_gf)**poly_gamma
+        enddo
+     case (2)
+        ! gamma-law EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * gl_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(gl_gamma) / &
+                   (gl_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           press(i) = (gl_gamma - 1.0d0) * rho(i) * eps(i)
+        enddo
+
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+     end select
+
+end subroutine EOS_Omni_EOS_Press
+
+
+
+subroutine EOS_Omni_EOS_DPressByDRho(eoskey,keytemp,npoints,&
+                              rho,eps,temp,ye,dpdrhoe,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: dpdrhoe(npoints)
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+
+  anyerr    = 0
+  keyerr(:) = 0
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * poly_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(poly_gamma) / &
+                   (poly_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           dpdrhoe(i) = press_gf * poly_k_cgs *  &
+                poly_gamma * inv_rho_gf *        & 
+                (rho(i)*inv_rho_gf) ** (poly_gamma - 1.d0)
+        enddo
+     case (2)
+        ! gamma-law EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * gl_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(gl_gamma) / &
+                   (gl_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           dpdrhoe(i) = (gl_gamma-1.0d0) * &
+                eps(i)
+        enddo
+
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+   end select
+     
+end subroutine EOS_Omni_EOS_DPressByDRho
+
+subroutine EOS_Omni_EOS_DPressByDEps(eoskey,keytemp,npoints,&
+                              rho,eps,temp,ye,dpdepsrho,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: dpdepsrho(npoints)
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+
+  anyerr    = 0
+  keyerr(:) = 0
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * poly_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(poly_gamma) / &
+                   (poly_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           dpdepsrho(i) = 0.0d0
+        enddo
+     case (2)
+        ! gamma-law EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * gl_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(gl_gamma) / &
+                   (gl_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           dpdepsrho(i) = (gl_gamma - 1.0d0) * &
+                rho(i)
+        enddo
+
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+   end select
+     
+end subroutine EOS_Omni_EOS_DPressByDEps
+
+subroutine EOS_Omni_EOS_cs2(eoskey,keytemp,npoints,&
+                            rho,eps,temp,ye,cs2,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: cs2(npoints)
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+  real*8         :: xpress,xdpdrhoe,xdpderho
+
+  anyerr    = 0
+  keyerr(:) = 0
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * poly_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(poly_gamma) / &
+                   (poly_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           xpress = press_gf*poly_k_cgs * &
+                (rho(i)*inv_rho_gf)**(poly_gamma)
+           cs2(i) = poly_gamma * xpress / rho(i) / &
+                (1 + eps(i) + xpress/rho(i))
+        enddo
+     case (2)
+        ! gamma-law EOS
+        if(keytemp.eq.1) then
+           do i=1,npoints
+              eps(i) = press_gf * gl_k_cgs * &
+                   (rho(i)*inv_rho_gf)**(gl_gamma) / &
+                   (gl_gamma - 1.0d0) / rho(i)
+           enddo
+        endif
+        do i=1,npoints
+           xpress = (gl_gamma-1.0d0)*rho(i)*eps(i)
+           xdpdrhoe = (gl_gamma-1.0d0)*eps(i)
+           xdpderho = (gl_gamma-1.0d0)*rho(i)
+           cs2(i) = (xdpdrhoe + xpress * xdpderho / (rho(i)**2)) / &
+                (1.0d0 + eps(i) + xpress/rho(i))
+        enddo
+
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+   end select
+     
+end subroutine EOS_Omni_EOS_cs2
+
+
+subroutine EOS_Omni_EOS_eps_from_press(eoskey,keytemp,npoints,&
+                              rho,eps,temp,ye,press,xeps,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: rho(npoints),ye(npoints),press(npoints)
+  CCTK_REAL, intent(inout) :: eps(npoints), temp(npoints)
+  CCTK_REAL, intent(out)   :: xeps(npoints)
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+
+  if(keytemp.eq.1) then
+     anyerr = 1
+     keyerr(:) = -1
+  else
+     anyerr    = 0
+     keyerr(:) = 0
+  endif
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        do i=1,npoints
+           xeps(i) = press(i) / (poly_gamma - 1.0d0) / rho(i)
+           eps(i)  = xeps(i)
+        enddo
+     case (2)
+        ! gamma-law EOS
+        do i=1,npoints
+           xeps(i) = press(i) / (gl_gamma - 1.0d0) / rho(i)
+           eps(i)  = xeps(i)
+        enddo
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+     end select
+
+end subroutine EOS_Omni_EOS_eps_from_press
+
+
+subroutine EOS_Omni_EOS_RestMassDensityFromEpsPress(eoskey,keytemp,npoints,&
+                              rho,eps,temp,ye,press,keyerr,anyerr)
+
+  use EOS_Omni_Module
+  implicit none
+  DECLARE_CCTK_PARAMETERS
+
+  CCTK_INT, intent(in)     :: eoskey,keytemp,npoints
+  CCTK_INT, intent(out)    :: keyerr(npoints)
+  CCTK_INT, intent(out)    :: anyerr
+  CCTK_REAL, intent(in)    :: ye(npoints),press(npoints),eps(npoints)
+  CCTK_REAL, intent(inout) :: rho(npoints),temp(npoints)
+
+
+  ! local vars
+  integer        :: i
+  character(256) :: warnstring
+
+  if(keytemp.eq.1) then
+     anyerr = 1
+     keyerr(:) = -1
+  else
+     anyerr    = 0
+     keyerr(:) = 0
+  endif
+
+  select case (eoskey)
+     case (1)
+        ! polytropic EOS
+        do i=1,npoints
+           rho(i) = press(i) / ((poly_gamma - 1.0d0)*eps(i))
+        enddo
+     case (2)
+        ! gamma-law EOS
+        do i=1,npoints
+           rho(i) = press(i) / ((gl_gamma - 1.0d0)*eps(i))
+        enddo
+     case DEFAULT
+        write(warnstring,*) "eoskey ",eoskey," not implemented!"
+        call CCTK_WARN(0,warnstring)
+     end select
+
+end subroutine EOS_Omni_EOS_RestMassDensityFromEpsPress

File [added]: EOS_Omni_Startup.F90
Delta lines: +18 -0
===================================================================
--- EOS_Omni/src/EOS_Omni_Startup.F90	                        (rev 0)
+++ EOS_Omni/src/EOS_Omni_Startup.F90	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,18 @@
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
+
+subroutine EOS_Omni_Startup(CCTK_ARGUMENTS)
+
+  use EOS_Omni_Module
+  implicit none
+
+  DECLARE_CCTK_PARAMETERS
+  DECLARE_CCTK_ARGUMENTS
+
+  poly_k_cgs = poly_k * rho_gf**poly_gamma / press_gf
+
+  gl_k_cgs   = gl_k * rho_gf**gl_gamma / press_gf
+
+end subroutine EOS_Omni_Startup

File [added]: make.code.defn
Delta lines: +7 -0
===================================================================
--- EOS_Omni/src/make.code.defn	                        (rev 0)
+++ EOS_Omni/src/make.code.defn	2010-06-29 14:59:02 UTC (rev 1)
@@ -0,0 +1,7 @@
+# Main make.code.defn file for thorn EOS_Omni
+
+# Source files in this directory
+SRCS = EOS_Omni_Module.F90 EOS_Omni_Startup.F90 EOS_Omni_SingleVarCalls.F90
+
+# Subdirectories containing source files
+SUBDIRS = 



More information about the Commits mailing list