CAMP 1.0.0
Chemistry Across Multiple Phases
Data Types | Functions/Subroutines | Variables
camp_chem_spec_data Module Reference

The chem_spec_data_t structure and associated subroutines. More...

Data Types

interface  chem_spec_data_t
 Chemical species data. More...
 

Functions/Subroutines

type(chem_spec_data_t) function, pointer constructor (init_size)
 Constructor for chem_spec_data_t.
 
subroutine load (this, json, j_obj)
 Load species from an input file.
 
subroutine initialize (this)
 Initialize the species set.
 
integer(kind=i_kind) function get_size (this, spec_type, spec_phase)
 Get the number of species with the given properties. If no properties are specified, return the total number of species.
 
logical function exists (this, spec_name)
 Check if a species name is in the set of chemical species.
 
type(string_t) function, dimension(:), allocatable get_spec_names (this, spec_type, spec_phase)
 Get a list of species names.
 
logical function get_property_set (this, spec_name, property_set)
 Get a species property set. Returns true if the species is found, or false otherwise.
 
logical function get_type (this, spec_name, spec_type)
 Get a species type by species name. Returns true if the species is found or false otherwise.
 
logical function get_phase (this, spec_name, spec_phase)
 Get a species phase by name. Returns true if the species is found, or false otherwise.
 
logical function get_abs_tol (this, spec_name, abs_tol)
 Get the absolute integration tolerance of a species by name. Returns true if the species is found, or false otherwise.
 
integer(kind=i_kind) function gas_state_id (this, spec_name)
 Get a gas-phase species index in the camp_camp_state::camp_state_t::state_var array. Note that aerosol-phase species indices on the camp_camp_state::camp_state_t::state_var array must be accessed from camp_aero_rep_data::aero_rep_data_t::spec_state_id() for a particular aerosol representation. Returns a valid state array index if the species is found, or 0 otherwise.
 
character(len=:) function, allocatable gas_state_name (this, spec_id)
 Get a gas-phase species name in the camp_camp_state::camp_state_t::state_var array. Note that aerosol-phase species names on the camp_camp_state::camp_state_t::state_var array must be accessed from camp_aero_rep_data::aero_rep_data_t::spec_state_id() for a particular aerosol representation. Returns a valid state array index if the species is found, or 0 otherwise.
 
subroutine do_print (this, file_unit)
 Print out the species data.
 
elemental subroutine finalize (this)
 Finalize the chemical species data.
 
subroutine ensure_size (this, num_spec)
 Ensure there is enough room in the species dataset to add a specified number of species.
 
subroutine add (this, spec_name, spec_type, spec_phase, property_set)
 Add a new chemical species.
 
logical function find (this, spec_name, spec_id)
 Get the index of a chemical species by name. Returns true if the species is found or false otherwise.
 

Variables

integer(kind=i_kind), parameter, public chem_spec_unknown_type = 0
 State variable types (Must match values in camp_solver.c)
 
integer(kind=i_kind), parameter, public chem_spec_variable = 1
 
integer(kind=i_kind), parameter, public chem_spec_constant = 2
 
integer(kind=i_kind), parameter, public chem_spec_pssa = 3
 
integer(kind=i_kind), parameter, public chem_spec_activity_coeff = 4
 
integer(kind=i_kind), parameter, public chem_spec_unknown_phase = 0
 Species phase.
 
integer(kind=i_kind), parameter, public chem_spec_gas_phase = 1
 
integer(kind=i_kind), parameter, public chem_spec_aero_phase = 2
 
integer(kind=i_kind), parameter realloc_inc = 50
 Reallocation increment.
 
real(kind=dp), parameter default_abs_tol = 1.0e-14
 Default absolute integration tolerance.
 

Detailed Description

The chem_spec_data_t structure and associated subroutines.

Function/Subroutine Documentation

◆ add()

subroutine camp_chem_spec_data::add ( class(chem_spec_data_t), intent(inout)  this,
character(len=*), intent(in)  spec_name,
integer(kind=i_kind), intent(inout)  spec_type,
integer(kind=i_kind), intent(inout)  spec_phase,
type(property_t), intent(inout), optional  property_set 
)
private

