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

Single particle aerosol representation functions. More...

Include dependency graph for aero_rep_single_particle.c:

Go to the source code of this file.

Macros

#define TEMPERATURE_K_   env_data[0]
 
#define PRESSURE_PA_   env_data[1]
 
#define UPDATE_NUMBER   0
 
#define NUM_LAYERS_   int_data[0]
 
#define AERO_REP_ID_   int_data[1]
 
#define MAX_PARTICLES_   int_data[2]
 
#define PARTICLE_STATE_SIZE_   int_data[3]
 
#define NUMBER_CONC_(x)   aero_rep_env_data[x]
 
#define NUM_INT_PROP_   4
 
#define NUM_FLOAT_PROP_   0
 
#define NUM_ENV_PARAM_   MAX_PARTICLES_
 
#define LAYER_PHASE_START_(l)   (int_data[NUM_INT_PROP_+l]-1)
 
#define LAYER_PHASE_END_(l)   (int_data[NUM_INT_PROP_+NUM_LAYERS_+l]-1)
 
#define TOTAL_NUM_PHASES_   (LAYER_PHASE_END_(NUM_LAYERS_-1)-LAYER_PHASE_START_(0)+1)
 
#define NUM_PHASES_(l)   (LAYER_PHASE_END_(l)-LAYER_PHASE_START_(l)+1)
 
#define PHASE_STATE_ID_(l, p)   (int_data[NUM_INT_PROP_+2*NUM_LAYERS_+LAYER_PHASE_START_(l)+p]-1)
 
#define PHASE_MODEL_DATA_ID_(l, p)   (int_data[NUM_INT_PROP_+2*NUM_LAYERS_+TOTAL_NUM_PHASES_+LAYER_PHASE_START_(l)+p]-1)
 
#define PHASE_NUM_JAC_ELEM_(l, p)   int_data[NUM_INT_PROP_+2*NUM_LAYERS_+2*TOTAL_NUM_PHASES_+LAYER_PHASE_START_(l)+p]
 

Functions

int aero_rep_single_particle_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_single_particle_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_single_particle_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_single_particle_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_single_particle_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_single_particle_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_single_particle_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_single_particle_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_single_particle_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{\kilo\gram\per\mol}}\))
 
bool aero_rep_single_particle_update_data (void *update_data, int *aero_rep_int_data, double *aero_rep_float_data, double *aero_rep_env_data)
 Update aerosol representation data.
 
void aero_rep_single_particle_print (int *aero_rep_int_data, double *aero_rep_float_data)
 Print the Single Particle reaction parameters.
 
void * aero_rep_single_particle_create_number_update_data ()
 Create update data for new particle number.
 
void aero_rep_single_particle_set_number_update_data__n_m3 (void *update_data, int aero_rep_id, int particle_id, double number_conc)
 Set number update data (#/m3)
 

Detailed Description

Single particle aerosol representation functions.

Definition in file aero_rep_single_particle.c.

Macro Definition Documentation

◆ AERO_REP_ID_

#define AERO_REP_ID_   int_data[1]

Definition at line 24 of file aero_rep_single_particle.c.

◆ LAYER_PHASE_END_

#define LAYER_PHASE_END_ (   l)    (int_data[NUM_INT_PROP_+NUM_LAYERS_+l]-1)

Definition at line 32 of file aero_rep_single_particle.c.

◆ LAYER_PHASE_START_

#define LAYER_PHASE_START_ (   l)    (int_data[NUM_INT_PROP_+l]-1)

Definition at line 31 of file aero_rep_single_particle.c.

◆ MAX_PARTICLES_

#define MAX_PARTICLES_   int_data[2]

Definition at line 25 of file aero_rep_single_particle.c.

◆ NUM_ENV_PARAM_

#define NUM_ENV_PARAM_   MAX_PARTICLES_

Definition at line 30 of file aero_rep_single_particle.c.

◆ NUM_FLOAT_PROP_

#define NUM_FLOAT_PROP_   0

Definition at line 29 of file aero_rep_single_particle.c.

◆ NUM_INT_PROP_

#define NUM_INT_PROP_   4

Definition at line 28 of file aero_rep_single_particle.c.

◆ NUM_LAYERS_

#define NUM_LAYERS_   int_data[0]

Definition at line 23 of file aero_rep_single_particle.c.

◆ NUM_PHASES_

#define NUM_PHASES_ (   l)    (LAYER_PHASE_END_(l)-LAYER_PHASE_START_(l)+1)

Definition at line 34 of file aero_rep_single_particle.c.

◆ NUMBER_CONC_

#define NUMBER_CONC_ (   x)    aero_rep_env_data[x]

Definition at line 27 of file aero_rep_single_particle.c.

◆ PARTICLE_STATE_SIZE_

#define PARTICLE_STATE_SIZE_   int_data[3]

Definition at line 26 of file aero_rep_single_particle.c.

◆ PHASE_MODEL_DATA_ID_

#define PHASE_MODEL_DATA_ID_ (   l,
 
)    (int_data[NUM_INT_PROP_+2*NUM_LAYERS_+TOTAL_NUM_PHASES_+LAYER_PHASE_START_(l)+p]-1)

