Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new setup for 3D flame propagation through a tube #2551

Merged
merged 10 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Exec/science/flame_tube/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
PRECISION = DOUBLE
PROFILE = FALSE

DEBUG = FALSE

DIM = 3

COMP = gnu

USE_MPI = TRUE

USE_GRAV = TRUE
USE_REACT = TRUE

USE_ROTATION = FALSE
USE_DIFFUSION = TRUE

# define the location of the CASTRO top directory
CASTRO_HOME := ../../..

USE_JACOBIAN_CACHING = TRUE
USE_CXX_MODEL_PARSER = TRUE
NUM_MODELS := 2

# This sets the EOS directory in $(MICROPHYSICS_HOME)/eos
EOS_DIR := helmholtz

# This sets the network directory in $(MICROPHYSICS_HOME)/networks
NETWORK_DIR := aprox13

INTEGRATOR_DIR := VODE

CONDUCTIVITY_DIR := stellar

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

include $(CASTRO_HOME)/Exec/Make.Castro
2 changes: 2 additions & 0 deletions Exec/science/flame_tube/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CEXE_headers += initial_model.H

5 changes: 5 additions & 0 deletions Exec/science/flame_tube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# flame_tube

This is a slightly modified version of flame_wave that models a 3-d flame
propagating through a tube shaped domain, with a periodic boundary along the
transverse horizontal direction (y).
70 changes: 70 additions & 0 deletions Exec/science/flame_tube/_prob_params
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

dtemp real 3.81e8_rt y

x_half_max real 1.2e5_rt y

x_half_width real 3.6e4_rt y

# cutoff mass fraction of the first species for refinement
X_min real 1.e-4_rt y

# do we dynamically refine based on density? or based on height?
tag_by_density integer 1 y

# used for tagging if tag_by_density = 1
cutoff_density real 500.e0_rt y

# used if we are refining based on height rather than density
refine_height real 3600 y

dx_model real 10.0_rt y

T_hi real 5.e8_rt y

T_star real 1.e8_rt y

T_lo real 5.e7_rt y

dens_base real 2.e6_rt y

H_star real 500.e0_rt y

atm_delta real 25.e0_rt y

fuel1_name character "helium-4" y

fuel2_name character "" y

fuel3_name character "" y

fuel4_name character "" y

ash1_name character "iron-56" y

ash2_name character "" y

ash3_name character "" y

fuel1_frac real 1.0_rt y

fuel2_frac real 0.0_rt y

fuel3_frac real 0.0_rt y

fuel4_frac real 0.0_rt y

ash1_frac real 1.0_rt y

ash2_frac real 0.0_rt y

ash3_frac real 0.0_rt y

low_density_cutoff real 1.e-4_rt y

smallx real 1.e-10_rt y

x_refine_distance real 1.e30_rt y

max_hse_tagging_level integer 2 y

max_base_tagging_level integer 1 y
34 changes: 34 additions & 0 deletions Exec/science/flame_tube/analysis/vis_3d/andes-single.submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
#SBATCH -A ast106
#SBATCH -J flame_tube_vr
#SBATCH -N 1
#SBATCH -t 4:00:00

set -u

cd $SLURM_SUBMIT_DIR

source "/ccs/proj/ast106/$USER/mambaforge_$(uname -m)/etc/profile.d/conda.sh"
conda activate andes_yt_dev

plotfiles=(run_256/flame_tube_25cm_smallplt*)
plotfiles=(run_256_extra_plotfiles/flame_tube_25cm_smallplt0039200)
#plotfile=flame_wave_1000Hz_25cm_smallplt207887
#plotfile=flame_wave_1000Hz_25cm_smallplt40842

#for i in flame_wave_1000Hz_25cm_smallplt*[0-9]
todo=()
for f in "${plotfiles[@]}"; do
dest=${f/run_/analysis_}
# check the last image generated for each plotfile
#if ! [[ -f "${dest}_enuc_annotated_top.png" ]]; then
todo+=("$f")
#fi
done

