Class Solution

Class Documentation

class Solution

A class to store all information related to a numerical solution run.

Public Functions

Solution(de_system &de_sys, std::complex<double> x0, std::complex<double> dx0, double t_i, double t_f, int o = 3, double r_tol = 1e-4, double a_tol = 0.0, double h_0 = 1, const char *full_output = "")

Constructor for when dense output was not requested. Sets up solution of the ODE.

Parameters
  • de_sys[in] de_system object carrying information about the ODE being solved

  • x0, dx0[in] initial conditions for the ODE, \( x(t) \), \( \frac{dx}{dt} \) evaluated at the start of the integration range

  • t_i[in] start of integration range

  • t_f[in] end of integration range

  • o[in] order of WKB approximation to be used

  • r_tol[in] (local) relative tolerance

  • a_tol[in] (local) absolute tolerance

  • h_0[in] initial stepsize to use

  • full_output[in] file name to write results to

template<typename X = double>
Solution(de_system &de_sys, std::complex<double> x0, std::complex<double> dx0, double t_i, double t_f, const X &do_times, int o = 3, double r_tol = 1e-4, double a_tol = 0.0, double h_0 = 1, const char *full_output = "")

Constructor for when dense output was requested. Sets up solution of the ODE.

Parameters
  • de_sys[in] de_system object carrying information about the ODE being solved

  • x0, dx0[in] initial conditions for the ODE, \( x(t) \), \( \frac{dx}{dt} \) evaluated at the start of the integration range

  • t_i[in] start of integration range

  • t_f[in] end of integration range

  • do_times[in] timepoints at which dense output is to be produced. Doesn’t need to be sorted, and duplicated are allowed.

  • o[in] order of WKB approximation to be used

  • r_tol[in] (local) relative tolerance

  • a_tol[in] (local) absolute tolerance

  • h_0[in] initial stepsize to use

  • full_output[in] file name to write results to

void solve()

Function to solve the ODE \( \ddot{x} + 2\gamma(t)\dot{x} + \omega^2(t)x = 0 \) for \( x(t), \frac{dx}{dt} \).

While solving the ODE, this function will populate the Solution object with the following results:

Public Members

RKSolver rksolver

Object to call RK steps

int ssteps

Successful, total attempted, and successful WKB steps the solver took, respectively

int totsteps
int wkbsteps
std::list<std::complex<double>> sol

Lists to contain the solution and its derivative evaluated at internal points taken by the solver (i.e. not dense output) after a run

std::list<std::complex<double>> dsol
std::list<double> times

List to contain the timepoints at which the solution and derivative are internally evaluated by the solver

std::list<bool> wkbs

List to contain the “type” of each step (RK/WKB) taken internally by the solver after a run

std::list<double> dotimes

Lists to contain the timepoints at which dense output was evaluated. This list will always be sorted in ascending order (with possible duplicates), regardless of the order the timepoints were specified upon input.

std::list<std::complex<double>> dosol

Lists to contain the dense output of the solution and its derivative

std::list<std::complex<double>> dodsol
std::list<double>::iterator dotit

Iterator to iterate over the dense output timepoints, for when these need to be written out to file

std::list<Eigen::Matrix<std::complex<double>, 7, 1>> sol_vdm