PartMC  2.6.1
Macros | Functions
condense_solver.c File Reference

Interface to SUNDIALS ODE solver library for condensation. More...

Include dependency graph for condense_solver.c:

Go to the source code of this file.

Macros

#define PMC_CONDENSE_SOLVER_SUCCESS   0
 Result code indicating successful completion. More...
 
#define PMC_CONDENSE_SOLVER_INIT_Y   1
 Result code indicating failure to allocate y vector. More...
 
#define PMC_CONDENSE_SOLVER_INIT_ABSTOL   2
 Result code indicating failure to allocate abstol vector. More...
 
#define PMC_CONDENSE_SOLVER_INIT_CVODE_MEM   3
 Result code indicating failure to create the solver. More...
 
#define PMC_CONDENSE_SOLVER_INIT_CVODE   4
 Result code indicating failure to initialize the solver. More...
 
#define PMC_CONDENSE_SOLVER_SVTOL   5
 Result code indicating failure to set tolerances. More...
 
#define PMC_CONDENSE_SOLVER_SET_MAX_STEPS   6
 Result code indicating failure to set maximum steps. More...
 
#define PMC_CONDENSE_SOLVER_FAIL   7
 Result code indicating failure of the solver. More...
 
#define PMC_CONDENSE_SOLVER_LINSOL_CTOR   8
 Result code indicating failure in creation of the linear solver. More...
 
#define PMC_CONDENSE_SOLVER_LINSOL_SET   9
 Result code indicating failure in setting the linear solver. More...
 
#define PMC_CONDENSE_SOLVER_LINSOL_PREC   10
 Result code indicating failure in setting the preconditioner. More...
 

Functions

static int condense_vf (realtype t, N_Vector y, N_Vector ydot, void *user_data)
 The ODE vector field to integrate. More...
 
static int condense_check_flag (void *flagvalue, char *funcname, int opt)
 Check the return value from a SUNDIALS call. More...
 
static int condense_solver_Solve (double t, N_Vector ycur, N_Vector fcur, N_Vector b, N_Vector z, double gamma, double delta, int lr, void *user_data)
 Linear solver routine for use by the ODE solver. More...
 
void condense_vf_f (int neq, realtype t, double *y_f, double *ydot_f)
 
void condense_jac_solve_f (int neq, double t, double *ycur_f, double *fcur_f, double *b_f, double gamma)
 
int condense_solver (int neq, double *x_f, double *abstol_f, double reltol_f, double t_initial_f, double t_final_f)
 Call the ODE solver. More...
 

Detailed Description

Interface to SUNDIALS ODE solver library for condensation.

Definition in file condense_solver.c.

Macro Definition Documentation

◆ PMC_CONDENSE_SOLVER_FAIL

#define PMC_CONDENSE_SOLVER_FAIL   7

Result code indicating failure of the solver.

Definition at line 40 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_INIT_ABSTOL

#define PMC_CONDENSE_SOLVER_INIT_ABSTOL   2

Result code indicating failure to allocate abstol vector.

Definition at line 25 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_INIT_CVODE

#define PMC_CONDENSE_SOLVER_INIT_CVODE   4

Result code indicating failure to initialize the solver.

Definition at line 31 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_INIT_CVODE_MEM

#define PMC_CONDENSE_SOLVER_INIT_CVODE_MEM   3

Result code indicating failure to create the solver.

Definition at line 28 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_INIT_Y

#define PMC_CONDENSE_SOLVER_INIT_Y   1

Result code indicating failure to allocate y vector.

Definition at line 22 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_LINSOL_CTOR

#define PMC_CONDENSE_SOLVER_LINSOL_CTOR   8

Result code indicating failure in creation of the linear solver.

Definition at line 43 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_LINSOL_PREC

#define PMC_CONDENSE_SOLVER_LINSOL_PREC   10

Result code indicating failure in setting the preconditioner.

Definition at line 49 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_LINSOL_SET

#define PMC_CONDENSE_SOLVER_LINSOL_SET   9

Result code indicating failure in setting the linear solver.

Definition at line 46 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_SET_MAX_STEPS

#define PMC_CONDENSE_SOLVER_SET_MAX_STEPS   6

Result code indicating failure to set maximum steps.

Definition at line 37 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_SUCCESS

#define PMC_CONDENSE_SOLVER_SUCCESS   0

Result code indicating successful completion.

Definition at line 19 of file condense_solver.c.

◆ PMC_CONDENSE_SOLVER_SVTOL

#define PMC_CONDENSE_SOLVER_SVTOL   5

Result code indicating failure to set tolerances.

Definition at line 34 of file condense_solver.c.

Function Documentation

◆ condense_check_flag()

static int condense_check_flag ( void *  flagvalue,
char *  funcname,
int  opt 
)
static

Check the return value from a SUNDIALS call.

  • opt == 0 means SUNDIALS function allocates memory so check if flagvalue is not a NULL pointer.
  • opt == 1 means SUNDIALS function returns a flag so check if the int pointed to by flagvalue has flag >= 0.
  • opt == 2 means function allocates memory so check if flagvalue is not a NULL pointer.
Parameters
flagvalueA pointer to check (either for NULL, or as an int pointer giving the flag value).
funcnameA string giving the function name returning this result code.
optA flag indicating the type of check to perform.
Returns
A result code (0 is success).

Definition at line 208 of file condense_solver.c.

◆ condense_jac_solve_f()

void condense_jac_solve_f ( int  neq,
double  t,
double *  ycur_f,
double *  fcur_f,
double *  b_f,
double  gamma 
)

◆ condense_solver()

int condense_solver ( int  neq,
double *  x_f,
double *  abstol_f,
double  reltol_f,
double  t_initial_f,
double  t_final_f 
)

Call the ODE solver.

Parameters
neqThe number of equations.
x_fA pointer to a vector of neq variables, giving the initial state vector on entry and the final state vector on exit.
abstol_fA pointer to a vector of neq variables, giving the absolute error tolerance for the corresponding state vector component.
reltol_fThe scalar relative tolerance.
t_initial_fThe initial time (s).
t_final_fThe final time (s).
Returns
A result code (0 is success).

Definition at line 79 of file condense_solver.c.

◆ condense_solver_Solve()

static int condense_solver_Solve ( double  t,
N_Vector  ycur,
N_Vector  fcur,
N_Vector  b,
N_Vector  z,
double  gamma,
double  delta,
int  lr,
void *  user_data 
)
static

Linear solver routine for use by the ODE solver.

Should solve the system $(I - \gamma J) x = b$, where $J$ is the current vector field Jacobian, $\gamma$ is a given scalar, and $b$ is a given vector.

Definition at line 245 of file condense_solver.c.

◆ condense_vf()

static int condense_vf ( realtype  t,
N_Vector  y,
N_Vector  ydot,
void *  user_data 
)
static

The ODE vector field to integrate.

Parameters
tThe current time (s).
yThe state vector.
ydotThe rate of change of the state vector.
user_dataA pointer to user-provided data.
Returns
A result code (0 is success).

Definition at line 162 of file condense_solver.c.

◆ condense_vf_f()

void condense_vf_f ( int  neq,
realtype  t,
double *  y_f,
double *  ydot_f 
)