@@ -42,50 +42,56 @@ subroutine f_aero_state_init(ptr_c, n_part, aero_data_ptr_c) bind(C)
4242 character (len= 10 ), parameter , dimension (2 ) :: mode_names = [" init_small" ," init_large" ]
4343 integer :: n_spec, n_modes, i_mode, i_spec
4444 integer :: n_part_added, source
45+ logical , parameter :: hardcoded_init = .true.
4546
4647 call c_f_pointer(ptr_c, ptr_f)
4748 call c_f_pointer(aero_data_ptr_c, aero_data_ptr_f)
4849
4950 call aero_state_zero(ptr_f)
50- call aero_state_set_weight(ptr_f, aero_data_ptr_f, AERO_STATE_WEIGHT_FLAT)
51- call aero_state_set_n_part_ideal(ptr_f, n_part)
52-
5351 call fractal_set_spherical(aero_data_ptr_f% fractal)
5452
55- n_modes = 2 ! TODO #141
56- n_spec = aero_data_n_spec(aero_data_ptr_f)
57- if (n_spec > 1 ) then
58- allocate (aero_dist_init% mode(n_modes))
59- do i_mode = 1 ,n_modes
60- aero_dist_init% mode(i_mode)% name = mode_names(i_mode)
61- aero_dist_init% mode(i_mode)% type = AERO_MODE_TYPE_LOG_NORMAL
62- aero_dist_init% mode(i_mode)% char_radius = diams(i_mode) / 2
63- aero_dist_init% mode(i_mode)% log10_std_dev_radius = &
64- log10 (std(i_mode))
65- aero_dist_init% mode(i_mode)% num_conc = num_conc(i_mode)
66- allocate (aero_dist_init% mode(i_mode)% vol_frac(n_spec))
67- aero_dist_init% mode(i_mode)% vol_frac = 0.0
68- if (i_mode == 1 ) then
69- i_spec = aero_data_spec_by_name(aero_data_ptr_f, " SO4" )
70- aero_dist_init% mode(i_mode)% vol_frac(i_spec) = 1.0
71- else
72- i_spec = aero_data_spec_by_name(aero_data_ptr_f, " OC" )
73- aero_dist_init% mode(i_mode)% vol_frac(i_spec) = .8
74- i_spec = aero_data_spec_by_name(aero_data_ptr_f, " BC" )
75- aero_dist_init% mode(i_mode)% vol_frac(i_spec) = .2
53+ if (hardcoded_init) then
54+ n_modes = 2 ! TODO #141
55+ n_spec = aero_data_n_spec(aero_data_ptr_f)
56+ if (n_spec > 1 ) then
57+ allocate (aero_dist_init% mode(n_modes))
58+ do i_mode = 1 ,n_modes
59+ aero_dist_init% mode(i_mode)% name = mode_names(i_mode)
60+ aero_dist_init% mode(i_mode)% type = AERO_MODE_TYPE_LOG_NORMAL
61+ aero_dist_init% mode(i_mode)% char_radius = diams(i_mode) / 2
62+ aero_dist_init% mode(i_mode)% log10_std_dev_radius = &
63+ log10 (std(i_mode))
64+ aero_dist_init% mode(i_mode)% num_conc = num_conc(i_mode)
65+ allocate (aero_dist_init% mode(i_mode)% vol_frac(n_spec))
66+ aero_dist_init% mode(i_mode)% vol_frac = 0.0
67+ if (i_mode == 1 ) then
68+ i_spec = aero_data_spec_by_name(aero_data_ptr_f, " SO4" )
69+ aero_dist_init% mode(i_mode)% vol_frac(i_spec) = 1.0
70+ else
71+ i_spec = aero_data_spec_by_name(aero_data_ptr_f, " OC" )
72+ aero_dist_init% mode(i_mode)% vol_frac(i_spec) = .8
73+ i_spec = aero_data_spec_by_name(aero_data_ptr_f, " BC" )
74+ aero_dist_init% mode(i_mode)% vol_frac(i_spec) = .2
75+ end if
76+ allocate (aero_dist_init% mode(i_mode)% vol_frac_std(n_spec))
77+ aero_dist_init% mode(i_mode)% vol_frac_std = 0.0
78+ source = aero_data_source_by_name(aero_data_ptr_f, mode_names(i_mode))
79+ aero_dist_init% mode(i_mode)% source = source
80+ end do
7681 end if
77- allocate (aero_dist_init% mode(i_mode)% vol_frac_std(n_spec))
78- aero_dist_init% mode(i_mode)% vol_frac_std = 0.0
79- source = aero_data_source_by_name(aero_data_ptr_f, mode_names(i_mode))
80- aero_dist_init% mode(i_mode)% source = source
81- end do
82-
83- call aero_state_add_aero_dist_sample(ptr_f, aero_data_ptr_f, &
84- aero_dist_init, 1d0 , 0d0 , &
85- .true. , & ! TODO #121 run_part_opt%allow_doubling, &
86- .true. , & ! TODO #121 run_part_opt%allow_halving)
87- n_part_added)
8882 end if
83+
84+ call aero_state_set_weight(ptr_f, aero_data_ptr_f, AERO_STATE_WEIGHT_NUMMASS_SOURCE)
85+ call aero_state_set_n_part_ideal(ptr_f, n_part)
86+
87+ if (hardcoded_init) then
88+ call aero_state_add_aero_dist_sample(ptr_f, aero_data_ptr_f, &
89+ aero_dist_init, 1d0 , 0d0 , &
90+ .true. , & ! TODO #121 run_part_opt%allow_doubling, &
91+ .true. , & ! TODO #121 run_part_opt%allow_halving)
92+ n_part_added)
93+ end if
94+
8995 end subroutine
9096
9197 subroutine f_aero_state_len (ptr_c , len ) bind(C)
0 commit comments