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

PDFiTE Activity sub model solver functions. More...

Include dependency graph for sub_model_PDFiTE.c:

Go to the source code of this file.

Macros

#define TEMPERATURE_K_   env_data[0]
 
#define PRESSURE_PA_   env_data[1]
 
#define NUM_PHASE_   (int_data[0])
 
#define GAS_WATER_ID_   (int_data[1] - 1)
 
#define NUM_ION_PAIRS_   (int_data[2])
 
#define INT_DATA_SIZE_   (int_data[3])
 
#define FLOAT_DATA_SIZE_   (int_data[4])
 
#define PPM_TO_RH_   (sub_model_env_data[0])
 
#define NUM_INT_PROP_   5
 
#define NUM_REAL_PROP_   0
 
#define NUM_ENV_PARAM_   1
 
#define PHASE_ID_(x)   (int_data[NUM_INT_PROP_ + x] - 1)
 
#define PAIR_INT_PARAM_LOC_(x)   (int_data[NUM_INT_PROP_ + NUM_PHASE_ + x] - 1)
 
#define PAIR_FLOAT_PARAM_LOC_(x)    (int_data[NUM_INT_PROP_ + NUM_PHASE_ + NUM_ION_PAIRS_ + x] - 1)
 
#define ION_PAIR_ACT_ID_(x)   (int_data[PAIR_INT_PARAM_LOC_(x)])
 
#define NUM_CATION_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 1])
 
#define NUM_ANION_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 2])
 
#define CATION_ID_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 3])
 
#define ANION_ID_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 4])
 
#define NUM_INTER_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 5])
 
#define JAC_WATER_ID_(p, x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 6 + p])
 
#define JAC_CATION_ID_(p, x, y)    (int_data[PAIR_INT_PARAM_LOC_(x) + 6 + NUM_PHASE_ + p * NUM_ION_PAIRS_ + y])
 
#define JAC_ANION_ID_(p, x, y)
 
#define NUM_B_(x, y)
 
#define INTER_SPEC_ID_(x, y)
 
#define INTER_SPEC_LOC_(x, y)
 
#define CATION_MW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x)])
 
#define ANION_MW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 1])
 
#define CATION_N_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 2])
 
#define ANION_N_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3])
 
#define MIN_RH_(x, y)   (float_data[INTER_SPEC_LOC_(x, y)])
 
#define MAX_RH_(x, y)   (float_data[INTER_SPEC_LOC_(x, y) + 1])
 
#define B_Z_(x, y, z)   (float_data[INTER_SPEC_LOC_(x, y) + 2 + z])
 

Functions

void sub_model_PDFiTE_get_used_jac_elem (int *sub_model_int_data, double *sub_model_float_data, Jacobian *jac)
 Flag Jacobian elements used by this sub model.
 
void sub_model_PDFiTE_update_ids (int *sub_model_int_data, double *sub_model_float_data, int *deriv_ids, Jacobian jac)
 Update the time derivative and Jacbobian array indices.
 
void sub_model_PDFiTE_update_env_state (int *sub_model_int_data, double *sub_model_float_data, double *sub_model_env_data, ModelData *model_data)
 Update sub model data for new environmental conditions.
 
void sub_model_PDFiTE_calculate (int *sub_model_int_data, double *sub_model_float_data, double *sub_model_env_data, ModelData *model_data)
 Perform the sub-model calculations for the current model state.
 
void sub_model_PDFiTE_get_jac_contrib (int *sub_model_int_data, double *sub_model_float_data, double *sub_model_env_data, ModelData *model_data, realtype *J, double time_step)
 Add contributions to the Jacobian from derivates calculated using the output of this sub model.
 
void sub_model_PDFiTE_print (int *sub_model_int_data, double *sub_model_float_data)
 Print the PDFiTE Activity sub model parameters.
 

Detailed Description

PDFiTE Activity sub model solver functions.

Definition in file sub_model_PDFiTE.c.

Macro Definition Documentation

◆ ANION_ID_

#define ANION_ID_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x) + 4])

Definition at line 38 of file sub_model_PDFiTE.c.

◆ ANION_MW_

#define ANION_MW_ (   x)    (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 1])

Definition at line 58 of file sub_model_PDFiTE.c.

◆ ANION_N_

#define ANION_N_ (   x)    (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3])

Definition at line 60 of file sub_model_PDFiTE.c.

