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

The camp_core_t structure and associated subroutines. More...

Data Types

interface  camp_core_t
 Part-MC model data. More...
 

Functions/Subroutines

type(camp_core_t) function, pointer constructor (input_file_path, n_cells)
 Constructor for camp_core_t. More...
 
subroutine load_files (this, input_file_path)
 Load a set of model data files. More...
 
subroutine load (this, input_file_path)
 Load model data from input files. More...
 
subroutine initialize (this)
 Initialize the model data. More...
 
logical function is_initialized (this)
 Inidicate whether the core has been initialized. More...
 
logical function is_solver_initialized (this)
 Inidicate whether the solver has been initialized. More...
 
logical function get_aero_phase (this, aero_phase_name, aero_phase)
 Get a pointer to an aerosol phase by name. More...
 
logical function get_aero_rep (this, aero_rep_name, aero_rep)
 Get a pointer to an aerosol representation by name. More...
 
logical function get_chem_spec_data (this, chem_spec_data)
 Get a pointer to the chemical species data. More...
 
logical function get_mechanism (this, mech_name, mechanism)
 Get a pointer to a mechanism by name. More...
 
logical function get_sub_model (this, sub_model_name, sub_model)
 Find an sub-model by name. More...
 
real(kind=dp) function get_rel_tol (this)
 Get the relative tolerance for the solver. More...
 
real(kind=dp) function get_abs_tol (this, spec_id)
 Get the absolute tolerance for a species on the state array. More...
 
type(camp_state_t) function, pointer new_state_multi_cell (this, env_states)
 Get a model state variable based on the this set of model data. More...
 
type(camp_state_t) function, pointer new_state_one_cell (this, env_state)
 Get a model state variable based on the this set of model data This is also called for multi-cell systems when no env_state_t array is passed. More...
 
integer(kind=i_kind) function state_size (this)
 Get the size of the state array. More...
 
integer(kind=i_kind) function state_size_per_cell (this)
 Get the size of the state array for each grid cell. More...
 
type(string_t) function, dimension(:), allocatable unique_names (this)
 Get an array of unique names for all species on the state array. More...
 
logical function spec_state_id (this, spec_name, state_id)
 Get the id of a species on the state array by its unique name. More...
 
subroutine solver_initialize (this)
 Initialize the solver. More...
 
subroutine free_solver (this)
 Free the solver memory. More...
 
subroutine initialize_aero_rep_update_object (this, aero_rep, update_data)
 Initialize an update data object for an aerosol representation. More...
 
subroutine initialize_rxn_update_object (this, rxn, update_data)
 Initialize an update data object for a reaction. More...
 
subroutine initialize_sub_model_update_object (this, sub_model, update_data)
 Initialize an update data object for a sub model. More...
 
subroutine aero_rep_update_data (this, update_data)
 Update data associated with an aerosol representation. This function should be called by an external aerosol microphysics model whenever the aerosol condensed data needs updated based on changes in, e.g., particle size or number concentration. The update types are aerosol- representation specific. More...
 
subroutine rxn_update_data (this, update_data)
 Update data associated with a reaction. This function should be called when reaction parameters need updated from the host model. For example, this function can be called to update photolysis rates from a host model's photolysis module. More...
 
subroutine sub_model_update_data (this, update_data)
 Update data associated with a sub-model. This function should be called when sub-model parameters need updated from the host model. More...
 
subroutine solve (this, camp_state, time_step, rxn_phase, solver_stats)
 Integrate the chemical mechanism. More...
 
integer(kind=i_kind) function pack_size (this, comm)
 Determine the size of a binary required to pack the mechanism. More...
 
subroutine bin_pack (this, buffer, pos, comm)
 Pack the given value to the buffer, advancing position. More...
 
subroutine bin_unpack (this, buffer, pos, comm)
 Unpack the given value from the buffer, advancing position. More...
 
subroutine do_print (this, file_unit, solver_data_only)
 Print the core data. More...
 
elemental subroutine finalize (this)
 Finalize the core. More...
 
subroutine add_aero_phase (this, phase_name)
 Add a aerosol phase to the model data. More...
 
subroutine add_aero_rep (this, rep_name)
 Add a aerosol representation to the model data. More...
 
subroutine add_mechanism (this, mech_name)
 Add a chemical mechanism to the model data. More...
 
subroutine add_sub_model (this, sub_model_name)
 Add a sub-model to the model data. More...
 

Detailed Description

The camp_core_t structure and associated subroutines.

Function/Subroutine Documentation

◆ add_aero_phase()

subroutine camp_camp_core::add_aero_phase ( class(camp_core_t), intent(inout)  this,
character(len=*), intent(in)  phase_name 
)
private

Add a aerosol phase to the model data.

Parameters
[in,out]thisModel data
[in]phase_nameAerosol phase name

Definition at line 1749 of file camp_core.F90.

◆ add_aero_rep()

subroutine camp_camp_core::add_aero_rep ( class(camp_core_t), intent(inout)  this,
character(len=*), intent(in)  rep_name 
)
private

Add a aerosol representation to the model data.

Parameters
[in,out]thisModel data
[in]rep_nameAerosol representation name

Definition at line 1773 of file camp_core.F90.

◆ add_mechanism()

subroutine camp_camp_core::add_mechanism ( class(camp_core_t), intent(inout)  this,
character(len=*), intent(in)  mech_name 
)
private

Add a chemical mechanism to the model data.

Parameters
[in,out]thisModel data
[in]mech_nameMechanism name

Definition at line 1799 of file camp_core.F90.

◆ add_sub_model()

subroutine camp_camp_core::add_sub_model ( class(camp_core_t), intent(inout)  this,
character(len=*), intent(in)  sub_model_name 
)
private

Add a sub-model to the model data.

Parameters
[in,out]thisModel data
[in]sub_model_nameSub model name

Definition at line 1824 of file camp_core.F90.

◆ aero_rep_update_data()

subroutine camp_camp_core::aero_rep_update_data ( class(camp_core_t), intent(in)  this,
class(aero_rep_update_data_t), intent(in)  update_data 
)
private

Update data associated with an aerosol representation. This function should be called by an external aerosol microphysics model whenever the aerosol condensed data needs updated based on changes in, e.g., particle size or number concentration. The update types are aerosol- representation specific.

Parameters
[in]thisChemical model
[in]update_dataUpdate data

Definition at line 1293 of file camp_core.F90.

◆ bin_pack()

subroutine camp_camp_core::bin_pack ( class(camp_core_t), intent(in)  this,
character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  pos,
integer, intent(in), optional  comm 
)
private

Pack the given value to the buffer, advancing position.

Parameters
[in]thisChemical model
[in,out]bufferMemory buffer
[in,out]posCurrent buffer position
[in]commMPI communicator

Definition at line 1478 of file camp_core.F90.

Here is the call graph for this function:

◆ bin_unpack()

subroutine camp_camp_core::bin_unpack ( class(camp_core_t), intent(inout)  this,
character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  pos,
integer, intent(in), optional  comm 
)
private

Unpack the given value from the buffer, advancing position.

Parameters
[in,out]thisChemical model
[in,out]bufferMemory buffer
[in,out]posCurrent buffer position
[in]commMPI communicator

Definition at line 1543 of file camp_core.F90.

Here is the call graph for this function:

◆ constructor()

type(camp_core_t) function, pointer camp_camp_core::constructor ( character(len=*), intent(in), optional  input_file_path,
integer(kind=i_kind), optional  n_cells 
)
private

Constructor for camp_core_t.

Returns
A new set of model parameters
Parameters
[in]input_file_pathPart-MC input file paths
n_cellsNum cells to compute simulatenously

Definition at line 253 of file camp_core.F90.

◆ do_print()

