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

ZSR Aerosol Water sub model solver functions. More...

Include dependency graph for sub_model_ZSR_aerosol_water.c:

Go to the source code of this file.

Macros

#define TEMPERATURE_K_   env_data[0]
 
#define PRESSURE_PA_   env_data[1]
 
#define MINIMUM_WATER_MASS_   1.0e-30L
 
#define ALPHA_   (-100.0)
 
#define ACT_TYPE_JACOBSON   1
 
#define ACT_TYPE_EQSAM   2
 
#define NUM_PHASE_   (int_data[0])
 
#define GAS_WATER_ID_   (int_data[1] - 1)
 
#define NUM_ION_PAIR_   (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_(p)   (int_data[NUM_INT_PROP_ + p] - 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_PAIR_ + x] - 1)
 
#define TYPE_(x)   (int_data[PAIR_INT_PARAM_LOC_(x)])
 
#define JACOB_NUM_CATION_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 1])
 
#define JACOB_NUM_ANION_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 2])
 
#define JACOB_CATION_ID_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 3])
 
#define JACOB_ANION_ID_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 4])
 
#define JACOB_NUM_Y_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 5])
 
#define JACOB_GAS_WATER_JAC_ID_(p, x)   int_data[PAIR_INT_PARAM_LOC_(x) + 6 + p]
 
#define JACOB_CATION_JAC_ID_(p, x)    int_data[PAIR_INT_PARAM_LOC_(x) + 6 + NUM_PHASE_ + p]
 
#define JACOB_ANION_JAC_ID_(p, x)    int_data[PAIR_INT_PARAM_LOC_(x) + 6 + 2 * NUM_PHASE_ + p]
 
#define EQSAM_NUM_ION_(x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 1])
 
#define EQSAM_GAS_WATER_JAC_ID_(p, x)   (int_data[PAIR_INT_PARAM_LOC_(x) + 2 + p])
 
#define EQSAM_ION_ID_(x, y)    (int_data[PAIR_INT_PARAM_LOC_(x) + 2 + NUM_PHASE_ + y])
 
#define EQSAM_ION_JAC_ID_(p, x, y)
 
#define JACOB_low_RH_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x)])
 
#define JACOB_CATION_MW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 1])
 
#define JACOB_ANION_MW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 2])
 
#define JACOB_Y_(x, y)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3 + y])
 
#define EQSAM_NW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x)])
 
#define EQSAM_ZW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 1])
 
#define EQSAM_ION_PAIR_MW_(x)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 2])
 
#define EQSAM_ION_MW_(x, y)   (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3 + y])
 

Functions

void sub_model_ZSR_aerosol_water_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_ZSR_aerosol_water_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_ZSR_aerosol_water_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_ZSR_aerosol_water_calculate (int *sub_model_int_data, double *sub_model_float_data, double *sub_model_env_data, ModelData *model_data)
 Do pre-derivative calculations.
 
void sub_model_ZSR_aerosol_water_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_ZSR_aerosol_water_print (int *sub_model_int_data, double *sub_model_float_data)
 Print the ZSR Aerosol Water sub model parameters.
 

Detailed Description

ZSR Aerosol Water sub model solver functions.

Definition in file sub_model_ZSR_aerosol_water.c.

Macro Definition Documentation

◆ ACT_TYPE_EQSAM

#define ACT_TYPE_EQSAM   2

Definition at line 28 of file sub_model_ZSR_aerosol_water.c.

◆ ACT_TYPE_JACOBSON

#define ACT_TYPE_JACOBSON   1

Definition at line 27 of file sub_model_ZSR_aerosol_water.c.

◆ ALPHA_

#define ALPHA_   (-100.0)

Definition at line 25 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_GAS_WATER_JAC_ID_

#define EQSAM_GAS_WATER_JAC_ID_ (   p,
 
)    (int_data[PAIR_INT_PARAM_LOC_(x) + 2 + p])

Definition at line 55 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_ION_ID_

#define EQSAM_ION_ID_ (   x,
 
)     (int_data[PAIR_INT_PARAM_LOC_(x) + 2 + NUM_PHASE_ + y])

Definition at line 56 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_ION_JAC_ID_

#define EQSAM_ION_JAC_ID_ (   p,
  x,
 
)
Value:
int_data[PAIR_INT_PARAM_LOC_(x) + 2 + NUM_PHASE_ + EQSAM_NUM_ION_(x) + \
y * NUM_PHASE_ + p]
#define EQSAM_NUM_ION_(x)
#define PAIR_INT_PARAM_LOC_(x)
#define NUM_PHASE_

Definition at line 58 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_ION_MW_

#define EQSAM_ION_MW_ (   x,
 
)    (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3 + y])

Definition at line 68 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_ION_PAIR_MW_

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

Definition at line 67 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_NUM_ION_

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