Add a new chemical species.

Parameters
[in,out]thisSpecies dataset
[in]spec_nameName of species to add
[in,out]spec_typeState variable type
[in,out]spec_phaseSpecies phase
[in,out]property_setProperty set for new species

Definition at line 714 of file chem_spec_data.F90.

Here is the call graph for this function:

◆ constructor()

type(chem_spec_data_t) function, pointer camp_chem_spec_data::constructor ( integer(i_kind), intent(in), optional  init_size)
private

Constructor for chem_spec_data_t.

Returns
A new set of chemical species
Parameters
[in]init_sizeNumber of species to allocate space for initially

Definition at line 138 of file chem_spec_data.F90.

◆ do_print()

subroutine camp_chem_spec_data::do_print ( class(chem_spec_data_t), intent(in)  this,
integer(kind=i_kind), intent(in), optional  file_unit 
)
private

Print out the species data.

Parameters
[in]thisChemical species data
[in]file_unitFile unit for output

Definition at line 607 of file chem_spec_data.F90.

◆ ensure_size()

subroutine camp_chem_spec_data::ensure_size ( class(chem_spec_data_t), intent(inout)  this,
integer(i_kind), intent(in)  num_spec 
)
private

Ensure there is enough room in the species dataset to add a specified number of species.

Parameters
[in,out]thisSpecies dataset
[in]num_specNumber of new species to ensure space for

Definition at line 676 of file chem_spec_data.F90.

◆ exists()

logical function camp_chem_spec_data::exists ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name 
)
private

Check if a species name is in the set of chemical species.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name

Definition at line 380 of file chem_spec_data.F90.

◆ finalize()

elemental subroutine camp_chem_spec_data::finalize ( type(chem_spec_data_t), intent(inout)  this)
private

Finalize the chemical species data.

Parameters
[in,out]thisSpecies dataset

Definition at line 660 of file chem_spec_data.F90.

Here is the caller graph for this function:

◆ find()

logical function camp_chem_spec_data::find ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
integer(kind=i_kind), intent(out)  spec_id 
)
private

Get the index of a chemical species by name. Returns true if the species is found or false otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name
[out]spec_idSpecies id

Definition at line 773 of file chem_spec_data.F90.

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

◆ gas_state_id()

integer(kind=i_kind) function camp_chem_spec_data::gas_state_id ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name 
)
private

Get a gas-phase species index in the camp_camp_state::camp_state_t::state_var array. Note that aerosol-phase species indices on the camp_camp_state::camp_state_t::state_var array must be accessed from camp_aero_rep_data::aero_rep_data_t::spec_state_id() for a particular aerosol representation. Returns a valid state array index if the species is found, or 0 otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name

Definition at line 551 of file chem_spec_data.F90.

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

◆ gas_state_name()

character(len=:) function, allocatable camp_chem_spec_data::gas_state_name ( class(chem_spec_data_t), intent(in)  this,
integer(kind=i_kind), intent(in)  spec_id 
)
private

Get a gas-phase species name in the camp_camp_state::camp_state_t::state_var array. Note that aerosol-phase species names on the camp_camp_state::camp_state_t::state_var array must be accessed from camp_aero_rep_data::aero_rep_data_t::spec_state_id() for a particular aerosol representation. Returns a valid state array index if the species is found, or 0 otherwise.

Returns
Species name
Parameters
[in]thisSpecies dataset
[in]spec_idSpecies id

Definition at line 580 of file chem_spec_data.F90.

Here is the call graph for this function:

◆ get_abs_tol()

logical function camp_chem_spec_data::get_abs_tol ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
real(kind=dp), intent(out)  abs_tol 
)
private

Get the absolute integration tolerance of a species by name. Returns true if the species is found, or false otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name
[out]abs_tolAbsolute integration tolerance

Definition at line 517 of file chem_spec_data.F90.

◆ get_phase()

logical function camp_chem_spec_data::get_phase ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
integer(kind=i_kind), intent(out)  spec_phase 
)
private

Get a species phase by name. Returns true if the species is found, or false otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name to find properties of
[out]spec_phaseSpecies phase

