@@ -16,7 +16,7 @@ using namespace integrator_rp;
16
16
17
17
template <typename BurnT>
18
18
AMREX_GPU_HOST_DEVICE AMREX_INLINE
19
- void actual_integrator (BurnT& state, Real dt)
19
+ void actual_integrator (BurnT& state, amrex:: Real dt, bool is_retry= false )
20
20
{
21
21
constexpr int int_neqs = integrator_neqs<BurnT>();
22
22
@@ -38,46 +38,63 @@ void actual_integrator (BurnT& state, Real dt)
38
38
// Save the initial composition and temperature for our later diagnostics.
39
39
40
40
#ifndef AMREX_USE_GPU
41
- Real xn_in[NumSpec];
41
+ amrex:: Real xn_in[NumSpec];
42
42
for (int n = 0 ; n < NumSpec; ++n) {
43
43
xn_in[n] = state.y [SFS+n] / state.y [SRHO];
44
44
}
45
45
// we are assuming that the temperature was valid on input
46
- Real T_in = state.T ;
46
+ amrex:: Real T_in = state.T ;
47
47
#ifdef AUX_THERMO
48
- Real aux_in[NumAux];
48
+ amrex:: Real aux_in[NumAux];
49
49
for (int n = 0 ; n < NumAux; ++n) {
50
50
aux_in[n] = state.y [SFX+n] / state.y [SRHO];
51
51
}
52
52
#endif
53
- Real rhoe_in = state.y [SEINT];
53
+ amrex:: Real rhoe_in = state.y [SEINT];
54
54
#endif
55
55
56
56
57
57
// Set the tolerances.
58
58
59
- Real sdc_tol_fac = std::pow (sdc_burn_tol_factor, state.num_sdc_iters - state.sdc_iter - 1 );
59
+ amrex:: Real sdc_tol_fac = std::pow (sdc_burn_tol_factor, state.num_sdc_iters - state.sdc_iter - 1 );
60
60
61
61
// we use 1-based indexing inside of RKC, so we need to shift the
62
62
// indices SRHO, SFS, etc by 1
63
63
64
- Real sdc_min_density = amrex::min (state.rho , state.rho_orig + state.ydot_a [SRHO] * dt);
64
+ amrex:: Real sdc_min_density = amrex::min (state.rho , state.rho_orig + state.ydot_a [SRHO] * dt);
65
65
66
- rkc_state.atol_enuc = sdc_min_density * atol_enuc * sdc_tol_fac;
67
- rkc_state.rtol_enuc = rtol_enuc * sdc_tol_fac;
66
+ if (!is_retry) {
67
+
68
+ rkc_state.atol_enuc = sdc_min_density * atol_enuc * sdc_tol_fac;
69
+ rkc_state.rtol_enuc = rtol_enuc * sdc_tol_fac;
70
+
71
+ // Note: we define the input atol for species to refer only to the
72
+ // mass fraction part, and we multiply by a representative density
73
+ // so that atol becomes an absolutely tolerance on (rho X)
74
+
75
+ rkc_state.atol_spec = sdc_min_density * atol_spec * sdc_tol_fac;
76
+ rkc_state.rtol_spec = rtol_spec * sdc_tol_fac;
77
+
78
+ } else {
79
+
80
+ rkc_state.atol_enuc = sdc_min_density * retry_atol_enuc * sdc_tol_fac;
81
+ rkc_state.rtol_enuc = retry_rtol_enuc * sdc_tol_fac;
82
+
83
+ // Note: we define the input atol for species to refer only to the
84
+ // mass fraction part, and we multiply by a representative density
85
+ // so that atol becomes an absolutely tolerance on (rho X)
86
+
87
+ rkc_state.atol_spec = sdc_min_density * retry_atol_spec * sdc_tol_fac;
88
+ rkc_state.rtol_spec = retry_rtol_spec * sdc_tol_fac;
89
+
90
+ }
68
91
69
92
if (scale_system) {
70
93
// the absolute tol for energy needs to reflect the scaled
71
94
// energy the integrator sees
72
95
rkc_state.atol_enuc /= state.e_scale ;
73
96
}
74
97
75
- // Note: we define the input atol for species to refer only to the
76
- // mass fraction part, and we multiply by a representative density
77
- // so that atol becomes an absolutely tolerance on (rho X)
78
-
79
- rkc_state.atol_spec = sdc_min_density * atol_spec * sdc_tol_fac;
80
- rkc_state.rtol_spec = rtol_spec * sdc_tol_fac;
81
98
82
99
// Call the integration routine.
83
100
@@ -98,7 +115,7 @@ void actual_integrator (BurnT& state, Real dt)
98
115
// we only evolved (rho e), not (rho E), so we need to update the
99
116
// total energy now to ensure we are conservative
100
117
101
- Real rho_Sdot = 0 .0_rt;
118
+ amrex:: Real rho_Sdot = 0 .0_rt;
102
119
if (state.time > 0 ) {
103
120
rho_Sdot = (state.y [SEINT] - state.rhoe_orig ) / state.time - state.ydot_a [SEINT];
104
121
}
@@ -164,14 +181,14 @@ void actual_integrator (BurnT& state, Real dt)
164
181
std::cout << " temp start = " << std::setprecision (16 ) << T_in << std::endl;
165
182
std::cout << " rhoe start = " << std::setprecision (16 ) << rhoe_in << std::endl;
166
183
std::cout << " xn start = " ;
167
- for (int n = 0 ; n < NumSpec; ++n ) {
168
- std::cout << std::setprecision (16 ) << xn_in[n] << " " ;
184
+ for (auto X : xn_in ) {
185
+ std::cout << std::setprecision (16 ) << X << " " ;
169
186
}
170
187
std::cout << std::endl;
171
188
#ifdef AUX_THERMO
172
189
std::cout << " aux start = " ;
173
- for (int n = 0 ; n < NumAux; ++n ) {
174
- std::cout << std::setprecision (16 ) << aux_in[n] << " " ;
190
+ for (auto aux : aux_in ) {
191
+ std::cout << std::setprecision (16 ) << aux << " " ;
175
192
}
176
193
std::cout << std::endl;
177
194
#endif
0 commit comments