28 real(kind=
dp),
allocatable :: vol(:)
31 integer,
allocatable :: n_orig_part(:)
33 integer :: weight_group
35 integer :: weight_class
37 real(kind=
dp) :: absorb_cross_sect
39 real(kind=
dp) :: scatter_cross_sect
41 real(kind=
dp) :: asymmetry
43 complex(kind=dc) :: refract_shell
45 complex(kind=dc) :: refract_core
47 real(kind=
dp) :: core_vol
49 integer :: water_hyst_leg
53 real(kind=
dp) :: least_create_time
55 real(kind=
dp) :: greatest_create_time
74 call move_alloc(aero_particle_from%vol, aero_particle_to%vol)
75 call move_alloc(aero_particle_from%n_orig_part, &
76 aero_particle_to%n_orig_part)
77 aero_particle_to%weight_group = aero_particle_from%weight_group
78 aero_particle_to%weight_class = aero_particle_from%weight_class
79 aero_particle_to%absorb_cross_sect = aero_particle_from%absorb_cross_sect
80 aero_particle_to%scatter_cross_sect = &
81 aero_particle_from%scatter_cross_sect
82 aero_particle_to%asymmetry = aero_particle_from%asymmetry
83 aero_particle_to%refract_shell = aero_particle_from%refract_shell
84 aero_particle_to%refract_core = aero_particle_from%refract_core
85 aero_particle_to%core_vol = aero_particle_from%core_vol
86 aero_particle_to%water_hyst_leg = aero_particle_from%water_hyst_leg
87 aero_particle_to%id = aero_particle_from%id
88 aero_particle_to%least_create_time = aero_particle_from%least_create_time
89 aero_particle_to%greatest_create_time = &
90 aero_particle_from%greatest_create_time
105 aero_particle%vol = 0d0
108 aero_particle%n_orig_part = 0
109 aero_particle%weight_group = 0
110 aero_particle%weight_class = 0
111 aero_particle%absorb_cross_sect = 0d0
112 aero_particle%scatter_cross_sect = 0d0
113 aero_particle%asymmetry = 0d0
114 aero_particle%refract_shell = (0d0, 0d0)
115 aero_particle%refract_core = (0d0, 0d0)
116 aero_particle%core_vol = 0d0
117 aero_particle%water_hyst_leg = 0
119 aero_particle%least_create_time = 0d0
120 aero_particle%greatest_create_time = 0d0
145 real(kind=
dp),
intent(in) :: create_time
147 aero_particle%least_create_time = create_time
148 aero_particle%greatest_create_time = create_time
160 real(kind=
dp),
intent(in) :: vols(:)
162 aero_particle%vol = vols
174 integer,
intent(in) :: i_source
176 aero_particle%n_orig_part = 0
177 aero_particle%n_orig_part(i_source) = 1
189 integer,
intent(in),
optional :: i_group
191 integer,
intent(in),
optional :: i_class
193 if (
present(i_group)) aero_particle%weight_group = i_group
194 if (
present(i_class)) aero_particle%weight_class = i_class
221 integer,
intent(in) :: i_spec
226 * aero_data%density(i_spec)
258 / aero_data%molec_weight)
278 aero_particle, i_spec)
283 integer,
intent(in) :: i_spec
304 if (i_spec /= aero_data%i_water)
then
306 + aero_particle%vol(i_spec)
316 aero_particle, aero_data, dry_volume)
323 logical,
intent(in) :: dry_volume
402 aero_data, env_state)
411 real(kind=
dp) :: volume, mobility_radius
414 mobility_radius = fractal_vol_to_mobility_rad(aero_data%fractal, &
415 volume, env_state%temp, env_state%pressure)
439 aero_particle, aero_data, quantity)
446 real(kind=
dp),
intent(in) :: quantity(:)
453 aero_data, quantity) &
469 real(kind=
dp),
intent(in) :: quantity(:)
476 if (i /= aero_data%i_water)
then
477 total = total + aero_particle%vol(i) * quantity(i)
495 real(kind=
dp),
intent(in) :: quantity(:)
497 call assert(420016623, aero_data%i_water > 0)
513 real(kind=
dp),
intent(in) :: quantity(:)
515 call assert(223343210, aero_data%i_water > 0)
517 = aero_particle%vol(aero_data%i_water) &
518 * quantity(aero_data%i_water)
531 call assert(772012490, aero_data%i_water > 0)
533 = aero_data%molec_weight(aero_data%i_water)
550 aero_data, aero_data%molec_weight)
567 aero_data, real(aero_data%num_ions, kind=
dp))
579 call assert(235482108, aero_data%i_water > 0)
597 aero_data, aero_data%density)
611 call assert(888636139, aero_data%i_water > 0)
613 * aero_data%density(aero_data%i_water)
629 aero_data, aero_data%density)
686 if (i_spec == aero_data%i_water)
then
688 elseif (aero_data%num_ions(i_spec) > 0)
then
689 call assert_msg(123681459, aero_data%kappa(i_spec) == 0d0, &
690 "species has nonzero num_ions and kappa: " &
691 // trim(aero_data%name(i_spec)))
692 m_a = aero_data%molec_weight(i_spec)
693 rho_a = aero_data%density(i_spec)
694 kappa(i_spec) = m_w * rho_a / (m_a * rho_w) &
695 * real(aero_data%num_ions(i_spec), kind=
dp)
697 kappa(i_spec) = aero_data%kappa(i_spec)
710 aero_data, env_state)
719 real(kind=
dp) :: kappa, diam, c, a
732 aero_data, env_state)
741 real(kind=
dp) :: kappa, crit_diam, dry_diam, a
748 if (kappa < 1d-30)
then
752 / (crit_diam**3 - dry_diam**3 * (1 - kappa)) * exp(a / crit_diam)
799 aero_data, env_state)
808 integer,
parameter :: crit_diam_max_iter = 100
810 real(kind=
dp) :: kappa, dry_diam, a, c4, c3, c0, d, f, df, dd
816 if (kappa < 1d-30)
then
822 c4 = - 3d0 * dry_diam**3 * kappa / a
823 c3 = - dry_diam**3 * (2d0 - kappa)
824 c0 = dry_diam**6 * (1d0 - kappa)
827 d = max(sqrt(-4d0 / 3d0 * c4), (-c3)**(1d0/3d0))
828 do i_newton = 1,crit_diam_max_iter
829 f = d**6 + c4 * d**4 + c3 * d**3 + c0
830 df = 6 * d**5 + 4 * c4 * d**3 + 3 * c3 * d**2
833 if (abs(dd / d) < 1d-14)
then
838 "critical diameter Newton loop failed to converge")
840 "critical diameter Newton loop converged to invalid solution")
850 aero_particle_2, aero_particle_new)
859 call assert(203741686,
size(aero_particle_1%vol) &
860 ==
size(aero_particle_2%vol))
861 call assert(483452167,
size(aero_particle_1%n_orig_part) &
862 ==
size(aero_particle_2%n_orig_part))
863 aero_particle_new%vol = aero_particle_1%vol + aero_particle_2%vol
864 aero_particle_new%n_orig_part = aero_particle_1%n_orig_part &
865 + aero_particle_2%n_orig_part
866 aero_particle_new%weight_group = 0
867 aero_particle_new%weight_class = 0
868 aero_particle_new%absorb_cross_sect = 0d0
869 aero_particle_new%scatter_cross_sect = 0d0
870 aero_particle_new%asymmetry = 0d0
871 aero_particle_new%refract_shell = (0d0, 0d0)
872 aero_particle_new%refract_core = (0d0, 0d0)
873 aero_particle_new%core_vol = 0d0
874 if ((aero_particle_1%water_hyst_leg == 1) &
875 .and. (aero_particle_2%water_hyst_leg == 1))
then
876 aero_particle_new%water_hyst_leg = 1
878 aero_particle_new%water_hyst_leg = 0
880 aero_particle_new%id = 0
881 aero_particle_new%least_create_time = &
882 min(aero_particle_1%least_create_time, &
883 aero_particle_2%least_create_time)
884 aero_particle_new%greatest_create_time = &
885 max(aero_particle_1%greatest_create_time, &
886 aero_particle_2%greatest_create_time)
922 character,
intent(inout) :: buffer(:)
924 integer,
intent(inout) :: position
929 integer :: prev_position
931 prev_position = position
946 call assert(810223998, position - prev_position &
958 character,
intent(inout) :: buffer(:)
960 integer,
intent(inout) :: position
965 integer :: prev_position
967 prev_position = position
982 call assert(287447241, position - prev_position &
999 logical,
intent(in) :: continue_on_error
1001 if (
allocated(aero_particle%vol))
then
1003 write(0, *)
'ERROR aero_particle A:'
1004 write(0, *)
'size(aero_particle%vol)',
size(aero_particle%vol)
1005 write(0, *)
'aero_data_n_spec(aero_data)', &
1007 call assert(185878626, continue_on_error)
1010 if (
allocated(aero_particle%n_orig_part))
then
1011 if (
size(aero_particle%n_orig_part) &
1013 write(0, *)
'ERROR aero_particle A:'
1014 write(0, *)
'size(aero_particle%n_orig_part)', &
1015 size(aero_particle%n_orig_part)
1016 write(0, *)
'aero_data_n_source(aero_data)', &
1018 call assert(625490639, continue_on_error)