export OMP_NUM_THREADS=16
if [[ ${#todo[@]} -gt 0 ]]; then
srun --cpu-bind=no python ~/dev/Castro/Exec/science/flame_tube/analysis/vis_3d/vol-xrb.py "${todo[@]}"
fi

echo "done!"
17 changes: 17 additions & 0 deletions Exec/science/flame_tube/analysis/vis_3d/andes-slice.submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#SBATCH -A ast106
#SBATCH -J plots
#SBATCH -N 1
#SBATCH -t 8:00:00
#SBATCH -p gpu

cd $SLURM_SUBMIT_DIR

#plotfile=flame_wave_1000Hz_25cm_smallplt207887
#plotfile=flame_wave_1000Hz_25cm_smallplt40842

source activate andes_env

srun python slice_vertical.py flame_wave_1000Hz_25cm_smallplt174562


26 changes: 26 additions & 0 deletions Exec/science/flame_tube/analysis/vis_3d/andes.submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#SBATCH -A ast106
#SBATCH -J plots
#SBATCH -N 1
#SBATCH -t 8:00:00

cd $SLURM_SUBMIT_DIR

source "/ccs/proj/ast106/$USER/mambaforge_$(uname -m)/etc/profile.d/conda.sh"
conda activate andes_yt_dev

plotfile=run_256_extra_plotfiles/flame_tube_25cm_smallplt0039200
#plotfile=flame_wave_1000Hz_25cm_smallplt207887
#plotfile=flame_wave_1000Hz_25cm_smallplt40842

#for i in flame_wave_1000Hz_25cm_smallplt*[0-9]
export OMP_NUM_THREADS=16
for i in $plotfile; do
dest=${i/run_/analysis_}
if ! [[ -f "${dest}_abar_annotated_top.png" ]]; then
srun --cpu-bind=no python ~/dev/Castro/Exec/science/flame_tube/analysis/vis_3d/vol-xrb-abar.py "${i}"
srun --cpu-bind=no python ~/dev/Castro/Exec/science/flame_tube/analysis/vis_3d/vol-xrb-enuc.py "${i}"
fi
done

echo "done!"
97 changes: 97 additions & 0 deletions Exec/science/flame_tube/analysis/vis_3d/slice_vertical.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import argparse
import os
import sys

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import ImageGrid

import yt
from yt.frontends.boxlib.api import CastroDataset
# assume that our data is in CGS
from yt.units import amu, cm

matplotlib.use('agg')




def doit(plotfiles):

plotfile = sys.argv[1]
ds = CastroDataset(plotfile)

xmin = ds.domain_left_edge[0]
xmax = ds.domain_right_edge[0]
xctr = 0.5 * (xmin + xmax)
L_x = (2./3.) * (xmax - xmin)

ymin = ds.domain_left_edge[1]
ymax = ds.domain_right_edge[1]
yctr = 0.5*(ymin + ymax)

zmin = 0.0*cm
zmax = 1.e4*cm

zctr = 0.5*(zmin + zmax)
L_z = zmax - zmin

fig = plt.figure()

grid = ImageGrid(fig, 111, nrows_ncols=(len(plotfiles), 1),
axes_pad=0.25, label_mode="L",
cbar_mode="single", cbar_size="0.5%")

for i, pf in enumerate(plotfiles):

ds = CastroDataset(pf)

f = "abar"

sp = yt.SlicePlot(ds, "y", f, origin="native", center=[xctr, yctr, zctr],
width=[L_z, L_x], fontsize="9")
sp.set_buff_size((4800,4800))
sp.swap_axes()

sp.set_zlim(f, 4, 5)
sp.set_log(f, False)
sp.set_cmap(f, "plasma_r")

sp.set_axes_unit("cm")

sp.annotate_text((0.8, 0.9), "{:5.2f} ms".format(1000.0*float(ds.current_time.in_cgs())),
coord_system="axis", text_args={"color": "black", "size": 9})

plot = sp.plots["abar"]
plot.figure = fig
plot.axes = grid[i].axes
plot.cax = grid.cbar_axes[i]
if i < len(plotfiles)-1:
grid[i].axes.xaxis.offsetText.set_visible(False)

sp._setup_plots()

fig.set_size_inches(10.0, 3.5)
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05)
fig.savefig("time_series_3D.pdf")

if __name__ == "__main__":

p = argparse.ArgumentParser()

p.add_argument("--skip", type=int, default=1,
help="interval between plotfiles")
p.add_argument("plotfiles", type=str, nargs="+",
help="list of plotfiles to plot")

args = p.parse_args()

plot_prefix = args.plotfiles[0].split("plt")[0] + "plt"
plot_nums = sorted([p.split("plt")[1] for p in args.plotfiles], key=int)

plotfiles = []
for n in range(0, len(plot_nums), args.skip):
plotfiles.append("{}{}".format(plot_prefix, plot_nums[n]))

doit(plotfiles)
Loading