◆ B_Z_

#define B_Z_ (   x,
  y,
 
)    (float_data[INTER_SPEC_LOC_(x, y) + 2 + z])

Definition at line 63 of file sub_model_PDFiTE.c.

◆ CATION_ID_

#define CATION_ID_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x) + 3])

Definition at line 37 of file sub_model_PDFiTE.c.

◆ CATION_MW_

#define CATION_MW_ (   x)    (float_data[PAIR_FLOAT_PARAM_LOC_(x)])

Definition at line 57 of file sub_model_PDFiTE.c.

◆ CATION_N_

#define CATION_N_ (   x)    (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 2])

Definition at line 59 of file sub_model_PDFiTE.c.

◆ FLOAT_DATA_SIZE_

#define FLOAT_DATA_SIZE_   (int_data[4])

Definition at line 25 of file sub_model_PDFiTE.c.

◆ GAS_WATER_ID_

#define GAS_WATER_ID_   (int_data[1] - 1)

Definition at line 22 of file sub_model_PDFiTE.c.

◆ INT_DATA_SIZE_

#define INT_DATA_SIZE_   (int_data[3])

Definition at line 24 of file sub_model_PDFiTE.c.

◆ INTER_SPEC_ID_

#define INTER_SPEC_ID_ (   x,
 
)
Value:
(int_data[PAIR_INT_PARAM_LOC_(x) + 6 + \
(1 + 2 * NUM_ION_PAIRS_) * NUM_PHASE_ + NUM_INTER_(x) + y] - \
1)
#define NUM_ION_PAIRS_
#define PAIR_INT_PARAM_LOC_(x)
#define NUM_INTER_(x)
#define NUM_PHASE_

Definition at line 49 of file sub_model_PDFiTE.c.

◆ INTER_SPEC_LOC_

#define INTER_SPEC_LOC_ (   x,
 
)
Value:
(int_data[PAIR_INT_PARAM_LOC_(x) + 6 + \
(1 + 2 * NUM_ION_PAIRS_) * NUM_PHASE_ + 2 * (NUM_INTER_(x)) + y] - \
1)

Definition at line 53 of file sub_model_PDFiTE.c.

◆ ION_PAIR_ACT_ID_

#define ION_PAIR_ACT_ID_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x)])

Definition at line 34 of file sub_model_PDFiTE.c.

◆ JAC_ANION_ID_

#define JAC_ANION_ID_ (   p,
  x,
 
)
Value:
(int_data[PAIR_INT_PARAM_LOC_(x) + 6 + (1 + NUM_ION_PAIRS_) * NUM_PHASE_ + \
p * NUM_ION_PAIRS_ + y])

Definition at line 43 of file sub_model_PDFiTE.c.

◆ JAC_CATION_ID_

#define JAC_CATION_ID_ (   p,
  x,
 
)     (int_data[PAIR_INT_PARAM_LOC_(x) + 6 + NUM_PHASE_ + p * NUM_ION_PAIRS_ + y])

Definition at line 41 of file sub_model_PDFiTE.c.

◆ JAC_WATER_ID_

#define JAC_WATER_ID_ (   p,
 
)    (int_data[PAIR_INT_PARAM_LOC_(x) + 6 + p])

Definition at line 40 of file sub_model_PDFiTE.c.

◆ MAX_RH_

#define MAX_RH_ (   x,
 
)    (float_data[INTER_SPEC_LOC_(x, y) + 1])

Definition at line 62 of file sub_model_PDFiTE.c.

◆ MIN_RH_

#define MIN_RH_ (   x,
 
)    (float_data[INTER_SPEC_LOC_(x, y)])

Definition at line 61 of file sub_model_PDFiTE.c.

◆ NUM_ANION_

#define NUM_ANION_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x) + 2])

Definition at line 36 of file sub_model_PDFiTE.c.

◆ NUM_B_

#define NUM_B_ (   x,
 
)
Value:
(int_data[PAIR_INT_PARAM_LOC_(x) + 6 + \
(1 + 2 * NUM_ION_PAIRS_) * NUM_PHASE_ + y])

Definition at line 46 of file sub_model_PDFiTE.c.

◆ NUM_CATION_

#define NUM_CATION_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x) + 1])

Definition at line 35 of file sub_model_PDFiTE.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   1

Definition at line 29 of file sub_model_PDFiTE.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   5

Definition at line 27 of file sub_model_PDFiTE.c.

