Implement ISM chemistry including metals and dust #11
Workflow file for this run
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
name: burn_cell_metal_chem | |
on: [pull_request] | |
jobs: | |
burn_cell_metal_chem: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get AMReX | |
run: | | |
mkdir external | |
cd external | |
git clone https://github.com/AMReX-Codes/amrex.git | |
cd amrex | |
git checkout development | |
echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV | |
echo $AMREX_HOME | |
if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi | |
cd ../.. | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -y -qq | |
sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 | |
- name: Compile and run for Z = 1 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
make -j 2 | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4461 4463 4465 4467 4468 4471 4472 4475 4481 4486) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution_1.out | |
reference_line_number=$((line_number - 24)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1.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" | |
echo "Value in reference_solution_1.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1 at z = 10 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1_z10 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1 at z = 10 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(1612 1614 4479 4481 4483 4485 4486 4489 4490 4493 4499 4504) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution_1_z10.out | |
reference_line_number=$((line_number - 24)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1_z10.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" | |
echo "Value in reference_solution_1_z10.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-1 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-1 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-1 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 0)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-1.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" | |
echo "Value in reference_solution_1e-1.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-2 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-2 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-2 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 0)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-2.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" | |
echo "Value in reference_solution_1e-2.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-3 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-3 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-3 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 0)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-3.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" | |
echo "Value in reference_solution_1e-3.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-4 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-4 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-4 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 0)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-4.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" | |
echo "Value in reference_solution_1e-4.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-5 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-5 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-5 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 0)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-5.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" | |
echo "Value in reference_solution_1e-5.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |
- name: Run for Z = 1e-6 | |
run: | | |
cd unit_test/burn_cell_metal_chem | |
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-6 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out | |
- name: Print backtrace | |
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }} | |
run: cat unit_test/burn_cell_metal_chem/Backtrace.0 | |
- name: Compare to stored output for Z = 1e-6 | |
run: | | |
set -e | |
cd unit_test/burn_cell_metal_chem | |
line_numbers=(4438 4440 4442 4444 4445 4448 4449 4452 4458 4463) | |
threshold=0.01 | |
error_found=false | |
for line_number in "${line_numbers[@]}"; do | |
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out) | |
# Adjust the line number for reference_solution | |
reference_line_number=$((line_number + 12)) | |
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-6.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" | |
echo "Value in reference_solution_1e-6.out: $value2" | |
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold" | |
echo | |
error_found=true | |
fi | |
done | |
if [[ $error_found == true ]]; then | |
exit 1 | |
fi | |