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

Phase Transfer reaction solver functions. More...

Include dependency graph for rxn_SIMPOL_phase_transfer.c:

Go to the source code of this file.

Macros

#define TEMPERATURE_K_   env_data[0]
 
#define PRESSURE_PA_   env_data[1]
 
#define JAC_GAS   0
 
#define JAC_AERO   1
 
#define PER_PARTICLE_MASS   0
 
#define TOTAL_PARTICLE_MASS   1
 
#define DELTA_H_   float_data[0]
 
#define DELTA_S_   float_data[1]
 
#define DIFF_COEFF_   float_data[2]
 
#define PRE_C_AVG_   float_data[3]
 
#define B1_   float_data[4]
 
#define B2_   float_data[5]
 
#define B3_   float_data[6]
 
#define B4_   float_data[7]
 
#define CONV_   float_data[8]
 
#define MW_   float_data[9]
 
#define NUM_AERO_PHASE_   int_data[0]
 
#define GAS_SPEC_   (int_data[1] - 1)
 
#define MFP_M_   rxn_env_data[0]
 
#define ALPHA_   rxn_env_data[1]
 
#define EQUIL_CONST_   rxn_env_data[2]
 
#define KGM3_TO_PPM_   rxn_env_data[3]
 
#define NUM_INT_PROP_   2
 
#define NUM_FLOAT_PROP_   10
 
#define NUM_ENV_PARAM_   4
 
#define AERO_SPEC_(x)   (int_data[NUM_INT_PROP_ + x] - 1)
 
#define AERO_ACT_ID_(x)   (int_data[NUM_INT_PROP_ + NUM_AERO_PHASE_ + x] - 1)
 
#define AERO_PHASE_ID_(x)    (int_data[NUM_INT_PROP_ + 2 * (NUM_AERO_PHASE_) + x] - 1)
 
#define AERO_REP_ID_(x)    (int_data[NUM_INT_PROP_ + 3 * (NUM_AERO_PHASE_) + x] - 1)
 
#define DERIV_ID_(x)   (int_data[NUM_INT_PROP_ + 4 * (NUM_AERO_PHASE_) + x])
 
#define GAS_ACT_JAC_ID_(x)    int_data[NUM_INT_PROP_ + 1 + 5 * (NUM_AERO_PHASE_) + x]
 
#define AERO_ACT_JAC_ID_(x)    int_data[NUM_INT_PROP_ + 1 + 6 * (NUM_AERO_PHASE_) + x]
 
#define JAC_ID_(x)   (int_data[NUM_INT_PROP_ + 1 + 7 * (NUM_AERO_PHASE_) + x])
 
#define PHASE_INT_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 10 * (NUM_AERO_PHASE_) + x] - 1)
 
#define PHASE_FLOAT_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 11 * (NUM_AERO_PHASE_) + x] - 1)
 
#define NUM_AERO_PHASE_JAC_ELEM_(x)   (int_data[PHASE_INT_LOC_(x)])
 
#define PHASE_JAC_ID_(x, s, e)    int_data[PHASE_INT_LOC_(x) + 1 + (s) * NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 
#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]
 
#define MASS_JAC_ELEM_(x, e)    float_data[PHASE_FLOAT_LOC_(x) + 2 * NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 
#define MW_JAC_ELEM_(x, e)    float_data[PHASE_FLOAT_LOC_(x) + 3 * NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 

Functions

void rxn_SIMPOL_phase_transfer_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_SIMPOL_phase_transfer_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_SIMPOL_phase_transfer_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_SIMPOL_phase_transfer_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_SIMPOL_phase_transfer_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_SIMPOL_phase_transfer_print (int *rxn_int_data, double *rxn_float_data)
 Print the Phase Transfer reaction parameters.
 

Detailed Description

Phase Transfer reaction solver functions.

Definition in file rxn_SIMPOL_phase_transfer.c.

Macro Definition Documentation

◆ AERO_ACT_ID_

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

Definition at line 51 of file rxn_SIMPOL_phase_transfer.c.

◆ AERO_ACT_JAC_ID_

