16#define MINIMUM_MASS_ 1.0e-25L
18#define MINIMUM_MW_ 0.1L
20#define MINIMUM_DENSITY_ 1800.0L
23#define CHEM_SPEC_UNKNOWN_TYPE 0
24#define CHEM_SPEC_VARIABLE 1
25#define CHEM_SPEC_CONSTANT 2
26#define CHEM_SPEC_PSSA 3
27#define CHEM_SPEC_ACTIVITY_COEFF 4
29#define NUM_STATE_VAR_ (int_data[0])
30#define NUM_INT_PROP_ 1
31#define NUM_FLOAT_PROP_ 0
32#define SPEC_TYPE_(x) (int_data[NUM_INT_PROP_ + x])
33#define MW_(x) (float_data[NUM_FLOAT_PROP_ + x])
34#define DENSITY_(x) (float_data[NUM_FLOAT_PROP_ + NUM_STATE_VAR_ + x])
47 int state_var_id,
bool *jac_struct) {
55 int num_flagged_elem = 0;
61 jac_struct[state_var_id + i_spec] =
true;
66 return num_flagged_elem;
94 double *state_var,
double *mass,
double *MW,
95 double *jac_elem_mass,
double *jac_elem_MW) {
111 l_mass += state_var[i_spec];
112 moles += state_var[i_spec] / (
long double)
MW_(i_spec);
113 if (jac_elem_mass) jac_elem_mass[i_jac] = 1.0L;
114 if (jac_elem_MW) jac_elem_MW[i_jac] = 1.0L /
MW_(i_spec);
118 *MW = (double)l_mass / moles;
120 for (
int j_jac = 0; j_jac < i_jac; j_jac++) {
122 (moles - jac_elem_MW[j_jac] * l_mass) / (moles * moles);
125 *mass = (double)l_mass;
145 double *state_var,
double *volume,
161 *volume += state_var[i_spec] /
DENSITY_(i_spec);
162 if (jac_elem) jac_elem[i_jac++] = 1.0 /
DENSITY_(i_spec);
176 int *int_param,
double *float_param,
182 int *aero_phase_int_data =
185 double *aero_phase_float_data = &(
199 for (; n_int_param > 0; --n_int_param)
200 *(aero_phase_int_data++) = *(int_param++);
203 for (; n_float_param > 0; --n_float_param)
204 *(aero_phase_float_data++) = (double)*(float_param++);
219 for (
int i_aero_phase = 0; i_aero_phase < n_aero_phase; i_aero_phase++) {
226 printf(
"\n\nAerosol Phase %d\n\n", i_aero_phase);
233#undef NUM_FLOAT_PROP_
238#undef FLOAT_DATA_SIZE_
#define CHEM_SPEC_VARIABLE
#define MINIMUM_MASS_
Minimum aerosol-phase mass concentration [kg m-3].
void aero_phase_print_data(void *solver_data)
Print the aerosol phase data.
#define MINIMUM_DENSITY_
Minimum mass assumed density [kg m-3].
#define CHEM_SPEC_CONSTANT
#define MINIMUM_MW_
Minimum mass assumed molecular weight [kg mol-1].
void aero_phase_get_volume__m3_m3(ModelData *model_data, int aero_phase_idx, double *state_var, double *volume, double *jac_elem)
Get the volume of an aerosol phase.
int aero_phase_get_used_jac_elem(ModelData *model_data, int aero_phase_idx, int state_var_id, bool *jac_struct)
Flag Jacobian elements used in calculations of mass and volume.
void aero_phase_add_condensed_data(int n_int_param, int n_float_param, int *int_param, double *float_param, void *solver_data)
Add condensed data to the condensed data block for aerosol phases.
void aero_phase_get_mass__kg_m3(ModelData *model_data, int aero_phase_idx, double *state_var, double *mass, double *MW, double *jac_elem_mass, double *jac_elem_MW)
Get the mass and average MW in an aerosol phase.
Header file for aerosol phase functions.
int * aero_phase_float_indices
int * aero_phase_int_indices
double * aero_phase_float_data
int * aero_phase_int_data