Definition at line 36 of file aero_rep_single_particle.c.

◆ PHASE_NUM_JAC_ELEM_

#define PHASE_NUM_JAC_ELEM_ (   l,
 
)    int_data[NUM_INT_PROP_+2*NUM_LAYERS_+2*TOTAL_NUM_PHASES_+LAYER_PHASE_START_(l)+p]

Definition at line 37 of file aero_rep_single_particle.c.

◆ PHASE_STATE_ID_

#define PHASE_STATE_ID_ (   l,
 
)    (int_data[NUM_INT_PROP_+2*NUM_LAYERS_+LAYER_PHASE_START_(l)+p]-1)

Definition at line 35 of file aero_rep_single_particle.c.

◆ PRESSURE_PA_

#define PRESSURE_PA_   env_data[1]

Definition at line 19 of file aero_rep_single_particle.c.

◆ TEMPERATURE_K_

#define TEMPERATURE_K_   env_data[0]

Definition at line 18 of file aero_rep_single_particle.c.

◆ TOTAL_NUM_PHASES_

#define TOTAL_NUM_PHASES_   (LAYER_PHASE_END_(NUM_LAYERS_-1)-LAYER_PHASE_START_(0)+1)

Definition at line 33 of file aero_rep_single_particle.c.

◆ UPDATE_NUMBER

#define UPDATE_NUMBER   0

Definition at line 21 of file aero_rep_single_particle.c.

Function Documentation

◆ aero_rep_single_particle_create_number_update_data()

void * aero_rep_single_particle_create_number_update_data ( )

Create update data for new particle number.

Returns
Pointer to a new number update data object

Definition at line 442 of file aero_rep_single_particle.c.

◆ aero_rep_single_particle_get_aero_conc_type()

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

Single particle concentrations are per-particle.

Parameters
aero_phase_idxIndex of the aerosol phase within the representation
aero_conc_typePointer to int that will hold the concentration type code (0 = per particle mass concentrations; 1 = total particle mass concentrations)
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 250 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_get_aero_phase_avg_MW__kg_mol()

void aero_rep_single_particle_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{\kilo\gram\per\mol}}\))

The single particle mass is set for each new state as the sum of the masses of the aerosol phases that compose the particle

Parameters
model_dataPointer to the model data, including the state array
aero_phase_idxIndex of the aerosol phase within the representation
aero_phase_avg_MWAverage 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_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 331 of file aero_rep_single_particle.c.

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

◆ aero_rep_single_particle_get_aero_phase_mass__kg_m3()

void aero_rep_single_particle_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}}\))

The single particle mass is set for each new state as the sum of the masses of the aerosol phases that compose the particle

Parameters
model_dataPointer to the model data, including the state array
aero_phase_idxIndex of the aerosol phase within the representation
aero_phase_massTotal 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_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 282 of file aero_rep_single_particle.c.

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