Definition at line 495 of file chem_spec_data.F90.

◆ get_property_set()

logical function camp_chem_spec_data::get_property_set ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
type(property_t), intent(out), pointer  property_set 
)
private

Get a species property set. Returns true if the species is found, or false otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name to find properties of
[out]property_setPointer to species properties

Definition at line 452 of file chem_spec_data.F90.

◆ get_size()

integer(kind=i_kind) function camp_chem_spec_data::get_size ( class(chem_spec_data_t), intent(in)  this,
integer(kind=i_kind), intent(in), optional  spec_type,
integer(kind=i_kind), intent(in), optional  spec_phase 
)
private

Get the number of species with the given properties. If no properties are specified, return the total number of species.

Parameters
[in]thisSpecies database
[in]spec_typeState variable type for the species
[in]spec_phasePhase of the species

Definition at line 346 of file chem_spec_data.F90.

◆ get_spec_names()

type(string_t) function, dimension(:), allocatable camp_chem_spec_data::get_spec_names ( class(chem_spec_data_t), intent(in)  this,
integer(kind=i_kind), intent(in), optional  spec_type,
integer(kind=i_kind), intent(in), optional  spec_phase 
)
private

Get a list of species names.

If a type or phase are specified, only species with the specified values are returned. Otherwise, all species names are returned.

Returns
Species names
Parameters
[in]thisSpecies dataset
[in]spec_typeState variable type for the species
[in]spec_phasePhase of the species

Definition at line 400 of file chem_spec_data.F90.

◆ get_type()

logical function camp_chem_spec_data::get_type ( class(chem_spec_data_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
integer(kind=i_kind), intent(out)  spec_type 
)
private

Get a species type by species name. Returns true if the species is found or false otherwise.

Parameters
[in]thisSpecies dataset
[in]spec_nameSpecies name to find properties of
[out]spec_typeSpecies type

Definition at line 474 of file chem_spec_data.F90.

◆ initialize()

subroutine camp_chem_spec_data::initialize ( class(chem_spec_data_t), intent(inout)  this)
private

Initialize the species set.

Parameters
[in,out]thisSpecies database

Definition at line 320 of file chem_spec_data.F90.

◆ load()

subroutine camp_chem_spec_data::load ( class(chem_spec_data_t), intent(inout)  this,
type(json_core), intent(in), pointer  json,
type(json_value), intent(in), pointer  j_obj 
)
private

Load species from an input file.

Parameters
[in,out]thisSpecies dataset
[in]jsonJSON core
[in]j_objJSON object

Definition at line 212 of file chem_spec_data.F90.

Here is the call graph for this function:

Variable Documentation

◆ chem_spec_activity_coeff

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_activity_coeff = 4

Definition at line 53 of file chem_spec_data.F90.

◆ chem_spec_aero_phase

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_aero_phase = 2

Definition at line 58 of file chem_spec_data.F90.

◆ chem_spec_constant

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_constant = 2

Definition at line 51 of file chem_spec_data.F90.

◆ chem_spec_gas_phase

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_gas_phase = 1

Definition at line 57 of file chem_spec_data.F90.

◆ chem_spec_pssa

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_pssa = 3

Definition at line 52 of file chem_spec_data.F90.

◆ chem_spec_unknown_phase

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_unknown_phase = 0

Species phase.

Definition at line 56 of file chem_spec_data.F90.

◆ chem_spec_unknown_type

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_unknown_type = 0

State variable types (Must match values in camp_solver.c)

Definition at line 49 of file chem_spec_data.F90.

◆ chem_spec_variable

integer(kind=i_kind), parameter, public camp_chem_spec_data::chem_spec_variable = 1

Definition at line 50 of file chem_spec_data.F90.

◆ default_abs_tol

real(kind=dp), parameter camp_chem_spec_data::default_abs_tol = 1.0e-14
private

Default absolute integration tolerance.

Definition at line 63 of file chem_spec_data.F90.

◆ realloc_inc

integer(kind=i_kind), parameter camp_chem_spec_data::realloc_inc = 50
private

Reallocation increment.

Definition at line 61 of file chem_spec_data.F90.