81#define NUM_REACT_ this%condensed_data_int(1)
82#define NUM_PROD_ this%condensed_data_int(2)
83#define A_ this%condensed_data_real(1)
84#define B_ this%condensed_data_real(2)
85#define C_ this%condensed_data_real(3)
86#define D_ this%condensed_data_real(4)
87#define E_ this%condensed_data_real(5)
88#define CONV_ this%condensed_data_real(6)
89#define NUM_INT_PROP_ 2
90#define NUM_REAL_PROP_ 6
91#define NUM_ENV_PARAM_ 1
92#define REACT_(x) this%condensed_data_int(NUM_INT_PROP_ + x)
93#define PROD_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + x)
94#define DERIV_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + NUM_REACT_ + NUM_PROD_ + x)
95#define JAC_ID_(x) this%condensed_data_int(NUM_INT_PROP_ + 2*(NUM_REACT_+NUM_PROD_) + x)
96#define YIELD_(x) this%condensed_data_real(NUM_REAL_PROP_ + x)
134 subroutine initialize(this, chem_spec_data, aero_phase, aero_rep, n_cells)
145 integer(kind=i_kind),
intent(in) :: n_cells
147 type(
property_t),
pointer :: spec_props, reactants, products
148 character(len=:),
allocatable :: key_name, spec_name, string_val
149 integer(kind=i_kind) :: i_spec, i_qty
151 integer(kind=i_kind) :: temp_int
152 real(kind=
dp) :: temp_real
155 if (.not.
associated(this%property_set))
call die_msg(255324828, &
156 "Missing property set needed to initialize reaction")
157 key_name =
"reactants"
159 this%property_set%get_property_t(key_name, reactants), &
160 "Arrhenius reaction is missing reactants")
161 key_name =
"products"
163 this%property_set%get_property_t(key_name, products), &
164 "Arrhenius reaction is missing products")
167 call reactants%iter_reset()
171 call assert(243342975, reactants%get_property_t(val=spec_props))
173 if (spec_props%get_int(key_name, temp_int)) i_spec = i_spec+temp_int-1
174 call reactants%iter_next()
179 allocate(this%condensed_data_int(num_int_prop_ + &
180 (i_spec + 2) * (i_spec + products%size())))
181 allocate(this%condensed_data_real(num_real_prop_ + products%size()))
182 this%condensed_data_int(:) = int(0, kind=
i_kind)
183 this%condensed_data_real(:) = real(0.0, kind=
dp)
186 this%num_env_params = num_env_param_
191 num_prod_ = products%size()
194 conv_ =
const%avagadro /
const%univ_gas_const * 10.0d0**(-12.0d0)
200 if (.not. this%property_set%get_real(key_name, a_))
then
203 key_name =
"time unit"
204 if (this%property_set%get_string(key_name, string_val))
then
205 if (trim(string_val).eq.
"MIN")
then
210 if (this%property_set%get_real(key_name, temp_real))
then
211 c_ = -temp_real/
const%boltzmann
214 .not.this%property_set%get_real(key_name, temp_real), &
215 "Received both Ea and C parameter for Arrhenius equation")
218 if (.not. this%property_set%get_real(key_name, c_))
then
223 if (.not. this%property_set%get_real(key_name, d_))
then
227 if (.not. this%property_set%get_real(key_name, b_))
then
231 if (.not. this%property_set%get_real(key_name, e_))
then
235 call assert_msg(344705857, .not. ((b_.ne.real(0.0, kind=
dp)) &
236 .and.(d_.eq.real(0.0, kind=
dp))), &
237 "D cannot be zero if B is non-zero in Arrhenius reaction.")
240 call reactants%iter_reset()
245 react_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
248 call assert_msg(751684145, react_(i_spec).gt.0, &
249 "Missing Arrhenius reactant: "//
spec_name)
252 call assert(796763915, reactants%get_property_t(val=spec_props))
254 if (spec_props%get_int(key_name, temp_int))
then
255 do i_qty = 1, temp_int - 1
256 react_(i_spec + i_qty) = react_(i_spec)
258 i_spec = i_spec + temp_int - 1
261 call reactants%iter_next()
266 call products%iter_reset()
271 prod_(i_spec) = chem_spec_data%gas_state_id(
spec_name)
274 call assert_msg(234495887, prod_(i_spec).gt.0, &
275 "Missing Arrhenius product: "//
spec_name)
278 call assert(451185800, products%get_property_t(val=spec_props))
280 if (spec_props%get_real(key_name, temp_real))
then
281 yield_(i_spec) = temp_real
286 call products%iter_next()
300 if (
associated(this%property_set)) &
301 deallocate(this%property_set)
302 if (
allocated(this%condensed_data_real)) &
303 deallocate(this%condensed_data_real)
304 if (
allocated(this%condensed_data_int)) &
305 deallocate(this%condensed_data_int)
317 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_arrhenius_t type and associated functions.
The rxn_data_t structure and associated subroutines.
integer(kind=i_kind), parameter, public gas_rxn
Gas-phase reaction.
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.
Generic test reaction data type.
Abstract reaction data type.