-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix_interp' into add_cubic_interp
- Loading branch information
Showing
10 changed files
with
4,270 additions
and
89 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: model parser | ||
|
||
on: [pull_request] | ||
jobs: | ||
model_parser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get submodules | ||
run: | | ||
git submodule update --init | ||
cd external/Microphysics | ||
git fetch; git checkout development | ||
cd ../amrex | ||
git fetch; git checkout development | ||
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 model_parser test | ||
run: | | ||
cd Util/model_parser/test | ||
make -j 4 | ||
- name: Run model_parser test | ||
run: | | ||
cd Util/model_parser/test | ||
./Castro3d.gnu.ex |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
model_name character "" y | ||
|
||
interpolate_pres int 0 y | ||
|
||
perturb_model int 0 y | ||
velpert_amplitude real 1.e5 y | ||
velpert_scale real 1.e7 y | ||
|
||
isi28 int -1 | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
PRECISION = DOUBLE | ||
PROFILE = FALSE | ||
|
||
DEBUG = FALSE | ||
|
||
DIM = 3 | ||
|
||
COMP = gnu | ||
|
||
USE_MPI = FALSE | ||
USE_OMP = FALSE | ||
|
||
USE_ALL_CASTRO = FALSE | ||
USE_AMR_CORE = FALSE | ||
|
||
# define the location of the CASTRO top directory | ||
CASTRO_HOME ?= ../../.. | ||
|
||
USE_MODEL_PARSER = TRUE | ||
NUM_MODELS := 2 | ||
|
||
# This sets the EOS directory in Castro/EOS | ||
EOS_DIR := helmholtz | ||
|
||
# This sets the network directory in Castro/Networks | ||
NETWORK_DIR := subch_simple | ||
|
||
EXTERN_SEARCH += . | ||
|
||
Bpack := ./Make.package | ||
Blocs := . .. $(CASTRO_HOME)/Source/problems | ||
|
||
include $(CASTRO_HOME)/Exec/Make.Castro |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CEXE_sources += main.cpp | ||
CEXE_sources += extern_parameters.cpp | ||
CEXE_headers += extern_parameters.H | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Unit test for model_parser | ||
|
||
This simply reads in an initial model and does some checks to make | ||
sure the locate and interpolation routines work as expected. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <iostream> | ||
|
||
#include <model_parser.H> | ||
|
||
|
||
int main(int argc, char *argv[]) { | ||
|
||
amrex::Initialize(argc, argv); | ||
|
||
// initialize the external runtime parameters in C++ | ||
|
||
init_extern_parameters(); | ||
|
||
// now initialize the C++ Microphysics | ||
#ifdef REACTIONS | ||
network_init(); | ||
#endif | ||
|
||
Real small_temp = 1.e-200; | ||
Real small_dens = 1.e-200; | ||
eos_init(small_temp, small_dens); | ||
|
||
std::string model = "sub_chandra.M_WD-1.10.M_He-0.050.hse.CO.N14.N.10.00km"; | ||
read_model_file(model); | ||
|
||
Real r{3.89e7}; | ||
|
||
std::cout << "testing locate" << std::endl; | ||
|
||
auto idx = locate(r, 0); | ||
AMREX_ALWAYS_ASSERT(r >= model::profile(0).r(idx) && | ||
r <= model::profile(0).r(idx+1)); | ||
|
||
std::cout << "testing interpolate" << std::endl; | ||
|
||
// density is monotonically decreasing | ||
auto dens = interpolate(r, model::idens); | ||
AMREX_ALWAYS_ASSERT(dens <= model::profile(0).state(idx, model::idens) && | ||
dens >= model::profile(0).state(idx+1, model::idens)); | ||
|
||
} |
Oops, something went wrong.