accelerInt
v0.1
|
Functions | |
void | dydt (const double t, const double mu, const double *__restrict__ y, double *__restrict__ dy) |
An implementation of the RHS of the van der Pol equation. More... | |
void | set_same_initial_conditions (int NUM, double **y_host, double **var_host) |
Set same ICs for all problems. More... | |
void | apply_mask (double *y_host) |
Not needed for van der Pol. More... | |
void | apply_reverse_mask (double *y_host) |
Not needed for van der Pol. More... | |
void | eval_jacob (const double t, const double mu, const double *__restrict__ y, double *__restrict__ jac) |
An implementation of the van der Pol jacobian. More... | |
void | sparse_multiplier (const double *A, const double *Vm, double *w) |
Implements Jacobian \ vector multiplication in sparse (or unrolled) form. More... | |
void van_der_pol::apply_mask | ( | double * | y_host | ) |
void van_der_pol::apply_reverse_mask | ( | double * | y_host | ) |
void van_der_pol::dydt | ( | const double | t, |
const double | mu, | ||
const double *__restrict__ | y, | ||
double *__restrict__ | dy | ||
) |
An implementation of the RHS of the van der Pol equation.
The y
and dy
vectors supplied here are local versions of the global state vectors. They have been transformed from the global Column major (Fortan) ordering to a local 1-D vector. Hence the vector accesses can be done in a simple manner below, i.e. y[0] -> \(y_1\), y[1] -> \(y_2\), etc.
[in] | t | The current system time |
[in] | mu | The van der Pol parameter |
[in] | y | The state vector |
[out] | dy | The output RHS (dydt) vector |
void van_der_pol::eval_jacob | ( | const double | t, |
const double | mu, | ||
const double *__restrict__ | y, | ||
double *__restrict__ | jac | ||
) |
An implementation of the van der Pol jacobian.
The Jacobian is in a local Column-major (Fortran) order. As with dydt(), this function operates on local copies of the global state vector and jacobian. Hence simple linear indexing can be used here.
[in] | t | The current system time |
[in] | mu | The van der Pol parameter |
[in] | y | The state vector at time t |
[out] | jac | The jacobian to populate |
i
by NSP, the size of the first dimension of Jacobian and add j, i.e.: jac[i, j] -> jac[i * NSP + j].Remember that the Jacobian is flatten in column-major order, hence:
jac[0, 0] = \(\frac{\partial \dot{y_1}}{\partial y_1}\)
jac[1, 0] = \(\frac{\partial \dot{y_2}}{\partial y_1}\)
jac[0, 1] = \(\frac{\partial \dot{y_1}}{\partial y_2}\)
jac[1, 1] = \(\frac{\partial \dot{y_2}}{\partial y_2}\)
void van_der_pol::set_same_initial_conditions | ( | int | NUM, |
double ** | y_host, | ||
double ** | var_host | ||
) |
void van_der_pol::sparse_multiplier | ( | const double * | A, |
const double * | Vm, | ||
double * | w | ||
) |
Implements Jacobian \ vector multiplication in sparse (or unrolled) form.
[in] | A | The (NSP x NSP) Jacobian matrix, see eval_jacob() for details on layout |
[in] | Vm | The (NSP x 1) vector to multiply by |
[out] | w | The (NSP x 1) vector to store the result in, \(w := A * Vm\) |
Definition at line 21 of file sparse_multiplier.c.