7void NewtonGauss6::f_Newton (
double *x,
double *y) {
14 for (n=0; n<
nk_; n++) {
16 for (i=0; i<
neq_; i++) {
27void NewtonGauss6::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];
71 double r = sqrt(15.0);
73 a[0][0] = 5.0/36; a[0][1] = 2.0/9 - r/15; a[0][2] = 5.0/36 - r/30;
74 a[1][0] = 5.0/36 + r/24; a[1][1] = 2.0/9; a[1][2] = 5.0/36 - r/24;
75 a[2][0] = 5.0/36 + r/30; a[2][1] = 2.0/9 + r/15; a[2][2] = 5.0/36;
77 b[0] = 5.0/18; b[1] = 4.0/9; b[2] = 5.0/18;
84 for (
int i=0; i<
nk_; i++)
delete [] a[i];
89void OdeGauss6::step_ (
double dt) {
97 for (i=0; i<
neq_; i++)
sol_[i] += dt*(b[0]*
k_[0][i]
Nonlinear system solver for OdeGauss6.
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
OdeGauss6(unsigned long neq)
constructs
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
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