Skip to content

Commit

Permalink
Merge branch 'development' into 2d_spherical_rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Oct 24, 2024
2 parents eb83e4e + de4d8d9 commit 1261061
Show file tree
Hide file tree
Showing 11 changed files with 256 additions and 166 deletions.
3 changes: 3 additions & 0 deletions Docs/source/mhd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ supported by MHD.

.. note::

The MHD solver is still under development and should not be used
for science simulations. See the issues in the github repo.

The MHD solver supports 3-d only.

Currently the MHD solver is single-level only. AMR support is forthcoming.
Expand Down
4 changes: 2 additions & 2 deletions Exec/science/flame_wave/ci-benchmarks/grid_diag.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# COLUMN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# TIMESTEP TIME MASS XMOM YMOM ZMOM ANG. MOM. X ANG. MOM. Y ANG. MOM. Z KIN. ENERGY INT. ENERGY GAS ENERGY GRAV. ENERGY TOTAL ENERGY CENTER OF MASS X-LOC CENTER OF MASS Y-LOC CENTER OF MASS Z-LOC CENTER OF MASS X-VEL CENTER OF MASS Y-VEL CENTER OF MASS Z-VEL MAXIMUM TEMPERATURE MAXIMUM DENSITY MAXIMUM T_S / T_E
0 0.0000000000000000e+00 1.4700685690736437e+20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 2.9163021935541997e+37 2.9163021935541997e+37 0.0000000000000000e+00 2.9163021935541997e+37 2.7306641645125415e+04 6.8087525965685256e+02 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 1.3928678114307070e+09 3.0715027784567930e+07 0.0000000000000000e+00
1 5.9806047036494849e-08 1.4700700110495903e+20 3.3564221217849212e+23 7.2876252590226133e+23 1.2612378556916341e+20 3.1318391966955516e+23 -2.7141686347841742e+24 1.9066097493127676e+28 7.8605324800324878e+29 2.9163081863790706e+37 2.9163082649843738e+37 0.0000000000000000e+00 2.9163082649843738e+37 2.7306641717925955e+04 6.8087482283157317e+02 0.0000000000000000e+00 2.2831716153358752e+03 4.9573321027203638e+03 8.5794407491595881e-01 1.3929561431310942e+09 3.0715326643212341e+07 3.3873763041849706e-04
2 1.2559269877663918e-07 1.4700717750115462e+20 7.0484895445039834e+23 1.5304335700823335e+24 5.5619061962888426e+20 1.3810900989697918e+24 -1.1969287484132617e+25 4.0039912979259806e+28 3.0853275723280981e+30 2.9163145904135894e+37 2.9163148989463411e+37 0.0000000000000000e+00 2.9163148989463411e+37 2.7306641954244522e+04 6.8087461718998338e+02 0.0000000000000000e+00 4.7946567401095926e+03 1.0410604407871944e+04 3.7834249257966728e+00 1.3933944939675827e+09 3.0715562157563787e+07 3.3857586854903492e-04
1 5.9806047036494849e-08 1.4700700110495903e+20 3.3564221215590610e+23 7.2876252589700228e+23 1.2612378556594561e+20 3.1318391966786556e+23 -2.7141686347838510e+24 1.9066097493139366e+28 7.8605324800584047e+29 2.9163081863790706e+37 2.9163082649843738e+37 0.0000000000000000e+00 2.9163082649843738e+37 2.7306641717925955e+04 6.8087482283158556e+02 0.0000000000000000e+00 2.2831716151822361e+03 4.9573321026845897e+03 8.5794407489407010e-01 1.3929529135508094e+09 3.0715326539046615e+07 3.3873763041849706e-04
2 1.2559269877663918e-07 1.4700717750115462e+20 7.0484895413073359e+23 1.5304335700221490e+24 5.5619061951241526e+20 1.3810900989051759e+24 -1.1969287484120623e+25 4.0039912979436722e+28 3.0853275724059276e+30 2.9163145904135894e+37 2.9163148989463416e+37 0.0000000000000000e+00 2.9163148989463416e+37 2.7306641954244522e+04 6.8087461719003727e+02 0.0000000000000000e+00 4.7946567379351090e+03 1.0410604407462544e+04 3.7834249250044056e+00 1.3933796339641171e+09 3.0715561813912578e+07 3.3857586854903492e-04
4 changes: 2 additions & 2 deletions Exec/science/flame_wave/ci-benchmarks/species_diag.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# COLUMN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# TIMESTEP TIME Mass He4 Mass C12 Mass O16 Mass Ne20 Mass Mg24 Mass Si28 Mass S32 Mass Ar36 Mass Ca40 Mass Ti44 Mass Cr48 Mass Fe52 Mass Ni56
0 0.0000000000000000e+00 2.8142378112400895e-15 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.3932235330395157e-24 7.1117997526547418e-14
1 5.9806047036494849e-08 2.8142323856670446e-15 5.4329394398418374e-21 7.4194443455948811e-24 7.3934514829832856e-24 7.3935541949306949e-24 7.3933935989353088e-24 7.3932321468740865e-24 7.3932312019180345e-24 7.3932308328287333e-24 7.3932307869392985e-24 7.3932307850741519e-24 7.3932307849933044e-24 7.1118070045957103e-14
2 1.2559269877663918e-07 2.8142264165381050e-15 1.1401993450709496e-20 7.4929528148974785e-24 7.3944694290388374e-24 7.3939305042586412e-24 7.3935838894001731e-24 7.3932425308122493e-24 7.3932405326301655e-24 7.3932397568503098e-24 7.3932396603620498e-24 7.3932396564405566e-24 7.3932396562705492e-24 7.1118158758588142e-14
1 5.9806047036494849e-08 2.8142323856670446e-15 5.4329394398523593e-21 7.4194443428333686e-24 7.3934514828234477e-24 7.3935541949253214e-24 7.3933935989348298e-24 7.3932321468740835e-24 7.3932312019180345e-24 7.3932308328287333e-24 7.3932307869392985e-24 7.3932307850741519e-24 7.3932307849933044e-24 7.1118070045957103e-14
2 1.2559269877663918e-07 2.8142264165381050e-15 1.1401993450700379e-20 7.4929526498089992e-24 7.3944694218302123e-24 7.3939305039811099e-24 7.3935838893792728e-24 7.3932425308121303e-24 7.3932405326301640e-24 7.3932397568503098e-24 7.3932396603620498e-24 7.3932396564405580e-24 7.3932396562705492e-24 7.1118158758588142e-14
156 changes: 156 additions & 0 deletions Exec/science/flame_wave/inputs.1d
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 250000000
stop_time = 3.0