◆ NUM_INTER_

#define NUM_INTER_ (   x)    (int_data[PAIR_INT_PARAM_LOC_(x) + 5])

Definition at line 39 of file sub_model_PDFiTE.c.

◆ NUM_ION_PAIRS_

#define NUM_ION_PAIRS_   (int_data[2])

Definition at line 23 of file sub_model_PDFiTE.c.

◆ NUM_PHASE_

#define NUM_PHASE_   (int_data[0])

Definition at line 21 of file sub_model_PDFiTE.c.

◆ NUM_REAL_PROP_

#define NUM_REAL_PROP_   0

Definition at line 28 of file sub_model_PDFiTE.c.

◆ PAIR_FLOAT_PARAM_LOC_

#define PAIR_FLOAT_PARAM_LOC_ (   x)     (int_data[NUM_INT_PROP_ + NUM_PHASE_ + NUM_ION_PAIRS_ + x] - 1)

Definition at line 32 of file sub_model_PDFiTE.c.

◆ PAIR_INT_PARAM_LOC_

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

Definition at line 31 of file sub_model_PDFiTE.c.

◆ PHASE_ID_

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

Definition at line 30 of file sub_model_PDFiTE.c.

◆ PPM_TO_RH_

#define PPM_TO_RH_   (sub_model_env_data[0])

Definition at line 26 of file sub_model_PDFiTE.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 19 of file sub_model_PDFiTE.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 18 of file sub_model_PDFiTE.c.

Function Documentation

◆ sub_model_PDFiTE_calculate()

void sub_model_PDFiTE_calculate ( int *  sub_model_int_data,
double *  sub_model_float_data,
double *  sub_model_env_data,
ModelData model_data 
)

Perform the sub-model calculations for the current model state.

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data
sub_model_env_dataPointer to the sub model environment-dependent data
model_dataPointer to the model data including the current state and environmental conditions

Definition at line 167 of file sub_model_PDFiTE.c.

Here is the caller graph for this function:

◆ sub_model_PDFiTE_get_jac_contrib()

void sub_model_PDFiTE_get_jac_contrib ( int *  sub_model_int_data,
double *  sub_model_float_data,
double *  sub_model_env_data,
ModelData model_data,
realtype *  J,
double  time_step 
)

Add contributions to the Jacobian from derivates calculated using the output of this sub model.

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data
sub_model_env_dataPointer to the sub model environment-dependent data
model_dataPointer to the model data
JJacobian to be calculated
time_stepCurrent time step in [s]

Definition at line 277 of file sub_model_PDFiTE.c.

Here is the caller graph for this function:

◆ sub_model_PDFiTE_get_used_jac_elem()

void sub_model_PDFiTE_get_used_jac_elem ( int *  sub_model_int_data,
double *  sub_model_float_data,
Jacobian jac 
)

Flag Jacobian elements used by this sub model.

activity sub models are assumed to be at equilibrium

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data
jacJacobian

Definition at line 73 of file sub_model_PDFiTE.c.

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

◆ sub_model_PDFiTE_print()

void sub_model_PDFiTE_print ( int *  sub_model_int_data,
double *  sub_model_float_data 
)

Print the PDFiTE Activity sub model parameters.

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data

Definition at line 462 of file sub_model_PDFiTE.c.

Here is the caller graph for this function:

◆ sub_model_PDFiTE_update_env_state()

void sub_model_PDFiTE_update_env_state ( int *  sub_model_int_data,
double *  sub_model_float_data,
double *  sub_model_env_data,
ModelData model_data 
)

Update sub model data for new environmental conditions.

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data
sub_model_env_dataPointer to the sub model environment-dependent data
model_dataPointer to the model data

Definition at line 137 of file sub_model_PDFiTE.c.

Here is the caller graph for this function:

◆ sub_model_PDFiTE_update_ids()

void sub_model_PDFiTE_update_ids ( int *  sub_model_int_data,
double *  sub_model_float_data,
int *  deriv_ids,
Jacobian  jac 
)

Update the time derivative and Jacbobian array indices.

activity sub models are assumed to be at equilibrium

Parameters
sub_model_int_dataPointer to the sub model integer data
sub_model_float_dataPointer to the sub model floating-point data
deriv_idsIndices for state array variables on the solver state array
jacJacobian

Definition at line 105 of file sub_model_PDFiTE.c.

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