Definition at line 54 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_NW_

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

Definition at line 65 of file sub_model_ZSR_aerosol_water.c.

◆ EQSAM_ZW_

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

Definition at line 66 of file sub_model_ZSR_aerosol_water.c.

◆ FLOAT_DATA_SIZE_

#define FLOAT_DATA_SIZE_   (int_data[4])

Definition at line 34 of file sub_model_ZSR_aerosol_water.c.

◆ GAS_WATER_ID_

#define GAS_WATER_ID_   (int_data[1] - 1)

Definition at line 31 of file sub_model_ZSR_aerosol_water.c.

◆ INT_DATA_SIZE_

#define INT_DATA_SIZE_   (int_data[3])

Definition at line 33 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_ANION_ID_

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

Definition at line 47 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_ANION_JAC_ID_

#define JACOB_ANION_JAC_ID_ (   p,
 
)     int_data[PAIR_INT_PARAM_LOC_(x) + 6 + 2 * NUM_PHASE_ + p]

Definition at line 52 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_ANION_MW_

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

Definition at line 63 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_CATION_ID_

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

Definition at line 46 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_CATION_JAC_ID_

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

Definition at line 50 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_CATION_MW_

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

Definition at line 62 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_GAS_WATER_JAC_ID_

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

Definition at line 49 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_low_RH_

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

Definition at line 61 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_NUM_ANION_

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

Definition at line 45 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_NUM_CATION_

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

Definition at line 44 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_NUM_Y_

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

Definition at line 48 of file sub_model_ZSR_aerosol_water.c.

◆ JACOB_Y_

#define JACOB_Y_ (   x,
 
)    (float_data[PAIR_FLOAT_PARAM_LOC_(x) + 3 + y])

Definition at line 64 of file sub_model_ZSR_aerosol_water.c.

◆ MINIMUM_WATER_MASS_

#define MINIMUM_WATER_MASS_   1.0e-30L

Definition at line 22 of file sub_model_ZSR_aerosol_water.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   1

Definition at line 38 of file sub_model_ZSR_aerosol_water.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   5

Definition at line 36 of file sub_model_ZSR_aerosol_water.c.

◆ NUM_ION_PAIR_

#define NUM_ION_PAIR_   (int_data[2])

Definition at line 32 of file sub_model_ZSR_aerosol_water.c.

◆ NUM_PHASE_

#define NUM_PHASE_   (int_data[0])

Definition at line 30 of file sub_model_ZSR_aerosol_water.c.

◆ NUM_REAL_PROP_

#define NUM_REAL_PROP_   0

Definition at line 37 of file sub_model_ZSR_aerosol_water.c.

◆ PAIR_FLOAT_PARAM_LOC_

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

Definition at line 41 of file sub_model_ZSR_aerosol_water.c.

◆ PAIR_INT_PARAM_LOC_

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

Definition at line 40 of file sub_model_ZSR_aerosol_water.c.

◆ PHASE_ID_

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

Definition at line 39 of file sub_model_ZSR_aerosol_water.c.

◆ PPM_TO_RH_

#define PPM_TO_RH_   (sub_model_env_data[0])

Definition at line 35 of file sub_model_ZSR_aerosol_water.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 19 of file sub_model_ZSR_aerosol_water.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 18 of file sub_model_ZSR_aerosol_water.c.

◆ TYPE_

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

Definition at line 43 of file sub_model_ZSR_aerosol_water.c.

Function Documentation

◆ sub_model_ZSR_aerosol_water_calculate()

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

Do pre-derivative calculations.

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 state array

Definition at line 216 of file sub_model_ZSR_aerosol_water.c.

Here is the caller graph for this function:

◆ sub_model_ZSR_aerosol_water_get_jac_contrib()

void sub_model_ZSR_aerosol_water_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 [s]

Definition at line 314 of file sub_model_ZSR_aerosol_water.c.

Here is the caller graph for this function:

◆ sub_model_ZSR_aerosol_water_get_used_jac_elem()

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

Flag Jacobian elements used by this sub model.

ZSR aerosol water 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 81 of file sub_model_ZSR_aerosol_water.c.

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

◆ sub_model_ZSR_aerosol_water_print()

void sub_model_ZSR_aerosol_water_print ( int *  sub_model_int_data,
double *  sub_model_float_data 
)

Print the ZSR Aerosol Water 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 445 of file sub_model_ZSR_aerosol_water.c.

Here is the caller graph for this function:

◆ sub_model_ZSR_aerosol_water_update_env_state()

void sub_model_ZSR_aerosol_water_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 189 of file sub_model_ZSR_aerosol_water.c.

Here is the caller graph for this function:

◆ sub_model_ZSR_aerosol_water_update_ids()

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

ZSR aerosol water 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 133 of file sub_model_ZSR_aerosol_water.c.

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