#define AERO_ACT_JAC_ID_ (   x)     int_data[NUM_INT_PROP_ + 1 + 6 * (NUM_AERO_PHASE_) + x]

Definition at line 59 of file rxn_SIMPOL_phase_transfer.c.

◆ AERO_PHASE_ID_

#define AERO_PHASE_ID_ (   x)     (int_data[NUM_INT_PROP_ + 2 * (NUM_AERO_PHASE_) + x] - 1)

Definition at line 52 of file rxn_SIMPOL_phase_transfer.c.

◆ AERO_REP_ID_

#define AERO_REP_ID_ (   x)     (int_data[NUM_INT_PROP_ + 3 * (NUM_AERO_PHASE_) + x] - 1)

Definition at line 54 of file rxn_SIMPOL_phase_transfer.c.

◆ AERO_SPEC_

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

Definition at line 50 of file rxn_SIMPOL_phase_transfer.c.

◆ ALPHA_

#define ALPHA_   rxn_env_data[1]

Definition at line 44 of file rxn_SIMPOL_phase_transfer.c.

◆ B1_

#define B1_   float_data[4]

Definition at line 35 of file rxn_SIMPOL_phase_transfer.c.

◆ B2_

#define B2_   float_data[5]

Definition at line 36 of file rxn_SIMPOL_phase_transfer.c.

◆ B3_

#define B3_   float_data[6]

Definition at line 37 of file rxn_SIMPOL_phase_transfer.c.

◆ B4_

#define B4_   float_data[7]

Definition at line 38 of file rxn_SIMPOL_phase_transfer.c.

◆ CONV_

#define CONV_   float_data[8]

Definition at line 39 of file rxn_SIMPOL_phase_transfer.c.

◆ DELTA_H_

#define DELTA_H_   float_data[0]

Definition at line 31 of file rxn_SIMPOL_phase_transfer.c.

◆ DELTA_S_

#define DELTA_S_   float_data[1]

Definition at line 32 of file rxn_SIMPOL_phase_transfer.c.

◆ DERIV_ID_

#define DERIV_ID_ (   x)    (int_data[NUM_INT_PROP_ + 4 * (NUM_AERO_PHASE_) + x])

Definition at line 56 of file rxn_SIMPOL_phase_transfer.c.

◆ DIFF_COEFF_

#define DIFF_COEFF_   float_data[2]

Definition at line 33 of file rxn_SIMPOL_phase_transfer.c.

◆ EFF_RAD_JAC_ELEM_

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

Definition at line 69 of file rxn_SIMPOL_phase_transfer.c.

◆ EQUIL_CONST_

#define EQUIL_CONST_   rxn_env_data[2]

Definition at line 45 of file rxn_SIMPOL_phase_transfer.c.

◆ GAS_ACT_JAC_ID_

#define GAS_ACT_JAC_ID_ (   x)     int_data[NUM_INT_PROP_ + 1 + 5 * (NUM_AERO_PHASE_) + x]

Definition at line 57 of file rxn_SIMPOL_phase_transfer.c.

◆ GAS_SPEC_

#define GAS_SPEC_   (int_data[1] - 1)

Definition at line 42 of file rxn_SIMPOL_phase_transfer.c.

◆ JAC_AERO

#define JAC_AERO   1

Definition at line 25 of file rxn_SIMPOL_phase_transfer.c.

◆ JAC_GAS

#define JAC_GAS   0

Definition at line 24 of file rxn_SIMPOL_phase_transfer.c.

◆ JAC_ID_

#define JAC_ID_ (   x)    (int_data[NUM_INT_PROP_ + 1 + 7 * (NUM_AERO_PHASE_) + x])

Definition at line 61 of file rxn_SIMPOL_phase_transfer.c.

◆ KGM3_TO_PPM_

#define KGM3_TO_PPM_   rxn_env_data[3]

Definition at line 46 of file rxn_SIMPOL_phase_transfer.c.

◆ MASS_JAC_ELEM_

#define MASS_JAC_ELEM_ (   x,
 
)     float_data[PHASE_FLOAT_LOC_(x) + 2 * NUM_AERO_PHASE_JAC_ELEM_(x) + e]