subroutine camp_camp_core::do_print ( class(camp_core_t), intent(in)  this,
integer(kind=i_kind), intent(in), optional  file_unit,
logical, intent(in), optional  solver_data_only 
)
private

Print the core data.

Parameters
[in]thisCore data
[in]file_unitFile unit for output
[in]solver_data_onlyPrint only the solver data (can be used during runtime for debugging)

Definition at line 1611 of file camp_core.F90.

Here is the call graph for this function:

◆ finalize()

elemental subroutine camp_camp_core::finalize ( type(camp_core_t), intent(inout)  this)
private

Finalize the core.

Parameters
[in,out]thisCAMP-core data

Definition at line 1718 of file camp_core.F90.

◆ free_solver()

subroutine camp_camp_core::free_solver ( class(camp_core_t), intent(inout)  this)
private

Free the solver memory.

Parameters
[in,out]thisCAMP-core

Definition at line 1209 of file camp_core.F90.

◆ get_abs_tol()

real(kind=dp) function camp_camp_core::get_abs_tol ( class(camp_core_t), intent(in)  this,
integer(kind=i_kind), intent(in)  spec_id 
)
private

Get the absolute tolerance for a species on the state array.

Returns
Absolute tolerance
Parameters
[in]thisModel data
[in]spec_idSpecies id

Definition at line 964 of file camp_core.F90.

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

◆ get_aero_phase()

logical function camp_camp_core::get_aero_phase ( class(camp_core_t), intent(in)  this,
character(len=*), intent(in)  aero_phase_name,
class(aero_phase_data_t), intent(out), pointer  aero_phase 
)
private

Get a pointer to an aerosol phase by name.

Parameters
[in]thisModel data
[in]aero_phase_nameAerosol phase name to search for
[out]aero_phasePointer to the aerosol phase

Definition at line 824 of file camp_core.F90.

◆ get_aero_rep()

logical function camp_camp_core::get_aero_rep ( class(camp_core_t), intent(in)  this,
character(len=*), intent(in)  aero_rep_name,
class(aero_rep_data_t), intent(out), pointer  aero_rep 
)
private

Get a pointer to an aerosol representation by name.

Parameters
[in]thisModel data
[in]aero_rep_nameAerosol representation name to search for
[out]aero_repAerosol representation

Definition at line 852 of file camp_core.F90.

◆ get_chem_spec_data()

logical function camp_camp_core::get_chem_spec_data ( class(camp_core_t), intent(in)  this,
type(chem_spec_data_t), pointer  chem_spec_data 
)
private

Get a pointer to the chemical species data.

Parameters
[in]thisModel data
chem_spec_dataPointer to the chemical species data

Definition at line 879 of file camp_core.F90.

◆ get_mechanism()

logical function camp_camp_core::get_mechanism ( class(camp_core_t), intent(in)  this,
character(len=*), intent(in)  mech_name,
type(mechanism_data_t), intent(out), pointer  mechanism 
)
private

Get a pointer to a mechanism by name.

Parameters
[in]thisModel data
[in]mech_nameMechanism name to search for
[out]mechanismPointer to the mechanism

Definition at line 895 of file camp_core.F90.

◆ get_rel_tol()

real(kind=dp) function camp_camp_core::get_rel_tol ( class(camp_core_t), intent(in)  this)
private

Get the relative tolerance for the solver.

Returns
Relative tolerance
Parameters
[in]thisModel data

Definition at line 950 of file camp_core.F90.

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

◆ get_sub_model()

logical function camp_camp_core::get_sub_model ( class(camp_core_t), intent(in)  this,
character(len=*), intent(in)  sub_model_name,
class(sub_model_data_t), intent(out), pointer  sub_model 
)
private

Find an sub-model by name.

Parameters
[in]thisModel data
[in]sub_model_nameSub model name to search for
[out]sub_modelSub model

Definition at line 922 of file camp_core.F90.

◆ initialize()

subroutine camp_camp_core::initialize ( class(camp_core_t), intent(inout), target  this)
private

