Skip to content

Commit 8212b20

Browse files
authored
Merge branch 'development' into fix_dlogarea
2 parents 8c15b81 + aed0328 commit 8212b20

File tree

17 files changed

+839
-45
lines changed

17 files changed

+839
-45
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
PRECISION = DOUBLE
2+
PROFILE = FALSE
3+
4+
DEBUG = FALSE
5+
6+
DIM = 2
7+
8+
COMP = gnu
9+
10+
USE_MPI = TRUE
11+
12+
USE_GRAV = TRUE
13+
USE_REACT = FALSE
14+
15+
USE_ROTATION = FALSE
16+
USE_DIFFUSION = FALSE
17+
18+
# define the location of the CASTRO top directory
19+
CASTRO_HOME ?= ../../..
20+
21+
USE_JACOBIAN_CACHING = TRUE
22+
USE_MODEL_PARSER = TRUE
23+
NUM_MODELS := 2
24+
25+
# This sets the EOS directory in $(MICROPHYSICS_HOME)/eos
26+
EOS_DIR := helmholtz
27+
28+
# This sets the network directory in $(MICROPHYSICS_HOME)/networks
29+
NETWORK_DIR := subch_base
30+
31+
INTEGRATOR_DIR := VODE
32+
33+
CONDUCTIVITY_DIR := stellar
34+
35+
PROBLEM_DIR ?= ./
36+
37+
Bpack := $(PROBLEM_DIR)/Make.package
38+
Blocs := $(PROBLEM_DIR)
39+
40+
include $(CASTRO_HOME)/Exec/Make.Castro
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CEXE_headers += initial_model.H
2+

