Skip to content

Commit

Permalink
Merge branch 'development' into new_rk2_sdc_and_eos
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Dec 20, 2023
2 parents c48f2cc + 7de2124 commit 4887db0
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 39 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/castro-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Castro development

on: [push, pull_request]

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

jobs:
castro-development:
name: Castro development
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Castro
uses: actions/checkout@v4
with:
repository: 'AMReX-Astro/Castro'
ref: development
path: 'Castro'
- name: Download AMReX
uses: actions/checkout@v4
with:
repository: 'AMReX-Codes/amrex'
ref: development
path: 'amrex'
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Build flame_wave
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=75M
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
export AMREX_HOME=${PWD}/amrex
export MICROPHYSICS_HOME=${PWD}
cd Castro/Exec/science/flame_wave/
make -j2 CCACHE=ccache USE_MPI=FALSE
ccache -s
du -hs ~/.cache/ccache
- name: Build subchandra
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=75M
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
export AMREX_HOME=${PWD}/amrex
export MICROPHYSICS_HOME=${PWD}
cd Castro/Exec/science/subchandra/
make -j2 CCACHE=ccache USE_MPI=FALSE
ccache -s
du -hs ~/.cache/ccache
save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr_number.txt
retention-days: 1
5 changes: 3 additions & 2 deletions integration/VODE/actual_integrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ void actual_integrator (BurnT& state, Real dt)
// need to sync the auxiliary data up with the new mass fractions
set_aux_comp_from_X(state);
#endif

eos(eos_input_re, state);
if (call_eos_in_rhs) {
eos(eos_input_re, state);
}

#endif

Expand Down
26 changes: 1 addition & 25 deletions interfaces/rhs_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,13 @@
#define rhs_type_H

#include <AMReX_REAL.H>
#include <AMReX_Loop.H>
#include <network_properties.H>
#ifdef SCREENING
#include <screen.H>
#endif
#include <tfactors.H>

// Implementation of "constexpr for" based on
// https://artificial-mind.net/blog/2020/10/31/constexpr-for
//
// Approximates what one would get from a compile-time
// unrolling of the loop
// for (int i = 0; i < N; ++i) {
// f(i);
// }
//
// The mechanism is recursive, we evaluate f(i) at the current
// i and then call the for loop at i+1. f() is a lambda function
// that provides the body of the loop and takes only an integer
// i as its argument. It is assumed that at the loop call site
// the lambda is declared [&] so that it can operate on whatever
// data it needs.

template<auto I, auto N, class F>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
constexpr void constexpr_for (F&& f)
{
if constexpr (I < N) {
f(std::integral_constant<decltype(I), I>());
constexpr_for<I+1, N>(f);
}
}

namespace RHS
{
Expand Down
1 change: 1 addition & 0 deletions networks/rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <AMReX.H>
#include <AMReX_REAL.H>
#include <AMReX_Print.H>
#include <AMReX_Loop.H>

#include <ArrayUtilities.H>
#include <rhs_type.H>
Expand Down
44 changes: 44 additions & 0 deletions nse_solver/nse_compatibility/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
PRECISION = DOUBLE
PROFILE = FALSE

DEBUG = FALSE

DIM = 3

COMP = gnu

USE_MPI = FALSE
USE_OMP = FALSE

USE_REACT = TRUE

USE_NSE_NET = TRUE
EBASE = main

# define the location of the Microphysics top directory
MICROPHYSICS_HOME ?= ../..

# This sets the EOS directory
EOS_DIR := helmholtz

# This sets the network directory
NETWORK_DIR := subch_base

SCREEN_METHOD = chabrier1998

CONDUCTIVITY_DIR := stellar

INTEGRATOR_DIR = VODE

ifeq ($(USE_CUDA), TRUE)
INTEGRATOR_DIR := VODE
endif

EXTERN_SEARCH += .

Bpack := ./Make.package
Blocs := .

include $(MICROPHYSICS_HOME)/unit_test/Make.unit_test


2 changes: 2 additions & 0 deletions nse_solver/nse_compatibility/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CEXE_sources += main.cpp
CEXE_headers += nse_network_compatibility.H
14 changes: 14 additions & 0 deletions nse_solver/nse_compatibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# NSE Network Checking Script

This is a script for checking whether integrated mass fractions of
a reaction network will eventually match with the mass fractions
calculated via NSE equations. Currently, this is only valid for networks
that do not involve weak rates.

* Note that the integration doesn't achieve NSE even though we have
USE_NSE_NET=TRUE is due to the reference size of the cell. By setting
nse.nse_dx_independet=1 will fix this.

Script will print out all burn_state cases when nse_dx_independent is
not enabled. It will only print out burn_state cases that didn't enter NSE
when nse_dx_independent=1
22 changes: 22 additions & 0 deletions nse_solver/nse_compatibility/_parameters
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@namespace: unit_test

run_prefix character ""

# the final time to integrate to
tmax real 1.e3

# first output time -- we will output in nsteps logarithmically spaced steps between [tfirst, tmax]
tfirst real 0.0

# number of steps (logarithmically spaced)
nsteps integer 100

rho_min real 1.e7
rho_max real 1.e9

nrho integer 4

T_min real 6.e9
T_max real 8.e9

nT integer 4
26 changes: 26 additions & 0 deletions nse_solver/nse_compatibility/inputs_nse_compatibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# this inputs is used for checking the compatibility of networks with NSE_NET

unit_test.run_prefix = "test_nse_network_compatibility_"

integrator.burner_verbose = 0

# Set which jacobian to use
# 1 = analytic jacobian
# 2 = numerical jacobian

integrator.jacobian = 1

integrator.renormalize_abundances = 0

integrator.rtol_spec = 1.0e-6
integrator.rtol_enuc = 1.0e-6
integrator.atol_spec = 1.0e-10
integrator.atol_enuc = 1.0e-6

unit_test.tmax = 1.e3
unit_test.tfirst = 1.e-10
unit_test.nsteps = 100

integrator.integrate_energy = 0
integrator.call_eos_in_rhs = 0
integrator.do_species_clip = 0
34 changes: 34 additions & 0 deletions nse_solver/nse_compatibility/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <cstring>
#include <vector>

#include <AMReX_ParmParse.H>
#include <AMReX_MultiFab.H>
using namespace amrex;

#include <extern_parameters.H>
#include <eos.H>
#include <network.H>
#include <nse_network_compatibility.H>
#include <unit_test.H>

int main(int argc, char *argv[]) {

amrex::Initialize(argc, argv);

std::cout << "starting the single zone burn..." << std::endl;

ParmParse ppa("amr");

init_unit_test();

// C++ EOS initialization (must be done after Fortran eos_init and init_extern_parameters)
eos_init();

// C++ Network, RHS, screening, rates initialization
network_init();

nse_network_compatibility();

amrex::Finalize();
}
Loading

0 comments on commit 4887db0

Please sign in to comment.