Initialize the model data.

Parameters
[in,out]thisModel data

Definition at line 655 of file camp_core.F90.

Here is the call graph for this function:

◆ initialize_aero_rep_update_object()

subroutine camp_camp_core::initialize_aero_rep_update_object ( class(camp_core_t), intent(in)  this,
class(aero_rep_data_t), intent(inout)  aero_rep,
class(aero_rep_update_data_t), intent(out)  update_data 
)
private

Initialize an update data object for an aerosol representation.

Parameters
[in]thisCAMP core
[in,out]aero_repAerosol representation to be updated
[out]update_dataUpdate data object

Definition at line 1226 of file camp_core.F90.

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

◆ initialize_rxn_update_object()

subroutine camp_camp_core::initialize_rxn_update_object ( class(camp_core_t), intent(in)  this,
class(rxn_data_t), intent(inout)  rxn,
class(rxn_update_data_t), intent(out)  update_data 
)
private

Initialize an update data object for a reaction.

Parameters
[in]thisCAMP core
[in,out]rxnReaction to be updated
[out]update_dataUpdate data object

Definition at line 1247 of file camp_core.F90.

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

◆ initialize_sub_model_update_object()

subroutine camp_camp_core::initialize_sub_model_update_object ( class(camp_core_t), intent(in)  this,
class(sub_model_data_t), intent(inout)  sub_model,
class(sub_model_update_data_t), intent(out)  update_data 
)
private

Initialize an update data object for a sub model.

Parameters
[in]thisCAMP core
[in,out]sub_modelSub model to be updated
[out]update_dataUpdate data object

Definition at line 1268 of file camp_core.F90.

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

◆ is_initialized()

logical function camp_camp_core::is_initialized ( class(camp_core_t), intent(in)  this)

Inidicate whether the core has been initialized.

Parameters
[in]thisModel data

Definition at line 800 of file camp_core.F90.

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

◆ is_solver_initialized()

logical function camp_camp_core::is_solver_initialized ( class(camp_core_t), intent(in)  this)
private

Inidicate whether the solver has been initialized.

Parameters
[in]thisModel data

Definition at line 812 of file camp_core.F90.

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

◆ load()

subroutine camp_camp_core::load ( class(camp_core_t), intent(inout)  this,
type(string_t), dimension(:), intent(in), allocatable  input_file_path 
)
private

Load model data from input files.

See Input File Format: CAMP-Chem Configuration Data for the input file format.

Parameters
[in,out]thisModel data
[in]input_file_pathPart-MC input file paths

Definition at line 424 of file camp_core.F90.

Here is the call graph for this function:

◆ load_files()

subroutine camp_camp_core::load_files ( class(camp_core_t), intent(inout)  this,
character(len=*), intent(in)  input_file_path 
)
private

Load a set of model data files.

See Input File Format: CAMP-Chem Configuration File List for the input file format.

Parameters
[in,out]thisModel data
[in]input_file_pathPart-MC input file paths

Definition at line 303 of file camp_core.F90.

Here is the call graph for this function:

◆ new_state_multi_cell()

type(camp_state_t) function, pointer camp_camp_core::new_state_multi_cell ( class(camp_core_t), intent(in)  this,
type(env_state_ptr), dimension(:), intent(in), target  env_states 
)
private

Get a model state variable based on the this set of model data.

Returns
New model state
Parameters
[in]thisChemical model
[in]env_statesEnvironmental state array (one element per grid cell to solve simultaneously)

Definition at line 984 of file camp_core.F90.

Here is the caller graph for this function:

◆ new_state_one_cell()

type(camp_state_t) function, pointer camp_camp_core::new_state_one_cell ( class(camp_core_t), intent(in)  this,
type(env_state_t), intent(in), optional, target  env_state 
)
private

Get a model state variable based on the this set of model data This is also called for multi-cell systems when no env_state_t array is passed.

Returns
New model state
Parameters
[in]thisChemical model
[in]env_stateEnvironmental state array (one element per grid cell to solve simultaneously)

