CAMP 1.0.0
Chemistry Across Multiple Phases
Macros | Functions
rxn_surface.c File Reference

Surface reaction solver functions. More...

Include dependency graph for rxn_surface.c:

Go to the source code of this file.

Macros

#define TEMPERATURE_K_   env_data[0]
 
#define PRESSURE_PA_   env_data[1]
 
#define DIFF_COEFF_   float_data[0]
 
#define GAMMA_   float_data[1]
 
#define MW_   float_data[2]
 
#define NUM_AERO_PHASE_   int_data[0]
 
#define REACT_ID_   (int_data[1] - 1)
 
#define NUM_PROD_   int_data[2]
 
#define MEAN_SPEED_MS_   rxn_env_data[0]
 
#define NUM_INT_PROP_   3
 
#define NUM_FLOAT_PROP_   3
 
#define NUM_ENV_PARAM_   1
 
#define PROD_ID_(x)   (int_data[NUM_INT_PROP_ + x] - 1)
 
#define DERIV_ID_(x)   int_data[NUM_INT_PROP_ + NUM_PROD_ + x]
 
#define JAC_ID_(x)   int_data[NUM_INT_PROP_ + 1 + 2 * NUM_PROD_ + x]
 
#define PHASE_INT_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 3 * NUM_PROD_ + x] - 1)
 
#define PHASE_FLOAT_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 3 * NUM_PROD_ + NUM_AERO_PHASE_ + x] - 1)
 
#define AERO_PHASE_ID_(x)   (int_data[PHASE_INT_LOC_(x)] - 1)
 
#define AERO_REP_ID_(x)   (int_data[PHASE_INT_LOC_(x) + 1] - 1)
 
#define NUM_AERO_PHASE_JAC_ELEM_(x)   (int_data[PHASE_INT_LOC_(x) + 2])
 
#define PHASE_JAC_ID_(x, s, e)    int_data[PHASE_INT_LOC_(x) + 3 + (s) * NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 
#define YIELD_(x)   float_data[NUM_FLOAT_PROP_ + x]
 
#define EFF_RAD_JAC_ELEM_(x, e)   float_data[PHASE_FLOAT_LOC_(x) + e]
 
#define NUM_CONC_JAC_ELEM_(x, e)    float_data[PHASE_FLOAT_LOC_(x) + NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 

Functions

void rxn_surface_get_used_jac_elem (ModelData *model_data, int *rxn_int_data, double *rxn_float_data, Jacobian *jac)
 Flag Jacobian elements used by this reaction.
 
void rxn_surface_update_ids (ModelData *model_data, int *deriv_ids, Jacobian jac, int *rxn_int_data, double *rxn_float_data)
 Update the time derivative and Jacbobian array indices.
 
void rxn_surface_update_env_state (ModelData *model_data, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data)
 Update reaction data for new environmental conditions.
 
void rxn_surface_calc_deriv_contrib (ModelData *model_data, TimeDerivative time_deriv, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data, realtype time_step)
 Calculate contributions to the time derivative \(f(t,y)\) from this reaction.
 
void rxn_surface_calc_jac_contrib (ModelData *model_data, Jacobian jac, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data, realtype time_step)
 Calculate contributions to the Jacobian from this reaction.
 
void rxn_surface_print (int *rxn_int_data, double *rxn_float_data)
 Print the surface reaction parameters.
 

Detailed Description

Surface reaction solver functions.

Definition in file rxn_surface.c.

Macro Definition Documentation

◆ AERO_PHASE_ID_

#define AERO_PHASE_ID_ (   x)    (int_data[PHASE_INT_LOC_(x)] - 1)

Definition at line 39 of file rxn_surface.c.

◆ AERO_REP_ID_

#define AERO_REP_ID_ (   x)    (int_data[PHASE_INT_LOC_(x) + 1] - 1)

Definition at line 40 of file rxn_surface.c.

◆ DERIV_ID_

#define DERIV_ID_ (   x)    int_data[NUM_INT_PROP_ + NUM_PROD_ + x]

Definition at line 33 of file rxn_surface.c.

◆ DIFF_COEFF_

#define DIFF_COEFF_   float_data[0]

Definition at line 22 of file rxn_surface.c.

◆ EFF_RAD_JAC_ELEM_

#define EFF_RAD_JAC_ELEM_ (   x,
 
)    float_data[PHASE_FLOAT_LOC_(x) + e]

Definition at line 45 of file rxn_surface.c.

◆ GAMMA_

#define GAMMA_   float_data[1]

Definition at line 23 of file rxn_surface.c.

◆ JAC_ID_

#define JAC_ID_ (   x)    int_data[NUM_INT_PROP_ + 1 + 2 * NUM_PROD_ + x]

Definition at line 34 of file rxn_surface.c.

◆ MEAN_SPEED_MS_

#define MEAN_SPEED_MS_   rxn_env_data[0]

Definition at line 28 of file rxn_surface.c.

◆ MW_

#define MW_   float_data[2]

Definition at line 24 of file rxn_surface.c.

