Skip to content

Commit c33bdf5

Browse files
authored
change subchandra model generation to allow different core X (AMReX-Astro#3166)
this now allows Ne20 and also the C/O ratio can be something other than 1/2. Each core X is specified separately now.
1 parent bda75b9 commit c33bdf5

File tree

7 files changed

+231
-11
lines changed

7 files changed

+231
-11
lines changed

Exec/science/subchandra/_prob_params

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ temp_core real 1.e7 y
5454

5555
temp_base real 4.e8 y
5656

57-
mixed_co_wd int 1 y
57+
# mass fraction of C12 to put in the core
58+
core_XC12 real 0.5 y
59+
60+
# mass fraction of O16 to put in the core
61+
core_XO16 real 0.5 y
62+
63+
# mass fraction of Ne20 to put in the core
64+
core_XNe20 real 0.0 y
5865

5966
low_density_cutoff real 1.e-4 y
6067

Exec/science/subchandra/initial_model.H

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ struct model_t {
3434
int ic12;
3535
int in14;
3636
int io16;
37+
int ine20;
3738

3839
amrex::Real X_N14;
3940
amrex::Real X_C12;
4041
amrex::Real X_O16;
42+
amrex::Real X_Ne20;
4143
};
4244

4345

@@ -428,7 +430,8 @@ build_star(const model_t& model_params, const Real dx,
428430
(model::profile(0).state(i, model::ispec+model_params.ihe4) <=
429431
network_rp::small_x)) {
430432
core_X += model::profile(0).state(i, model::ispec+model_params.ic12) +
431-
model::profile(0).state(i, model::ispec+model_params.io16);
433+
model::profile(0).state(i, model::ispec+model_params.io16) +
434+
model::profile(0).state(i, model::ispec+model_params.ine20);
432435
}
433436

434437
mass_he += vol * model::profile(0).state(i, model::idens) * layer_X;

Exec/science/subchandra/inputs_2d.N14.coarse

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ problem.delta = 5.e6
118118
problem.temp_core = 1.e7
119119
problem.temp_base = 1.75e8
120120

121-
problem.mixed_co_wd = 1
121+
problem.core_XC12 = 0.5
122+
problem.core_XO16 = 0.5
122123

123124
problem.X_N14 = 0.01
124125

Exec/science/subchandra/inputs_2d.NSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ problem.delta = 5.e6
113113
problem.temp_core = 1.e7
114114
problem.temp_base = 1.75e8
115115

116-
problem.mixed_co_wd = 1
116+
problem.core_XC12 = 0.5
117+
problem.core_XO16 = 0.5
117118

118119
problem.X_N14 = 0.0
119120

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# ------------------ INPUTS TO MAIN PROGRAM -------------------
2+
3+
amr.plot_files_output = 1
4+
amr.checkpoint_files_output = 1
5+
6+
max_step = 1000000
7+
stop_time = 10.0
8+
9+
geometry.is_periodic = 0 0
10+
geometry.coord_sys = 1 # r-z coordinates
11+
12+
geometry.prob_lo = 0. 0.
13+
geometry.prob_hi = 5.12e9 1.024e10
14+
15+
amr.n_cell = 640 1280
16+
17+
castro.lo_bc = 3 2
18+
castro.hi_bc = 2 2
19+
20+
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
21+
# 0 = Interior 3 = Symmetry
22+
# 1 = Inflow 4 = SlipWall
23+
# 2 = Outflow 5 = NoSlipWall
24+
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
25+
26+
castro.do_hydro = 1
27+
castro.do_grav = 1
28+
castro.do_react = 1
29+
castro.do_sponge = 1
30+
31+
castro.react_rho_min = 100.0
32+
castro.react_T_min = 5.e7
33+
34+
castro.disable_shock_burning = 1
35+
castro.ppm_type = 1
36+
castro.ppm_temp_fix = 0
37+
castro.use_pslope = 1
38+
39+
castro.use_flattening = 1
40+
41+
castro.riemann_solver = 1
42+
43+
# Full self-gravity with the Poisson equation
44+
gravity.gravity_type = PoissonGrav
45+
46+
# Multipole expansion includes terms up to r**(-max_multipole_order)
47+
gravity.max_multipole_order = 6
48+
49+
# Tolerance for multigrid solver for phi solves
50+
gravity.abs_tol = 1.e-10
51+
52+
# Use sync solve for gravity after refluxing
53+
#gravity.no_sync = 0
54+
55+
# Disable the use of the lagged composite correction for the potential
56+
gravity.do_composite_phi_correction = 0
57+
58+
castro.sponge_upper_density = 1.e4
59+
castro.sponge_lower_density = 1.e2
60+
castro.sponge_timescale = 1.e-3
61+
62+
castro.cfl = 0.2 # cfl number for hyperbolic system
63+
castro.init_shrink = 0.05 # scale back initial timestep by this factor
64+
castro.change_max = 1.025 # factor by which dt is allowed to change each timestep
65+
castro.sum_interval = 5 # timesteps between computing and printing volume averages
66+
castro.update_sources_after_reflux = 0
67+
castro.time_integration_method = 3
68+
69+
castro.use_retry = 1
70+
castro.retry_subcycle_factor = 0.5
71+
castro.max_subcycles = 32
72+
73+
castro.abundance_failure_rho_cutoff = 1.0
74+
75+
amr.v = 1 # control verbosity in Amr.cpp
76+
castro.v = 1 # control verbosity in Castro.cpp
77+
78+
castro.small_dens = 1.e-5
79+
castro.small_temp = 1.e5
80+
81+
#castro.dtnuc_e = 0.25
82+
#castro.dtnuc_X = 0.25
83+
84+
# gridding
85+
86+
amr.max_level = 2 # maximum level number allowed
87+
88+
amr.ref_ratio = 2 2 2 2 # refinement ratio
89+
amr.regrid_int = 2 # how often to regrid
90+
amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est
91+
amr.grid_eff = 0.7 # what constitutes an efficient grid
92+
93+
amr.max_grid_size = 256 # maximum grid size allowed -- used to control parallelism
94+
amr.blocking_factor = 32 # block factor in grid generation
95+
96+
# I/O
97+
98+
amr.check_file = subch_chk # root name of checkpoint file
99+
amr.check_int = 50 # number of timesteps between checkpoints
100+
amr.plot_file = subch_plt # root name of plot file
101+
amr.plot_int = -1 # number of timesteps between plotfiles
102+
amr.plot_per = 2.e-3
103+
104+
amr.derive_plot_vars = ALL
105+
castro.store_burn_weights = 1
106+
107+
# problem parameters
108+
109+
problem.pert_temp_factor = 20.0
110+
problem.pert_rad_factor = 0.5
111+
problem.R_pert = 1.e7
112+
113+
problem.M_WD = 1.1
114+
problem.M_He = 0.05
115+
116+
problem.delta = 5.e6
117+
118+
problem.temp_core = 1.e7
119+
problem.temp_base = 1.75e8
120+
121+
problem.core_XC12 = 0.0
122+
problem.core_XO16 = 0.7
123+
problem.core_XNe20 = 0.3
124+
125+
problem.X_N14 = 0.0
126+
127+
problem.low_density_cutoff = 1.e-4
128+
problem.temp_fluff = 7.5e7
129+
130+
problem.model_min_res = 5.e5
131+
132+
# tagging
133+
134+
amr.refinement_indicators = tempgrad denerr dencore temperr dencutoff
135+
136+
amr.refine.tempgrad.field_name = Temp
137+
amr.refine.tempgrad.relative_gradient = 2.0
138+
amr.refine.tempgrad.max_level = 2
139+
140+
amr.refine.denerr.field_name = density
141+
amr.refine.denerr.value_greater = 1.0
142+
amr.refine.denerr.max_level = 2
143+
144+
# this just refines the very center to capture the convergence of the
145+
# compression wave
146+
147+
amr.refine.dencore.field_name = density
148+
amr.refine.dencore.value_greater = 7.5e7
149+
amr.refine.dencore.max_level = 3
150+
151+
# now we want to refine regions where T > 2.e8 up to the maximum
152+
# level, but only if rho > 1.e3 -- otherwise, we don't care about
153+
# following things
154+
155+
amr.refine.temperr.field_name = Temp
156+
amr.refine.temperr.value_greater = 1.e8
157+
amr.refine.temperr.max_level = 3
158+
159+
amr.refine.dencutoff.derefine = 1
160+
amr.refine.dencutoff.field_name = density
161+
amr.refine.dencutoff.value_less = 1.e4
162+
163+
# Microphysics
164+
165+
network.small_x = 1.e-10
166+
integrator.SMALL_X_SAFE = 1.e-10
167+
168+
integrator.rtol_spec = 1.e-5
169+
integrator.atol_spec = 1.e-5
170+
integrator.rtol_enuc = 1.e-5
171+
integrator.atol_enuc = 1.e-5
172+
integrator.jacobian = 1
173+
174+
integrator.X_reject_buffer = 4.0
175+
176+
# disable jacobian caching in VODE
177+
integrator.use_jacobian_caching = 0
178+
179+
integrator.ode_max_steps = 20000
180+
181+
integrator.use_burn_retry = 1
182+
integrator.retry_swap_jacobian = 1

Exec/science/subchandra/inputs_3d.N14.coarse

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ problem.delta = 5.e6
128128
problem.temp_core = 1.e7
129129
problem.temp_base = 1.75e8
130130

131-
problem.mixed_co_wd = 1
131+
problem.core_XC12 = 0.5
132+
problem.core_XO16 = 0.5
132133

133134
problem.X_N14 = 0.01
134135

Exec/science/subchandra/problem_initialize.H

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,55 @@ void problem_initialize ()
6161
int ihe4 = network_spec_index("helium-4");
6262
int ic12 = network_spec_index("carbon-12");
6363
int io16 = network_spec_index("oxygen-16");
64+
int ine20 = network_spec_index("neon-20");
6465

6566
int in14 = network_spec_index("nitrogen-14");
6667

67-
if (ihe4 < 0 || ic12 < 0 || io16 < 0) {
68+
if (ihe4 < 0 || ic12 < 0 || io16 < 0 || ine20 < 0) {
6869
amrex::Error("ERROR: species not defined");
6970
}
7071

7172
if (in14 < 0 && problem::X_N14 > 0.0_rt) {
7273
amrex::Error("ERROR: N14 not defined");
7374
}
7475

76+
// core mass fractions should sum to 1
77+
if (std::abs(problem::core_XC12 +
78+
problem::core_XO16 +
79+
problem::core_XNe20 - 1.0_rt) > 1.e-10) {
80+
std::cout << problem::core_XC12 << " " << problem::core_XO16 << " " << problem::core_XNe20 << std::endl;
81+
amrex::Error("ERROR: core mass fractions should sum to 1");
82+
}
83+
7584
for (auto& X : model_params.xn_core) {
7685
X = network_rp::small_x;
7786
}
7887
for (auto& X : model_params.xn_he) {
7988
X = network_rp::small_x;
8089
}
8190

82-
if (problem::mixed_co_wd) {
83-
model_params.xn_core[ic12] = 0.5_rt - 0.5_rt * (NumSpec - 1) * network_rp::small_x;
84-
model_params.xn_core[io16] = 0.5_rt - 0.5_rt * (NumSpec - 1) * network_rp::small_x;
85-
} else {
86-
model_params.xn_core[ic12] = 1.0_rt - (NumSpec - 1) * network_rp::small_x;
91+
int ncore = 0;
92+
if (problem::core_XC12 > 0.0) {
93+
ncore++;
8794
}
8895

96+
if (problem::core_XO16 > 0.0) {
97+
ncore++;
98+
}
99+
100+
if (problem::core_XNe20 > 0.0) {
101+
ncore++;
102+
}
103+
104+
// we need to initialize the core to be 1 - other_xn * small_x.
105+
// We'll distribute this remainder over the core nuclei
106+
107+
int other_xn = NumSpec - ncore;
108+
109+
model_params.xn_core[ic12] = problem::core_XC12 - other_xn * network_rp::small_x / ncore;
110+
model_params.xn_core[io16] = problem::core_XO16 - other_xn * network_rp::small_x / ncore;;
111+
model_params.xn_core[ine20] = problem::core_XNe20 - other_xn * network_rp::small_x / ncore;;
112+
89113
if (problem::X_N14 > 0.0_rt) {
90114
model_params.xn_he[in14] = problem::X_N14;
91115
}
@@ -108,6 +132,7 @@ void problem_initialize ()
108132
model_params.ic12 = ic12;
109133
model_params.in14 = in14;
110134
model_params.io16 = io16;
135+
model_params.ine20 = ine20;
111136

112137
model_params.X_N14 = problem::X_N14;
113138
model_params.X_C12 = problem::X_C12;

0 commit comments

Comments
 (0)