Definition at line 1007 of file camp_core.F90.

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

◆ pack_size()

integer(kind=i_kind) function camp_camp_core::pack_size ( class(camp_core_t), intent(in)  this,
integer, intent(in), optional  comm 
)

Determine the size of a binary required to pack the mechanism.

Parameters
[in]thisChemical model
[in]commMPI communicator

Definition at line 1419 of file camp_core.F90.

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

◆ rxn_update_data()

subroutine camp_camp_core::rxn_update_data ( class(camp_core_t), intent(in)  this,
class(rxn_update_data_t), intent(in)  update_data 
)
private

Update data associated with a reaction. This function should be called when reaction parameters need updated from the host model. For example, this function can be called to update photolysis rates from a host model's photolysis module.

Parameters
[in]thisChemical model
[in]update_dataUpdate data

Definition at line 1315 of file camp_core.F90.

◆ solve()

subroutine camp_camp_core::solve ( class(camp_core_t), intent(in)  this,
type(camp_state_t), intent(inout), target  camp_state,
real(kind=dp), intent(in)  time_step,
integer(kind=i_kind), intent(in), optional  rxn_phase,
type(solver_stats_t), intent(inout), optional, target  solver_stats 
)
private

Integrate the chemical mechanism.

Parameters
[in]thisChemical model
[in,out]camp_stateCurrent model state
[in]time_stepTime step over which to integrate (s)
[in]rxn_phasePhase to solve - gas, aerosol, or both (default) Use parameters in camp_rxn_data to specify phase: GAS_RXN, AERO_RXN, GAS_AERO_RXN
[in,out]solver_statsReturn solver statistics to the host model

Definition at line 1354 of file camp_core.F90.

Here is the call graph for this function:

◆ solver_initialize()

subroutine camp_camp_core::solver_initialize ( class(camp_core_t), intent(inout)  this)
private

Initialize the solver.

Parameters
[in,out]thisChemical model

Definition at line 1136 of file camp_core.F90.

Here is the call graph for this function:

◆ spec_state_id()

logical function camp_camp_core::spec_state_id ( class(camp_core_t), intent(in)  this,
character(len=*), intent(in)  spec_name,
integer(kind=i_kind), intent(inout)  state_id 
)
private

Get the id of a species on the state array by its unique name.

Returns
Flag indicating whether the species was found
Parameters
[in]thisCAMP core
[in]spec_nameSpecies unique name
[in,out]state_idSpecies state id

Definition at line 1106 of file camp_core.F90.

◆ state_size()

integer(kind=i_kind) function camp_camp_core::state_size ( class(camp_core_t), intent(in)  this)
private

Get the size of the state array.

Returns
State size
Parameters
[in]thisChemical model

Definition at line 1035 of file camp_core.F90.

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

◆ state_size_per_cell()

integer(kind=i_kind) function camp_camp_core::state_size_per_cell ( class(camp_core_t), intent(in)  this)
private

Get the size of the state array for each grid cell.

Returns
State size
Parameters
[in]thisChemical model

Definition at line 1053 of file camp_core.F90.

Here is the call graph for this function:

◆ sub_model_update_data()

subroutine camp_camp_core::sub_model_update_data ( class(camp_core_t), intent(in)  this,
class(sub_model_update_data_t), intent(in)  update_data 
)
private

Update data associated with a sub-model. This function should be called when sub-model parameters need updated from the host model.

Parameters
[in]thisChemical model
[in]update_dataUpdate data

Definition at line 1335 of file camp_core.F90.

◆ unique_names()

type(string_t) function, dimension(:), allocatable camp_camp_core::unique_names ( class(camp_core_t), intent(in)  this)
private

Get an array of unique names for all species on the state array.

The order of this array is the same as the state array for one grid cell

Returns
Array of unique species names
Parameters
[in]thisCAMP core

Definition at line 1073 of file camp_core.F90.