# PROBLEM SIZE & GEOMETRY
geometry.is_periodic = 0 0 0
geometry.prob_lo = 0 0 0

geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical

geometry.prob_hi = 2.4576e4
amr.n_cell = 192

# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
# 0 = Interior 3 = Symmetry
# 1 = Inflow 4 = SlipWall
# 2 = Outflow 5 = NoSlipWall
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
castro.lo_bc = 3
castro.hi_bc = 2

castro.fill_ambient_bc = 1
castro.ambient_fill_dir = 0
castro.ambient_outflow_vel = 1

#castro.allow_non_unit_aspect_zones = 1

castro.domain_is_plane_parallel = 1

# WHICH PHYSICS
castro.do_hydro = 1
castro.do_react = 1
castro.do_rotation = 0
castro.do_grav = 1
castro.do_sponge = 1

castro.small_temp = 1.e6
castro.small_dens = 1.e-5

castro.ppm_type = 1
castro.grav_source_type = 2
castro.use_pslope = 1
castro.pslope_cutoff_density = 1.e4

gravity.gravity_type = ConstantGrav
gravity.const_grav = -1.5e14

castro.rotational_period = 0.0
castro.rotation_include_centrifugal = 0

castro.diffuse_temp = 0
castro.diffuse_cutoff_density_hi = 5.e4
castro.diffuse_cutoff_density = 2.e4

castro.diffuse_cond_scale_fac = 1.0

castro.react_rho_min = 1.e2
castro.react_rho_max = 5.e6

castro.react_T_min = 6.e7

castro.sponge_upper_density = 1.e2
castro.sponge_lower_density = 1.e0
castro.sponge_timescale = 1.e-7

# GPU options
castro.hydro_memory_footprint_ratio = 3

# TIME STEP CONTROL
castro.cfl = 0.8 # cfl number for hyperbolic system
castro.init_shrink = 0.1 # scale back initial timestep
castro.change_max = 1.1 # max time step growth

castro.use_retry = 1
castro.max_subcycles = 16

castro.retry_small_density_cutoff = 10.0

castro.abundance_failure_tolerance = 0.1
castro.abundance_failure_rho_cutoff = 1.0

# DIAGNOSTICS & VERBOSITY
castro.sum_interval = 10 # timesteps between computing mass
castro.v = 1 # verbosity in Castro.cpp
amr.v = 1 # verbosity in Amr.cpp

# REFINEMENT / REGRIDDING
amr.max_level = 2 # maximum level number allowed
amr.ref_ratio = 4 2 2 2 # refinement ratio
amr.regrid_int = 0 # static grids ftw
amr.blocking_factor = 32 # block factor in grid generation
amr.max_grid_size = 128
amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est

# CHECKPOINT FILES
amr.check_file = flame_wave_1000Hz_25cm_chk # root name of checkpoint file
#if AMREX_SPACEDIM == 3
amr.check_int = 25 # number of timesteps between checkpoints
#elif AMREX_SPACEDIM == 2
amr.check_int = 250 # number of timesteps between checkpoints
#endif

amr.checkpoint_files_output = 1

# PLOTFILES
amr.plot_file = flame_wave_1000Hz_25cm_plt # root name of plotfile
amr.plot_per = 5.e-3 # number of seconds between plotfiles
amr.derive_plot_vars = ALL
amr.plot_files_output = 1

amr.small_plot_file = flame_wave_1000Hz_25cm_smallplt # root name of plotfile
amr.small_plot_per = 5.e-4 # number of seconds between plotfiles
amr.small_plot_vars = density Temp