Definition at line 72 of file rxn_SIMPOL_phase_transfer.c.

◆ MFP_M_

#define MFP_M_   rxn_env_data[0]

Definition at line 43 of file rxn_SIMPOL_phase_transfer.c.

◆ MW_

#define MW_   float_data[9]

Definition at line 40 of file rxn_SIMPOL_phase_transfer.c.

◆ MW_JAC_ELEM_

#define MW_JAC_ELEM_ (   x,
 
)     float_data[PHASE_FLOAT_LOC_(x) + 3 * NUM_AERO_PHASE_JAC_ELEM_(x) + e]

Definition at line 74 of file rxn_SIMPOL_phase_transfer.c.

◆ NUM_AERO_PHASE_

#define NUM_AERO_PHASE_   int_data[0]

Definition at line 41 of file rxn_SIMPOL_phase_transfer.c.

◆ NUM_AERO_PHASE_JAC_ELEM_

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

Definition at line 66 of file rxn_SIMPOL_phase_transfer.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 70 of file rxn_SIMPOL_phase_transfer.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   4

Definition at line 49 of file rxn_SIMPOL_phase_transfer.c.

◆ NUM_FLOAT_PROP_

#define NUM_FLOAT_PROP_   10

Definition at line 48 of file rxn_SIMPOL_phase_transfer.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   2

Definition at line 47 of file rxn_SIMPOL_phase_transfer.c.

◆ PER_PARTICLE_MASS

#define PER_PARTICLE_MASS   0

Definition at line 28 of file rxn_SIMPOL_phase_transfer.c.

◆ PHASE_FLOAT_LOC_

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

Definition at line 64 of file rxn_SIMPOL_phase_transfer.c.

◆ PHASE_INT_LOC_

#define PHASE_INT_LOC_ (   x)     (int_data[NUM_INT_PROP_ + 2 + 10 * (NUM_AERO_PHASE_) + x] - 1)

Definition at line 62 of file rxn_SIMPOL_phase_transfer.c.

◆ PHASE_JAC_ID_

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

Definition at line 67 of file rxn_SIMPOL_phase_transfer.c.

◆ PRE_C_AVG_

#define PRE_C_AVG_   float_data[3]

Definition at line 34 of file rxn_SIMPOL_phase_transfer.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 21 of file rxn_SIMPOL_phase_transfer.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 20 of file rxn_SIMPOL_phase_transfer.c.

◆ TOTAL_PARTICLE_MASS

#define TOTAL_PARTICLE_MASS   1

Definition at line 29 of file rxn_SIMPOL_phase_transfer.c.

Function Documentation

◆ rxn_SIMPOL_phase_transfer_calc_deriv_contrib()

void rxn_SIMPOL_phase_transfer_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 279 of file rxn_SIMPOL_phase_transfer.c.

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

◆ rxn_SIMPOL_phase_transfer_calc_jac_contrib()

void rxn_SIMPOL_phase_transfer_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 415 of file rxn_SIMPOL_phase_transfer.c.

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

◆ rxn_SIMPOL_phase_transfer_get_used_jac_elem()

void rxn_SIMPOL_phase_transfer_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 84 of file rxn_SIMPOL_phase_transfer.c.

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

◆ rxn_SIMPOL_phase_transfer_print()

void rxn_SIMPOL_phase_transfer_print ( int *  rxn_int_data,
double *  rxn_float_data 
)

Print the Phase Transfer reaction parameters.

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

Definition at line 751 of file rxn_SIMPOL_phase_transfer.c.

Here is the caller graph for this function:

◆ rxn_SIMPOL_phase_transfer_update_env_state()

void rxn_SIMPOL_phase_transfer_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 Phase Transfer reaction this only involves recalculating the rate constant.

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

save the mean free path [m] for calculating condensation rates

Definition at line 220 of file rxn_SIMPOL_phase_transfer.c.

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

◆ rxn_SIMPOL_phase_transfer_update_ids()

void rxn_SIMPOL_phase_transfer_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 for finding sub model ids
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 163 of file rxn_SIMPOL_phase_transfer.c.

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