From c4b7181453f3dca7645d8fdb79fe3d4317ca7ecb Mon Sep 17 00:00:00 2001 From: Zhi Chen <62574124+zhichen3@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:41:37 -0500 Subject: [PATCH 1/2] use abs for volume and area for 1d and 2d (#3007) Use std::abs to make sure volume in non-cartesian coord are positive. Also make sure 1d/2d noncartesian area are positive since area direction becomes trivial when we have phi-symmetry. --- Source/driver/Castro_util.H | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/driver/Castro_util.H b/Source/driver/Castro_util.H index c6162b0190..fb667b7fae 100644 --- a/Source/driver/Castro_util.H +++ b/Source/driver/Castro_util.H @@ -217,7 +217,7 @@ Real volume(const int& i, const int& j, const int& k, Real rl = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; Real rr = rl + dx[0]; - vol = M_PI * dx[0] * (rr + rl); + vol = std::abs(M_PI * dx[0] * (rr + rl)); } else { @@ -226,7 +226,7 @@ Real volume(const int& i, const int& j, const int& k, Real rl = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; Real rr = rl + dx[0]; - vol = (4.0_rt / 3.0_rt) * M_PI * dx[0] * (rl * rl + rl * rr + rr * rr); + vol = std::abs((4.0_rt / 3.0_rt) * M_PI * dx[0] * (rl * rl + rl * rr + rr * rr)); } @@ -247,7 +247,7 @@ Real volume(const int& i, const int& j, const int& k, Real r_l = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; Real r_r = geomdata.ProbLo()[0] + static_cast(i+1) * dx[0]; - vol = M_PI * (r_l + r_r) * dx[0] * dx[1]; + vol = std::abs(M_PI * (r_l + r_r) * dx[0] * dx[1]); } else { @@ -260,8 +260,8 @@ Real volume(const int& i, const int& j, const int& k, Real theta_l = geomdata.ProbLo()[1] + static_cast(j) * dx[1]; Real theta_r = geomdata.ProbLo()[1] + static_cast(j+1) * dx[1]; - vol = twoThirdsPi * (std::cos(theta_l) - std::cos(theta_r)) * dx[0] * - (r_r * r_r + r_r * r_l + r_l * r_l); + vol = std::abs(twoThirdsPi * (std::cos(theta_l) - std::cos(theta_r)) * dx[0] * + (r_r * r_r + r_r * r_l + r_l * r_l)); } @@ -306,7 +306,7 @@ Real area(const int& i, const int& j, const int& k, Real r = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; - a = 2.0_rt * M_PI * r; + a = std::abs(2.0_rt * M_PI * r); } else { @@ -314,7 +314,7 @@ Real area(const int& i, const int& j, const int& k, Real r = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; - a = 4.0_rt * M_PI * r * r; + a = std::abs(4.0_rt * M_PI * r * r); } @@ -339,11 +339,11 @@ Real area(const int& i, const int& j, const int& k, if (idir == 0) { Real r = geomdata.ProbLo()[0] + static_cast(i) * dx[0]; - a = 2.0_rt * M_PI * r * dx[1]; + a = std::abs(2.0_rt * M_PI * r * dx[1]); } else { Real r = geomdata.ProbLo()[0] + (static_cast(i) + 0.5_rt) * dx[0]; - a = 2.0_rt * M_PI * r * dx[0]; + a = std::abs(2.0_rt * M_PI * r * dx[0]); } } else { @@ -355,13 +355,13 @@ Real area(const int& i, const int& j, const int& k, Real theta_l = geomdata.ProbLo()[1] + static_cast(j) * dx[1]; Real theta_r = geomdata.ProbLo()[1] + static_cast(j+1) * dx[1]; - a = 2.0_rt * M_PI * r * r * (std::cos(theta_l) - std::cos(theta_r)); + a = std::abs(2.0_rt * M_PI * r * r * (std::cos(theta_l) - std::cos(theta_r))); } else { Real r = geomdata.ProbLo()[0] + (static_cast(i) + 0.5_rt) * dx[0]; Real theta = geomdata.ProbLo()[1] + static_cast(j) * dx[1]; - a = 2.0_rt * M_PI * std::sin(theta) * r * dx[0]; + a = std::abs(2.0_rt * M_PI * std::sin(theta) * r * dx[0]); } } From 5d9a59a2a0b6c80c8708e9094961e795b1f67d8f Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Fri, 6 Dec 2024 14:40:35 -0500 Subject: [PATCH 2/2] some updates for the He merger stuff (#3008) This turns on burn retry, thins out the plotfiles, and sets the plotfiles to single precision --- .../he_double_det/inputs_pakmor_simp_sdc | 33 +++++++++++-------- .../tests/he_double_det/inputs_pakmor_strang | 24 +++++++++----- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_simp_sdc b/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_simp_sdc index 9b49a701ed..b6d715e70a 100644 --- a/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_simp_sdc +++ b/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_simp_sdc @@ -61,7 +61,7 @@ castro.hi_bc = 2 2 2 max_step = 10000000 # Simulation end time -stop_time = 200.0 +stop_time = 1000.0 # CFL number for hyperbolic system castro.cfl = 0.5 @@ -70,10 +70,10 @@ castro.cfl = 0.5 castro.fixed_dt = -1.0 # Scale back initial timestep by this factor -castro.init_shrink = 0.01 +castro.init_shrink = 0.1 # Factor by which dt is allowed to change each timestep -castro.change_max = 1.10 +castro.change_max = 1.20 # If we regrid on Level 0, compute a new timestep afterward amr.compute_new_dt_on_regrid = 1 @@ -91,6 +91,8 @@ castro.abundance_failure_rho_cutoff = 1.0e0 # Default is 10, 16 is recommended value castro.max_subcycles = 16 +# Switching to simplified SDC +castro.time_integration_method = 3 ############################################################################################ # Resolution, gridding and AMR @@ -292,9 +294,6 @@ integrator.atol_spec = 1.0e-6 integrator.rtol_enuc = 1.0e-6 integrator.atol_enuc = 1.0e-6 -# Do not abort or retry on a failed burn (Castro will handle this) -integrator.abort_on_failure = 0 - # Renormalize abundances during the burn integrator.renormalize_abundances = 1 @@ -302,10 +301,13 @@ integrator.renormalize_abundances = 1 integrator.MAX_TEMP = 1.0e10 # Use tabular rate evaluation when available -network.use_tables = 1 +network.use_tables = 0 -# Switching to simplified SDC -castro.time_integration_method = 3 +# use retry in the burner and cap the number of steps to make the +# reactions go faster +integrator.use_burn_retry = 1 +integrator.retry_swap_jacobian = 1 +integrator.ode_max_steps = 10000 ############################################################################################ # Gravity @@ -380,16 +382,16 @@ amr.check_file = chk castro.dump_old = 1 # Simulation time between checkpoints -amr.check_per = 1.0 +amr.check_per = -1 # Number of timesteps between checkpoints -amr.check_int = -1 +amr.check_int = 50 # Root name of plot files amr.plot_file = plt # Simulation time between plotfiles -amr.plot_per = 1.0 +amr.plot_per = 2.0 # Number of timesteps between plotfiles amr.plot_int = -1 @@ -426,17 +428,20 @@ gravity.v = 1 amr.plot_vars = ALL # Derived variables to add to plot files -amr.derive_plot_vars = pressure +amr.derive_plot_vars = ALL # State variables to add to small plot files amr.small_plot_vars = density Temp # Derived variables to add to small plot files -amr.derive_small_plot_vars = enuc X(He4) X(C12) X(O16) +amr.derive_small_plot_vars = abar enuc MachNumber magvel magvort X(He4) X(C12) X(O16) # Name of the diagnostic sum output files amr.data_log = star_diag.out primary_diag.out secondary_diag.out rotation_diag.out +# write plotfiles as single precision +fab.format = NATIVE_32 + ############################################################################################ # Problem parameters ############################################################################################ diff --git a/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_strang b/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_strang index 7977ab7787..bb503bcc8d 100644 --- a/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_strang +++ b/Exec/science/wdmerger/tests/he_double_det/inputs_pakmor_strang @@ -292,9 +292,6 @@ integrator.atol_spec = 1.0e-6 integrator.rtol_enuc = 1.0e-6 integrator.atol_enuc = 1.0e-6 -# Do not abort or retry on a failed burn (Castro will handle this) -integrator.abort_on_failure = 0 - # Renormalize abundances during the burn integrator.renormalize_abundances = 1 @@ -302,7 +299,13 @@ integrator.renormalize_abundances = 1 integrator.MAX_TEMP = 1.0e10 # Use tabular rate evaluation when available -network.use_tables = 1 +network.use_tables = 0 + +# use retry in the burner and cap the number of steps to make the +# reactions go faster +integrator.use_burn_retry = 1 +integrator.retry_swap_jacobian = 1 +integrator.ode_max_steps = 10000 ############################################################################################ # Gravity @@ -377,16 +380,16 @@ amr.check_file = chk castro.dump_old = 1 # Simulation time between checkpoints -amr.check_per = 1.0 +amr.check_per = -1 # Number of timesteps between checkpoints -amr.check_int = -1 +amr.check_int = 50 # Root name of plot files amr.plot_file = plt # Simulation time between plotfiles -amr.plot_per = 1.0 +amr.plot_per = 2.0 # Number of timesteps between plotfiles amr.plot_int = -1 @@ -423,17 +426,20 @@ gravity.v = 1 amr.plot_vars = ALL # Derived variables to add to plot files -amr.derive_plot_vars = pressure +amr.derive_plot_vars = ALL # State variables to add to small plot files amr.small_plot_vars = density Temp # Derived variables to add to small plot files -amr.derive_small_plot_vars = enuc X(He4) X(C12) X(O16) +amr.derive_small_plot_vars = abar enuc MachNumber magvel magvort X(He4) X(C12) X(O16) # Name of the diagnostic sum output files amr.data_log = star_diag.out primary_diag.out secondary_diag.out rotation_diag.out +# write plotfiles as single precision +fab.format = NATIVE_32 + ############################################################################################ # Problem parameters ############################################################################################