143 subroutine initialize(this, chem_spec_data, aero_rep, n_cells)
152 integer(kind=i_kind),
intent(in) :: n_cells
154 type(
property_t),
pointer :: spec_props, reactants, alkoxy_products, &
156 character(len=:),
allocatable :: key_name, spec_name, string_val
157 integer(kind=i_kind) :: i_spec, i_qty
159 integer(kind=i_kind) :: temp_int
160 real(kind=
dp) :: temp_real
163 if (.not.
associated(this%property_set))
call die_msg(573144252, &
164 "Missing property set needed to initialize reaction")
165 key_name =
"reactants"
167 this%property_set%get_property_t(key_name, reactants), &
168 "Wennberg NO + RO2 reaction is missing reactants")
169 key_name =
"alkoxy products"
171 this%property_set%get_property_t(key_name, alkoxy_products), &
172 "Wennberg NO + RO2 reaction is missing alkoxy products")
173 key_name =
"nitrate products"
175 this%property_set%get_property_t(key_name, nitrate_products), &
176 "Wennberg NO + RO2 reaction is missing nitrate products")
179 call reactants%iter_reset()
183 call assert(626170799, reactants%get_property_t(val=spec_props))
185 if (spec_props%get_int(key_name, temp_int)) i_spec = i_spec+temp_int-1
186 call reactants%iter_next()
191 allocate(this%condensed_data_int(num_int_prop_ + &
192 (i_spec + 2) * (i_spec + alkoxy_products%size() + &
193 nitrate_products%size())))
194 allocate(this%condensed_data_real(num_real_prop_ + &
195 alkoxy_products%size() + nitrate_products%size()))
196 this%condensed_data_int(:) = int(0, kind=
i_kind)
197 this%condensed_data_real(:) = real(0.0, kind=
dp)
200 this%num_env_params = num_env_param_
205 num_alkoxy_prod_ = alkoxy_products%size()
206 num_nitrate_prod_ = nitrate_products%size()
209 conv_ =
const%avagadro /
const%univ_gas_const * 10.0d0**(-12.0d0)
215 if (.not. this%property_set%get_real(key_name, x_))
then
218 key_name =
"time unit"
219 if (this%property_set%get_string(key_name, string_val))
then
220 if (trim(string_val).eq.
"MIN")
then
225 if (.not. this%property_set%get_real(key_name, y_))
then
229 if (.not. this%property_set%get_real(key_name,
a0_))
then
233 if (.not. this%property_set%get_real(key_name,
n_))
then
238 call reactants%iter_reset()
243 react_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
246 call assert_msg(716430972, react_(i_spec).gt.0, &
247 "Missing Wennberg NO + RO2 reactant: "//
spec_name)
250 call assert(493699816, reactants%get_property_t(val=spec_props))
252 if (spec_props%get_int(key_name, temp_int))
then
253 do i_qty = 1, temp_int - 1
254 react_(i_spec + i_qty) = react_(i_spec)
256 i_spec = i_spec + temp_int - 1
259 call reactants%iter_next()
264 call alkoxy_products%iter_reset()
266 do while (alkoxy_products%get_key(
spec_name))
269 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
272 call assert_msg(825390544, prod_(i_spec).gt.0, &
273 "Missing Wennberg NO + RO2 alkoxy product: "//
spec_name)
276 call assert(879870330, alkoxy_products%get_property_t(val=spec_props))
278 if (spec_props%get_real(key_name, temp_real))
then
279 yield_(i_spec) = temp_real
284 call alkoxy_products%iter_next()
287 call nitrate_products%iter_reset()
288 do while (nitrate_products%get_key(
spec_name))
291 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
294 call assert_msg(590677535, prod_(i_spec).gt.0, &
295 "Missing Wennberg NO + RO2 nitrate product: "//
spec_name)
298 call assert(815314225, nitrate_products%get_property_t(val=spec_props))
300 if (spec_props%get_real(key_name, temp_real))
then
301 yield_(i_spec) = temp_real
306 call nitrate_products%iter_next()
309 call assert(699637107, i_spec - 1 .eq. &
310 num_alkoxy_prod_ + num_nitrate_prod_ )