forked from enzo-project/enzo-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HM12 Photo-ionization/heating rates can be selected now by choosing
RadiationFieldType = 15 in Enzo Config file. Still need to do some testing and the output is still overly verbose. --HG-- branch : week-of-code
- Loading branch information
Showing
7 changed files
with
365 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/*********************************************************************** | ||
/ | ||
/ INITIALIZE THE TABULATED HM12 Photo-ionization/heating rates | ||
/ | ||
/ written by: Gabriel Altay | ||
/ date: April, 2013 | ||
/ modified1: | ||
/ | ||
/ PURPOSE: | ||
/ | ||
/ RETURNS: SUCCESS or FAIL | ||
/ | ||
************************************************************************/ | ||
|
||
#include <string.h> | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include "ErrorExceptions.h" | ||
#include "macros_and_parameters.h" | ||
#include "typedefs.h" | ||
#include "global_data.h" | ||
#include "CosmologyParameters.h" | ||
|
||
int InitializeHM12Photorates() | ||
{ | ||
|
||
|
||
/* Open input file for data. */ | ||
|
||
FILE *fptr = fopen("hm12_photorates.dat", "r"); | ||
if (fptr == NULL) { | ||
ENZO_FAIL("Error opening hm12_photorates.dat\n"); | ||
} | ||
|
||
/* Read rate data, skipping over comments (count first). | ||
Note that photoheating rates are per ion in eV/s */ | ||
|
||
int index = 0; | ||
char line[MAX_LINE_LENGTH]; | ||
double ev2erg; | ||
|
||
ev2erg = 1.60217657e-12; | ||
|
||
RateData.HM12NumberOfRedshiftBins = 0; | ||
|
||
while (fgets(line, MAX_LINE_LENGTH, fptr) != NULL) { | ||
if (line[0] != '#') RateData.HM12NumberOfRedshiftBins++; | ||
} | ||
|
||
RateData.HM12Redshifts = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GH1 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GHe1 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GHe2 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GhH1 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GhHe1 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12GhHe2 = new float[RateData.HM12NumberOfRedshiftBins]; | ||
RateData.HM12Compton = new float[RateData.HM12NumberOfRedshiftBins]; | ||
|
||
rewind(fptr); | ||
while (fgets(line, MAX_LINE_LENGTH, fptr) != NULL) { | ||
if (line[0] != '#') | ||
if (sscanf(line, "%"ESYM" %"ESYM" %"ESYM" %"ESYM" %"ESYM" %"ESYM" %"ESYM" %"ESYM, | ||
&RateData.HM12Redshifts[index], | ||
&RateData.HM12GH1[index], | ||
&RateData.HM12GhH1[index], | ||
&RateData.HM12GHe1[index], | ||
&RateData.HM12GhHe1[index], | ||
&RateData.HM12GHe2[index], | ||
&RateData.HM12GhHe2[index], | ||
&RateData.HM12Compton[index]) == 8) { | ||
|
||
RateData.HM12GH1[index] = log10( RateData.HM12GH1[index] ); | ||
RateData.HM12GhH1[index] = log10( RateData.HM12GhH1[index]*ev2erg ); | ||
|
||
RateData.HM12GHe1[index] = log10( RateData.HM12GHe1[index] ); | ||
RateData.HM12GhHe1[index] = log10( RateData.HM12GhHe1[index]*ev2erg ); | ||
|
||
RateData.HM12GHe2[index] = log10( RateData.HM12GHe2[index] ); | ||
RateData.HM12GhHe2[index] = log10( RateData.HM12GhHe2[index]*ev2erg ); | ||
|
||
RateData.HM12Compton[index] = log10( RateData.HM12Compton[index]*ev2erg ); | ||
|
||
index++; | ||
|
||
} | ||
} | ||
|
||
fclose(fptr); | ||
|
||
RateData.HM12RedshiftLo = RateData.HM12Redshifts[0]; | ||
RateData.HM12RedshiftHi = RateData.HM12Redshifts[RateData.HM12NumberOfRedshiftBins-1]; | ||
|
||
if (debug) { | ||
printf("InitializeHM12Photorates: HM12NumberOfRedshiftBins = %"ISYM"\n", | ||
RateData.HM12NumberOfRedshiftBins); | ||
printf("InitializeHM12Photorates: HM12RedshiftLo = %"ESYM"\n", | ||
RateData.HM12RedshiftLo); | ||
printf("InitializeHM12Photorates: HM12RedshiftHi = %"ESYM"\n", | ||
RateData.HM12RedshiftHi); | ||
} | ||
|
||
|
||
return SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#======================================================================= | ||
# | ||
# FILE: Make.mach.honest-mistake | ||
# | ||
# DESCRIPTION: Makefile settings for my laptop | ||
# | ||
# AUTHOR: Gabriel Altay ([email protected]) | ||
# | ||
# DATE: 2013-04-11 | ||
# | ||
# This configuration assumes that build-essentials, gfortran, | ||
# OpenMPI and HDF5 have been installed using apt-get. | ||
# | ||
#======================================================================= | ||
|
||
MACH_TEXT = Generic Ubuntu | ||
MACH_VALID = 1 | ||
MACH_FILE = Make.mach.honest-mistake | ||
|
||
#----------------------------------------------------------------------- | ||
# Install paths (local variables) | ||
#----------------------------------------------------------------------- | ||
|
||
# LOCAL_HDF5_INSTALL = /usr/local/hdf5/1.8.2s | ||
LOCAL_HDF5_INSTALL = | ||
|
||
#----------------------------------------------------------------------- | ||
# Compiler settings | ||
#----------------------------------------------------------------------- | ||
|
||
MACH_CPP = cpp # C preprocessor command | ||
|
||
# With MPI | ||
|
||
MACH_CC_MPI = mpicc # C compiler when using MPI | ||
MACH_CXX_MPI = mpic++ # C++ compiler when using MPI | ||
MACH_FC_MPI = gfortran # Fortran 77 compiler when using MPI | ||
MACH_F90_MPI = gfortran # Fortran 90 compiler when using MPI | ||
MACH_LD_MPI = mpic++ # Linker when using MPI | ||
|
||
# Without MPI | ||
|
||
MACH_CC_NOMPI = gcc # C compiler when not using MPI | ||
MACH_CXX_NOMPI = g++ # C++ compiler when not using MPI | ||
MACH_FC_NOMPI = gfortran # Fortran 77 compiler when not using MPI | ||
MACH_F90_NOMPI = gfortran # Fortran 90 compiler when not using MPI | ||
MACH_LD_NOMPI = g++ # Linker when not using MPI | ||
|
||
#----------------------------------------------------------------------- | ||
# Machine-dependent defines | ||
#----------------------------------------------------------------------- | ||
|
||
MACH_DEFINES = -DLINUX -DH5_USE_16_API | ||
|
||
#----------------------------------------------------------------------- | ||
# Compiler flag settings | ||
#----------------------------------------------------------------------- | ||
|
||
|
||
MACH_CPPFLAGS = -P -traditional | ||
MACH_CFLAGS = | ||
MACH_CXXFLAGS = | ||
MACH_FFLAGS = -fno-second-underscore -ffixed-line-length-132 | ||
MACH_F90FLAGS = -fno-second-underscore | ||
MACH_LDFLAGS = | ||
|
||
#----------------------------------------------------------------------- | ||
# Optimization flags | ||
#----------------------------------------------------------------------- | ||
|
||
MACH_OPT_WARN = -Wall -g | ||
MACH_OPT_DEBUG = -g | ||
MACH_OPT_HIGH = -O2 | ||
MACH_OPT_AGGRESSIVE = -O3 -g | ||
|
||
#----------------------------------------------------------------------- | ||
# Includes | ||
#----------------------------------------------------------------------- | ||
|
||
LOCAL_INCLUDES_MPI = # MPI includes | ||
LOCAL_INCLUDES_HDF5 = -I$(LOCAL_HDF5_INSTALL)/include # HDF5 includes | ||
LOCAL_INCLUDES_HYPRE = # hypre includes | ||
LOCAL_INCLUDES_PAPI = # PAPI includes | ||
|
||
MACH_INCLUDES = $(LOCAL_INCLUDES_HDF5) | ||
|
||
MACH_INCLUDES_MPI = $(LOCAL_INCLUDES_MPI) | ||
MACH_INCLUDES_HYPRE = $(LOCAL_INCLUDES_HYPRE) | ||
MACH_INCLUDES_PAPI = $(LOCAL_INCLUDES_PAPI) | ||
|
||
#----------------------------------------------------------------------- | ||
# Libraries | ||
#----------------------------------------------------------------------- | ||
|
||
LOCAL_LIBS_MPI = # MPI libraries | ||
LOCAL_LIBS_HDF5 = -L$(LOCAL_HDF5_INSTALL)/lib -lhdf5 -lz # HDF5 libraries | ||
LOCAL_LIBS_HYPRE = # hypre libraries | ||
LOCAL_LIBS_PAPI = # PAPI libraries | ||
|
||
LOCAL_LIBS_MACH = -lgfortran # Machine-dependent libraries | ||
|
||
MACH_LIBS = $(LOCAL_LIBS_HDF5) $(LOCAL_LIBS_MACH) | ||
MACH_LIBS_MPI = $(LOCAL_LIBS_MPI) | ||
MACH_LIBS_HYPRE = $(LOCAL_LIBS_HYPRE) | ||
MACH_LIBS_PAPI = $(LOCAL_LIBS_PAPI) |
Oops, something went wrong.