accelerInt  v0.1
Functions
generic Namespace Reference

Functions

void intDriver (const int NUM, const double t, const double t_end, const double *pr_global, double *y_global)
 Integration driver for the CPU integrators. More...
 
int integrate (const double t_start, const double t_end, const double pr, double *y)
 A header definition of the integrate method, that must be implemented by various solvers. More...
 
void init_solver_log ()
 Initializes solver specific items for logging. More...
 
void solver_log ()
 Executes solver specific logging tasks. More...
 
void initialize_solver (int num_threads)
 Initializes the solver. More...
 
void cleanup_solver (int num_threads)
 Cleans up the created solvers. More...
 
const char * solver_name ()
 Returns a descriptive solver name. More...
 
void accelerInt_initialize (int num_threads)
 Initializes the solver. More...
 
void accelerInt_integrate (const int NUM, const double t_start, const double t_end, const double stepsize, double *__restrict__ y_host, const double *__restrict__ var_host)
 integrate NUM odes from time t to time t_end, using stepsizes of t_step More...
 
void accelerInt_cleanup (int num_threads)
 Cleans up the solver. More...
 
void write_log (int NUM, double t, const double *y_host, FILE *pFile)
 Writes state vectors to file. More...
 
int main (int argc, char *argv[])
 
void check_error (int, int)
 Checks the return code of the given thread (IVP) for an error, and exits if found. More...
 

Detailed Description

Include common code.

Function Documentation

◆ accelerInt_cleanup()

void generic::accelerInt_cleanup ( int  num_threads)

Cleans up the solver.

Parameters
[in]num_threadsThe number of OpenMP threads to use

Definition at line 63 of file solver_interface.c.

◆ accelerInt_initialize()

void generic::accelerInt_initialize ( int  num_threads)

Initializes the solver.

Parameters
[in]num_threadsThe number of OpenMP threads to use

Definition at line 23 of file solver_interface.c.

◆ accelerInt_integrate()

void generic::accelerInt_integrate ( const int  NUM,
const double  t_start,
const double  t_end,
const double  stepsize,
double *__restrict__  y_host,
const double *__restrict__  var_host 
)

integrate NUM odes from time t to time t_end, using stepsizes of t_step

Parameters
[in]NUMThe number of ODEs to integrate. This should be the size of the leading dimension of y_host and var_host.
See also
accelerint_indx
Parameters
[in]t_startThe system time
[in]t_endThe end time
[in]stepsizeThe integration step size. If stepsize < 0, the step size will be set to t_end - t
[in,out]y_hostThe state vectors to integrate.
[in]var_hostThe parameters to use in dydt() and eval_jacob()
[in]NUMThe number of ODEs to integrate. This should be the size of the leading dimension of y_host and var_host.
See also
accelerint_indx
Parameters
[in]tThe system time
[in]t_endThe end time
[in]stepsizeThe integration step size. If stepsize < 0, the step size will be set to t_end - t
[in,out]y_hostThe state vectors to integrate.
[in]var_hostThe parameters to use in dydt() and eval_jacob()

Definition at line 39 of file solver_interface.c.

◆ check_error()

void generic::check_error ( int  tid,
int  code 
)

Checks the return code of the given thread (IVP) for an error, and exits if found.

Parameters
tidThe thread (IVP) index
codeThe return code of the thread
See also
Return codes of Integrators
Parameters
tidThe thread (IVP) index
codeThe return code of the thread
See also
Return codes of EXP4 integrator

Definition at line 13 of file radau2a_props.c.

◆ cleanup_solver()

void generic::cleanup_solver ( int  num_threads)

Cleans up the created solvers.

Parameters
num_threadsThe number of OpenMP threads used

Frees and cleans up allocated CVODE memory.

Parameters
num_threadsThe number of OpenMP threads used

Frees and cleans up allocated RK78 memory.

Definition at line 165 of file cvodes_init.c.

◆ init_solver_log()

void generic::init_solver_log ( )

Initializes solver specific items for logging.

Initializes stepsize logging for stiffness measurement

Initializes solver specific items for logging.

See also
solver_options.cuh

Initializes the Krylov subspace logging files (if LOG_OUTPUT is defined)

See also
solver_options.cuh

Definition at line 190 of file cvodes_init.c.

◆ initialize_solver()

void generic::initialize_solver ( int  num_threads)

Initializes the solver.

Parameters
num_threadsThe number of OpenMP threads to use

