7void NewtonSDIRK43::f_Newton (
double *x,
double *y) {
15 for (i=0; i<
neq_; i++) {
26void NewtonSDIRK43::J_Newton (
double *x,
double **J) {
35 for (i=0; i<
neq_; i++) {
44 for (i=0; i<
neq_; i++) {
45 for (j=0; j<
neq_; j++) {
62 for (
int i=0; i<nk; i++) a[i] =
new double[nk];
69 a[2][0] = 17.0/50; a[2][1] = -1.0/25;
70 a[3][0] = 371.0/1360; a[3][1] = -137.0/2720; a[3][2] = 15.0/544;
71 a[4][0] = 25.0/24; a[4][1] = -49.0/48; a[4][2] = 125.0/16; a[4][3] = -85.0/12;
73 b[0] = a[4][0]; b[1] = a[4][1]; b[2] = a[4][2]; b[3] = a[4][3]; b[4] = gam;
74 d[0] = 59.0/48; d[1] = -17.0/96; d[2] = 225.0/32; d[3] = -85.0/12;
81 for (
int i=0; i<
nk_; i++)
delete [] a[i];
87void OdeSDIRK43::step_ (
double dt) {
93 for (i=0; i<
neq_; i++)
k_[0][i] = 0.0;
99 for (
int j=1; j<
nk_; j++) {
101 for (i=0; i<
neq_; i++)
k_[j][i] =
k_[j-1][i];
107 for (i=0; i<
neq_; i++) {
112 sol_[i] += dt*(b[0]*
k_[0][i]
Nonlinear system solver for OdeSDIRK43.
void ode_jac_(double *solin, double **Jout)
wrapper, calls ode_jac() and increments nJac;
unsigned long neq_
number of equations in the system of ODEs
double ** Jac_
storage for the ODE system's Jacobian matrix, only allocated for the methods that need it
std::string method_
the "name" of the solver/method, as in "Euler" or "RK4"
double * sol_
array for the solution, changing over time
Base clase implementing methods for embedded Runge-Kutta error estimation.
double * solemb_
embedded solution array
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
void set_ignore_JLU(bool ignore_JLU)
sets whether no LU decompositions should be done
void set_ik(int ik)
sets the index of the k vector being solved for
double ** k_
pointer to the stage slopes of RK methods
double ** a
pointer to tableau coefficients
double gam
diagonal tableau coefficient
int ik_
the index of the k vector being solved for
Provides space for stage slope values, an array of arrays for k values.
int nk_
number of stages, or k vectors
double ** k_
stage evaluations
OdeSDIRK43(unsigned long neq)
constructs