aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@9002d74a-9e00-4850-b1cf-9d84fd065b5d>2009-12-02 22:22:53 +0000
committerknarf <knarf@9002d74a-9e00-4850-b1cf-9d84fd065b5d>2009-12-02 22:22:53 +0000
commitd324ef7f4c2e2de9b29f3110e3d25f5bff1d16a6 (patch)
tree30fd9eb39302e9d9928c153fc406d8b0f8f81b2e
parent8dae45ad0c7465172e619abffc7a0e4e8d9cfef0 (diff)
thorns for general eos interface (moved from Whisky_Dev repositories)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEOS/EOSG_IdealFluid/trunk@2 9002d74a-9e00-4850-b1cf-9d84fd065b5d
-rwxr-xr-xREADME11
-rwxr-xr-xdoc/documentation.tex144
-rwxr-xr-xinterface.ccl14
-rwxr-xr-xparam.ccl15
-rwxr-xr-xschedule.ccl12
-rwxr-xr-xsrc/EOS_GIF.F9084
-rwxr-xr-xsrc/EOS_GIF.c91
-rwxr-xr-xsrc/EOS_GIF.h15
-rwxr-xr-xsrc/EOS_GIF_Scalars.F9020
-rwxr-xr-xsrc/EOS_GIF_Setup.F9026
-rwxr-xr-xsrc/EOS_GIF_Setup.c42
-rwxr-xr-xsrc/make.code.defn12
-rwxr-xr-xsrc/make.code.deps4
13 files changed, 490 insertions, 0 deletions
diff --git a/README b/README
new file mode 100755
index 0000000..900cea8
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+CVS info : $Header$
+
+Cactus Code Thorn EOS_GeneralIdealFluid
+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 standard ideal fluid EOS through the general EOS
+interface.
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100755
index 0000000..c0d4a75
--- /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 17 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..c28819e
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,14 @@
+# Interface definition for thorn EOS_GeneralIdealFluid
+# $Header$
+
+implements: EOS_IdealFluid
+
+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..fb36d09
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,15 @@
+# Parameter definitions for thorn EOS_GeneralIdealFluid
+# $Header$
+
+private:
+
+REAL eos_ideal_fluid_gamma "Adiabatic Index for Ideal Fluid"
+{
+ : :: "Strictly greater than 1 is probably a good idea"
+} 2.0
+
+REAL mean_molecular_weight "Allows a temperature to be defined"
+{
+ (0.0:* :: "Strictly greater than zero"
+} 1.0
+
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100755
index 0000000..a7560c5
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,12 @@
+# Schedule definitions for thorn EOS_GeneralIdealFluid
+# $Header$
+
+schedule EOS_GIF_Startup IN EOSBase_GeneralRegister
+{
+ LANGUAGE: C
+} "Register the ideal fluid EOS"
+
+schedule EOS_GIF_Setup IN EOSBase_GeneralRegister
+{
+ LANGUAGE: Fortran
+} "Set up scalars for the ideal fluid EOS"
diff --git a/src/EOS_GIF.F90 b/src/EOS_GIF.F90
new file mode 100755
index 0000000..b8cef15
--- /dev/null
+++ b/src/EOS_GIF.F90
@@ -0,0 +1,84 @@
+ /*@@
+ @file EOS_GIF.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_GIF_Pressure(nelems, rho, eps, press)
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho, eps
+ CCTK_REAL, dimension(nelems), intent(out) :: press
+
+ press = (eos_if_gamma_local - 1.d0) * rho * eps
+
+end subroutine EOS_GIF_Pressure
+
+subroutine EOS_GIF_DPDRho(nelems, rho, eps, dpdrho)
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho, eps
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdrho
+
+ dpdrho = (eos_if_gamma_local - 1.d0) * eps
+
+end subroutine EOS_GIF_DPDRho
+
+subroutine EOS_GIF_DPDIE(nelems, rho, eps, dpdie)
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho, eps
+ CCTK_REAL, dimension(nelems), intent(out) :: dpdie
+
+ dpdie = (eos_if_gamma_local - 1.d0) * rho
+
+end subroutine EOS_GIF_DPDIE
+
+subroutine EOS_GIF_cs2(nelems, rho, eps, cs2)
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho, eps
+ CCTK_REAL, dimension(nelems), intent(out) :: cs2
+
+ cs2 = eos_if_gamma_local * (eos_if_gamma_local - 1.d0) * eps / &
+ (1.d0 + eos_if_gamma_local * eps)
+
+end subroutine EOS_GIF_cs2
+
+subroutine EOS_GIF_Temp(nelems, rho, eps, temperature)
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ CCTK_INT, intent(in) :: nelems
+ CCTK_REAL, dimension(nelems), intent(in) :: rho, eps
+ CCTK_REAL, dimension(nelems), intent(out) :: temperature
+
+ temperature = (eos_if_gamma_local - 1.d0) * eps * &
+ mean_molecular_weight_local / &
+ k_boltzmann
+
+end subroutine EOS_GIF_Temp
diff --git a/src/EOS_GIF.c b/src/EOS_GIF.c
new file mode 100755
index 0000000..4947aa9
--- /dev/null
+++ b/src/EOS_GIF.c
@@ -0,0 +1,91 @@
+#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_GIF.h"
+
+void CCTK_FCALL CCTK_FNAME(EOS_GIF_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_GIF_IntEn) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* inten);
+void CCTK_FCALL CCTK_FNAME(EOS_GIF_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_GIF_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_GIF_cs2) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* cs2);
+void CCTK_FCALL CCTK_FNAME(EOS_GIF_Temp) (const CCTK_INT* nelems,
+ const CCTK_REAL* const rho,
+ const CCTK_REAL* const eps,
+ const CCTK_REAL* temperature);
+CCTK_INT EOS_GIF_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;
+
+/* printf("A call to the ideal fluid EOS.\n" */
+/* "n_elems %d.\n", n_elems); */
+
+ for (var = 0; var < N_DEPS; ++var)
+ {
+ if (which_deps_to_set[var])
+ {
+ switch (var)
+ {
+ case (0):
+ CCTK_FNAME(EOS_GIF_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_GIF_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_GIF_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_GIF_cs2) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[3]);
+ break;
+ case (4):
+ CCTK_FNAME(EOS_GIF_Temp) (&n_elems,
+ (const CCTK_REAL*)indep_vars[0],
+ (const CCTK_REAL*)indep_vars[1],
+ (const CCTK_REAL*)dep_vars[4]);
+ break;
+ }
+ }
+ }
+
+ return ierr;
+}
diff --git a/src/EOS_GIF.h b/src/EOS_GIF.h
new file mode 100755
index 0000000..2e81ea0
--- /dev/null
+++ b/src/EOS_GIF.h
@@ -0,0 +1,15 @@
+#ifndef EOS_GIF_H
+#define EOS_GIF_H
+
+#include "cctk.h"
+
+#define N_INDEPS 2
+#define N_DEPS 5
+
+CCTK_INT EOS_GIF_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_GIF_Scalars.F90 b/src/EOS_GIF_Scalars.F90
new file mode 100755
index 0000000..5a9c588
--- /dev/null
+++ b/src/EOS_GIF_Scalars.F90
@@ -0,0 +1,20 @@
+ /*@@
+ @file EOS_GIF_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_GIF_Scalars
+
+ implicit none
+
+ CCTK_REAL :: eos_if_gamma_local
+ CCTK_REAL :: mean_molecular_weight_local
+ CCTK_REAL :: k_boltzmann
+
+end module EOS_GIF_Scalars
diff --git a/src/EOS_GIF_Setup.F90 b/src/EOS_GIF_Setup.F90
new file mode 100755
index 0000000..5b5d56f
--- /dev/null
+++ b/src/EOS_GIF_Setup.F90
@@ -0,0 +1,26 @@
+ /*@@
+ @file EOS_GIF_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_GIF_Setup()
+
+ USE EOS_GIF_Scalars
+
+ implicit none
+
+ DECLARE_CCTK_PARAMETERS
+
+ eos_if_gamma_local = eos_ideal_fluid_gamma
+ mean_molecular_weight_local = mean_molecular_weight
+ k_boltzmann = 1.d80
+
+end subroutine EOS_GIF_Setup
diff --git a/src/EOS_GIF_Setup.c b/src/EOS_GIF_Setup.c
new file mode 100755
index 0000000..330c97c
--- /dev/null
+++ b/src/EOS_GIF_Setup.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_GIF.h"
+
+void EOS_GIF_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 Temperature",
+ "Dependent variable names");
+ Util_TableSetString(table_handle,
+ "Ideal Fluid",
+ "EOS Name");
+
+ ierr = EOS_RegisterCall(table_handle,
+ EOS_GIF_SetArray);
+ if (ierr)
+ {
+ CCTK_WARN(0, "Failed to set up EOS_IdealFluid call");
+ }
+}
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100755
index 0000000..8359d5e
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,12 @@
+# Main make.code.defn file for thorn EOS_GeneralIdealFluid
+# $Header$
+
+# Source files in this directory
+SRCS = EOS_GIF_Setup.c \
+ EOS_GIF.c \
+ EOS_GIF.F90 \
+ EOS_GIF_Scalars.F90 \
+ EOS_GIF_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..77c94cd
--- /dev/null
+++ b/src/make.code.deps
@@ -0,0 +1,4 @@
+# Module dependencies for thorn EOS_GeneralIdealFluid
+
+EOS_GIF.F90.o: EOS_GIF_Scalars.F90.o
+EOS_GIF_Setup.F90.o: EOS_GIF_Scalars.F90.o