72#define NUM_REACT_ this%condensed_data_int(1)
73#define NUM_PROD_ this%condensed_data_int(2)
74#define A_ this%condensed_data_real(1)
75#define B_ this%condensed_data_real(2)
76#define C_ this%condensed_data_real(3)
77#define CONV_ this%condensed_data_real(4)
78#define NUM_INT_PROP_ 2
79#define NUM_REAL_PROP_ 4
80#define NUM_ENV_PARAM_ 1
81#define REACT_(x) this%condensed_data_int(NUM_INT_PROP_ + x)
82#define PROD_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + x)
83#define DERIV_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + NUM_PROD_ + x)
84#define JAC_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + 2*(NUM_REACT_+NUM_PROD_) + x)
85#define YIELD_(x) this%condensed_data_real(NUM_REAL_PROP_ + x)
123 subroutine initialize(this, chem_spec_data, aero_phase, aero_rep, n_cells)
134 integer(kind=i_kind),
intent(in) :: n_cells
136 type(
property_t),
pointer :: spec_props, reactants, products
137 character(len=:),
allocatable :: key_name, spec_name, string_val
138 integer(kind=i_kind) :: i_spec, i_qty
140 integer(kind=i_kind) :: temp_int
141 real(kind=
dp) :: temp_real
144 if (.not.
associated(this%property_set))
call die_msg(255324828, &
145 "Missing property set needed to initialize reaction")
146 key_name =
"reactants"
148 this%property_set%get_property_t(key_name, reactants), &
149 "Wennberg tunneling reaction is missing reactants")
150 key_name =
"products"
152 this%property_set%get_property_t(key_name, products), &
153 "Wennberg tunneling reaction is missing products")
156 call reactants%iter_reset()
160 call assert(463909147, reactants%get_property_t(val=spec_props))
162 if (spec_props%get_int(key_name, temp_int)) i_spec = i_spec+temp_int-1
163 call reactants%iter_next()
168 allocate(this%condensed_data_int(num_int_prop_ + &
169 (i_spec + 2) * (i_spec + products%size())))
170 allocate(this%condensed_data_real(num_real_prop_ + products%size()))
171 this%condensed_data_int(:) = int(0, kind=
i_kind)
172 this%condensed_data_real(:) = real(0.0, kind=
dp)
175 this%num_env_params = num_env_param_
180 num_prod_ = products%size()
183 conv_ =
const%avagadro /
const%univ_gas_const * 10.0d0**(-12.0d0)
189 if (.not. this%property_set%get_real(key_name, a_))
then
192 key_name =
"time unit"
193 if (this%property_set%get_string(key_name, string_val))
then
194 if (trim(string_val).eq.
"MIN")
then
199 if (.not. this%property_set%get_real(key_name, b_))
then
203 if (.not. this%property_set%get_real(key_name, c_))
then
208 call reactants%iter_reset()
213 react_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
216 call assert_msg(292299004, react_(i_spec).gt.0, &
217 "Missing Wennberg tunneling reactant: "//
spec_name)
220 call assert(687092598, reactants%get_property_t(val=spec_props))
222 if (spec_props%get_int(key_name, temp_int))
then
223 do i_qty = 1, temp_int - 1
224 react_(i_spec + i_qty) = react_(i_spec)
226 i_spec = i_spec + temp_int - 1
229 call reactants%iter_next()
234 call products%iter_reset()
239 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
242 call assert_msg(681828291, prod_(i_spec).gt.0, &
243 "Missing Wennberg tunneling product: "//
spec_name)
246 call assert(794146636, products%get_property_t(val=spec_props))
248 if (spec_props%get_real(key_name, temp_real))
then
249 yield_(i_spec) = temp_real
254 call products%iter_next()
268 if (
associated(this%property_set)) &
269 deallocate(this%property_set)
270 if (
allocated(this%condensed_data_real)) &
271 deallocate(this%condensed_data_real)
272 if (
allocated(this%condensed_data_int)) &
273 deallocate(this%condensed_data_int)
285 integer(kind=i_kind) :: i_rxn
287 do i_rxn = 1,
size(this)
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_wennberg_tunneling_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.