Go to the documentation of this file.
40 real(kind=dp),
allocatable :: num_conc(:)
44 real(kind=dp),
allocatable :: vol_conc(:,:)
60 valid = valid .and.
allocated(aero_binned%num_conc)
61 valid = valid .and.
allocated(aero_binned%vol_conc)
63 .and. (
size(aero_binned%num_conc) ==
size(aero_binned%num_conc, 1))
76 integer,
intent(in) :: n_bin
79 integer,
intent(in) :: n_spec
81 if (
allocated(aero_binned%num_conc))
deallocate(aero_binned%num_conc)
82 if (
allocated(aero_binned%vol_conc))
deallocate(aero_binned%vol_conc)
83 allocate(aero_binned%num_conc(n_bin))
84 allocate(aero_binned%vol_conc(n_bin, n_spec))
98 aero_binned%num_conc = 0d0
99 aero_binned%vol_conc = 0d0
118 aero_binned%num_conc = aero_binned%num_conc &
119 + aero_binned_delta%num_conc
120 aero_binned%vol_conc = aero_binned%vol_conc &
121 + aero_binned_delta%vol_conc
123 aero_binned%num_conc = aero_binned_delta%num_conc
124 aero_binned%vol_conc = aero_binned_delta%vol_conc
142 real(kind=dp),
intent(in) :: alpha
146 aero_binned%num_conc = aero_binned%num_conc &
147 + alpha * aero_binned_delta%num_conc
148 aero_binned%vol_conc = aero_binned%vol_conc &
149 + alpha * aero_binned_delta%vol_conc
151 aero_binned%num_conc = aero_binned_delta%num_conc
152 aero_binned%vol_conc = aero_binned_delta%vol_conc
172 aero_binned%num_conc = aero_binned%num_conc &
173 - aero_binned_delta%num_conc
174 aero_binned%vol_conc = aero_binned%vol_conc &
175 - aero_binned_delta%vol_conc
177 aero_binned%num_conc = - aero_binned_delta%num_conc
178 aero_binned%vol_conc = - aero_binned_delta%vol_conc
194 real(kind=dp),
intent(in) :: alpha
197 aero_binned%num_conc = aero_binned%num_conc * alpha
198 aero_binned%vol_conc = aero_binned%vol_conc * alpha
211 real(kind=dp),
allocatable,
intent(in) :: alpha_array(:)
215 do i = 1,
size(aero_binned%num_conc)
216 aero_binned%num_conc(i) = alpha_array(i)*aero_binned%num_conc(i)
217 aero_binned%vol_conc(i,:) = alpha_array(i)*aero_binned%vol_conc(i,:)
228 aero_data, aero_dist)
248 aero_binned%num_conc = aero_binned%num_conc + dist_num_conc
249 aero_binned%vol_conc = aero_binned%vol_conc + dist_vol_conc
251 aero_binned%num_conc = dist_num_conc
252 aero_binned%vol_conc = dist_vol_conc
281 character,
intent(inout) :: buffer(:)
283 integer,
intent(inout) :: position
288 integer :: prev_position
290 prev_position = position
307 character,
intent(inout) :: buffer(:)
309 integer,
intent(inout) :: position
314 integer :: prev_position
316 prev_position = position
344 subroutine aero_binned_output_netcdf(aero_binned, ncid, bin_grid, &
350 integer,
intent(in) :: ncid
356 integer :: dimid_aero_diam, dimid_aero_species
409 mass_conc(i_bin,:) = aero_binned%vol_conc(i_bin,:) * aero_data%density
413 dimid_aero_diam,
"aerosol diameter", scale=2d0)
416 call pmc_nc_write_real_1d(ncid, aero_binned%num_conc, &
417 "aero_number_concentration", (/ dimid_aero_diam /), &
419 long_name=
"aerosol number size concentration distribution", &
420 description=
"logarithmic number size concentration, " &
421 //
"d N(r)/d ln D --- multiply by aero_diam_widths(i) " &
422 //
"and sum over i to compute the total number concentration")
423 call pmc_nc_write_real_2d(ncid, mass_conc, &
424 "aero_mass_concentration", &
425 (/ dimid_aero_diam, dimid_aero_species /), unit=
"kg/m^3", &
426 long_name=
"aerosol mass size concentration distribution", &
427 description=
"logarithmic mass size concentration per species, " &
428 //
"d M(r,s)/d ln D --- multiply by aero_diam_widths(i) " &
429 //
"and sum over i to compute the total mass concentration of " &
432 end subroutine aero_binned_output_netcdf
471 integer,
intent(in) :: ncid
479 call pmc_nc_read_real_1d(ncid, aero_binned%num_conc, &
480 "aero_number_concentration")
481 call pmc_nc_read_real_2d(ncid, aero_binned%vol_conc, &
482 "aero_mass_concentration")
485 aero_binned%vol_conc(i_bin,:) = aero_binned%vol_conc(i_bin,:) &
subroutine aero_binned_add_scaled(aero_binned, aero_binned_delta, alpha)
Add a scaled aero_binned_t structure to an existing one.
elemental integer function aero_data_n_spec(aero_data)
Return the number of aerosol species, or -1 if uninitialized.
subroutine pmc_mpi_reduce_avg_aero_binned(val, val_avg)
Computes the average of the structure across all processes, storing the result on the root process.
Wrapper functions for MPI.
subroutine aero_binned_set_sizes(aero_binned, n_bin, n_spec)
Set the number of bins and species in an aero_binned_t.
subroutine pmc_mpi_reduce_avg_real_array_2d(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process.
The aero_particle_t structure and associated subroutines.
subroutine pmc_mpi_pack_aero_binned(buffer, position, val)
Pack the structure into the buffer and advance position.
subroutine aero_binned_add(aero_binned, aero_binned_delta)
Add two aero_binned_t structures together.
Reading formatted text input.
elemental integer function bin_grid_size(bin_grid)
Return the number of bins in the grid, or -1 if the bin grid is not allocated.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
integer function pmc_mpi_pack_size_real_array(val)
Determines the number of bytes required to pack the given value.
subroutine aero_dist_vol_conc(aero_dist, bin_grid, aero_data, vol_conc)
Return the binned per-species volume concentration for an aero_dist.
subroutine aero_binned_add_aero_dist(aero_binned, bin_grid, aero_data, aero_dist)
Add an aero_dist_t to an aero_binned_t.
integer function pmc_mpi_pack_size_real_array_2d(val)
Determines the number of bytes required to pack the given value.
subroutine aero_binned_scale_by_array(aero_binned, alpha_array)
Scales an aero_binned_t element-wise by an array of reals.
The aero_dist_t structure and associated subroutines.
integer function pmc_mpi_pack_size_aero_binned(val)
Determine the number of bytes required to pack the structure.
subroutine pmc_mpi_pack_real_array_2d(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine aero_binned_sub(aero_binned, aero_binned_delta)
Subtract one aero_binned_t structure from another.
Aerosol material properties and associated data.
logical function aero_binned_is_allocated(aero_binned)
Determine whether the aero_binned is correctly allocated.
subroutine aero_data_netcdf_dim_aero_species(aero_data, ncid, dimid_aero_species)
Write the aero species dimension to the given NetCDF file if it is not already present and in any cas...
subroutine bin_grid_netcdf_dim(bin_grid, ncid, dim_name, unit, dimid, long_name, scale)
Write a bin grid dimension to the given NetCDF file if it is not already present and in any case retu...
A complete aerosol distribution, consisting of several modes.
Common utility subroutines.
subroutine pmc_mpi_unpack_real_array_2d(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine aero_binned_scale(aero_binned, alpha)
Scale an aero_binned_t by a real number.
subroutine aero_binned_zero(aero_binned)
Set all internal data in an aero_binned_t structure to zero.
The aero_binned_t structure and associated subroutines.
subroutine aero_binned_input_netcdf(aero_binned, ncid, bin_grid, aero_data)
Read full state.
Aerosol number and volume distributions stored per bin.
The bin_grid_t structure and associated subroutines.
The aero_data_t structure and associated subroutines.
subroutine pmc_mpi_pack_real_array(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_unpack_aero_binned(buffer, position, val)
Unpack the structure from the buffer and advance position.
1D grid, either logarithmic or linear.
subroutine pmc_mpi_reduce_avg_real_array(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process.
subroutine aero_dist_num_conc(aero_dist, bin_grid, aero_data, num_conc)
Return the binned number concentration for an aero_dist.
subroutine pmc_mpi_unpack_real_array(buffer, position, val)
Unpacks the given value from the buffer, advancing position.