PartMC
2.1.5
|
Interface to SUNDIALS ODE solver library for condensation. More...
Go to the source code of this file.
Defines | |
#define | PMC_CONDENSE_SOLVER_SUCCESS 0 |
Result code indicating successful completion. | |
#define | PMC_CONDENSE_SOLVER_INIT_Y 1 |
Result code indicating failure to allocate y vector. | |
#define | PMC_CONDENSE_SOLVER_INIT_ABSTOL 2 |
Result code indicating failure to allocate abstol vector. | |
#define | PMC_CONDENSE_SOLVER_INIT_CVODE_MEM 3 |
Result code indicating failure to create the solver. | |
#define | PMC_CONDENSE_SOLVER_INIT_CVODE 4 |
Result code indicating failure to initialize the solver. | |
#define | PMC_CONDENSE_SOLVER_SVTOL 5 |
Result code indicating failure to set tolerances. | |
#define | PMC_CONDENSE_SOLVER_SET_MAX_STEPS 6 |
Result code indicating failure to set maximum steps. | |
#define | PMC_CONDENSE_SOLVER_FAIL 7 |
Result code indicating failure of the solver. | |
Functions/Subroutines | |
static int | condense_vf (realtype t, N_Vector y, N_Vector ydot, void *user_data) |
The ODE vector field to integrate. | |
static int | condense_check_flag (void *flagvalue, char *funcname, int opt) |
Check the return value from a SUNDIALS call. | |
static int | condense_solver_Init (CVodeMem cv_mem) |
Initialization routine for the ODE linear equation solver. | |
static int | condense_solver_Setup (CVodeMem cv_mem, int convfail, N_Vector ypred, N_Vector fpred, booleantype *jcurPtr, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3) |
Setup routine for the ODE linear equation solver. | |
static int | condense_solver_Solve (CVodeMem cv_mem, N_Vector b, N_Vector weight, N_Vector ycur, N_Vector fcur) |
Linear solver routine for use by the ODE solver. | |
static void | condense_solver_Free (CVodeMem cv_mem) |
Finalization routine for the ODE linear equation 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. |
Interface to SUNDIALS ODE solver library for condensation.
Definition in file condense_solver.c.
#define PMC_CONDENSE_SOLVER_FAIL 7 |
Result code indicating failure of the solver.
Definition at line 40 of file condense_solver.c.
#define PMC_CONDENSE_SOLVER_INIT_ABSTOL 2 |
Result code indicating failure to allocate abstol
vector.
Definition at line 25 of file condense_solver.c.
#define PMC_CONDENSE_SOLVER_INIT_CVODE 4 |
Result code indicating failure to initialize the solver.
Definition at line 31 of file condense_solver.c.
#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.
#define PMC_CONDENSE_SOLVER_INIT_Y 1 |
Result code indicating failure to allocate y
vector.
Definition at line 22 of file condense_solver.c.
#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.
#define PMC_CONDENSE_SOLVER_SUCCESS 0 |
Result code indicating successful completion.
Definition at line 19 of file condense_solver.c.
#define PMC_CONDENSE_SOLVER_SVTOL 5 |
Result code indicating failure to set tolerances.
Definition at line 34 of file condense_solver.c.
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.flagvalue | A pointer to check (either for NULL , or as an int pointer giving the flag value). |
funcname | A string giving the function name returning this result code. |
opt | A flag indicating the type of check to perform. |
Definition at line 218 of file condense_solver.c.
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.
neq | The number of equations. |
x_f | A pointer to a vector of neq variables, giving the initial state vector on entry and the final state vector on exit. |
abstol_f | A pointer to a vector of neq variables, giving the absolute error tolerance for the corresponding state vector component. |
reltol_f | The scalar relative tolerance. |
t_initial_f | The initial time (s). |
t_final_f | The final time (s). |
Definition at line 73 of file condense_solver.c.
static void condense_solver_Free | ( | CVodeMem | cv_mem | ) | [static] |
Finalization routine for the ODE linear equation solver.
cv_mem | The CVODE solver parameter structure. |
Definition at line 327 of file condense_solver.c.
static int condense_solver_Init | ( | CVodeMem | cv_mem | ) | [static] |
Initialization routine for the ODE linear equation solver.
cv_mem | The CVODE solver parameter structure. |
Definition at line 250 of file condense_solver.c.
static int condense_solver_Setup | ( | CVodeMem | cv_mem, |
int | convfail, | ||
N_Vector | ypred, | ||
N_Vector | fpred, | ||
booleantype * | jcurPtr, | ||
N_Vector | vtemp1, | ||
N_Vector | vtemp2, | ||
N_Vector | vtemp3 | ||
) | [static] |
Setup routine for the ODE linear equation solver.
cv_mem | The CVODE solver parameter structure. |
convfail | |
ypred | |
fpred | |
jcurPtr | |
vtemp1 | |
vtemp2 | |
vtemp3 |
Definition at line 267 of file condense_solver.c.
static int condense_solver_Solve | ( | CVodeMem | cv_mem, |
N_Vector | b, | ||
N_Vector | weight, | ||
N_Vector | ycur, | ||
N_Vector | fcur | ||
) | [static] |
Linear solver routine for use by the ODE solver.
Should solve the system , where
is the current vector field Jacobian,
is a given scalar, and
is a given vector.
cv_mem | The CVODE solver parameter structure. |
b | The right-hand-side of the linear system. |
weight | |
ycur | The current state vector. |
fcur | The current vector field vector. |
Definition at line 287 of file condense_solver.c.
static int condense_vf | ( | realtype | t, |
N_Vector | y, | ||
N_Vector | ydot, | ||
void * | user_data | ||
) | [static] |
The ODE vector field to integrate.
t | The current time (s). |
y | The state vector. |
ydot | The rate of change of the state vector. |
user_data | A pointer to user-provided data. |
Definition at line 173 of file condense_solver.c.