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

Condensed Phase photolysis reaction solver functions. More...

Include dependency graph for rxn_condensed_phase_photolysis.c:

Go to the source code of this file.

Macros

#define NUM_REACT_   int_data[0]
 
#define NUM_PROD_   int_data[1]
 
#define NUM_AERO_PHASE_   int_data[2]
 
#define RXN_ID_   int_data[3]
 
#define SCALING_   float_data[0]
 
#define RATE_CONSTANT_   rxn_env_data[0]
 
#define BASE_RATE_   rxn_env_data[1]
 
#define NUM_INT_PROP_   4
 
#define NUM_FLOAT_PROP_   1
 
#define NUM_ENV_PARAM_   2
 
#define REACT_(x)   (int_data[NUM_INT_PROP_ + x] - 1)
 
#define PROD_(x)    (int_data[NUM_INT_PROP_ + NUM_REACT_ * NUM_AERO_PHASE_ + x] - 1)
 
#define WATER_(x)    (int_data[NUM_INT_PROP_ + (NUM_REACT_ + NUM_PROD_) * NUM_AERO_PHASE_ + x] - 1)
 
#define DERIV_ID_(x)    (int_data[NUM_INT_PROP_ + (NUM_REACT_ + NUM_PROD_ + 1) * NUM_AERO_PHASE_ + x])
 
#define JAC_ID_(x)
 
#define YIELD_(x)   (float_data[NUM_FLOAT_PROP_ + x])
 
#define KGM3_TO_MOLM3_(x)   (float_data[NUM_FLOAT_PROP_ + NUM_PROD_ + x])
 

Functions

void rxn_condensed_phase_photolysis_get_used_jac_elem (int *rxn_int_data, double *rxn_float_data, Jacobian *jac)
 Flag Jacobian elements used by this reaction.
 
void rxn_condensed_phase_photolysis_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.
 
bool rxn_condensed_phase_photolysis_update_data (void *update_data, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data)
 Update reaction data.
 
void rxn_condensed_phase_photolysis_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_condensed_phase_photolysis_calc_deriv_contrib (ModelData *model_data, TimeDerivative time_deriv, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data, double time_step)
 Calculate contributions to the time derivative f(t,y) from this reaction.
 
void rxn_condensed_phase_photolysis_calc_jac_contrib (ModelData *model_data, Jacobian jac, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data, double time_step)
 Calculate contributions to the Jacobian from this reaction.
 
void rxn_condensed_phase_photolysis_print (int *rxn_int_data, double *rxn_float_data)
 Print the Condensed Phase photolysis reaction parameters.
 
void * rxn_condensed_phase_photolysis_create_rate_update_data ()
 Create update data for new photolysis rates.
 
void rxn_condensed_phase_photolysis_set_rate_update_data (void *update_data, int photo_id, double base_rate)
 Set rate update data.
 

Detailed Description

Condensed Phase photolysis reaction solver functions.

Definition in file rxn_condensed_phase_photolysis.c.

Macro Definition Documentation

◆ BASE_RATE_

#define BASE_RATE_   rxn_env_data[1]

Definition at line 22 of file rxn_condensed_phase_photolysis.c.

◆ DERIV_ID_

#define DERIV_ID_ (   x)     (int_data[NUM_INT_PROP_ + (NUM_REACT_ + NUM_PROD_ + 1) * NUM_AERO_PHASE_ + x])

Definition at line 31 of file rxn_condensed_phase_photolysis.c.

◆ JAC_ID_

#define JAC_ID_ (   x)
Value:
(int_data[NUM_INT_PROP_ + \
(2 * (NUM_REACT_ + NUM_PROD_) + 1) * NUM_AERO_PHASE_ + x])
#define NUM_INT_PROP_
#define NUM_AERO_PHASE_

Definition at line 33 of file rxn_condensed_phase_photolysis.c.

◆ KGM3_TO_MOLM3_

#define KGM3_TO_MOLM3_ (   x)    (float_data[NUM_FLOAT_PROP_ + NUM_PROD_ + x])

Definition at line 37 of file rxn_condensed_phase_photolysis.c.

◆ NUM_AERO_PHASE_

#define NUM_AERO_PHASE_   int_data[2]

Definition at line 18 of file rxn_condensed_phase_photolysis.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   2

Definition at line 25 of file rxn_condensed_phase_photolysis.c.

◆ NUM_FLOAT_PROP_

#define NUM_FLOAT_PROP_   1

Definition at line 24 of file rxn_condensed_phase_photolysis.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   4

Definition at line 23 of file rxn_condensed_phase_photolysis.c.

◆ NUM_PROD_

#define NUM_PROD_   int_data[1]

Definition at line 17 of file rxn_condensed_phase_photolysis.c.

◆ NUM_REACT_