◆ aero_rep_single_particle_get_dependencies()

void aero_rep_single_particle_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 single particle aerosol representation functions do not use state array values

Parameters
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
state_flagsArray of flags indicating state array elements used

Definition at line 86 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_get_effective_radius__m()

void aero_rep_single_particle_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)

Parameters
model_dataPointer to the model data, including the state array
aero_phase_idxIndex of the aerosol phase within the representation
radiusEffective particle radius (m)
partial_deriv\(\frac{\partial r_{eff}}{\partial y}\) where \(y\) are species on the state array
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 153 of file aero_rep_single_particle.c.

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

◆ aero_rep_single_particle_get_number_conc__n_m3()

void aero_rep_single_particle_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}}\))

This single particle number concentration is set by the aerosol model prior to solving the chemistry. Thus, all \(\frac{\partial n}{\partial y}\) are zero. Also, there is only one set of particles in the single particle representation, so the phase index is not used.

Parameters
model_dataPointer to the model data, including the state array
aero_phase_idxIndex of the aerosol phase within the representation (not used)
number_concParticle number concentration, \(n\) ( \(\mbox{\si{\#\per\cubic\metre}}\))
partial_deriv\(\frac{\partial n}{\partial y}\) where \(y\) are the species on the state array
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 212 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_get_used_jac_elem()

int aero_rep_single_particle_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.

Parameters
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
model_dataPointer to the model data
aero_phase_idxIndex of the aerosol phase to find elements for
jac_struct1D array of flags indicating potentially non-zero Jacobian elements. (The dependent variable should have been chosen by the calling function.)
Returns
Number of Jacobian elements flagged

Definition at line 52 of file aero_rep_single_particle.c.

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

◆ aero_rep_single_particle_print()

void aero_rep_single_particle_print ( int *  aero_rep_int_data,
double *  aero_rep_float_data 
)

Print the Single Particle reaction parameters.

Parameters
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data

Definition at line 414 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_set_number_update_data__n_m3()

void aero_rep_single_particle_set_number_update_data__n_m3 ( void *  update_data,
int  aero_rep_id,
int  particle_id,
double  number_conc 
)

Set number update data (#/m3)

Parameters
update_dataPointer to an allocated number update data object
aero_rep_idId of the aerosol representation(s) to update
particle_idId of the computational particle
number_concNew particle number (#/m3)

Definition at line 458 of file aero_rep_single_particle.c.

◆ aero_rep_single_particle_update_data()

bool aero_rep_single_particle_update_data ( void *  update_data,
int *  aero_rep_int_data,
double *  aero_rep_float_data,
double *  aero_rep_env_data 
)

Update aerosol representation data.

Single particle aerosol representation update data is structured as follows:

  • int aero_rep_id (Id of one or more aerosol representations set by the host model using the camp_aero_rep_single_particle::aero_rep_single_particle_t::set_id function prior to initializing the solver.)
  • int update_type (Type of update to perform. Can be UPDATE_NUMBER only.)
  • double new_value (Either the new radius (m) or the new number concentration ( \(\mbox{\si{\#\per\cubic\centi\metre}}\)).)
Parameters
update_dataPointer to the updated aerosol representation data
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters
Returns
Flag indicating whether this is the aerosol representation to update

Definition at line 383 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_update_env_state()

void aero_rep_single_particle_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 single particle aerosol representation does not use environmental conditions

Parameters
model_dataPointer to the model data
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 108 of file aero_rep_single_particle.c.

Here is the caller graph for this function:

◆ aero_rep_single_particle_update_state()

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

Parameters
model_dataPointer to the model data, include the state array
aero_rep_int_dataPointer to the aerosol representation integer data
aero_rep_float_dataPointer to the aerosol representation floating-point data
aero_rep_env_dataPointer to the aerosol representation environment-dependent parameters

Definition at line 129 of file aero_rep_single_particle.c.

Here is the caller graph for this function: