71#define RXN_ID_ this%condensed_data_int(1)
72#define NUM_SPEC_ this%condensed_data_int(2)
73#define SCALING_ this%condensed_data_real(1)
74#define NUM_INT_PROP_ 2
75#define NUM_REAL_PROP_ 1
76#define NUM_ENV_PARAM_ 2
77#define REACT_(s) this%condensed_data_int(NUM_INT_PROP_+s)
78#define DERIV_ID_(s) this%condensed_data_int(NUM_INT_PROP_+NUM_SPEC_+s)
79#define JAC_ID_(s) this%condensed_data_int(NUM_INT_PROP_+2*NUM_SPEC_+s))
98 procedure :: constructor
105 logical :: is_malloced = .false.
107 integer(kind=i_kind) :: rxn_unique_id = 0
126 result(update_data)
bind (c)
129 type(c_ptr) :: update_data
134 rxn_unique_id, base_rate)
bind (c)
137 type(c_ptr),
value :: update_data
139 integer(kind=c_int),
value :: rxn_unique_id
141 real(kind=c_double),
value :: base_rate
148 type(c_ptr),
value,
intent(in) :: update_data
173 subroutine initialize(this, chem_spec_data, aero_phase, aero_rep, n_cells)
184 integer(kind=i_kind),
intent(in) :: n_cells
187 type(
string_t),
allocatable :: unique_names(:)
188 character(len=:),
allocatable :: key_name, phase_name
189 integer(kind=i_kind) :: i_rep, i_spec, i_rep_spec, num_spec
191 integer(kind=i_kind) :: temp_int
192 real(kind=
dp) :: temp_real
195 call assert_msg(368664748,
associated(this%property_set), &
196 "Missing property set needed to initialize reaction")
199 key_name =
"aerosol phase"
201 this%property_set%get_string(key_name, phase_name), &
202 "Wet Deposition reaction is missing aerosol phase name")
205 call assert_msg(674938531,
associated(aero_rep), &
206 "Missing aerosol representation for wet deposition reaction")
207 call assert_msg(731323851,
size(aero_rep).gt.0, &
208 "Missing aerosol representation for wet deposition reaction")
213 do i_rep = 1,
size(aero_rep)
214 unique_names = aero_rep(i_rep)%val%unique_names( phase_name = &
219 "No species found for wet deposition aerosol phase "// &
223 allocate(this%condensed_data_int(num_int_prop_+3*num_spec))
224 allocate(this%condensed_data_real(num_real_prop_))
225 this%condensed_data_int(:) = int(0, kind=
i_kind)
226 this%condensed_data_real(:) = real(0.0, kind=
dp)
229 this%num_env_params = num_env_param_
235 key_name =
"scaling factor"
236 if (.not. this%property_set%get_real(key_name, scaling_))
then
237 scaling_ = real(1.0, kind=
dp)
242 do i_rep = 1,
size(aero_rep)
243 unique_names = aero_rep(i_rep)%val%unique_names( phase_name = &
247 react_(i_spec) = aero_rep(i_rep)%val%spec_state_id( &
249 call assert( 702159475, react_(i_spec) .gt. 0 )
252 call assert(312643342, i_spec .eq. num_spec_)
269 prop_set => this%property_set
281 if (
associated(this%property_set)) &
282 deallocate(this%property_set)
283 if (
allocated(this%condensed_data_real)) &
284 deallocate(this%condensed_data_real)
285 if (
allocated(this%condensed_data_int)) &
286 deallocate(this%condensed_data_int)
298 integer(kind=i_kind) :: i_rxn
300 do i_rxn = 1,
size(this)
314 real(kind=
dp),
intent(in) :: base_rate
317 this%rxn_unique_id, base_rate)
333 integer(kind=i_kind),
intent(in) :: rxn_type
336 if (rxn_id_.eq.-1)
then
340 update_data%rxn_unique_id = rxn_id_
341 update_data%rxn_type = int(rxn_type, kind=c_int)
343 update_data%is_malloced = .true.
356 integer,
intent(in) :: comm
372 character,
intent(inout) :: buffer(:)
374 integer,
intent(inout) :: pos
376 integer,
intent(in) :: comm
379 integer :: prev_position
385 pos - prev_position <= this%pack_size(comm))
398 character,
intent(inout) :: buffer(:)
400 integer,
intent(inout) :: pos
402 integer,
intent(in) :: comm
405 integer :: prev_position
411 pos - prev_position <= this%pack_size(comm))
437 integer(kind=i_kind) :: i_rxn
439 do i_rxn = 1,
size(this)
Initialize the aerosol representation data, validating component data and loading any required inform...
Extending-type binary pack function (Internal use only)
Extending-type binary unpack function (Internal use only)
Extending-type binary pack size (internal use only)
Get a list of unique names for each element on the camp_camp_state::camp_state_t::state_var array for...
Free an update rate data object.
Interface to c reaction functions.
Set a new wet_deposition rate.
Interface for to_string functions.
The abstract aero_phase_data_t structure and associated subroutines.
subroutine finalize_array(this)
Finalize the aerosol phase data.
class(property_t) function, pointer get_property_set(this)
Get the aerosol phase property set.
type(aero_phase_data_t) function, pointer constructor(phase_name, init_size)
Constructor for aero_phase_data_t.
subroutine finalize(this)
Finalize the aerosol phase data.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the aerosol representation data.
The abstract aero_rep_data_t structure and associated subroutines.
The camp_state_t structure and associated subroutines.
The chem_spec_data_t structure and associated subroutines.
integer, parameter dp
Kind of a double precision real number.
type(const_t), save const
Fixed variable for accessing the constant's values.
integer, parameter i_kind
Kind of an integer.
Wrapper functions for MPI.
subroutine camp_mpi_pack_logical(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
subroutine camp_mpi_unpack_integer(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
subroutine camp_mpi_unpack_logical(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
integer function camp_mpi_pack_size_logical(val, comm)
Determines the number of bytes required to pack the given value.
subroutine camp_mpi_pack_integer(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
integer function camp_mpi_pack_size_integer(val, comm)
Determines the number of bytes required to pack the given value.
The property_t structure and associated subroutines.
Random number generators.
integer(kind=i_kind) function generate_int_id()
Generate an integer id Ids will be sequential, and can only be generated by the primary process.
The rxn_data_t structure and associated subroutines.
integer(kind=i_kind), parameter, public aero_rxn
Aerosol-phase reaction.
The rxn_wet_deposition_t type and associated functions.
subroutine update_data_finalize(this)
Finalize an update data object.
subroutine update_data_initialize(this, update_data, rxn_type)
Initialize update data.
subroutine update_data_rate_set(this, base_rate)
Set packed update data for wet_deposition rate constants.
subroutine update_data_finalize_array(this)
Finalize an array of reactions.
Common utility subroutines.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine die_msg(code, error_msg)
Error immediately.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
Pointer type for building arrays.
Pointer to aero_rep_data_t extending types.
Abstract reaction data type.
Wet Deposition rate update object.
Generic test reaction data type.
String type for building arrays of string of various size.