Skip to content

Commit

Permalink
Merge branch 'development' into pynucastro_nse_table
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Oct 24, 2023
2 parents 9388d54 + ebdb5b8 commit 5086829
Show file tree
Hide file tree
Showing 96 changed files with 17,045 additions and 1,046 deletions.
62 changes: 62 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# http://EditorConfig.org
#
# precedence of rules is bottom to top

# this is the top-most EditorConfig file
root = true


[*.{c,h,cpp,hpp,H,py}]
# 4 space indentation
indent_style = space
indent_size = 4

# Clean up trailing whitespace
trim_trailing_whitespace = true

# unix-style newlines
end_of_line = lf

# newline ending in files
insert_final_newline = true

[networks/**/reaclib_rates.H]
# some reaclib rate labels have trailing spaces
trim_trailing_whitespace = false


[*.md]
# two end of line whitespaces are newlines without a paragraph
trim_trailing_whitespace = false


[*.rst]
# Enforce UTF-8 encoding
charset = utf-8

# Unix-style newlines
end_of_line = lf

# Newline ending in files
insert_final_newline = true

# 3 space indentation
indent_style = space
indent_size = 3

# Clean up trailing whitespace
trim_trailing_whitespace = true

[{Makefile,GNUmakefile,Make.*}]
# TABs are part of its syntax
indent_style = tab
indent_size = unset


