Skip to content

Commit

Permalink
Merge branch 'development' into jacobian_correction
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Oct 23, 2024
2 parents bf77ccf + 533f712 commit 1ace2c9
Show file tree
Hide file tree
Showing 18 changed files with 2,250 additions and 2,075 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/burn_cell_metal_chem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ jobs:
cd unit_test/burn_cell_metal_chem
make -j 2
- name: Run and compare outputs for different Z values
- name: Run and compare outputs for different Z values, also including cosmic ray ionization
run: |
set -e
cd unit_test/burn_cell_metal_chem
declare -A line_numbers_map=(
["Z=1"]="4461 4463 4465 4467 4468 4471 4472 4475 4481 4486"
["Z=1"]="4450 4452 4454 4456 4457 4460 4461 4464 4470 4475"
["Z=1_z10"]="1613 1615 4456 4458 4460 4463 4470 4476 4481"
["Z=1e-1"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-2"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-3"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-4"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-5"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-6"]="4438 4440 4442 4444 4445 4448 4449 4452 4458 4463"
["Z=1e-6"]="4463 4465 4467 4469 4470 4473 4474 4477 4483 4488"
["Z=1_cr"]="652 654 656 658 659 662 663 666 672 677"
["Z=1e-4_cr"]="652 654 656 658 659 662 663 666 672 677"
)
declare -A ref_map=(
Expand All @@ -58,6 +60,8 @@ jobs:
["Z=1e-4"]="reference_solution_1e-4.out"
["Z=1e-5"]="reference_solution_1e-5.out"
["Z=1e-6"]="reference_solution_1e-6.out"
["Z=1_cr"]="reference_solution_1_cr.out"
["Z=1e-4_cr"]="reference_solution_1e-4_cr.out"
)
ref_line_number_z10=(1 2 3 5 7 10 17 23 28)
Expand All @@ -66,19 +70,31 @@ jobs:
original_input_file="inputs_metal_chem_1"
modified_input_file="inputs_metal_chem_modified"
for Z in "Z=1" "Z=1_z10" "Z=1e-1" "Z=1e-2" "Z=1e-3" "Z=1e-4" "Z=1e-5" "Z=1e-6"; do
for Z in "Z=1" "Z=1_z10" "Z=1e-1" "Z=1e-2" "Z=1e-3" "Z=1e-4" "Z=1e-5" "Z=1e-6" "Z=1_cr" "Z=1e-4_cr"; do
cp $original_input_file $modified_input_file
Z_val=${Z//Z=/}
if [[ "$Z" == "Z=1_z10" ]]; then
# Modify the redshift line for Z=1_z10
sed -i 's/network.redshift = 0.0/network.redshift = 10.0/g' $modified_input_file
else
elif [[ "$Z" != "Z=1_cr" && "$Z" != "Z=1e-4_cr" ]]; then
# Replace the metallicity and dust2gas_ratio values for other Z values
sed -i 's/network.metallicity = .*/network.metallicity = '"$Z_val"'/g' $modified_input_file
sed -i 's/network.dust2gas_ratio = .*/network.dust2gas_ratio = '"$Z_val"'/g' $modified_input_file
fi
if [[ "$Z" == "Z=1_cr" || "$Z" == "Z=1e-4_cr" ]]; then
# Modify the number of steps, since CRs impact lowest densities
sed -i 's/unit_test.nsteps = 100000/unit_test.nsteps = 600/g' $modified_input_file
# Modify the crate line for Z=1_cr
sed -i 's/network.crate = 0.0/network.crate = 3e-17/g' $modified_input_file
if [[ "$Z" == "Z=1e-4_cr" ]]; then
# Replace the metallicity and dust2gas_ratio values for other Z values
sed -i 's/network.metallicity = 1/network.metallicity = 1e-4/g' $modified_input_file
sed -i 's/network.dust2gas_ratio = 1/network.dust2gas_ratio = 1e-4/g' $modified_input_file
fi
fi
output_file="test_${Z_val}.out"
./main1d.gnu.DEBUG.ex $modified_input_file amrex.fpe_trap_{invalid,zero,overflow}=1 > $output_file
Expand All @@ -92,9 +108,13 @@ jobs:
# Adjust the line number for the reference file
if [[ "$Z" == "Z=1" ]]; then
reference_line_number=$((line_number - 4460))
reference_line_number=$((line_number - 4449))
elif [[ "$Z" == "Z=1_z10" ]]; then
reference_line_number=${ref_line_number_z10[$index]}
elif [[ "$Z" == "Z=1e-6" ]]; then
reference_line_number=$((line_number - 4462))
elif [[ "$Z" == "Z=1_cr" || "$Z" == "Z=1e-4_cr" ]]; then
reference_line_number=$((line_number - 651))
else
reference_line_number=$((line_number - 4437))
fi
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 24.10

* metal chemistry updates (#1648) with ices (#1650) and cosmic rays (#1651)

* added dust to primordial chemistry (#1649)

* doc updates (#1652)

# 24.09

* Improvements to the primordial chemistry network and the addition
Expand Down
4 changes: 2 additions & 2 deletions EOS/metal_chem/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
eos_gamma_default real 1.4

# define the specie names, and their masses and gammas
species_1_name string "co_ice"
species_1_name string "co_total"
species_1_gamma real 5./3.
species_1_mass real 0.0

species_2_name string "h2o_ice"
species_2_name string "h2o_total"
species_2_gamma real 5./3.
species_2_mass real 0.0

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Microphysics

*A collection of astrophysical microphysics routines for stellar explosions*
*A collection of astrophysical microphysics routines for stellar explosions and interstellar medium chemistry (including primordial chemistry)*

There are several core types of microphysics routines hosted here:

Expand All @@ -25,7 +25,9 @@ There are several core types of microphysics routines hosted here:

* `networks/`: these are the reaction networks. They serve both to
define the composition and its properties, as well as describe the
reactions and energy release when reactions occur.
reactions and energy release when reactions occur. For ISM chemistry,
network contains the differentials of the number density of various
chemical species and the gas specific internal energy.

* `neutrinos/`: this holds the plasma neutrino cooling routines used
in the reaction networks.
Expand Down Expand Up @@ -57,7 +59,7 @@ There are several core types of microphysics routines hosted here:
# AMReX-Astro Codes

At the moment, these routines are written to be compatible with
the AMReX-Astro codes, Maestro and Castro.
the AMReX-Astro codes, Maestro, Castro and Quokka.

* Castro: http://amrex-astro.github.io/Castro/

Expand Down
2 changes: 0 additions & 2 deletions networks/metal_chem/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ redshift real 0e0
metallicity real 1e0
# dust to gas ratio relative to solar
dust2gas_ratio real 1e0
# starting index for gas-phase species (after the ices)
idx_gas_species int 2

# Cosmic ray ionization rate (per s)
crate real 0e0
Expand Down
Loading

0 comments on commit 1ace2c9

Please sign in to comment.