diff --git a/include/oscode/solver.hpp b/include/oscode/solver.hpp index 4c916da..01ac46b 100644 --- a/include/oscode/solver.hpp +++ b/include/oscode/solver.hpp @@ -307,7 +307,9 @@ void Solution::solve() { std::complex x_dense_rk, dx_dense_rk; // Experimental continuous solution, vandermonde representation Eigen::Matrix, 7, 1> xvdm; - + // So that warnings only happen once + bool step_size_warning = true; + bool acceptance_ratio_warning = true; while (fend > 0) { // Check if we are reaching the end of integration if (fnext < 0) { @@ -382,9 +384,13 @@ void Solution::solve() { totsteps += 1; // Checking for too many steps and low acceptance ratio: if (totsteps % 5000 == 0) { - std::cerr << "Warning: the solver took " << totsteps - << " steps, and may take a while to converge." << std::endl; - if (ssteps / totsteps < 0.05) { + if (step_size_warning) { + step_size_warning = false; + std::cerr << "Warning: the solver took " << totsteps + << " steps, and may take a while to converge." << std::endl; + } + if (acceptance_ratio_warning && ssteps / totsteps < 0.05) { + acceptance_ratio_warning = false; std::cerr << "Warning: the step acceptance ratio is below 5%, the " "solver may take a while to converge." << std::endl; diff --git a/include/oscode/wkbsolver.hpp b/include/oscode/wkbsolver.hpp index d6b4671..aa3afad 100644 --- a/include/oscode/wkbsolver.hpp +++ b/include/oscode/wkbsolver.hpp @@ -5,10 +5,10 @@ #include #include -/** Class to carry out WKB steps of varying orders. */ +/** Class to carry out WKB steps of varying orders. */ class WKBSolver { protected: - // Derivative terms + // Derivative terms void d1w1(); void d1w2(); void d1w3();