diff options
author | knarf <knarf@9002d74a-9e00-4850-b1cf-9d84fd065b5d> | 2009-12-02 22:22:53 +0000 |
---|---|---|
committer | knarf <knarf@9002d74a-9e00-4850-b1cf-9d84fd065b5d> | 2009-12-02 22:22:53 +0000 |
commit | d324ef7f4c2e2de9b29f3110e3d25f5bff1d16a6 (patch) | |
tree | 30fd9eb39302e9d9928c153fc406d8b0f8f81b2e /src | |
parent | 8dae45ad0c7465172e619abffc7a0e4e8d9cfef0 (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
Diffstat (limited to 'src')
-rwxr-xr-x | src/EOS_GIF.F90 | 84 | ||||
-rwxr-xr-x | src/EOS_GIF.c | 91 | ||||
-rwxr-xr-x | src/EOS_GIF.h | 15 | ||||
-rwxr-xr-x | src/EOS_GIF_Scalars.F90 | 20 | ||||
-rwxr-xr-x | src/EOS_GIF_Setup.F90 | 26 | ||||
-rwxr-xr-x | src/EOS_GIF_Setup.c | 42 | ||||
-rwxr-xr-x | src/make.code.defn | 12 | ||||
-rwxr-xr-x | src/make.code.deps | 4 |
8 files changed, 294 insertions, 0 deletions
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 |