Skip to content

Commit

Permalink
add a script to setup the runs
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed May 29, 2024
1 parent 64e1304 commit 409f82e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ geometry.is_periodic = 0 0 0
geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical
geometry.prob_lo = 0 0 0
geometry.prob_hi = 5.89824e7 2500 2500
amr.n_cell = 48 16 16
amr.n_cell = @nx@ 16 16


# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
Expand All @@ -30,6 +30,9 @@ castro.ppm_temp_fix = 0

castro.time_integration_method = 3

castro.disable_shock_burning = @shock_flag@
castro.shock_detection_threshold = @shock_thresh@

# castro.transverse_reset_density = 1

castro.small_dens = 1.e-5
Expand All @@ -53,8 +56,8 @@ amr.v = 1 # verbosity in Amr.cpp
#amr.grid_log = grdlog # name of grid logging file

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed
amr.ref_ratio = 2 2 2 2 # refinement ratio
amr.max_level = @nlevel@ # maximum level number allowed
amr.ref_ratio = 4 4 2 2 # refinement ratio
amr.regrid_int = 2 2 2 2 # how often to regrid
amr.blocking_factor = 8 # block factor in grid generation
amr.max_grid_size = 512
Expand Down
48 changes: 48 additions & 0 deletions Exec/science/Detonation/shock_paper/setup_runs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python

import os
import shutil

# tuples of label, nx, and max_level
RES_INFO = [("12.288km", "48", "0"),
("1.536km", "384", "0"),
("0.192km", "3072", "0"),
("0.024km", "6144", "1"),
("0.003km", "12288", "2")]

INPUTS_TEMPLATE = "inputs-shock-burn.template"

COMMON_FILES = ["helm_table.dat",
"Castro1d.gnu.MPI.SMPLSDC.ex"]

shock_flag = "0"
shock_thresh = "0.6666"

def doit():

# read in the template
with open(INPUTS_TEMPLATE) as tf:
template = tf.readlines()

# loop over resolutions
for label, nx, max_level in RES_INFO:

# create output direct
odir = f"res{label}"
if shock_flag == 1:
odir += "_noshockburn"

os.mkdir(odir)

# copy files
for f in COMMON_FILES:
shutil.copy(f, odir)

# modify inputs
with open(f"{odir}/inputs", "w") as fin:
for line in template:
fin.write(line.replace("@nx@", nx).replace("@nlevel@", max_level).replace("@shock_flag@", shock_flag).replace("@shock_thresh@", shock_thresh))


if __name__ == "__main__":
doit()

0 comments on commit 409f82e

Please sign in to comment.