Various definitions in the generated options, e.g. FINITE_DIFFERENCE, CV_MAX_ERRTEST_FAILS, etc. affect the options set for the CVODEs solver.

See also
solver_options.h

The RHS function dydt_cvodes() will be used in the solver.

If FINITE_DIFFERENCE is not defined, the jacobian function in eval_jacob_cvodes will be used in the CVODE solver. Else, the CVODE finite difference based on the RHS function will be used.

Parameters
num_threadsThe number of OpenMP threads to use
num_threadsUnused

Definition at line 49 of file cvodes_init.c.

◆ intDriver()

void generic::intDriver ( const int  NUM,
const double  t,
const double  t_end,
const double *  pr_global,
double *  y_global 
)

Integration driver for the CPU integrators.

Parameters
[in]NUMThe (non-padded) number of IVPs to integrate
[in]tThe current system time
[in]t_endThe IVP integration end time
[in]pr_globalThe system constant variable (pressures / densities)
[in,out]y_globalThe system state vectors at time t. Returns system state vectors at time t_end
[in]NUMThe (non-padded) number of IVPs to integrate
[in]tThe current system time
[in]t_endThe IVP integration end time
[in]pr_globalThe system constant variable (pressures / densities)
[in,out]y_globalThe system state vectors at time t. Returns system state vectors at time t_end

This is generic driver for CPU integrators

Definition at line 28 of file solver_generic.c.

◆ integrate()

int generic::integrate ( const double  t_start,
const double  t_end,
const double  pr,
double *  y 
)

A header definition of the integrate method, that must be implemented by various solvers.

Parameters
[in]t_startthe starting IVP integration time
[in]t_endthe IVP integration endtime
[in]prthe IVP constant variable (presssure/density)
[in,out]yThe IVP state vector at time t_start. At end of this function call, the system state at time t_end is stored here

A header definition of the integrate method, that must be implemented by various solvers.

Parameters
[in]t_startThe starting time
[in]t_endThe end integration time
[in]prThe system constant variable (pressure/density)
[in,out]yThe system state vector at time t_start. Overwritten with the system state at time t_end
Returns
Return code,
See also
Return codes of Radau-IIa integrator

A header definition of the integrate method, that must be implemented by various solvers.

Parameters
t_startThe initial integration time
t_endThe final integration timestep
prUser data passed to the RHS function dydt() - commonly used for the Pressure term
yThe state vector
Returns
The result of this integration step
See also
Return codes of EXP4 integrator

A header definition of the integrate method, that must be implemented by various solvers.

Parameters
t_startThe initial integration time
t_endThe final integration timestep
prUser data passed to the RHS function dydt() - commonly used for the Pressure term
yThe state vector
Returns
The result of this integration step
See also
Return codes of EXPRB43 integrator

Definition at line 520 of file radau2a.c.

◆ main()

int generic::main ( int  argc,
char *  argv[] 
)

Main function

Parameters
[in]argccommand line argument count
[in]argvcommand line argument vector

This allows running the integrators from the command line. The syntax is as follows:
./solver-name [num_threads] [num_IVPs]

  • num_threads [Optional, Default:1]
    • The number OpenMP threads to utilize
    • The number of threads cannot be greater than recognized by OpenMP via omp_get_max_threads()
  • num_IVPs [Optional, Default:1]
    • The number of initial value problems to solve.
    • This must be less than the number of conditions in the data file if SAME_IC is not defined.
    • If SAME_IC is defined, then the initial conditions in the mechanism files will be used.

Definition at line 87 of file solver_main.c.

◆ solver_log()

void generic::solver_log ( )

Executes solver specific logging tasks.

Logs errors, step-sizes, and krylov subspace size (if LOG_OUTPUT is defined)

See also
solver_options.cuh

Definition at line 192 of file cvodes_init.c.

◆ solver_name()

const char* generic::solver_name ( )

Returns a descriptive solver name.

Definition at line 181 of file cvodes_init.c.

◆ write_log()

void generic::write_log ( int  NUM,
double  t,
const double *  y_host,
FILE *  pFile 
)

Writes state vectors to file.

Parameters
[in]NUMthe number of state vectors to write
[in]tthe current system time
[in]y_hostthe current state vectors
[in]pFilethe opened binary file object

The resulting file is updated as: system time
temperature, mass fractions (State #1)
temperature, mass fractions (State #2)...

Definition at line 47 of file solver_main.c.