Go to the documentation of this file.
21 character(len=1000) :: in_filename, out_prefix
28 integer :: n_bin, index, i_repeat, output_type
29 real(kind=
dp) :: d_min, d_max, time, del_t
30 character(len=1000) :: tmp_str
31 logical :: record_removals, dry_volume, bin_center, record_optical
32 logical :: preserve_number
33 character(len=PMC_UUID_LEN) :: uuid
36 if (command_argument_count() .ne. 8)
then
37 write(6,*)
'Usage: bin_average_size <d_min> <d_max> <n_bin> ' &
38 //
'<"wet" or "dry"> <"center" or "average"> ' &
39 //
'<"number" or "volume"> ' &
40 //
'<input_filename> <output_prefix>'
42 write(6,*)
' d_min: minimum bin diameter (m)'
43 write(6,*)
' d_max: maximum bin diameter (m)'
44 write(6,*)
' n_bin: number of bins'
45 write(6,*)
' wet/dry: average wet or dry sizes'
46 write(6,*)
' center/average: set new sizes to bin centers, ' &
47 //
'or to average sizes'
48 write(6,*)
' number/volume: preserve number or volume'
49 write(6,*)
' input_filename: like scenario_0001_00000001.nc'
50 write(6,*)
' output_prefix: like scenario_size_average'
53 call get_command_argument(1, tmp_str)
55 call get_command_argument(2, tmp_str)
57 call get_command_argument(3, tmp_str)
59 call get_command_argument(4, tmp_str)
60 if (trim(tmp_str) ==
"wet")
then
62 elseif (trim(tmp_str) ==
"dry")
then
65 write(6,*)
'Argument 4 must be "wet" or "dry", not ' &
69 call get_command_argument(5, tmp_str)
70 if (trim(tmp_str) ==
"center")
then
72 elseif (trim(tmp_str) ==
"average")
then
75 write(6,*)
'Argument 5 must be "center" or "average", not ' &
79 call get_command_argument(6, tmp_str)
80 if (trim(tmp_str) ==
"number")
then
81 preserve_number = .true.
82 elseif (trim(tmp_str) ==
"volume")
then
83 preserve_number = .false.
85 write(6,*)
'Argument 6 must be "number" or "volume", not ' &
89 call get_command_argument(7, in_filename)
90 call get_command_argument(8, out_prefix)
97 call input_state(in_filename, index, time, del_t, i_repeat, uuid, &
98 aero_data, aero_state, gas_data, gas_state, env_state)
105 bin_center, preserve_number)
108 record_removals = .false.
109 record_optical = .true.
110 call output_state(out_prefix, output_type, aero_data, aero_state, &
111 gas_data, gas_state, env_state, index, time, del_t, i_repeat, &
112 record_removals, record_optical, uuid)
subroutine pmc_mpi_init()
Initialize MPI.
subroutine aero_state_make_dry(aero_state, aero_data)
Make all particles dry (water set to zero).
subroutine input_state(filename, index, time, del_t, i_repeat, uuid, aero_data, aero_state, gas_data, gas_state, env_state)
Read the current state.
The gas_data_t structure and associated subroutines.
integer, parameter dp
Kind of a double precision real number.
subroutine output_state(prefix, output_type, aero_data, aero_state, gas_data, gas_state, env_state, index, time, del_t, i_repeat, record_removals, record_optical, uuid)
Write the current state.
Current environment state.
integer function string_to_integer(string)
Convert a string to an integer.
The aero_state_t structure and assocated subroutines.
The gas_state_t structure and associated subroutines.
subroutine pmc_mpi_finalize()
Shut down MPI.
real(kind=dp) elemental function diam2rad(d)
Convert diameter (m) to radius (m).
integer, parameter output_type_single
Type code for single output (one file for all processes, written by process 0).
subroutine aero_state_bin_average_size(aero_state, bin_grid, aero_data, bin_center, preserve_number)
Set each aerosol particle to have its original species ratios, but total volume given by the average ...
The env_state_t structure and associated subroutines.
Current state of the gas mixing ratios in the system.
Aerosol material properties and associated data.
Write data in NetCDF format.
program bin_average_size
Read a NetCDF file, average the size of all particles within each bin, and write the data out as anot...
The bin_grid_t structure and associated subroutines.
The aero_data_t structure and associated subroutines.
1D grid, either logarithmic or linear.
integer, parameter bin_grid_type_log
Logarithmically spaced bin grid.
subroutine bin_grid_make(bin_grid, type, n_bin, min, max)
Generates the bin grid given the range and number of bins.
The current collection of aerosol particles.
real(kind=dp) function string_to_real(string)
Convert a string to a real.