#define NUM_REACT_   int_data[0]

Definition at line 16 of file rxn_condensed_phase_photolysis.c.

◆ PROD_

#define PROD_ (   x)     (int_data[NUM_INT_PROP_ + NUM_REACT_ * NUM_AERO_PHASE_ + x] - 1)

Definition at line 27 of file rxn_condensed_phase_photolysis.c.

◆ RATE_CONSTANT_

#define RATE_CONSTANT_   rxn_env_data[0]

Definition at line 21 of file rxn_condensed_phase_photolysis.c.

◆ REACT_

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

Definition at line 26 of file rxn_condensed_phase_photolysis.c.

◆ RXN_ID_

#define RXN_ID_   int_data[3]

Definition at line 19 of file rxn_condensed_phase_photolysis.c.

◆ SCALING_

#define SCALING_   float_data[0]

Definition at line 20 of file rxn_condensed_phase_photolysis.c.

◆ WATER_

#define WATER_ (   x)     (int_data[NUM_INT_PROP_ + (NUM_REACT_ + NUM_PROD_) * NUM_AERO_PHASE_ + x] - 1)

Definition at line 29 of file rxn_condensed_phase_photolysis.c.

◆ YIELD_

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

Definition at line 36 of file rxn_condensed_phase_photolysis.c.

Function Documentation

◆ rxn_condensed_phase_photolysis_calc_deriv_contrib()

void rxn_condensed_phase_photolysis_calc_deriv_contrib ( ModelData model_data,
TimeDerivative  time_deriv,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data,
double  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 of the itegrator (s)

Definition at line 203 of file rxn_condensed_phase_photolysis.c.

Here is the call graph for this function:

◆ rxn_condensed_phase_photolysis_calc_jac_contrib()

void rxn_condensed_phase_photolysis_calc_jac_contrib ( ModelData model_data,
Jacobian  jac,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data,
double  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 of the itegrator (s)

Definition at line 271 of file rxn_condensed_phase_photolysis.c.

Here is the call graph for this function:

◆ rxn_condensed_phase_photolysis_create_rate_update_data()

void * rxn_condensed_phase_photolysis_create_rate_update_data ( )

Create update data for new photolysis rates.

Returns
Pointer to a new rate update data object

Definition at line 464 of file rxn_condensed_phase_photolysis.c.

◆ rxn_condensed_phase_photolysis_get_used_jac_elem()

void rxn_condensed_phase_photolysis_get_used_jac_elem ( int *  rxn_int_data,
double *  rxn_float_data,
Jacobian jac 
)

Flag Jacobian elements used by this reaction.

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

Definition at line 45 of file rxn_condensed_phase_photolysis.c.

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

◆ rxn_condensed_phase_photolysis_print()

void rxn_condensed_phase_photolysis_print ( int *  rxn_int_data,
double *  rxn_float_data 
)

Print the Condensed Phase photolysis reaction parameters.

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

Definition at line 378 of file rxn_condensed_phase_photolysis.c.

Here is the caller graph for this function:

◆ rxn_condensed_phase_photolysis_set_rate_update_data()

void rxn_condensed_phase_photolysis_set_rate_update_data ( void *  update_data,
int  photo_id,
double  base_rate 
)

Set rate update data.

Parameters
update_dataPointer to an allocated rate update data object
photo_idId of photolysis reactions to update
base_rateNew pre-scaling photolysis rate

Definition at line 479 of file rxn_condensed_phase_photolysis.c.

◆ rxn_condensed_phase_photolysis_update_data()

bool rxn_condensed_phase_photolysis_update_data ( void *  update_data,
int *  rxn_int_data,
double *  rxn_float_data,
double *  rxn_env_data 
)

Update reaction data.

Photolysis reactions can have their base (pre-scaling) rate constants updated from the host model based on the calculations of an external photolysis module. The structure of the update data is:

  • int photo_id (Id of one or more photolysis reactions set by the host model using the camp_rxn_photolysis::rxn_photolysis_t::set_photo_id function prior to initializing the solver.)
  • double rate_const (New pre-scaling rate constant.)
Parameters
update_dataPointer to the updated reaction 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 data
Returns
Flag indicating whether this is the reaction to update

Definition at line 157 of file rxn_condensed_phase_photolysis.c.

Here is the caller graph for this function:

◆ rxn_condensed_phase_photolysis_update_env_state()

void rxn_condensed_phase_photolysis_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 Condensed Phase photolysis reaction this only involves recalculating the forward 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 185 of file rxn_condensed_phase_photolysis.c.

Here is the caller graph for this function:

◆ rxn_condensed_phase_photolysis_update_ids()

void rxn_condensed_phase_photolysis_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 88 of file rxn_condensed_phase_photolysis.c.

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