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.
 
subroutine load_files (this, input_file_path)
 Load a set of model data files.
 
subroutine load (this, input_file_path)
 Load model data from input files.
 
subroutine initialize (this)
 Initialize the model data.
 
logical function is_initialized (this)
 Inidicate whether the core has been initialized.
 
logical function is_solver_initialized (this)
 Inidicate whether the solver has been initialized.
 
logical function get_aero_phase (this, aero_phase_name, aero_phase)
 Get a pointer to an aerosol phase by name.
 
logical function get_aero_rep (this, aero_rep_name, aero_rep)
 Get a pointer to an aerosol representation by name.
 
logical function get_chem_spec_data (this, chem_spec_data)
 Get a pointer to the chemical species data.
 
logical function get_mechanism (this, mech_name, mechanism)
 Get a pointer to a mechanism by name.
 
logical function get_sub_model (this, sub_model_name, sub_model)
 Find an sub-model by name.
 
real(kind=dp) function get_rel_tol (this)
 Get the relative tolerance for the solver.
 
real(kind=dp) function get_abs_tol (this, spec_id)
 Get the absolute tolerance for a species on the state array.
 
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.
 
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.
 
integer(kind=i_kind) function state_size (this)
 Get the size of the state array.
 
integer(kind=i_kind) function state_size_per_cell (this)
 Get the size of the state array for each grid cell.
 
type(string_t) function, dimension(:), allocatable unique_names (this)
 Get an array of unique names for all species on the state array.
 
logical function spec_state_id (this, spec_name, state_id)
 Get the id of a species on the state array by its unique name.
 
subroutine solver_initialize (this)
 Initialize the solver.
 
subroutine free_solver (this)
 Free the solver memory.
 
subroutine initialize_aero_rep_update_object (this, aero_rep, update_data)
 Initialize an update data object for an aerosol representation.
 
subroutine initialize_rxn_update_object (this, rxn, update_data)
 Initialize an update data object for a reaction.
 
subroutine initialize_sub_model_update_object (this, sub_model, update_data)
 Initialize an update data object for a sub model.
 
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.
 
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.
 
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.
 
subroutine solve (this, camp_state, time_step, rxn_phase, solver_stats)
 Integrate the chemical mechanism.
 
integer(kind=i_kind) function pack_size (this, comm)
 Determine the size of a binary required to pack the mechanism.
 
subroutine bin_pack (this, buffer, pos, comm)
 Pack the given value to the buffer, advancing position.
 
subroutine bin_unpack (this, buffer, pos, comm)
 Unpack the given value from the buffer, advancing position.
 
subroutine do_print (this, file_unit, solver_data_only)
 Print the core data.
 
elemental subroutine finalize (this)
 Finalize the core.
 
subroutine add_aero_phase (this, phase_name)
 Add a aerosol phase to the model data.
 
subroutine add_aero_rep (this, rep_name)
 Add a aerosol representation to the model data.
 
subroutine add_mechanism (this, mech_name)
 Add a chemical mechanism to the model data.
 
subroutine add_sub_model (this, sub_model_name)
 Add a sub-model to the model data.
 

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 1748 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 1772 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 1798 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 1823 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 1292 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 1477 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 1542 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 252 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 1610 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 1717 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 1208 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 963 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 823 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 851 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 878 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 894 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 949 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 921 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 654 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 1225 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 1246 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 1267 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)
private

Inidicate whether the core has been initialized.

Parameters
[in]thisModel data

Definition at line 799 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 811 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 423 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 302 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 983 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 1006 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 
)
private

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

Parameters
[in]thisChemical model
[in]commMPI communicator

Definition at line 1418 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 1314 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 1353 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 1135 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 1105 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 1034 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 1052 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 1334 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 1072 of file camp_core.F90.