accelerInt
v0.1
examples
van_der_pol
jacob.cu
Go to the documentation of this file.
1
9
#include "
header.cuh
"
10
11
#ifdef GENERATE_DOCS
12
//put this in the van der Pol namespace for documentation
13
namespace
van_der_pol_cu
{
14
#endif
15
30
__device__
31
void
eval_jacob
(
const
double
t,
const
double
mu,
const
double
* __restrict__ y,
double
* __restrict__ jac,
const
mechanism_memory
* __restrict__ d_mem)
32
{
33
//Note, to reach index [i, j] of the Jacobian, we multiply `i` by NSP, the size of the first dimension of Jacobian and add j, i.e.:
34
//jac[i, j] -> jac[i * NSP + j]
36
jac[
INDEX
(0 *
NSP
+ 0)] = 0;
38
jac[
INDEX
(0 *
NSP
+ 1)] = -2 * mu * y[
INDEX
(0)] * y[
INDEX
(1)] - 1;
40
jac[
INDEX
(1 *
NSP
+ 0)] = 1;
42
jac[
INDEX
(1 *
NSP
+ 1)] = mu * (1 - y[
INDEX
(0)] * y[
INDEX
(0)]);
43
}
44
45
#ifdef GENERATE_DOCS
46
}
47
#endif
NSP
#define NSP
The IVP system size.
Definition:
header.cuh:20
header.cuh
An example header file that defines system size, memory functions and other required methods for inte...
van_der_pol_cu::mechanism_memory
This struct is used to store memory for the CUDA RHS and Jacobian evaluation. Along with the solver_m...
Definition:
gpu_memory.cuh:25
van_der_pol_cu
Definition:
dydt.cu:14
INDEX
#define INDEX(i)
Convenience macro to get the value of a vector at index i, calculated as i * GRID_DIM + T_ID...
Definition:
gpu_macros.cuh:24
van_der_pol_cu::eval_jacob
__device__ void eval_jacob(const double t, const double mu, const double *__restrict__ y, double *__restrict__ jac, const mechanism_memory *__restrict__ d_mem)
An implementation of the van der Pol jacobian.
Definition:
jacob.cu:31
Generated by
1.8.14