Skip to content

Commit d7bf2d4

Browse files
author
Chris Sullivan
committed
Initial commit of the refactored (object oriented) weak-rate library
0 parents  commit d7bf2d4

23 files changed

+3626
-0
lines changed

Makefile

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
include make.inc
2+
3+
SOURCES=src/input_parser.F90 \
4+
src/nuclei_distribution_helpers.F90 \
5+
src/ratetable.F90 \
6+
src/rateapprox.F90 \
7+
src/ratelibrary.F90
8+
# src/interface.F90
9+
10+
ifeq ($(INCLUDE_APPROX),1)
11+
NUCLEI_HEMPEL=1
12+
#take care of EOS dependences etc
13+
EXTRAINCS = -I./src/nuc_eos
14+
EXTRADEPS = src/nuc_eos/nuc_eos.a
15+
EXTRAOBJECTS = src/nuc_eos/nuc_eos.a
16+
EXTRAINCS += $(HDF5INCS)
17+
EXTRAOBJECTS += $(HDF5LIBS)
18+
F_SOURCES = $(HEMPEL_DIRECTORY)sfho_frdm_composition_module.f
19+
F_OBJECTS=$(F_SOURCES:.f=.o )
20+
MODINC += -I$(HEMPEL_DIRECTORY)
21+
DEFS += -DINCLUDE_APPROX
22+
endif
23+
24+
25+
ifeq ($(OPENMP),1)
26+
ifeq ($(F90),gfortran)
27+
F90FLAGS += -fopenmp
28+
else
29+
F90FLAGS += -openmp
30+
endif
31+
endif
32+
33+
34+
EXTRADEPS = src/constants.inc
35+
OBJECTS=$(SOURCES:.F90=.o )
36+
ARCHIVE=weakrates.a
37+
38+
all: src/nuc_eos/nuc_eos.a weakrates.a example
39+
40+
example: $(EXTRADEPS) $(F_OBJECTS) $(OBJECTS) example.F90
41+
$(F90) $(F90FLAGS) $(DEFS) $(MODINC) $(EXTRAINCS) -o $@ example.F90 $(OBJECTS) $(F_OBJECTS) $(EXTRAOBJECTS)
42+
43+
weakrates.a: $(EXTRADEPS) $(F_OBJECTS) $(OBJECTS) $(NT_OBJECTS)
44+
ar -r src/weakrates.a src/*.o
45+
46+
$(OBJECTS): %.o: %.F90 $(EXTRADEPS)
47+
$(F90) $(F90FLAGS) $(DEFS) $(MODINC) $(EXTRAINCS) -c $< -o $@
48+
49+
$(F_OBJECTS): %.o: %.f
50+
$(F90) $(F90FLAGS) $(DEFS) $(MODINC) $(EXTRAINCS) -c $< -o $@
51+
52+
src/nuc_eos/nuc_eos.a: src/nuc_eos/*.F90 src/nuc_eos/*.f
53+
$(MAKE) -C src/nuc_eos
54+
55+
clean:
56+
rm -rf example
57+
rm -rf src/*.o
58+
rm -rf src/*~
59+
rm -rf src/*.mod
60+
rm -rf src/*.a
61+
rm -rf *.o
62+
rm -rf *.mod
63+
rm -rf *~
64+
$(MAKE) -C src/nuc_eos clean
65+
rm -rf $(HEMPEL_DIRECTORY)*.o

README

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
A Weak Interaction Rate Library With Interchangable Nuclear Data
2+
Author: Chris Sullivan ([email protected])
3+
Version 1.1
4+
5+
Copyright:
6+
----------
7+
This weak-rate library is open source, but copyrighted by Chris Sullivan.
8+
The code is released to the community under the
9+
Creative Commons attribution-noncommercial-share alike license:
10+
11+
http://creativecommons.org/licenses/by-nc-sa/3.0/us
12+
13+
The license stipulates that you may use this library but must make reference to
14+
this work, must not use it for any commercial purpose, and any code including or
15+
using these routines or part of them may be made publically available,
16+
and if so, only under the same license.
17+
18+
NOTICE: The software is provided "as is", without warranty of any kind,
19+
express or implied, including but not limited to the warranties of
20+
merchantability, fitness for a particular purpose and noninfringement.
21+
In no event shall the authors be liable for any claim, damages or
22+
other liability, whether in an action of contract, tort or otherwise,
23+
arising from, out of or in connection with the software or the use or
24+
other dealings in the software. The authors cannot guarantee they will
25+
be able to provide support for integrating these routines into your simulations
26+
if problems arise. It is the responsibility of the user of this library, not
27+
the author, to check the physical correctness and consistency of any and all
28+
outputs of this library.
29+
30+
31+
Electron-Capture Rates on Nuclei:
32+
---------------------------------
33+
34+
This library is a new module for estimating microphysical electron-capture rates on nuclei.
35+
It utilizes the formalism discussed in:
36+
37+
----[1]-----------------------------------------------------------------------------
38+
| Sullivan, C., O'Connor, E., Zegers, R. G. T., Grubb, T., & Austin, S. M. (2015). |
39+
| The Sensitivity of Core-Collapse Supernovae to Nuclear Electron Capture. |
40+
| The Astrophysical Journal (submitted) |
41+
| http://arxiv.org/abs/1508.07348 |
42+
| Contact: Chris Sullivan <[email protected]> |
43+
------------------------------------------------------------------------------------
44+
45+
At it's core, this code is a library of electron-capture rate tables and
46+
are available as a part of the ratelibrary class (set in the parameters
47+
file). In addition, number densities (abundances) and nuclear masses
48+
are needed for a large set of nuclei. These are calculated via Matthias
49+
Hempel's NSE mass distributions discussed below. This library provides
50+
a variety of weak interaction rates for over 6000 species of nuclei. Emissivities
51+
and opcaities for electron capture are provided in a sister code (NuLib), located
52+
at http://www.nulib.org/. To utilize rates from this work, one must cite the above paper
53+
as well the following publications from which the weak-rate tables derive:
54+
55+
----[2]-------------------------------------------------------------------------
56+
| Fuller, G. M., Fowler, W. A., & Newman, M. J. (1982). |
57+
| Stellar weak interaction rates for intermediate-mass nuclei. |
58+
| II - A = 21 to A = 60. The Astrophysical Journal, 252, 715. |
59+
| http://doi.org/10.1086/159597 |
60+
----[3]-------------------------------------------------------------------------
61+
| Oda, T., Hino, M., Muto, K., Takahara, M., & Sato, K. (1994). |
62+
| Rate Tables for the Weak Processes of sd-Shell Nuclei in Stellar Matter. |
63+
| Atomic Data and Nuclear Data Tables, 56(2), 231-403. |
64+
| http://doi.org/10.1006/adnd.1994.1007 |
65+
----[4]-------------------------------------------------------------------------
66+
| Langanke, K., & Mart\'{i}nez-Pinedo, G. (2000). |
67+
| Shell-model calculations of stellar weak interaction rates: |
68+
| II. Weak rates for nuclei in the mass range in supernovae environments. |
69+
| Nuclear Physics A, 673(1-4), 481-508. |
70+
| http://doi.org/10.1016/S0375-9474(00)00131-7 |
71+
----[5]-------------------------------------------------------------------------
72+
| Langanke, K., & Mart\'{i}nez-Pinedo, G. (2003). |
73+
| Electron capture rates on nuclei and implications for stellar core collapse. |
74+
| Physical Review Letters 90, 241102. |
75+
| http://prl.aps.org/abstract/PRL/v90/i24/e241102 |
76+
--------------------------------------------------------------------------------
77+
78+
In addition to the above rate tables, this library employes an approximate routine
79+
for estimating the electron capture and neutrino energy loss rates for nuclei
80+
which are not included in the tables, and for density and temperatures outside the
81+
range of the tabulations. This routine is an analytic extension of the
82+
rates present in the LMP data set and was introduced in reference [5] above.
83+
This routine takes as input the ground state to ground state mass difference (Q),
84+
as well as the temperature and electron chemical potential. A variety of nuclear
85+
mass tables can be used in this code via Matthias Hempel's NSE composition routines
86+
(see below for more information). Calculating the electron chemical-potential relies
87+
upon nuclear equations of state which were compiled by
88+
Evan O'Connor and Christian Ott's and are used in this code via their nuc_eos routines.
89+
These EOS are self consistent with the NSE compositions provided by Matthias Hempel.
90+
Thus, if the approximate electron capture rate routine is used, in addition to
91+
references [1] and [3], please also cite:
92+
93+
----[6]------------------------------------------------------------------------------------------------
94+
| O'Connor, E., & Ott, C. D. (2010). |
95+
| A new open-source code for spherically symmetric stellar collapse to neutron stars and black holes. |
96+
| Classical and Quantum Gravity, 27(11), 114103. |
97+
| http://doi.org/10.1088/0264-9381/27/11/114103 |
98+
----[7]------------------------------------------------------------------------------------------------
99+
| Hempel, M., & Fischer, T. (2012). |
100+
| New Equations of State in Simulations of Core-collapse Supernovae. |
101+
| The Astrophysical Journal, 70. |
102+
| http://iopscience.iop.org/0004-637X/748/1/70 |
103+
-------------------------------------------------------------------------------------------------------
104+
105+
Installation:
106+
-------------
107+
1. Clone this repository to your local machine
108+
109+
2. Copy make.inc.template to make.inc and update with correct compiler information
110+
(Some options default options are implemented which should work for most users)
111+
112+
3. Run 'Make'
113+
114+
4. An input parameter file 'parameters_template' is located in the top leve directory.
115+
Rename the file to 'parameters' and set the relevant options here, including the
116+
absolute paths to the desired rate tables. Rate tables can be downloaded from:
117+
[LINK]
118+
119+
* That's it! The example executable should have compiled and be ready to use. *
120+
121+
------------------
122+
123+
5. (optional) If approximate rate estimates for nuclei not included in the tabulated
124+
rate files are desired (see ref. [1])), an EOS and mass table will be necessary.
125+
This code utilizes the EOS driver routines and EOS from E. O'Connor and C. D. Ott
126+
located at http://www.stellarcollapse.org/equationofstate. Visit this website and
127+
obtain the EOS table of choice.
128+
129+
6. (optional) The EOS driver (nuc_eos module), requires the HDF5 libraries. They must be
130+
compiled with the same compiler that is used to compile this code. Two options exist:
131+
(a) download and compile the HDF5 libraries and update the relevant flags in make.inc
132+
(b) download the mesasdk (http://www.astro.wisc.edu/~townsend/static.php?ref=mesasdk)
133+
and utilize the gfortran compiler and HDF5 libs within it.
134+
135+
7. (optional) Matthias Hempel's NSE mass distributions (which include the necessary
136+
mass tables) are available from http://phys-merger.physik.unibas.ch/~hempel/eos.html.
137+
To enable these, the user must download the composition code and tables from his
138+
website and update the HEMPEL_DIRECTORY preprocessor flag to point to the directory
139+
of this library in make.inc. The SFHo table and EOS is used as an example in the
140+
code, you can change this by editting nuclei_distribution_helpers.F90 directly.
141+
Please see this file for more details.
142+
143+
8. (optional) A few small changes must be made to xxxx_xxxx_composition_module.f as
144+
provided by M. Hempel if the weak_rates module (electron-capture rates). Primarily
145+
a public (non-private) copy of the loaded nuclear masses must be exposed. e.g. for
146+
the SFHo EOS, one must add the following to the source file:
147+
148+
---------------------------------------------------
149+
| double precision, dimension(kmax) :: sfho_mass |
150+
|---------------------- & ------------------------|
151+
| sfho_mass = mass |
152+
---------------------------------------------------
153+
* Finally, update the path inside the *_composition.f to correctly point to the
154+
compotion binary.

example.F90

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
!-*-f90-*-
2+
program example
3+
use nuclei_hempel
4+
use class_ratelibrary
5+
implicit none
6+
!NuLib parameters file (weak rates and EOS)
7+
character*200 :: parameters_filename = "parameters"
8+
type(RateLibrary) :: weakrate_library
9+
include 'src/constants.inc'
10+
11+
m_ref = m_amu
12+
call set_up_Hempel !set's up EOS for nuclear abundances
13+
weakrate_library = new_RateLibrary(parameters_filename)
14+
!print *, in_table(weakrate_library,78,33,10.0d0,10.0d0)
15+
16+
17+
end program example

make.inc.template

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
F90=gfortran
2+
F90FLAGS= -O3 -ffree-line-length-none
3+
MODINC=-I./
4+
5+
#if you want to take advantage of openmp, set OPENMP=1
6+
OPENMP=0
7+
8+
#utilize the approximate rate routines (=1)
9+
INCLUDE_APPROX=0
10+
###### Below this line: only necessary if INCLUDE_APPROX=1
11+
12+
HEMPEL_DIRECTORY=./src/hempel/sfho_frdm_comp/
13+
14+
#You must have a HDF5 version installed with the _same_
15+
#compiler, this often means compiling it by yourself.
16+
#The mesasdk (see README), provides a version of gfortran
17+
#and HDF5 libraries compiled with it than can also be used
18+
19+
HDF5DIR=/projects/ceclub/gr1dnulib/mesasdk
20+
HDF5INCS=-I$(HDF5DIR)/include
21+
HDF5LIBS=-L$(HDF5DIR)/lib -lhdf5 -lhdf5_fortran -lhdf5 -lz

parameters

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ####### EOS parameters #######
2+
eos_table_name = "./src/hempel/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817.h5"
3+
4+
####### Weak interaction parameters #######
5+
directory = "./tables/"
6+
lmp_rates = "lmprates.dat"
7+
lmsh_rates = "lmshrates.dat"
8+
oda_rates = "odarates.dat"
9+
ffn_rates = "ffnrates.dat"
10+
11+
## Rate table priority hierarchy ##
12+
ilmp = 1
13+
ilmsh = 2
14+
ioda = 3
15+
iffn = 0
16+
iapprox = 4
17+
18+
# 0 indicates the table will not be used
19+
# 1 indicates highest priority, if other tables have rates for a nuclei contained in this table, they will be ignored.
20+
# CITATION NOTICE: By using the ilmp/ilmsh/iffn/ioda/iapprox flags you agree to cite the relevant publications in your work.
21+
------------------------------------------------------------------------------------------
22+
| iffn | Fuller, G. M., Fowler, W. A., & Newman, M. J. (1982). |
23+
| | Stellar weak interaction rates for intermediate-mass nuclei. |
24+
| | II - A = 21 to A = 60. The Astrophysical Journal, 252, 715. |
25+
| | http://doi.org/10.1086/159597 |
26+
------------------------------------------------------------------------------------------
27+
| ioda | Oda, T., Hino, M., Muto, K., Takahara, M., & Sato, K. (1994). |
28+
| | Rate Tables for the Weak Processes of sd-Shell Nuclei in Stellar Matter. |
29+
| | Atomic Data and Nuclear Data Tables, 56(2), 231-403. |
30+
| | http://doi.org/10.1006/adnd.1994.1007 |
31+
------------------------------------------------------------------------------------------
32+
| ilmp | Langanke, K., & Mart\'{i}nez-Pinedo, G. (2000). |
33+
| | Shell-model calculations of stellar weak interaction rates: |
34+
| | II. Weak rates for nuclei in the mass range in supernovae environments. |
35+
| | Nuclear Physics A, 673(1-4), 481-508. |
36+
| | http://doi.org/10.1016/S0375-9474(00)00131-7 |
37+
------------------------------------------------------------------------------------------
38+
| ilmsh | Langanke, K., & Mart\'{i}nez-Pinedo, G. (2003). |
39+
| iapprox | Electron capture rates on nuclei and implications for stellar core collapse. |
40+
| | Physical Review Letters 90, 241102. |
41+
| | http://prl.aps.org/abstract/PRL/v90/i24/e241102 |
42+
------------------------------------------------------------------------------------------
43+

src/constants.inc

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
!enum
2+
integer, parameter :: total_eos_variables = 15
3+
integer, parameter :: rhoindex =1
4+
integer, parameter :: tempindex = 2
5+
integer, parameter :: yeindex = 3
6+
integer, parameter :: energyindex = 4
7+
integer, parameter :: xaindex = 5
8+
integer, parameter :: xhindex = 6
9+
integer, parameter :: xnindex = 7
10+
integer, parameter :: xpindex = 8
11+
integer, parameter :: abarindex = 9
12+
integer, parameter :: zbarindex = 10
13+
integer, parameter :: mueindex = 11
14+
integer, parameter :: munindex = 12
15+
integer, parameter :: mupindex = 13
16+
integer, parameter :: muhatindex = 14
17+
integer, parameter :: entropyindex = 15
18+
19+
!constants
20+
real*8, parameter :: sigma0 = 1.761d-44 !cm^2
21+
real*8, parameter :: Gfermi = 1.16637d-11 !MeV^-2
22+
real*8, parameter :: gA = 1.254d0 !dimensionless
23+
real*8, parameter :: delta_np = 1.293332d0 !MeV
24+
real*8, parameter :: m_e = 0.510998910d0 !MeV
25+
real*8, parameter :: m_e_x2 = (0.510998910d0)**2 !MeV^2
26+
real*8, parameter :: m_n = 939.565346d0 !MeV
27+
real*8, parameter :: m_p = 938.272013d0 !MeV
28+
real*8, parameter :: m_amu = 931.494061d0 !MeV
29+
real*8, parameter :: m_alpha = 3727.379240 !MeV
30+
real*8, parameter :: sin2thetaW = 0.23d0 !dimensionless
31+
real*8, parameter :: clight = 29979245800.0d0 !cm/s
32+
real*8, parameter :: pi = 3.141592653589793238462643383279d0
33+
real*8, parameter :: hbarc_ergcm = 3.1615262d-17! in erg*cm
34+
real*8, parameter :: hbarc_mevcm = 1.97326966d-11! in MeV*cm
35+
real*8, parameter :: FSC = 7.2973525376d-3 !dimensionless
36+
real*8, parameter :: log10exp = 0.43429448190325182765 !dimensionless = log_{10}(exp(1))
37+
real*8, parameter :: planck = 6.626176d-27 !h (i.e. hbar*2*pi), in cgs
38+
real*8, parameter :: avo = 6.0221367d23 !N_A, avogadro's number
39+
40+
!conversions
41+
real*8, parameter :: mev_to_gram = 1.782661758d-27 !one MeV is # grams
42+
real*8, parameter :: mev_to_erg = 1.60217733d-6 !one MeV is # ergs
43+
real*8, parameter :: kelvin_to_mev = 8.6173423d-11 !one K is # MeV
44+
45+

0 commit comments

Comments
 (0)