Skip to content

Commit a5ee71b

Browse files
authored
simplify some logic in the SDC integrators (#1243)
basically, once we convert back from the integrator type to the burn_t, we should not have to use the integrator type any more. This will make it easier to merge these code paths in the future.
1 parent 946f079 commit a5ee71b

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

integration/BackwardEuler/actual_integrator_simplified_sdc.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void actual_integrator (BurnT& state, const Real dt)
9090

9191
Real rho_Sdot = 0.0_rt;
9292
if (state.time > 0) {
93-
rho_Sdot = (be.y(SEINT+1) - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
93+
rho_Sdot = (state.y[SEINT] - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
9494
}
9595

9696
state.y[SEDEN] += state.time * (state.ydot_a[SEDEN] + rho_Sdot);
@@ -130,7 +130,7 @@ void actual_integrator (BurnT& state, const Real dt)
130130
std::cout << Font::Bold << FGColor::Red << "[ERROR] integration failed in net" << ResetDisplay << std::endl;
131131
std::cout << "istate = " << istate << std::endl;
132132
std::cout << "zone = (" << state.i << ", " << state.j << ", " << state.k << ")" << std::endl;
133-
std::cout << "time = " << be.t << std::endl;
133+
std::cout << "time = " << state.time << std::endl;
134134
std::cout << "dt = " << std::setprecision(16) << dt << std::endl;
135135
std::cout << "dens start = " << std::setprecision(16) << state.rho_orig << std::endl;
136136
std::cout << "temp start = " << std::setprecision(16) << T_in << std::endl;

integration/RKC/actual_integrator_simplified_sdc.H

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void actual_integrator (BurnT& state, Real dt)
9898

9999
Real rho_Sdot = 0.0_rt;
100100
if (state.time > 0) {
101-
rho_Sdot = (rkc_state.y(SEINT+1) - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
101+
rho_Sdot = (state.y[SEINT] - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
102102
}
103103

104104
state.y[SEDEN] += state.time * (state.ydot_a[SEDEN] + rho_Sdot);
@@ -123,16 +123,16 @@ void actual_integrator (BurnT& state, Real dt)
123123
state.success = false;
124124
}
125125

126-
if (rkc_state.y(SEINT+1) < 0.0_rt) {
126+
if (state.y[SEINT] < 0.0_rt) {
127127
state.success = false;
128128
}
129129

130-
for (int n = 1; n <= NumSpec; ++n) {
131-
if (rkc_state.y(SFS+n) / state.y[SRHO] < -species_failure_tolerance) {
130+
for (int n = 0; n < NumSpec; ++n) {
131+
if (state.y[SFS+n] / state.rho < -species_failure_tolerance) {
132132
state.success = false;
133133
}
134134

135-
if (rkc_state.y(SFS+n) / state.y[SRHO] > 1.0_rt + species_failure_tolerance) {
135+
if (state.y[SFS+n] / state.rho > 1.0_rt + species_failure_tolerance) {
136136
state.success = false;
137137
}
138138
}
@@ -144,8 +144,8 @@ void actual_integrator (BurnT& state, Real dt)
144144
std::cout << "integration summary: " << std::endl;
145145
std::cout << "dens: " << state.rho << " temp: " << state.T << std::endl;
146146
std::cout << " energy released: " << state.e << std::endl;
147-
std::cout << "number of steps taken: " << rkc_state.nsteps << std::endl;
148-
std::cout << "number of f evaluations: " << rkc_state.nfe << std::endl;
147+
std::cout << "number of steps taken: " << state.n_step << std::endl;
148+
std::cout << "number of f evaluations: " << state.n_rhs << std::endl;
149149
}
150150
#endif
151151

@@ -156,7 +156,7 @@ void actual_integrator (BurnT& state, Real dt)
156156
std::cout << Font::Bold << FGColor::Red << "[ERROR] integration failed in net" << ResetDisplay << std::endl;
157157
std::cout << "ierr = " << ierr << std::endl;
158158
std::cout << "zone = (" << state.i << ", " << state.j << ", " << state.k << ")" << std::endl;
159-
std::cout << "time = " << rkc_state.t << std::endl;
159+
std::cout << "time = " << state.time << std::endl;
160160
std::cout << "dt = " << std::setprecision(16) << dt << std::endl;
161161
std::cout << "dens start = " << std::setprecision(16) << state.rho_orig << std::endl;
162162
std::cout << "temp start = " << std::setprecision(16) << T_in << std::endl;

integration/VODE/actual_integrator_simplified_sdc.H

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void actual_integrator (BurnT& state, Real dt)
102102

103103
Real rho_Sdot = 0.0_rt;
104104
if (state.time > 0) {
105-
rho_Sdot = (vode_state.y(SEINT+1) - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
105+
rho_Sdot = (state.y[SEINT] - state.rhoe_orig) / state.time - state.ydot_a[SEINT];
106106
}
107107

108108
state.y[SEDEN] += state.time * (state.ydot_a[SEDEN] + rho_Sdot);
@@ -127,16 +127,16 @@ void actual_integrator (BurnT& state, Real dt)
127127
state.success = false;
128128
}
129129

130-
if (vode_state.y(SEINT+1) < 0.0_rt) {
130+
if (state.y[SEINT] < 0.0_rt) {
131131
state.success = false;
132132
}
133133

134-
for (int n = 1; n <= NumSpec; ++n) {
135-
if (vode_state.y(SFS+n) / state.y[SRHO] < -species_failure_tolerance) {
134+
for (int n = 0; n < NumSpec; ++n) {
135+
if (state.y[SFS+n] / state.rho < -species_failure_tolerance) {
136136
state.success = false;
137137
}
138138

139-
if (vode_state.y(SFS+n) / state.y[SRHO] > 1.0_rt + species_failure_tolerance) {
139+
if (state.y[SFS+n] / state.rho > 1.0_rt + species_failure_tolerance) {
140140
state.success = false;
141141
}
142142
}
@@ -148,8 +148,8 @@ void actual_integrator (BurnT& state, Real dt)
148148
std::cout << "integration summary: " << std::endl;
149149
std::cout << "dens: " << state.rho << " temp: " << state.T << std::endl;
150150
std::cout << " energy released: " << state.e << std::endl;
151-
std::cout << "number of steps taken: " << vode_state.NST << std::endl;
152-
std::cout << "number of f evaluations: " << vode_state.NFE << std::endl;
151+
std::cout << "number of steps taken: " << state.n_step << std::endl;
152+
std::cout << "number of f evaluations: " << state.n_rhs << std::endl;
153153
}
154154
#endif
155155

@@ -164,7 +164,7 @@ void actual_integrator (BurnT& state, Real dt)
164164
std::cout << " VODE exited successfully, but a check on the data values failed" << std::endl;
165165
}
166166
std::cout << "zone = (" << state.i << ", " << state.j << ", " << state.k << ")" << std::endl;
167-
std::cout << "time = " << vode_state.t << std::endl;
167+
std::cout << "time = " << state.time << std::endl;
168168
std::cout << "dt = " << std::setprecision(16) << dt << std::endl;
169169
std::cout << "dens start = " << std::setprecision(16) << state.rho_orig << std::endl;
170170
std::cout << "temp start = " << std::setprecision(16) << T_in << std::endl;
@@ -212,7 +212,7 @@ void actual_integrator (BurnT& state, Real dt)
212212
#endif
213213
} else {
214214
#ifndef AMREX_USE_GPU
215-
std::cout << "burn entered NSE during integration (after " << vode_state.NST << " steps), zone = (" << state.i << ", " << state.j << ", " << state.k << ")" << std::endl;
215+
std::cout << "burn entered NSE during integration (after " << state.n_step << " steps), zone = (" << state.i << ", " << state.j << ", " << state.k << ")" << std::endl;
216216
#endif
217217
}
218218
}

0 commit comments

Comments
 (0)