◆ NUM_AERO_PHASE_

#define NUM_AERO_PHASE_   int_data[0]

Definition at line 25 of file rxn_surface.c.

◆ NUM_AERO_PHASE_JAC_ELEM_

#define NUM_AERO_PHASE_JAC_ELEM_ (   x)    (int_data[PHASE_INT_LOC_(x) + 2])

Definition at line 41 of file rxn_surface.c.

◆ NUM_CONC_JAC_ELEM_

#define NUM_CONC_JAC_ELEM_ (   x,
 
)     float_data[PHASE_FLOAT_LOC_(x) + NUM_AERO_PHASE_JAC_ELEM_(x) + e]

Definition at line 46 of file rxn_surface.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   1

Definition at line 31 of file rxn_surface.c.

◆ NUM_FLOAT_PROP_

#define NUM_FLOAT_PROP_   3

Definition at line 30 of file rxn_surface.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   3

Definition at line 29 of file rxn_surface.c.

◆ NUM_PROD_

#define NUM_PROD_   int_data[2]

Definition at line 27 of file rxn_surface.c.

◆ PHASE_FLOAT_LOC_

#define PHASE_FLOAT_LOC_ (   x)     (int_data[NUM_INT_PROP_ + 2 + 3 * NUM_PROD_ + NUM_AERO_PHASE_ + x] - 1)

Definition at line 37 of file rxn_surface.c.

◆ PHASE_INT_LOC_

#define PHASE_INT_LOC_ (   x)     (int_data[NUM_INT_PROP_ + 2 + 3 * NUM_PROD_ + x] - 1)

Definition at line 35 of file rxn_surface.c.

◆ PHASE_JAC_ID_

#define PHASE_JAC_ID_ (   x,
  s,
 
)     int_data[PHASE_INT_LOC_(x) + 3 + (s) * NUM_AERO_PHASE_JAC_ELEM_(x) + e]

Definition at line 42 of file rxn_surface.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 20 of file rxn_surface.c.

◆ PROD_ID_

#define PROD_ID_ (   x)    (int_data[NUM_INT_PROP_ + x] - 1)

Definition at line 32 of file rxn_surface.c.

◆ REACT_ID_

#define REACT_ID_   (int_data[1] - 1)

Definition at line 26 of file rxn_surface.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 19 of file rxn_surface.c.

◆ YIELD_

#define YIELD_ (   x)    float_data[NUM_FLOAT_PROP_ + x]

Definition at line 44 of file rxn_surface.c.

Function Documentation

◆ rxn_surface_calc_deriv_contrib()

void rxn_surface_calc_deriv_contrib ( ModelData model_data,
TimeDerivative  time_deriv,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data,
realtype  time_step 
)

Calculate contributions to the time derivative \(f(t,y)\) from this reaction.

Parameters
model_dataPointer to the model data, including the state array
time_derivTimeDerivative object
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data
rxn_env_dataPointer to the environment-dependent parameters
time_stepCurrent time step being computed (s)

Definition at line 203 of file rxn_surface.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rxn_surface_calc_jac_contrib()

void rxn_surface_calc_jac_contrib ( ModelData model_data,
Jacobian  jac,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data,
realtype  time_step 
)

Calculate contributions to the Jacobian from this reaction.

Parameters
model_dataPointer to the model data
jacReaction Jacobian
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data
rxn_env_dataPointer to the environment-dependent parameters
time_stepCurrent time step being calculated (s)

Definition at line 264 of file rxn_surface.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rxn_surface_get_used_jac_elem()

void rxn_surface_get_used_jac_elem ( ModelData model_data,
int *  rxn_int_data,
double *  rxn_float_data,
Jacobian jac 
)

Flag Jacobian elements used by this reaction.

Parameters
model_dataPointer to the model data
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data
jacJacobian

Definition at line 56 of file rxn_surface.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rxn_surface_print()

void rxn_surface_print ( int *  rxn_int_data,
double *  rxn_float_data 
)

Print the surface reaction parameters.

Parameters
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data

Definition at line 363 of file rxn_surface.c.

Here is the caller graph for this function:

◆ rxn_surface_update_env_state()

void rxn_surface_update_env_state ( ModelData model_data,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data 
)

Update reaction data for new environmental conditions.

For surface reactions this only involves calculating the mean speed of the reacting species

Parameters
model_dataPointer to the model data
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data
rxn_env_dataPointer to the environment-dependent parameters

Definition at line 178 of file rxn_surface.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rxn_surface_update_ids()

void rxn_surface_update_ids ( ModelData model_data,
int *  deriv_ids,
Jacobian  jac,
int *  rxn_int_data,
double *  rxn_float_data 
)

Update the time derivative and Jacbobian array indices.

Parameters
model_dataPointer to the model data
deriv_idsId of each state variable in the derivative array
jacJacobian
rxn_int_dataPointer to the reaction integer data
rxn_float_dataPointer to the reaction floating-point data

Definition at line 132 of file rxn_surface.c.

Here is the call graph for this function:
Here is the caller graph for this function: