17#define TEMPERATURE_K_ env_data[0]
18#define PRESSURE_PA_ env_data[1]
20#define RXN_ID_ (int_data[0])
21#define NUM_SPEC_ (int_data[1])
22#define SCALING_ float_data[0]
23#define RATE_CONSTANT_ (rxn_env_data[0])
24#define BASE_RATE_ (rxn_env_data[1])
25#define NUM_INT_PROP_ 2
26#define NUM_FLOAT_PROP_ 1
27#define NUM_ENV_PARAM_ 2
28#define REACT_(s) (int_data[NUM_INT_PROP_ + s] - 1)
29#define DERIV_ID_(s) int_data[NUM_INT_PROP_ + NUM_SPEC_ + s]
30#define JAC_ID_(s) int_data[NUM_INT_PROP_ + 2 * NUM_SPEC_ + s]
39 double *rxn_float_data,
41 int *int_data = rxn_int_data;
42 double *float_data = rxn_float_data;
44 for (
int i_spec = 0; i_spec <
NUM_SPEC_; i_spec++) {
61 double *rxn_float_data) {
62 int *int_data = rxn_int_data;
63 double *float_data = rxn_float_data;
65 for (
int i_spec = 0; i_spec <
NUM_SPEC_; i_spec++) {
96 double *rxn_float_data,
97 double *rxn_env_data) {
98 int *int_data = rxn_int_data;
99 double *float_data = rxn_float_data;
101 int *rxn_id = (
int *)update_data;
102 double *base_rate = (
double *)&(rxn_id[1]);
126 double *rxn_float_data,
127 double *rxn_env_data) {
128 int *int_data = rxn_int_data;
129 double *float_data = rxn_float_data;
148#ifdef CAMP_USE_SUNDIALS
151 double *rxn_float_data,
double *rxn_env_data, realtype time_step) {
152 int *int_data = rxn_int_data;
153 double *float_data = rxn_float_data;
158 for (
int i_spec = 0; i_spec <
NUM_SPEC_; i_spec++) {
178#ifdef CAMP_USE_SUNDIALS
181 double *rxn_float_data,
182 double *rxn_env_data,
183 realtype time_step) {
184 int *int_data = rxn_int_data;
185 double *float_data = rxn_float_data;
190 for (
int i_spec = 0; i_spec <
NUM_SPEC_; i_spec++) {
206 int *int_data = rxn_int_data;
207 double *float_data = rxn_float_data;
209 printf(
"\n\nWet deposition reaction\n");
219 int *update_data = (
int *)malloc(
sizeof(
int) +
sizeof(double));
220 if (update_data == NULL) {
221 printf(
"\n\nERROR allocating space for wet deposition update data\n\n");
224 return (
void *)update_data;
235 int *new_rxn_id = (
int *)update_data;
236 double *new_base_rate = (
double *)&(new_rxn_id[1]);
237 *new_rxn_id = rxn_id;
238 *new_base_rate = base_rate;
unsigned int jacobian_get_element_id(Jacobian jac, unsigned int dep_id, unsigned int ind_id)
Get an element id in the Jacobian data arrays.
void jacobian_add_value(Jacobian jac, unsigned int elem_id, unsigned int prod_or_loss, long double jac_contribution)
Add a contribution to the Jacobian.
void jacobian_register_element(Jacobian *jac, unsigned int dep_id, unsigned int ind_id)
Adds an element to the sparse matrix.
void rxn_wet_deposition_get_used_jac_elem(int *rxn_int_data, double *rxn_float_data, Jacobian *jac)
Flag Jacobian elements used by this reaction.
void * rxn_wet_deposition_create_rate_update_data()
Create update data for new wet deposition rates.
void rxn_wet_deposition_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_wet_deposition_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_wet_deposition_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 from this reaction.
void rxn_wet_deposition_print(int *rxn_int_data, double *rxn_float_data)
Print the reaction parameters.
bool rxn_wet_deposition_update_data(void *update_data, int *rxn_int_data, double *rxn_float_data, double *rxn_env_data)
Update reaction data.
void rxn_wet_deposition_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_wet_deposition_set_rate_update_data(void *update_data, int rxn_id, double base_rate)
Set rate update data.
void time_derivative_add_value(TimeDerivative time_deriv, unsigned int spec_id, long double rate_contribution)
Add a contribution to the time derivative.