#if AMREX_SPACEDIM == 3
amr.derive_small_plot_vars = abar magvel enuc
#elif AMREX_SPACEDIM == 2
amr.derive_small_plot_vars = abar x_velocity y_velocity z_velocity enuc
#endif

fab.format = NATIVE_32


# problem initialization

problem.dtemp = 1.2e9
problem.x_half_max = 2.56e4
problem.x_half_width = 2048.e0

problem.dens_base = 3.43e6

problem.T_star = 2.e8
problem.T_hi = 2.e8
problem.T_lo = 8.e6

problem.H_star = 2000.e0
problem.atm_delta = 50.0

problem.fuel1_name = "helium-4"
problem.fuel1_frac = 1.0

problem.ash1_name = "nickel-56"
problem.ash1_frac = 1.0

problem.low_density_cutoff = 1.e-4

problem.tag_by_density = 0
problem.refine_height = 3600.0
problem.max_base_tagging_level = 3

# Microphysics

integrator.rtol_spec = 1.e-6
integrator.atol_spec = 1.e-6

network.use_tables = 1
4 changes: 4 additions & 0 deletions Exec/science/flame_wave/problem_initialize.H
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ void problem_initialize ()
problem::center[d] = 0.5_rt * (problo[d] + probhi[d]);
}

#if AMREX_SPACEDIM == 1
problem::center[0] = 0.0_rt;
#endif

#if AMREX_SPACEDIM == 2
// for axisymmetry, put the x-center on the x-axis
// and the y-center at 0, so the height computation is okay
Expand Down
32 changes: 20 additions & 12 deletions Exec/science/massive_star/analysis/massive_star_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

matplotlib.use('agg')


ANNOTATE_O16 = False
ANNOTATE_NSE = True


def make_plot(plotfile, prefix="plot", width_frac=0.1,
Expand All @@ -25,8 +26,8 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
t_drive = 0.0
if "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
elif "castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["castro.drive_initial_convection_tmax"]
elif "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
print(t_drive)

xmin = ds.domain_left_edge[0]
Expand Down Expand Up @@ -75,27 +76,34 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
sp.set_cmap(f, "magma")
sp.set_zlim(f, 1.e-2, 5)

if f == "enuc":
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", ncont=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})

# now do a contour of O
if ANNOTATE_O16:
sp.annotate_contour(("boxlib", "X(O16)"), ncont=1, clim=(0.5, 0.5), factor=32, take_log=False,
plot_args={"colors": "0.5", "linewidths": 2})

# now do a contour of NSE
if ANNOTATE_NSE:
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})


sp.set_axes_unit("cm")

fig = sp.export_to_mpl_figure((layout[0], layout[1]), axes_pad=(1.0, 0.4),
cbar_location=cbar_location, cbar_pad="2%")

fig.subplots_adjust(left=0.05, right=0.95, bottom=0.025, top=0.975)
fig.text(0.02, 0.02, f"$t - \\tau_\\mathrm{{drive}}$ = {float(ds.current_time) - t_drive:6.1f} s",
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.035, top=0.975)
fig.text(0.02, 0.01, f"$t - \\tau_\\mathrm{{drive}}$ = {float(ds.current_time) - t_drive:6.1f} s",
transform=fig.transFigure)
fig.set_size_inches(size)
fig.tight_layout()
extra = ""
if layout[0] >= layout[1]:
extra = "_vertical"

fig.savefig(f"{prefix}_{os.path.basename(plotfile)}_w{width_frac:04.2f}{extra}.pdf", pad_inches=0.1, bbox_inches="tight")
fig.savefig(f"{prefix}_{os.path.basename(plotfile)}_w{width_frac:04.2f}{extra}.pdf", pad_inches=0.1) #, bbox_inches="tight")


if __name__ == "__main__":
Expand All @@ -112,7 +120,7 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
plotfile = args.plotfile[0]

if args.vertical:
size = (7.5, 11.0)
size = (7.0, 10.0)
layout = (2, 2)
else:
size = (19.2, 8.5)
Expand Down
17 changes: 8 additions & 9 deletions Exec/science/massive_star/analysis/massive_star_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

matplotlib.use('agg')

times = [50, 100, 150, 200, 250]
times = [50, 100, 150, 200, 250, 300]

def find_files(plist):

Expand Down Expand Up @@ -60,8 +60,8 @@ def make_plot(field, pfiles, *,
t_drive = 0.0
if "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
elif "castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["castro.drive_initial_convection_tmax"]
elif "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
print(t_drive)

xmin = ds.domain_left_edge[0]
Expand Down Expand Up @@ -127,11 +127,10 @@ def make_plot(field, pfiles, *,
sp.set_cmap(f, "magma")
sp.set_zlim(f, 1.e-2, 5)

if f == "enuc":
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})

sp.set_axes_unit("cm")

Expand Down Expand Up @@ -168,7 +167,7 @@ def make_plot(field, pfiles, *,
args = p.parse_args()

if args.vertical:
size = (7.5, 8.5)
size = (7.0, 8.0)
else:
size = (19.2, 8.5)

Expand Down
Loading

0 comments on commit 1261061

Please sign in to comment.