Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions include/oscode/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ void Solution::solve() {
std::complex<double> x_dense_rk, dx_dense_rk;
// Experimental continuous solution, vandermonde representation
Eigen::Matrix<std::complex<double>, 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) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions include/oscode/wkbsolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <iomanip>
#include <list>

/** 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();
Expand Down