144 subroutine initialize(this, chem_spec_data, aero_phase, aero_rep, n_cells)
155 integer(kind=i_kind),
intent(in) :: n_cells
157 type(
property_t),
pointer :: spec_props, reactants, alkoxy_products, &
159 character(len=:),
allocatable :: key_name, spec_name, string_val
160 integer(kind=i_kind) :: i_spec, i_qty
162 integer(kind=i_kind) :: temp_int
163 real(kind=
dp) :: temp_real
166 if (.not.
associated(this%property_set))
call die_msg(573144252, &
167 "Missing property set needed to initialize reaction")
168 key_name =
"reactants"
170 this%property_set%get_property_t(key_name, reactants), &
171 "Wennberg NO + RO2 reaction is missing reactants")
172 key_name =
"alkoxy products"
174 this%property_set%get_property_t(key_name, alkoxy_products), &
175 "Wennberg NO + RO2 reaction is missing alkoxy products")
176 key_name =
"nitrate products"
178 this%property_set%get_property_t(key_name, nitrate_products), &
179 "Wennberg NO + RO2 reaction is missing nitrate products")
182 call reactants%iter_reset()
186 call assert(626170799, reactants%get_property_t(val=spec_props))
188 if (spec_props%get_int(key_name, temp_int)) i_spec = i_spec+temp_int-1
189 call reactants%iter_next()
194 allocate(this%condensed_data_int(num_int_prop_ + &
195 (i_spec + 2) * (i_spec + alkoxy_products%size() + &
196 nitrate_products%size())))
197 allocate(this%condensed_data_real(num_real_prop_ + &
198 alkoxy_products%size() + nitrate_products%size()))
199 this%condensed_data_int(:) = int(0, kind=
i_kind)
200 this%condensed_data_real(:) = real(0.0, kind=
dp)
203 this%num_env_params = num_env_param_
208 num_alkoxy_prod_ = alkoxy_products%size()
209 num_nitrate_prod_ = nitrate_products%size()
212 conv_ =
const%avagadro /
const%univ_gas_const * 10.0d0**(-12.0d0)
218 if (.not. this%property_set%get_real(key_name, x_))
then
221 key_name =
"time unit"
222 if (this%property_set%get_string(key_name, string_val))
then
223 if (trim(string_val).eq.
"MIN")
then
228 if (.not. this%property_set%get_real(key_name, y_))
then
232 if (.not. this%property_set%get_real(key_name,
a0_))
then
236 if (.not. this%property_set%get_real(key_name,
n_))
then
241 call reactants%iter_reset()
246 react_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
249 call assert_msg(716430972, react_(i_spec).gt.0, &
250 "Missing Wennberg NO + RO2 reactant: "//
spec_name)
253 call assert(493699816, reactants%get_property_t(val=spec_props))
255 if (spec_props%get_int(key_name, temp_int))
then
256 do i_qty = 1, temp_int - 1
257 react_(i_spec + i_qty) = react_(i_spec)
259 i_spec = i_spec + temp_int - 1
262 call reactants%iter_next()
267 call alkoxy_products%iter_reset()
269 do while (alkoxy_products%get_key(
spec_name))
272 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
275 call assert_msg(825390544, prod_(i_spec).gt.0, &
276 "Missing Wennberg NO + RO2 alkoxy product: "//
spec_name)
279 call assert(879870330, alkoxy_products%get_property_t(val=spec_props))
281 if (spec_props%get_real(key_name, temp_real))
then
282 yield_(i_spec) = temp_real
287 call alkoxy_products%iter_next()
290 call nitrate_products%iter_reset()
291 do while (nitrate_products%get_key(
spec_name))
294 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
297 call assert_msg(590677535, prod_(i_spec).gt.0, &
298 "Missing Wennberg NO + RO2 nitrate product: "//
spec_name)
301 call assert(815314225, nitrate_products%get_property_t(val=spec_props))
303 if (spec_props%get_real(key_name, temp_real))
then
304 yield_(i_spec) = temp_real
309 call nitrate_products%iter_next()
312 call assert(699637107, i_spec - 1 .eq. &
313 num_alkoxy_prod_ + num_nitrate_prod_ )