Class ode_iv_solve_grid (o2scl)¶
-
template<class
func_t
= ode_funct_solve_grid, classmat_row_t
= solve_grid_mat_row>
classo2scl
::
ode_iv_solve_grid
¶ Solve an initial-value ODE problems on a grid given an adaptive ODE stepper.
This class works as similar to ode_iv_solve::solve_store() except that the solution is stored on a grid of points in the independent variable specified by the user, at the cost of taking extra steps to ensure that function values, derivatives, and errors are computed at each grid point.
There is an example for the usage of this class in
examples/ex_ode.cpp
documented in the ex_ode_sect section.Main solver function
-
int
verbose
¶ Set output level.
-
size_t
ntrial
¶ Maximum number of applications of the adaptive stepper (default 1000)
-
size_t
nsteps
¶ Number of adaptive steps employed.
-
template<class
vec_t
, classmat_t
>
intsolve_grid
(double h, size_t n, size_t nsol, vec_t &xsol, mat_t &ysol, mat_t &err_sol, mat_t &dydx_sol, func_t &derivs)¶ Solve the initial-value problem from
x0
tox1
over a grid storing derivatives and errors.Initially,
xsol
should be an array of sizensol
, andysol
should be aubmatrix
of size[nsol][n]. This function never takes a step larger than the grid size.
If verbose is greater than zero, The solution at each grid point will be written to
std::cout
. If verbose is greater than one, a character will be required after each point.- Idea for Future:
Consider making a version of grid which gives the same answers as solve_final_value(). After each proposed step, it would go back and fill in the grid points if the proposed step was past the next grid point.
The adaptive stepper
-
bool
exit_on_fail
¶ If true, stop the solution if the adaptive stepper fails (default true)
-
int
set_astep
(astep_base<mat_row_t, mat_row_t, mat_row_t, func_t> &as)¶ Set the adaptive stepper to use.
-
const char *
type
()¶ Return the type,
"ode_iv_solve"
.
Public Members
-
bool
err_nonconv
¶ If true, call the error handler if the solution does not converge (default true)
Protected Functions
-
int