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

Phase Transfer reaction solver functions. More...

Include dependency graph for rxn_HL_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 MIN_WATER_   1.0e-4
 
#define JAC_GAS   0
 
#define JAC_AERO   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 A_   float_data[4]
 
#define C_   float_data[5]
 
#define CONV_   float_data[6]
 
#define MW_   float_data[7]
 
#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_   8
 
#define NUM_ENV_PARAM_   4
 
#define DERIV_ID_(x)   int_data[NUM_INT_PROP_ + x]
 
#define JAC_ID_(x)   int_data[NUM_INT_PROP_ + 1 + NUM_AERO_PHASE_ + x]
 
#define PHASE_INT_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 6 * NUM_AERO_PHASE_ + x] - 1)
 
#define PHASE_REAL_LOC_(x)    (int_data[NUM_INT_PROP_ + 2 + 7 * NUM_AERO_PHASE_ + x] - 1)
 
#define AERO_SPEC_(x)   (int_data[PHASE_INT_LOC_(x)] - 1)
 
#define AERO_WATER_(x)   (int_data[PHASE_INT_LOC_(x) + 1] - 1)
 
#define AERO_PHASE_ID_(x)   (int_data[PHASE_INT_LOC_(x) + 2] - 1)
 
#define AERO_REP_ID_(x)   (int_data[PHASE_INT_LOC_(x) + 3] - 1)
 
#define NUM_AERO_PHASE_JAC_ELEM_(x)   (int_data[PHASE_INT_LOC_(x) + 4])
 
#define PHASE_JAC_ID_(x, s, e)    int_data[PHASE_INT_LOC_(x) + 5 + (s) * NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 
#define SMALL_WATER_CONC_(x)   (float_data[PHASE_REAL_LOC_(x)])
 
#define EFF_RAD_JAC_ELEM_(x, e)   float_data[PHASE_REAL_LOC_(x) + 1 + e]
 
#define NUM_CONC_JAC_ELEM_(x, e)    float_data[PHASE_REAL_LOC_(x) + 1 + NUM_AERO_PHASE_JAC_ELEM_(x) + e]
 

Functions

void rxn_HL_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_HL_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_HL_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_HL_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_HL_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_HL_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_HL_phase_transfer.c.

Macro Definition Documentation

◆ A_

#define A_   float_data[4]

Definition at line 34 of file rxn_HL_phase_transfer.c.

◆ AERO_PHASE_ID_

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

Definition at line 55 of file rxn_HL_phase_transfer.c.

◆ AERO_REP_ID_

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

Definition at line 56 of file rxn_HL_phase_transfer.c.

◆ AERO_SPEC_

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

Definition at line 53 of file rxn_HL_phase_transfer.c.

◆ AERO_WATER_

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

Definition at line 54 of file rxn_HL_phase_transfer.c.

◆ ALPHA_

#define ALPHA_   rxn_env_data[1]

Definition at line 41 of file rxn_HL_phase_transfer.c.

◆ C_

#define C_   float_data[5]

Definition at line 35 of file rxn_HL_phase_transfer.c.

◆ CONV_

#define CONV_   float_data[6]

Definition at line 36 of file rxn_HL_phase_transfer.c.

◆ DELTA_H_

#define DELTA_H_   float_data[0]

Definition at line 30 of file rxn_HL_phase_transfer.c.

◆ DELTA_S_

#define DELTA_S_   float_data[1]

Definition at line 31 of file rxn_HL_phase_transfer.c.

◆ DERIV_ID_

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

Definition at line 47 of file rxn_HL_phase_transfer.c.

◆ DIFF_COEFF_

#define DIFF_COEFF_   float_data[2]

Definition at line 32 of file rxn_HL_phase_transfer.c.

◆ EFF_RAD_JAC_ELEM_

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

Definition at line 61 of file rxn_HL_phase_transfer.c.

◆ EQUIL_CONST_

#define EQUIL_CONST_   rxn_env_data[2]

Definition at line 42 of file rxn_HL_phase_transfer.c.

◆ GAS_SPEC_

#define GAS_SPEC_   (int_data[1] - 1)

Definition at line 39 of file rxn_HL_phase_transfer.c.

◆ JAC_AERO

#define JAC_AERO   1

Definition at line 28 of file rxn_HL_phase_transfer.c.

◆ JAC_GAS

#define JAC_GAS   0

Definition at line 27 of file rxn_HL_phase_transfer.c.

◆ JAC_ID_

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

Definition at line 48 of file rxn_HL_phase_transfer.c.

◆ KGM3_TO_PPM_

#define KGM3_TO_PPM_   rxn_env_data[3]

Definition at line 43 of file rxn_HL_phase_transfer.c.

◆ MFP_M_

#define MFP_M_   rxn_env_data[0]

Definition at line 40 of file rxn_HL_phase_transfer.c.

◆ MIN_WATER_

#define MIN_WATER_   1.0e-4

Definition at line 24 of file rxn_HL_phase_transfer.c.

◆ MW_

#define MW_   float_data[7]

Definition at line 37 of file rxn_HL_phase_transfer.c.

◆ NUM_AERO_PHASE_

#define NUM_AERO_PHASE_   int_data[0]

Definition at line 38 of file rxn_HL_phase_transfer.c.

◆ NUM_AERO_PHASE_JAC_ELEM_

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

Definition at line 57 of file rxn_HL_phase_transfer.c.

◆ NUM_CONC_JAC_ELEM_

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

Definition at line 62 of file rxn_HL_phase_transfer.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   4

Definition at line 46 of file rxn_HL_phase_transfer.c.

◆ NUM_FLOAT_PROP_

#define NUM_FLOAT_PROP_   8

Definition at line 45 of file rxn_HL_phase_transfer.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   2

Definition at line 44 of file rxn_HL_phase_transfer.c.

◆ PHASE_INT_LOC_

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

Definition at line 49 of file rxn_HL_phase_transfer.c.

◆ PHASE_JAC_ID_

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

Definition at line 58 of file rxn_HL_phase_transfer.c.

◆ PHASE_REAL_LOC_

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

Definition at line 51 of file rxn_HL_phase_transfer.c.

◆ PRE_C_AVG_

#define PRE_C_AVG_   float_data[3]

Definition at line 33 of file rxn_HL_phase_transfer.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 20 of file rxn_HL_phase_transfer.c.

◆ SMALL_WATER_CONC_

#define SMALL_WATER_CONC_ (   x)    (float_data[PHASE_REAL_LOC_(x)])

Definition at line 60 of file rxn_HL_phase_transfer.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 19 of file rxn_HL_phase_transfer.c.

Function Documentation

◆ rxn_HL_phase_transfer_calc_deriv_contrib()

void rxn_HL_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.

Bug:
this does not work for modal/binned aero reps. Needs update following the logic in the SIMPOL partitioning 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 265 of file rxn_HL_phase_transfer.c.

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

◆ rxn_HL_phase_transfer_calc_jac_contrib()

void rxn_HL_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 354 of file rxn_HL_phase_transfer.c.

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

◆ rxn_HL_phase_transfer_get_used_jac_elem()

void rxn_HL_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 72 of file rxn_HL_phase_transfer.c.

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

◆ rxn_HL_phase_transfer_print()

void rxn_HL_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 510 of file rxn_HL_phase_transfer.c.

Here is the caller graph for this function:

◆ rxn_HL_phase_transfer_update_env_state()

void rxn_HL_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

Definition at line 209 of file rxn_HL_phase_transfer.c.

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

◆ rxn_HL_phase_transfer_update_ids()

void rxn_HL_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
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 149 of file rxn_HL_phase_transfer.c.

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