CAMP 1.0.0
Chemistry Across Multiple Phases
|
Modal mass aerosol representation functions. More...
Go to the source code of this file.
Macros | |
#define | TEMPERATURE_K_ env_data[0] |
#define | PRESSURE_PA_ env_data[1] |
#define | UPDATE_GMD 0 |
#define | UPDATE_GSD 1 |
#define | BINNED 1 |
#define | MODAL 2 |
#define | NUM_SECTION_ (int_data[0]) |
#define | INT_DATA_SIZE_ (int_data[1]) |
#define | FLOAT_DATA_SIZE_ (int_data[2]) |
#define | AERO_REP_ID_ (int_data[3]) |
#define | NUM_INT_PROP_ 4 |
#define | NUM_FLOAT_PROP_ 0 |
#define | NUM_ENV_PARAM_ 0 |
#define | MODE_INT_PROP_LOC_(x) (int_data[NUM_INT_PROP_ + x] - 1) |
#define | MODE_FLOAT_PROP_LOC_(x) (int_data[NUM_INT_PROP_ + NUM_SECTION_ + x] - 1) |
#define | SECTION_TYPE_(x) (int_data[MODE_INT_PROP_LOC_(x)]) |
#define | NUM_BINS_(x) (int_data[MODE_INT_PROP_LOC_(x) + 1]) |
#define | NUM_PHASE_(x) (int_data[MODE_INT_PROP_LOC_(x) + 2]) |
#define | PHASE_STATE_ID_(x, y, b) (int_data[MODE_INT_PROP_LOC_(x) + 3 + b * NUM_PHASE_(x) + y] - 1) |
#define | PHASE_MODEL_DATA_ID_(x, y, b) |
#define | PHASE_NUM_JAC_ELEM_(x, y, b) |
#define | BIN_DP_(x, b) (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3]) |
#define | GMD_(x) (aero_rep_env_data[x]) |
#define | GSD_(x) (aero_rep_env_data[NUM_SECTION_ + x]) |
#define | NUMBER_CONC_(x, b) (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3 + 1]) |
#define | EFFECTIVE_RADIUS_(x, b) (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3 + 2]) |
#define | PHASE_MASS_(x, y, b) |
#define | PHASE_AVG_MW_(x, y, b) |
Functions | |
int | aero_rep_modal_binned_mass_get_used_jac_elem (ModelData *model_data, int aero_phase_idx, int *aero_rep_int_data, double *aero_rep_float_data, bool *jac_struct) |
Flag Jacobian elements used in calcualtions of mass and volume. | |
void | aero_rep_modal_binned_mass_get_dependencies (int *aero_rep_int_data, double *aero_rep_float_data, bool *state_flags) |
Flag elements on the state array used by this aerosol representation. | |
void | aero_rep_modal_binned_mass_update_env_state (ModelData *model_data, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Update aerosol representation data for new environmental conditions. | |
void | aero_rep_modal_binned_mass_update_state (ModelData *model_data, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Update aerosol representation data for a new state. | |
void | aero_rep_modal_binned_mass_get_effective_radius__m (ModelData *model_data, int aero_phase_idx, double *radius, double *partial_deriv, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Get the effective particle radius \(r_{eff}\) (m) | |
void | aero_rep_modal_binned_mass_get_number_conc__n_m3 (ModelData *model_data, int aero_phase_idx, double *number_conc, double *partial_deriv, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Get the particle number concentration \(n\) ( \(\mbox{\si{\#\per\cubic\metre}}\)) | |
void | aero_rep_modal_binned_mass_get_aero_conc_type (int aero_phase_idx, int *aero_conc_type, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Get the type of aerosol concentration used. | |
void | aero_rep_modal_binned_mass_get_aero_phase_mass__kg_m3 (ModelData *model_data, int aero_phase_idx, double *aero_phase_mass, double *partial_deriv, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Get the total mass in an aerosol phase \(m\) ( \(\mbox{\si{\kilogram\per\cubic\metre}}\)) | |
void | aero_rep_modal_binned_mass_get_aero_phase_avg_MW__kg_mol (ModelData *model_data, int aero_phase_idx, double *aero_phase_avg_MW, double *partial_deriv, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Get the average molecular weight in an aerosol phase \(m\) ( \(\mbox{\si{\kilogram\per\mole}}\)) | |
bool | aero_rep_modal_binned_mass_update_data (void *update_data, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data) |
Update the aerosol representation data. | |
void | aero_rep_modal_binned_mass_print (int *aero_rep_int_data, double *aero_rep_float_data) |
Print the mass-only modal/binned reaction parameters. | |
void * | aero_rep_modal_binned_mass_create_gmd_update_data () |
Create update data for new GMD. | |
void | aero_rep_modal_binned_mass_set_gmd_update_data (void *update_data, int aero_rep_id, int section_id, double gmd) |
Set GMD update data. | |
void * | aero_rep_modal_binned_mass_create_gsd_update_data () |
Create update data for new GSD. | |
void | aero_rep_modal_binned_mass_set_gsd_update_data (void *update_data, int aero_rep_id, int section_id, double gsd) |
Set GSD update data. | |
Modal mass aerosol representation functions.
Definition in file aero_rep_modal_binned_mass.c.
#define AERO_REP_ID_ (int_data[3]) |
Definition at line 31 of file aero_rep_modal_binned_mass.c.
#define BIN_DP_ | ( | x, | |
b | |||
) | (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3]) |
Definition at line 59 of file aero_rep_modal_binned_mass.c.
#define BINNED 1 |
Definition at line 25 of file aero_rep_modal_binned_mass.c.
#define EFFECTIVE_RADIUS_ | ( | x, | |
b | |||
) | (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3 + 2]) |
Definition at line 69 of file aero_rep_modal_binned_mass.c.
#define FLOAT_DATA_SIZE_ (int_data[2]) |
Definition at line 30 of file aero_rep_modal_binned_mass.c.
#define GMD_ | ( | x | ) | (aero_rep_env_data[x]) |
Definition at line 62 of file aero_rep_modal_binned_mass.c.
#define GSD_ | ( | x | ) | (aero_rep_env_data[NUM_SECTION_ + x]) |
Definition at line 63 of file aero_rep_modal_binned_mass.c.
#define INT_DATA_SIZE_ (int_data[1]) |
Definition at line 29 of file aero_rep_modal_binned_mass.c.
#define MODAL 2 |
Definition at line 26 of file aero_rep_modal_binned_mass.c.
#define MODE_FLOAT_PROP_LOC_ | ( | x | ) | (int_data[NUM_INT_PROP_ + NUM_SECTION_ + x] - 1) |
Definition at line 36 of file aero_rep_modal_binned_mass.c.
#define MODE_INT_PROP_LOC_ | ( | x | ) | (int_data[NUM_INT_PROP_ + x] - 1) |
Definition at line 35 of file aero_rep_modal_binned_mass.c.
#define NUM_BINS_ | ( | x | ) | (int_data[MODE_INT_PROP_LOC_(x) + 1]) |
Definition at line 40 of file aero_rep_modal_binned_mass.c.
#define NUM_ENV_PARAM_ 0 |
Definition at line 34 of file aero_rep_modal_binned_mass.c.
#define NUM_FLOAT_PROP_ 0 |
Definition at line 33 of file aero_rep_modal_binned_mass.c.
#define NUM_INT_PROP_ 4 |
Definition at line 32 of file aero_rep_modal_binned_mass.c.
#define NUM_PHASE_ | ( | x | ) | (int_data[MODE_INT_PROP_LOC_(x) + 2]) |
Definition at line 43 of file aero_rep_modal_binned_mass.c.
#define NUM_SECTION_ (int_data[0]) |
Definition at line 28 of file aero_rep_modal_binned_mass.c.
#define NUMBER_CONC_ | ( | x, | |
b | |||
) | (float_data[MODE_FLOAT_PROP_LOC_(x) + b * 3 + 1]) |
Definition at line 66 of file aero_rep_modal_binned_mass.c.
#define PHASE_AVG_MW_ | ( | x, | |
y, | |||
b | |||
) |
Definition at line 79 of file aero_rep_modal_binned_mass.c.
#define PHASE_MASS_ | ( | x, | |
y, | |||
b | |||
) |
Definition at line 73 of file aero_rep_modal_binned_mass.c.
#define PHASE_MODEL_DATA_ID_ | ( | x, | |
y, | |||
b | |||
) |
Definition at line 48 of file aero_rep_modal_binned_mass.c.
#define PHASE_NUM_JAC_ELEM_ | ( | x, | |
y, | |||
b | |||
) |
Definition at line 54 of file aero_rep_modal_binned_mass.c.
#define PHASE_STATE_ID_ | ( | x, | |
y, | |||
b | |||
) | (int_data[MODE_INT_PROP_LOC_(x) + 3 + b * NUM_PHASE_(x) + y] - 1) |
Definition at line 46 of file aero_rep_modal_binned_mass.c.
#define PRESSURE_PA_ env_data[1] |
Definition at line 20 of file aero_rep_modal_binned_mass.c.
#define SECTION_TYPE_ | ( | x | ) | (int_data[MODE_INT_PROP_LOC_(x)]) |
Definition at line 37 of file aero_rep_modal_binned_mass.c.
#define TEMPERATURE_K_ env_data[0] |
Definition at line 19 of file aero_rep_modal_binned_mass.c.
#define UPDATE_GMD 0 |
Definition at line 22 of file aero_rep_modal_binned_mass.c.
#define UPDATE_GSD 1 |
Definition at line 23 of file aero_rep_modal_binned_mass.c.
void * aero_rep_modal_binned_mass_create_gmd_update_data | ( | ) |
Create update data for new GMD.
Definition at line 677 of file aero_rep_modal_binned_mass.c.
void * aero_rep_modal_binned_mass_create_gsd_update_data | ( | ) |
Create update data for new GSD.
Definition at line 711 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_aero_conc_type | ( | int | aero_phase_idx, |
int * | aero_conc_type, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Get the type of aerosol concentration used.
Modal mass concentrations are per-mode or per-bin.
aero_phase_idx | Index of the aerosol phase within the representation |
aero_conc_type | Pointer to int that will hold the concentration type code |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 434 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_aero_phase_avg_MW__kg_mol | ( | ModelData * | model_data, |
int | aero_phase_idx, | ||
double * | aero_phase_avg_MW, | ||
double * | partial_deriv, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Get the average molecular weight in an aerosol phase \(m\) ( \(\mbox{\si{\kilogram\per\mole}}\))
model_data | Pointer to the model data, including the state array |
aero_phase_idx | Index of the aerosol phase within the representation |
aero_phase_avg_MW | Average molecular weight in the aerosol phase ( \(\mbox{\si{\kilogram\per\mole}}\)) |
partial_deriv | \(\frac{\partial m}{\partial y}\) where \(y\) are the species on the state array |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 525 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_aero_phase_mass__kg_m3 | ( | ModelData * | model_data, |
int | aero_phase_idx, | ||
double * | aero_phase_mass, | ||
double * | partial_deriv, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Get the total mass in an aerosol phase \(m\) ( \(\mbox{\si{\kilogram\per\cubic\metre}}\))
model_data | Pointer to the model data, including the state array |
aero_phase_idx | Index of the aerosol phase within the representation |
aero_phase_mass | Total mass in the aerosol phase, \(m\) ( \(\mbox{\si{\kilogram\per\cubic\metre}}\)) |
partial_deriv | \(\frac{\partial m}{\partial y}\) where \(y\) are the species on the state array |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 462 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_dependencies | ( | int * | aero_rep_int_data, |
double * | aero_rep_float_data, | ||
bool * | state_flags | ||
) |
Flag elements on the state array used by this aerosol representation.
The modal mass aerosol representation functions do not use state array values
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
state_flags | Array of flags indicating state array elements used |
Definition at line 139 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_effective_radius__m | ( | ModelData * | model_data, |
int | aero_phase_idx, | ||
double * | radius, | ||
double * | partial_deriv, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Get the effective particle radius \(r_{eff}\) (m)
The modal mass effective radius is calculated for a log-normal distribution where the geometric mean diameter ( \(\tilde{D}_n\)) and geometric standard deviation ( \(\sigma_g\)) are set by the aerosol model prior to solving the chemistry. Thus, all \(\frac{\partial r_{eff}}{\partial y}\) are zero. The effective radius is calculated according to the equation given in Table 1 of Zender [Zender2002] :
\[ \tilde{\sigma_g} \equiv ln( \sigma_g ) \]
\[ D_s = D_{eff} = \tilde{D_n} e^{5 \tilde{\sigma}_g^2 / 2} \]
\[ r_{eff} = \frac{D_{eff}}{2} \]
For bins, \(r_{eff}\) is assumed to be the bin radius.
model_data | Pointer to the model data, including the state array |
aero_phase_idx | Index of the aerosol phase within the representation |
radius | Effective particle radius (m) |
partial_deriv | \(\frac{\partial r_{eff}}{\partial y}\) where \(y\) are species on the state array |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 300 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_get_number_conc__n_m3 | ( | ModelData * | model_data, |
int | aero_phase_idx, | ||
double * | number_conc, | ||
double * | partial_deriv, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Get the particle number concentration \(n\) ( \(\mbox{\si{\#\per\cubic\metre}}\))
The modal mass number concentration is calculated for a log-normal distribution where the geometric mean diameter ( \(\tilde{D}_n\)) and geometric standard deviation ( \(\tilde{\sigma}_g\)) are set by the aerosol model prior to solving the chemistry. The number concentration is calculated according to the equation given in Table 1 of Zender [Zender2002] :
\[ n = N_0 = \frac{6V_0}{\pi}\tilde{D}_n^{-3}e^{-9 ln(\tilde{\sigma}_g)^2/2} \]
\[ V_0 = \sum_i{\frac{m_i}{\rho_i}} \]
where \(\rho_i\) and \(m_i\) are the density and total mass of species \(i\) in the specified mode.
The binned number concentration is calculated according to:
\[ n = V_0 / V_p \]
\[ V_p = \frac{4}{3}\pi r^{3} \]
where \(r\) is the radius of the size bin and \(V_0\) is defined as above.
model_data | Pointer to the model data, including the state array |
aero_phase_idx | Index of the aerosol phase within the representation |
number_conc | Particle number concentration, \(n\) ( \(\mbox{\si{\#\per\cubic\centi\metre}}\)) |
partial_deriv | \(\frac{\partial n}{\partial y}\) where \(y\) are the species on the state array |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 368 of file aero_rep_modal_binned_mass.c.
int aero_rep_modal_binned_mass_get_used_jac_elem | ( | ModelData * | model_data, |
int | aero_phase_idx, | ||
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
bool * | jac_struct | ||
) |
Flag Jacobian elements used in calcualtions of mass and volume.
model_data | Pointer to the model data |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_phase_idx | Index of the aerosol phase to find elements for |
jac_struct | 1D array of flags indicating potentially non-zero Jacobian elements. (The dependent variable should have been chosen by the calling function.) |
Definition at line 95 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_print | ( | int * | aero_rep_int_data, |
double * | aero_rep_float_data | ||
) |
Print the mass-only modal/binned reaction parameters.
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
Definition at line 663 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_set_gmd_update_data | ( | void * | update_data, |
int | aero_rep_id, | ||
int | section_id, | ||
double | gmd | ||
) |
Set GMD update data.
update_data | Pointer to an allocated GMD update data object |
aero_rep_id | Id of the aerosol representation(s) to update |
section_id | Id of the mode to update |
gmd | New mode GMD (m) |
Definition at line 693 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_set_gsd_update_data | ( | void * | update_data, |
int | aero_rep_id, | ||
int | section_id, | ||
double | gsd | ||
) |
Set GSD update data.
update_data | Pointer to an allocated GSD update data object |
aero_rep_id | Id of the aerosol representation(s) to update |
section_id | Id of the mode to update |
gsd | New mode GSD (unitless) |
Definition at line 727 of file aero_rep_modal_binned_mass.c.
bool aero_rep_modal_binned_mass_update_data | ( | void * | update_data, |
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Update the aerosol representation data.
The model mass aerosol representation update data is structured as follows:
update_data | Pointer to the updated aerosol representation data |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Recalculate the effective radius [m]
Equation based on [Zender2002] Table 1 effective diameter \((D_s, D_{eff}\)) equations:
\[ \tilde{\sigma_g} \equiv ln( \sigma_g ) \]
\[ D_s = D_{eff} = \tilde{D_n} e^{5 \tilde{\sigma}_g^2 / 2} \]
\[ r_{eff} = \frac{D_{eff}}{2} \]
where \(\tilde{D_n}\) is the geometric mean diameter [m], \(\sigma_g\) is the geometric standard deviation [unitless], and \(r_{eff}\) is the effective radius [m].
Definition at line 594 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_update_env_state | ( | ModelData * | model_data, |
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Update aerosol representation data for new environmental conditions.
The modal mass aerosol representation is not updated for new environmental conditions
model_data | Pointer to the model data |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 160 of file aero_rep_modal_binned_mass.c.
void aero_rep_modal_binned_mass_update_state | ( | ModelData * | model_data, |
int * | aero_rep_int_data, | ||
double * | aero_rep_float_data, | ||
double * | aero_rep_env_data | ||
) |
Update aerosol representation data for a new state.
The modal mass aerosol representation recalculates effective radius and number concentration for each new state.
model_data | Pointer to the model data, including the state array |
aero_rep_int_data | Pointer to the aerosol representation integer data |
aero_rep_float_data | Pointer to the aerosol representation floating-point data |
aero_rep_env_data | Pointer to the aerosol representation environment-dependent parameters |
Definition at line 183 of file aero_rep_modal_binned_mass.c.