[util/gcem/**]
# don't mess with the gcem subtree
indent_style = unset
indent_size = unset
trim_trailing_whitespace = unset
end_of_line = unset
insert_final_newline = unset
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Replaced tabs with spaces and trimmed trailing whitespace
5a2247f598f88f80ad8b186188fccfd5537b18d3
2 changes: 1 addition & 1 deletion .github/workflows/burn_cell_primordial_chem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
value2=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution.out)
difference=$(awk -v val1="$value1" -v val2="$value2" 'BEGIN { printf "%.2f", (val1 - val2) / val2 }')
if (( $(echo "$difference > $threshold" | bc -l) )); then
echo "Line number: $line_number"
echo "Value in test.out: $value1"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '[0-9][0-9].[0-9][0-9]'
- '[0-9][0-9].[0-9][0-9]'

name: Create Release

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/find_changed_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def find_files(SHAs=None):
if stderr is not None:
raise Exception('git diff encountered an error')

files = [f for f in stdout.decode('utf-8').strip().split('\n')
files = [f for f in stdout.decode('utf-8').strip().split('\n')
if f.startswith('networks/')]
print(files)

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/get_release_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
txt = txt[m.end():].strip()
else:
txt = ""
# we now need to substitute characters in the string so that
# the action can deal with line breaks

# we now need to substitute characters in the string so that
# the action can deal with line breaks
txt = txt.replace('%', '%25')
txt = txt.replace('\n', '%0A')
txt = txt.replace('\r', '%0D')
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos_build_cell_primordial_chem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:

- name: Install dependencies
run: |
brew install cmake openmpi python3
brew install cmake openmpi python3 || true
brew link --overwrite [email protected]
- name: Compile and run
run: |
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Style

on: [push, pull_request]

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-style
cancel-in-progress: true

jobs:
tabs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Tabs
run: .github/workflows/style/check_tabs.sh

trailing_whitespaces:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Trailing Whitespaces
run: .github/workflows/style/check_trailing_whitespaces.sh
36 changes: 36 additions & 0 deletions .github/workflows/style/check_tabs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -eu -o pipefail

find . -type d \( -name .git \
-o -path ./paper \
-o -name build -o -name install \
-o -name tmp_build_dir -o -name tmp_install_dir \
\) -prune -o \
-type f \( \( -name "*.H" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" \
-o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.cxx" \
-o -name "*.f" -o -name "*.F" -o -name "*.f90" -o -name "*.F90" \
-o -name "*.py" \
-o -name "*.md" -o -name "*.rst" \
-o -name "*.sh" \
-o -name "*.tex" \
-o -name "*.txt" \
-o -name "*.yml" \) \
-a \( ! -name "*.tab.h" -a ! -name "*.tab.nolint.H" \
-a ! -name "*.lex.h" -a ! -name "*.lex.nolint.H" \) \
\) \
-exec grep -Iq . {} \; \
-exec sed -i 's/\t/\ \ \ \ /g' {} +

gitdiff=`git diff`

if [ -z "$gitdiff" ]
then
exit 0
else
echo -e "\nTabs are not allowed. Changes suggested by"
echo -e " ${0}\n"
git --no-pager diff
echo ""
exit 1
fi
38 changes: 38 additions & 0 deletions .github/workflows/style/check_trailing_whitespaces.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -eu -o pipefail

find . -type d \( -name .git \
-o -path ./paper \
-o -name build -o -name install \
-o -name tmp_build_dir -o -name tmp_install_dir \
-o -path ./util/gcem \
\) -prune -o \
-type f \( \( -name "*.H" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" \
-o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.cxx" \
-o -name "*.f" -o -name "*.F" -o -name "*.f90" -o -name "*.F90" \
-o -name "*.py" \
-o -name "*.rst" \
-o -name "*.sh" \
-o -name "*.tex" \
-o -name "*.txt" \
-o -name "*.yml" \) \
-a \( ! -name "*.tab.h" -a ! -name "*.tab.nolint.H" \
-a ! -name "*.lex.h" -a ! -name "*.lex.nolint.H" \
-a ! -path "./networks/*/reaclib_rates.H" \) \
\) \
-exec grep -Iq . {} \; \
-exec sed -i 's/[[:blank:]]\+$//g' {} +

gitdiff=`git diff`

if [ -z "$gitdiff" ]
then
exit 0
else
echo -e "\nTrailing whitespaces at the end of a line are not allowed. Changes suggested by"
echo -e " ${0}\n"
git --no-pager diff
echo ""
exit 1
fi
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ function(setup_target_for_microphysics_compilation network_name output_dir)
set(networkdir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/general_null/")
set(networkheadertemplatefile "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/general_null/network_header.template")

set (gamma_law_dirs ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/gcem/include
set (gamma_law_dirs ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/gcem/include
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/interfaces
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/EOS ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/EOS/gamma_law
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/general_null
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/general_null
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/constants PARENT_SCOPE)

execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${EOSparamfile} ${networkparamfile}
execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${EOSparamfile} ${networkparamfile}
${VODEparamfile} ${integrationparamfile}" --use_namespace WORKING_DIRECTORY ${output_dir}/)

set(gamma_law_sources ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/interfaces/eos_data.cpp
Expand All @@ -57,12 +57,12 @@ function(setup_target_for_microphysics_compilation network_name output_dir)
set(networkheadertemplatefile "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/general_null/network_header.template")

#DO NOT change the order of the directories below!
set (primordial_chem_dirs ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/gcem/include
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/integration/VODE ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/integration/utils
set (primordial_chem_dirs ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/gcem/include
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/integration/VODE ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/integration/utils
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/integration ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/interfaces
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/EOS ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/EOS/primordial_chem
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/primordial_chem ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/constants
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks/primordial_chem ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/networks
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/constants
PARENT_SCOPE)

#we need to have extern_parameters.cpp be available at configure time
Expand All @@ -72,11 +72,11 @@ function(setup_target_for_microphysics_compilation network_name output_dir)
#to generate updated header files

if(BUILD_UNIT_TEST)
execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${paramfile} ${EOSparamfile}
execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${paramfile} ${EOSparamfile}
${networkpcparamfile} ${networkparamfile} ${VODEparamfile} ${integrationparamfile} ${unittestparamfile}" --use_namespace WORKING_DIRECTORY ${output_dir}/)
else()
#do not need paramfile and unittestparamfile
execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${EOSparamfile} ${networkpcparamfile}
execute_process(COMMAND python3 "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/util/build_scripts/write_probin.py" --pa "${EOSparamfile} ${networkpcparamfile}
${networkparamfile} ${VODEparamfile} ${integrationparamfile} " --use_namespace WORKING_DIRECTORY ${output_dir}/)
endif()

Expand Down
2 changes: 1 addition & 1 deletion EOS/breakout/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void actual_eos (I input, T& state)
}
}

// Try to avoid the expensive log function. Since we don't need entropy
// Try to avoid the expensive log function. Since we don't need entropy
// in hydro solver, set it to an invalid but "nice" value for the plotfile.
if constexpr (has_entropy<T>::value) {
state.s = 1.0_rt;
Expand Down
2 changes: 1 addition & 1 deletion EOS/eos_composition.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct eos_xderivs_t {
/// The auxiliary state provides an alternate description to the composition,
/// in terms of Ye, abar, and binding energy / nucleon
///
template <class state_t>
template <class state_t>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void set_aux_comp_from_X(state_t& state) {

Expand Down
20 changes: 16 additions & 4 deletions EOS/helmholtz/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ using namespace eos_rp;
// derivatives), number density of electrons and positron pair (along
// with their derivatives), adiabatic indices, specific heats, and
// relativistically correct sound speed are also returned.
//
//
// this routine assumes planckian photons, an ideal gas of ions,
// and an electron-positron gas with an arbitrary degree of relativity
// and degeneracy. interpolation in a table of the helmholtz free energy
// is used to return the electron-positron thermodynamic quantities.
// all other derivatives are analytic.
//
//
// references: cox & giuli chapter 24 ; timmes & swesty apj 1999

const std::string eos_name = "helmholtz";
Expand Down Expand Up @@ -510,7 +510,7 @@ void apply_ions (T& state)
Real sion = (pion * deni + eion) * tempi + kergavo * ytot1 * y;
Real dsiondd = (dpiondd * deni - pion * deni * deni + deiondd) * tempi -
kergavo * deni * ytot1;
Real dsiondt = (dpiondt * deni + deiondt) * tempi -
Real dsiondt = (dpiondt * deni + deiondt) * tempi -
(pion * deni + eion) * tempi * tempi +
1.5e0_rt * kergavo * tempi * ytot1;

Expand Down Expand Up @@ -759,7 +759,7 @@ void apply_coulomb_corrections (T& state)
decoulda = s * dpcoulda;
decouldz = s * dpcouldz;

s = -avo_eos * kerg / (state.abar * plasg) *
s = -avo_eos * kerg / (state.abar * plasg) *
(1.5e0_rt * c2 * x - a2 * (b2 - 1.0e0_rt) * y);
dscouldd = s * plasgdd;
dscouldt = s * plasgdt;
Expand Down Expand Up @@ -1364,6 +1364,9 @@ void actual_eos_init ()
for (int j = 0; j < jmax; ++j) {
for (int i = 0; i < imax; ++i) {
std::getline(table, line);
if (line.empty()) {
amrex::Error("Error reading free energy from helm_table.dat");
}
std::istringstream data(line);
data >> f_local[idx] >> f_local[idx+3] >> f_local[idx+1]
>> f_local[idx+4] >> f_local[idx+2] >> f_local[idx+5]
Expand All @@ -1377,6 +1380,9 @@ void actual_eos_init ()
for (int j = 0; j < jmax; ++j) {
for (int i = 0; i < imax; ++i) {
std::getline(table, line);
if (line.empty()) {
amrex::Error("Error reading pressure derivative from helm_table.dat");
}
std::istringstream data(line);
data >> dpdf_local[idx] >> dpdf_local[idx+2]
>> dpdf_local[idx+1] >> dpdf_local[idx+3];
Expand All @@ -1389,6 +1395,9 @@ void actual_eos_init ()
for (int j = 0; j < jmax; ++j) {
for (int i = 0; i < imax; ++i) {
std::getline(table, line);
if (line.empty()) {
amrex::Error("Error reading electron chemical potential from helm_table.dat");
}
std::istringstream data(line);
data >> ef_local[idx] >> ef_local[idx+2]
>> ef_local[idx+1] >> ef_local[idx+3];
Expand All @@ -1401,6 +1410,9 @@ void actual_eos_init ()
for (int j = 0; j < jmax; ++j) {
for (int i = 0; i < imax; ++i) {
std::getline(table, line);
if (line.empty()) {
amrex::Error("Error reading number density from helm_table.dat");
}
std::istringstream data(line);
data >> xf_local[idx] >> xf_local[idx+2]
>> xf_local[idx+1] >> xf_local[idx+3];
Expand Down
4 changes: 2 additions & 2 deletions EOS/polytrope/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void actual_eos_init ()
// Available pre-defined polytrope options:

// 1: Non-relativistic, fully degenerate electron gas
// 2: Relativistic, fully degenerate electron gas
// 2: Relativistic, fully degenerate electron gas

if (polytrope_type > 0) {
mu_e = polytrope_mu_e;
Expand Down Expand Up @@ -88,7 +88,7 @@ bool is_input_valid (I input)


//---------------------------------------------------------------------------
// Public interfaces
// Public interfaces
//---------------------------------------------------------------------------

inline
Expand Down
Loading

0 comments on commit 5086829

Please sign in to comment.