15 gam21 = -0.767672395484;
16 gam31 = -0.851675323742; gam32 = 0.522967289188;
17 gam41 = 0.288463109545; gam42 = 0.0880214273381; gam43 = -0.337389840627;
20 g31 = gam31/
gam; g32 = gam32/
gam;
21 g41 = gam41/
gam; g42 = gam42/
gam; g43 = gam43/
gam;
24 alp31 = 0.796920457938; alp32 = 0.0730795420615;
26 b1 = 0.199293275701; b2 = 0.482645235674; b3 = 0.0680614886256; b4 = 0.25;
27 d1 = 0.346325833758; d2 = 0.285693175712; d3 = 0.367980990530;
31void OdeGRK4A::step_ (
double dt) {
56 for (i=0; i<
neq_; i++)
rhs_[i] = dt*
k_[1][i] + g21*
k_[0][i];
60 for (i=0; i<
neq_; i++)
k_[1][i] -= g21*
k_[0][i];
71 for (i=0; i<
neq_; i++)
rhs_[i] = dt*
k_[2][i] + g31*
k_[0][i]
76 for (i=0; i<
neq_; i++)
k_[2][i] -= g31*
k_[0][i] + g32*
k_[1][i];
87 for (i=0; i<
neq_; i++)
rhs_[i] = dt*
k_[3][i] + g41*
k_[0][i]
93 for (i=0; i<
neq_; i++)
k_[3][i] -= g41*
k_[0][i] + g42*
k_[1][i] + g43*
k_[2][i];
98 for (i=0; i<
neq_; i++) {
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
void ode_fun_(double *solin, double *fout)
wrapper, calls ode_fun() and increases the neval counter by one
Base clase implementing methods for embedded Runge-Kutta error estimation.
double * solemb_
embedded solution array
OdeGRK4A(unsigned long neq)
constructs
Base class for Rosenbrock methods.
void prep_jac(double **Jac, unsigned long n, double dt, int *p)
do necessary arithmetic with the Jacobian then lu factor it
int * p_
permutation array for LU factorization
double ** k_
stage derivatives
double * soltemp_
temporary sol vector
double * rhs_
right hand side of matrix equations
double gam
parameter multipying Jacobian or single diagonal gamma
void ode_solve_LU(double **LU, int *p, double *b, int n, double *out)
Solves a matrix equation where the matrix has already be crout LU decomposed.