83#define NUM_REACT_ this%condensed_data_int(1)
84#define NUM_PROD_ this%condensed_data_int(2)
85#define K0_A_ this%condensed_data_real(1)
86#define K0_B_ this%condensed_data_real(2)
87#define K0_C_ this%condensed_data_real(3)
88#define KINF_A_ this%condensed_data_real(4)
89#define KINF_B_ this%condensed_data_real(5)
90#define KINF_C_ this%condensed_data_real(6)
91#define FC_ this%condensed_data_real(7)
92#define N_ this%condensed_data_real(8)
93#define SCALING_ this%condensed_data_real(9)
94#define CONV_ this%condensed_data_real(10)
95#define NUM_INT_PROP_ 2
96#define NUM_REAL_PROP_ 10
97#define NUM_ENV_PARAM_ 1
98#define REACT_(x) this%condensed_data_int(NUM_INT_PROP_ + x)
99#define PROD_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + x)
100#define DERIV_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + NUM_PROD_ + x)
101#define JAC_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + 2*(NUM_REACT_+NUM_PROD_) + x)
102#define YIELD_(x) this%condensed_data_real(NUM_REAL_PROP_ + x)
140 subroutine initialize(this, chem_spec_data, aero_phase, aero_rep, n_cells)
151 integer(kind=i_kind),
intent(in) :: n_cells
153 type(
property_t),
pointer :: spec_props, reactants, products
154 character(len=:),
allocatable :: key_name, spec_name, string_val
155 integer(kind=i_kind) :: i_spec, i_qty
157 integer(kind=i_kind) :: temp_int
158 real(kind=
dp) :: temp_real
161 if (.not.
associated(this%property_set))
call die_msg(138420387, &
162 "Missing property set needed to initialize reaction")
163 key_name =
"reactants"
165 this%property_set%get_property_t(key_name, reactants), &
166 "Ternary Chemical Activation reaction is missing reactants")
167 key_name =
"products"
169 this%property_set%get_property_t(key_name, products), &
170 "Ternary Chemical Activation reaction is missing products")
173 call reactants%iter_reset()
177 call assert(475375422, reactants%get_property_t(val=spec_props))
179 if (spec_props%get_int(key_name, temp_int)) i_spec = i_spec+temp_int-1
180 call reactants%iter_next()
188 allocate(this%condensed_data_int(num_int_prop_ + &
189 (i_spec + 2) * (i_spec + products%size())))
190 allocate(this%condensed_data_real(num_real_prop_ + products%size()))
191 this%condensed_data_int(:) = int(0, kind=
i_kind)
192 this%condensed_data_real(:) = real(0.0, kind=
dp)
195 this%num_env_params = num_env_param_
200 num_prod_ = products%size()
203 conv_ =
const%avagadro /
const%univ_gas_const * 10.0d0**(-12.0d0)
209 if (.not. this%property_set%get_real(key_name, k0_a_))
then
213 if (.not. this%property_set%get_real(key_name, k0_b_))
then
217 if (.not. this%property_set%get_real(key_name, k0_c_))
then
221 if (.not. this%property_set%get_real(key_name, kinf_a_))
then
225 if (.not. this%property_set%get_real(key_name, kinf_b_))
then
229 if (.not. this%property_set%get_real(key_name, kinf_c_))
then
233 if (.not. this%property_set%get_real(key_name, fc_))
then
237 if (.not. this%property_set%get_real(key_name,
n_))
then
240 key_name =
"time unit"
241 scaling_ = real(1.0, kind=
dp)
242 if (this%property_set%get_string(key_name, string_val))
then
243 if (trim(string_val).eq.
"MIN")
then
244 scaling_ = real(1.0d0/60.0d0, kind=
dp)
249 k0_a_ = k0_a_ * real(1.0d6, kind=
dp)
252 call reactants%iter_reset()
257 react_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
260 call assert_msg(194805707, react_(i_spec).gt.0, &
261 "Missing Ternary Chemical Activation reactant: "//
spec_name)
264 call assert(524590901, reactants%get_property_t(val=spec_props))
266 if (spec_props%get_int(key_name, temp_int))
then
267 do i_qty = 1, temp_int - 1
268 react_(i_spec + i_qty) = react_(i_spec)
270 i_spec = i_spec + temp_int - 1
273 call reactants%iter_next()
278 call products%iter_reset()
283 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
286 call assert_msg(249285493, prod_(i_spec).gt.0, &
287 "Missing Ternary Chemical Activation product: "//
spec_name)
290 call assert(296595438, products%get_property_t(val=spec_props))
292 if (spec_props%get_real(key_name, temp_real))
then
293 yield_(i_spec) = temp_real
298 call products%iter_next()
312 if (
associated(this%property_set)) &
313 deallocate(this%property_set)
314 if (
allocated(this%condensed_data_real)) &
315 deallocate(this%condensed_data_real)
316 if (
allocated(this%condensed_data_int)) &
317 deallocate(this%condensed_data_int)
329 integer(kind=i_kind) :: i
Initialize the aerosol representation data, validating component data and loading any required inform...
Get the non-unique name of a chemical species by its unique name.
Interface for to_string functions.
The abstract aero_phase_data_t structure and associated subroutines.
subroutine finalize_array(this)
Finalize the aerosol phase data.
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.
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.
The property_t structure and associated subroutines.
The rxn_data_t structure and associated subroutines.
integer(kind=i_kind), parameter, public gas_rxn
Gas-phase reaction.
The rxn_ternary_chemical_activation_t type and associated functions.
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.
Generic test reaction data type.