70#define RXN_ID_ this%condensed_data_int(1)
71#define NUM_SPEC_ this%condensed_data_int(2)
72#define SCALING_ this%condensed_data_real(1)
73#define NUM_INT_PROP_ 2
74#define NUM_REAL_PROP_ 1
75#define NUM_ENV_PARAM_ 2
76#define REACT_(s) this%condensed_data_int(NUM_INT_PROP_+s)
77#define DERIV_ID_(s) this%condensed_data_int(NUM_INT_PROP_+NUM_SPEC_+s)
78#define JAC_ID_(s) this%condensed_data_int(NUM_INT_PROP_+2*NUM_SPEC_+s))
104 logical :: is_malloced = .false.
106 integer(kind=i_kind) :: rxn_unique_id = 0
125 result(update_data)
bind (c)
128 type(c_ptr) :: update_data
133 rxn_unique_id, base_rate)
bind (c)
136 type(c_ptr),
value :: update_data
138 integer(kind=c_int),
value :: rxn_unique_id
140 real(kind=c_double),
value :: base_rate
147 type(c_ptr),
value,
intent(in) :: update_data
172 subroutine initialize(this, chem_spec_data, aero_rep, n_cells)
181 integer(kind=i_kind),
intent(in) :: n_cells
184 type(
string_t),
allocatable :: unique_names(:)
185 character(len=:),
allocatable :: key_name, phase_name
186 integer(kind=i_kind) :: i_rep, i_spec, i_rep_spec, num_spec
188 integer(kind=i_kind) :: temp_int
189 real(kind=
dp) :: temp_real
192 call assert_msg(368664748,
associated(this%property_set), &
193 "Missing property set needed to initialize reaction")
196 key_name =
"aerosol phase"
198 this%property_set%get_string(key_name, phase_name), &
199 "Wet Deposition reaction is missing aerosol phase name")
202 call assert_msg(674938531,
associated(aero_rep), &
203 "Missing aerosol representation for wet deposition reaction")
204 call assert_msg(731323851,
size(aero_rep).gt.0, &
205 "Missing aerosol representation for wet deposition reaction")
210 do i_rep = 1,
size(aero_rep)
211 unique_names = aero_rep(i_rep)%val%unique_names( phase_name = &
216 "No species found for wet deposition aerosol phase "// &
220 allocate(this%condensed_data_int(num_int_prop_+3*num_spec))
221 allocate(this%condensed_data_real(num_real_prop_))
222 this%condensed_data_int(:) = int(0, kind=
i_kind)
223 this%condensed_data_real(:) = real(0.0, kind=
dp)
226 this%num_env_params = num_env_param_
232 key_name =
"scaling factor"
233 if (.not. this%property_set%get_real(key_name, scaling_))
then
234 scaling_ = real(1.0, kind=
dp)
239 do i_rep = 1,
size(aero_rep)
240 unique_names = aero_rep(i_rep)%val%unique_names( phase_name = &
244 react_(i_spec) = aero_rep(i_rep)%val%spec_state_id( &
246 call assert( 702159475, react_(i_spec) .gt. 0 )
249 call assert(312643342, i_spec .eq. num_spec_)
266 prop_set => this%property_set
278 if (
associated(this%property_set)) &
279 deallocate(this%property_set)
280 if (
allocated(this%condensed_data_real)) &
281 deallocate(this%condensed_data_real)
282 if (
allocated(this%condensed_data_int)) &
283 deallocate(this%condensed_data_int)
295 real(kind=
dp),
intent(in) :: base_rate
298 this%rxn_unique_id, base_rate)
314 integer(kind=i_kind),
intent(in) :: rxn_type
317 if (rxn_id_.eq.-1)
then
321 update_data%rxn_unique_id = rxn_id_
322 update_data%rxn_type = int(rxn_type, kind=c_int)
324 update_data%is_malloced = .true.
337 integer,
intent(in) :: comm
353 character,
intent(inout) :: buffer(:)
355 integer,
intent(inout) :: pos
357 integer,
intent(in) :: comm
360 integer :: prev_position
366 pos - prev_position <= this%pack_size(comm))
379 character,
intent(inout) :: buffer(:)
381 integer,
intent(inout) :: pos
383 integer,
intent(in) :: comm
386 integer :: prev_position
392 pos - prev_position <= this%pack_size(comm))
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_rep_data_t structure and associated subroutines.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the aerosol representation data.
The camp_state_t structure and associated subroutines.
elemental subroutine finalize(this)
Finalize the state.
The chem_spec_data_t structure and associated subroutines.
type(chem_spec_data_t) function, pointer constructor(init_size)
Constructor for chem_spec_data_t.
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.
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_initialize(this, update_data, rxn_type)
Initialize update data.
elemental subroutine update_data_finalize(this)
Finalize an update data object.
subroutine update_data_rate_set(this, base_rate)
Set packed update data for wet_deposition rate constants.
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 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.