Exec/science/xrb_spherical/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# xrb_spherical
2+
3+
This is the full-star XRB flame setup based on flame_wave.
4+
This setup uses a spherical 2D geometry to model XRB flame
5+
on a spherical shell with initial temperature perturbation
6+
on the north pole.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
dtemp real 3.81e8_rt y
3+
4+
theta_half_max real 1.745e-2_rt y
5+
6+
theta_half_width real 4.9e-3_rt y
7+
8+
# cutoff mass fraction of the first species for refinement
9+
X_min real 1.e-4_rt y
10+
11+
# do we dynamically refine based on density? or based on height?
12+
tag_by_density integer 1 y
13+
14+
# used for tagging if tag_by_density = 1
15+
cutoff_density real 500.e0_rt y
16+
17+
# used if we are refining based on height rather than density
18+
refine_height real 3600 y
19+
20+
T_hi real 5.e8_rt y
21+
22+
T_star real 1.e8_rt y
23+
24+
T_lo real 5.e7_rt y
25+
26+
dens_base real 2.e6_rt y
27+
28+
H_star real 500.e0_rt y
29+
30+
atm_delta real 25.e0_rt y
31+
32+
fuel1_name string "helium-4" y
33+
34+
fuel2_name string "" y
35+
36+
fuel3_name string "" y
37+
38+
fuel4_name string "" y
39+
40+
ash1_name string "iron-56" y
41+
42+
ash2_name string "" y
43+
44+
ash3_name string "" y
45+
46+
fuel1_frac real 1.0_rt y
47+
48+
fuel2_frac real 0.0_rt y
49+
50+
fuel3_frac real 0.0_rt y
51+
52+
fuel4_frac real 0.0_rt y
53+
54+
ash1_frac real 1.0_rt y
55+
56+
ash2_frac real 0.0_rt y
57+
58+
ash3_frac real 0.0_rt y
59+
60+
low_density_cutoff real 1.e-4_rt y
61+
62+
smallx real 1.e-10_rt y
63+
64+
r_refine_distance real 1.e30_rt y
65+
66+
max_hse_tagging_level integer 2 y
67+
68+
max_base_tagging_level integer 1 y
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python3
2+
3+
# Spherical R profile at different theta
4+
5+
import os
6+
import sys
7+
import yt
8+
import matplotlib.pyplot as plt
9+
import numpy as np
10+
from functools import reduce
11+
import itertools
12+
13+
import matplotlib.ticker as ptick
14+
from yt.frontends.boxlib.api import CastroDataset
15+
from yt.units import cm
16+
17+
18+
plotfile = sys.argv[1]
19+
ds = CastroDataset(plotfile)
20+
21+
rmin = ds.domain_left_edge[0]
22+
rmax = rmin + 5000.0*cm
23+
#rmax = ds.domain_right_edge[0]
24+
print(ds.domain_left_edge[1])
25+
fig, _ax = plt.subplots(2,2)
26+
27+
axes = list(itertools.chain(*_ax))
28+
29+
fig.set_size_inches(7.0, 8.0)
30+
31+
fields = ["Temp", "density", "x_velocity", "y_velocity"]
32+
nice_names = [r"$T$ (K)", r"$\rho$ (g/${cm}^3$)", r"$u$ (cm/s)", r"$v$ (cm/s)"]
33+
34+
# 4 rays at different theta values
35+
thetal = ds.domain_left_edge[1]
36+
thetar = ds.domain_right_edge[1]
37+
thetas = [thetal, 0.25*thetar, 0.5*thetar, 0.75*thetar]
38+
39+
for i, f in enumerate(fields):
40+
41+
for theta in thetas:
42+
# simply go from (rmin, theta) -> (rmax, theta). Doesn't need to convert to physical R-Z
43+
ray = ds.ray((rmin, theta, 0*cm), (rmax, theta, 0*cm))
44+
isrt = np.argsort(ray["t"])
45+
axes[i].plot(ray['r'][isrt], ray[f][isrt], label=r"$\theta$ = {:.4f}".format(float(theta)))
46+
47+
axes[i].set_xlabel(r"$r$ (cm)")
48+
axes[i].set_ylabel(nice_names[i])
49+
axes[i].set_yscale("symlog")
50+
51+
if i == 0:
52+
axes[0].legend(frameon=False, loc="lower left")
53+
54+
#fig.set_size_inches(10.0, 9.0)
55+
plt.tight_layout()
56+
plt.savefig("{}_profiles.png".format(os.path.basename(plotfile)))
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import os
5+
import yt
6+
import numpy as np
7+
import matplotlib.pyplot as plt
8+
from yt.frontends.boxlib.api import CastroDataset
9+
10+
from yt.units import cm
11+
12+
"""
13+
Given a plot file and field name, it gives slice plots at the top,
14+
middle, and bottom of the domain (shell).
15+
"""
16+
17+
def slice(fname:str, field:str,
18+
loc: str = "top", width_factor: float = 3.0) -> None:
19+
"""
20+
A slice plot of the dataset for Spherical2D geometry.
21+
22+
Parameter
23+
=======================
24+
fname: plot file name
25+
field: field parameter
26+
loc: location on the domain. {top, mid, bot}
27+
"""
28+
29+
ds = CastroDataset(fname)
30+
currentTime = ds.current_time.in_units("s")
31+
print(f"Current time of this plot file is {currentTime} s")
32+
33+
# Some geometry properties
34+
rr = ds.domain_right_edge[0].in_units("km")
35+
rl = ds.domain_left_edge[0].in_units("km")
36+
dr = rr - rl
37+
r_center = 0.5 * (rr + rl)
38+
39+
thetar = ds.domain_right_edge[1]
40+
thetal = ds.domain_left_edge[1]
41+
dtheta = thetar - thetal
42+
theta_center = 0.5 * (thetar + thetal)
43+
44+
# Domain width of the slice plot
45+
width = width_factor * dr
46+
box_widths = (width, width)
47+
48+
loc = loc.lower()
49+
loc_options = ["top", "mid", "bot"]
50+
51+
if loc not in loc_options:
52+
raise Exception("loc parameter must be top, mid or bot")
53+
54+
# Centers for the Top, Mid and Bot panels
55+
centers = {"top":(r_center*np.sin(thetal)+0.5*width, r_center*np.cos(thetal)),
56+
"mid":(r_center*np.sin(theta_center), r_center*np.cos(theta_center)),
57+
"bot":(r_center*np.sin(thetar)+0.5*width, r_center*np.cos(thetar))}
58+
59+
# Note we can also set center during SlicePlot, however then we would enter in [r_center, theta_center, 0]
60+
# rather than the physical R-Z coordinate if we do it via sp.set_center
61+
62+
sp = yt.SlicePlot(ds, 'phi', field, width=box_widths)
63+
sp.set_center(centers[loc])
64+
65+
sp.set_cmap(field, "viridis")
66+
if field in ["x_velocity", "y_velocity", "z_velocity"]:
67+
sp.set_cmap(field, "coolwarm")
68+
elif field == "Temp":
69+
sp.set_zlim(f, 5.e7, 2.5e9)
70+
sp.set_cmap(f, "magma_r")
71+
elif field == "enuc":
72+
sp.set_zlim(f, 1.e18, 1.e20)
73+
elif field == "density":
74+
sp.set_zlim(f, 1.e-3, 5.e8)
75+
76+
# sp.annotate_text((0.05, 0.05), f"{currentTime.in_cgs():8.5f} s")
77+
sp.save(f"{ds}_{loc}")
78+
79+
if __name__ == "__main__":
80+
81+
if len(sys.argv) < 3:
82+
raise Exception("Please enter parameters in order of: fname field_name width_factor[optional] loc[optional]")
83+
84+
fname = sys.argv[1]
85+
field = sys.argv[2]
86+
loc = "top"
87+
width_factor = 3.0
88+
89+
if len(sys.argv) == 4:
90+
width_factor = float(sys.argv[3])
91+
elif len(sys.argv) > 4:
92+
loc = sys.argv[4]
93+
94+
slice(fname, field, loc=loc, width_factor=width_factor)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../flame_wave/initial_model.H

0 commit comments

Comments
 (0)