7void NewtonLobattoIIIC6::f_Newton (
double *x,
double *y) {
14 for (n=0; n<
nk_; n++) {
16 for (i=0; i<
neq_; i++) {
27void NewtonLobattoIIIC6::J_Newton (
double *x,
double **J) {
36 for (n=0; n<
nk_; n++) {
39 for (i=0; i<
neq_; i++) {
47 for (i=0; i<
neq_; i++) {
48 for (j=0; j<
neq_; j++) {
49 for (m=0; m<
nk_; m++) {
68 for (
int i=0; i<nk; i++) a[i] =
new double[nk];
73 a[0][0] = 1.0/12; a[0][1] = -r/12; a[0][2] = r/12; a[0][3] = -1.0/12;
74 a[1][0] = 1.0/12; a[1][1] = 1.0/4; a[1][2] = (10 - 7*r)/60; a[1][3] = r/60;
75 a[2][0] = 1.0/12; a[2][1] = (10 + 7*r)/60; a[2][2] = 1.0/4; a[2][3] = -r/60;
76 a[3][0] = 1.0/12; a[3][1] = 5.0/12; a[3][2] = 5.0/12; a[3][3] = 1.0/12;
78 b[0] = 1.0/12; b[1] = 5.0/12; b[2] = 5.0/12; b[3] = 1.0/12;
85 for (
int i=0; i<
nk_; i++)
delete [] a[i];
90void OdeLobattoIIIC6::step_ (
double dt) {
98 for (i=0; i<
neq_; i++)
sol_[i] += dt*(b[0]*
k_[0][i]
Nonlinear system solver for OdeLobattoIIIC6.
Base class implementing solver functions with adaptive time steps.
unsigned long neq_
number of equations in the system of ODEs
std::string method_
the "name" of the solver/method, as in "Euler" or "RK4"
double * sol_
array for the solution, changing over time
Provides a large vector containing the slope values of all stages with pointers to each of the indivi...
double ** k_
individual k arrays for each stage
int nk_
number of RK stages
double * kall_
pointer to single array storing all stage k values
OdeLobattoIIIC6(unsigned long neq)
constructs
~OdeLobattoIIIC6()
destructs
double ** Jac_
pointer to the solver's Jacobian matrix
void fun(double *solin, double *fout)
wrapper around system evaluation function
unsigned long neq_
ODE system size.
double * dt_
pointer to time step member
void jac(double *solin, double **Jout)
wrapper around Jacobian evaluation function
double * ftemp_
temporary values for evaluation of Newton function
double * sol_
pointer to the solver's solution vector
double * soltemp_
temporary solution values
void set_modified(bool modified)
sets whether modified Newtion's is being used
int solve_Newton(double *x)
Solve the system of equations.
bool get_modified()
gets whether modified Newtion's is being used
int nk_
number of stages or k vectors
double ** a
pointer to tableau coefficients
double ** k_
pointer to the stage slopes of RK methods