accelerInt  v0.1
Functions
van_der_pol Namespace Reference

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...
 

Function Documentation

◆ apply_mask()

void van_der_pol::apply_mask ( double *  y_host)

Not needed for van der Pol.

In pyJac, these are used to transform the input/output vectors to deal with moving the last species mass fraction

Definition at line 41 of file ics.c.

◆ apply_reverse_mask()

void van_der_pol::apply_reverse_mask ( double *  y_host)

Not needed for van der Pol.

In pyJac, these are used to transform the input/output vectors to deal with moving the last species mass fraction

Definition at line 48 of file ics.c.

◆ dydt()

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.

See also
solver_generic.c
Parameters
[in]tThe current system time
[in]muThe van der Pol parameter
[in]yThe state vector
[out]dyThe output RHS (dydt) vector

Definition at line 22 of file dydt.c.

◆ eval_jacob()

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.

See also
solver_generic.c
Parameters
[in]tThe current system time
[in]muThe van der Pol parameter
[in]yThe state vector at time t
[out]jacThe jacobian to populate
Note
To get the value at index [i, j] of the Jacobian, we multiply 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 = [jac[0, 0], jac[1, 0], jac[0, 1], jac[1, 1]]





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}\)

Definition at line 23 of file jacob.c.

◆ set_same_initial_conditions()

void van_der_pol::set_same_initial_conditions ( int  NUM,
double **  y_host,
double **  var_host 
)

Set same ICs for all problems.

Parameters
NUMThe number of initial value problems
y_hostThe state vectors to initialize
var_hostThe vector of \(mu\) parameters for the van der Pol equation

Definition at line 20 of file ics.c.

◆ sparse_multiplier()

void van_der_pol::sparse_multiplier ( const double *  A,
const double *  Vm,
double *  w 
)

Implements Jacobian \ vector multiplication in sparse (or unrolled) form.

Parameters
[in]AThe (NSP x NSP) Jacobian matrix, see eval_jacob() for details on layout
[in]VmThe (NSP x 1) vector to multiply by
[out]wThe (NSP x 1) vector to store the result in, \(w := A * Vm\)

Definition at line 21 of file sparse_multiplier.c.