diff --git a/ode/impl/KokkosODE_RungeKutta_impl.hpp b/ode/impl/KokkosODE_RungeKutta_impl.hpp index 99995f8b6d..975fe8e6f8 100644 --- a/ode/impl/KokkosODE_RungeKutta_impl.hpp +++ b/ode/impl/KokkosODE_RungeKutta_impl.hpp @@ -34,8 +34,8 @@ template KOKKOS_FUNCTION void RKStep(ode_type& ode, const table_type& table, scalar_type t, scalar_type dt, - const vec_type& y_old, const vec_type& y_new, - const vec_type& temp, const mv_type& k_vecs) { + const vec_type& y_old, const vec_type& y_new, + const vec_type& temp, const mv_type& k_vecs) { const int neqs = ode.neqs; const int nstages = table.nstages; @@ -122,20 +122,19 @@ KOKKOS_FUNCTION Experimental::ode_solver_status RKSolve( // Compute the largest error and decide on // the size of the next time step to take. - error = 0; + error = 0; // Compute estimation of the error using k_vecs and table.e if (adapt == true) { - // Compute the error for (int eqIdx = 0; eqIdx < ode.neqs; ++eqIdx) { tol = params.abs_tol + params.rel_tol * Kokkos::max(Kokkos::abs(y(eqIdx)), Kokkos::abs(y0(eqIdx))); - error_n = 0; - for (int stageIdx = 0; stageIdx < table.nstages; ++stageIdx) { - error_n += dt * table.e[stageIdx] * k_vecs(stageIdx, eqIdx); - } + error_n = 0; + for (int stageIdx = 0; stageIdx < table.nstages; ++stageIdx) { + error_n += dt * table.e[stageIdx] * k_vecs(stageIdx, eqIdx); + } error = Kokkos::max(error, Kokkos::abs(error_n) / tol); } @@ -143,8 +142,9 @@ KOKKOS_FUNCTION Experimental::ode_solver_status RKSolve( // is too large and current step // is rejected. if (error > 1) { - dt = dt * - Kokkos::max(0.2, 0.8 * Kokkos::pow(error, -1.0 / (table.order + 1))); + dt = + dt * Kokkos::max( + 0.2, 0.8 * Kokkos::pow(error, -1.0 / (table.order + 1))); dt_was_reduced = true; } @@ -165,7 +165,8 @@ KOKKOS_FUNCTION Experimental::ode_solver_status RKSolve( dt = dt * Kokkos::min( 10.0, - Kokkos::max(2.0, 0.9 * Kokkos::pow(error, -1.0 / (table.order + 1)))); + Kokkos::max( + 2.0, 0.9 * Kokkos::pow(error, -1.0 / (table.order + 1)))); } } else { return Experimental::ode_solver_status::SUCCESS;