22 character(len=1000) :: in_filename, out_prefix
29 integer :: n_bin, index, i_repeat, output_type
30 real(kind=dp) :: d_min, d_max, time, del_t
31 character(len=1000) :: tmp_str
32 logical :: record_removals, dry_volume, record_optical
33 character(len=PMC_UUID_LEN) :: uuid
36 if (command_argument_count() .ne. 6)
then
37 write(6,*)
'Usage: bin_average_comp <d_min> <d_max> <n_bin> ' &
38 //
'<"wet" or "dry"> <input_filename> <output_prefix>'
40 write(6,*)
' d_min: minimum bin diameter (m)'
41 write(6,*)
' d_max: maximum bin diameter (m)'
42 write(6,*)
' n_bin: number of bins'
43 write(6,*)
' wet/dry: average wet or dry sizes'
44 write(6,*)
' input_filename: like scenario_0001_00000001.nc'
45 write(6,*)
' output_prefix: like scenario_comp_average'
48 call get_command_argument(1, tmp_str)
50 call get_command_argument(2, tmp_str)
52 call get_command_argument(3, tmp_str)
54 call get_command_argument(4, tmp_str)
55 if (trim(tmp_str) ==
"wet")
then
57 elseif (trim(tmp_str) ==
"dry")
then
60 write(6,*)
'Argument 4 must be "wet" or "dry", not ' &
64 call get_command_argument(5, in_filename)
65 call get_command_argument(6, out_prefix)
79 call
input_state(in_filename, index, time, del_t, i_repeat, uuid, &
80 aero_data, aero_state, gas_data, gas_state, env_state)
88 output_type = output_type_single
89 record_removals = .false.
90 record_optical = .true.
91 call
output_state(out_prefix, output_type, aero_data, aero_state, &
92 gas_data, gas_state, env_state, index, time, del_t, i_repeat, &
93 record_removals, record_optical, uuid)
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 aero_data_t structure and associated subroutines.
The env_state_t structure and associated subroutines.
subroutine aero_state_allocate(aero_state)
Allocates aerosol arrays.
subroutine bin_grid_make(bin_grid, type, n_bin, min, max)
Generates the bin grid given the range and number of bins.
program bin_average_comp
Read a NetCDF file, average the composition of all particles within each bin, and write the data out ...
subroutine pmc_mpi_finalize()
Shut down MPI.
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.
Random number generators.
subroutine pmc_mpi_init()
Initialize MPI.
subroutine gas_data_deallocate(gas_data)
Free all storage.
subroutine bin_grid_allocate(bin_grid)
Allocates a bin_grid.
The gas_data_t structure and associated subroutines.
real(kind=dp) elemental function diam2rad(d)
Convert diameter (m) to radius (m).
integer function string_to_integer(string)
Convert a string to an integer.
subroutine aero_data_deallocate(aero_data)
Frees all storage.
Current environment state.
subroutine env_state_deallocate(env_state)
Free all storage.
The aero_state_t structure and assocated subroutines.
subroutine gas_state_deallocate(gas_state)
Free all storage.
The gas_state_t structure and associated subroutines.
subroutine gas_state_allocate(gas_state)
Allocate storage for gas species.
The current collection of aerosol particles.
subroutine aero_state_make_dry(aero_state, aero_data)
Make all particles dry (water set to zero).
1D grid, either logarithmic or linear.
The bin_grid_t structure and associated subroutines.
subroutine aero_state_deallocate(aero_state)
Deallocates a previously allocated aerosol.
subroutine aero_state_bin_average_comp(aero_state, bin_grid, aero_data)
Set each aerosol particle to have its original total volume, but species volume ratios given by the t...
subroutine gas_data_allocate(gas_data)
Allocate storage for gas species.
Current state of the gas mixing ratios in the system.
subroutine aero_data_allocate(aero_data)
Allocate storage for aero_data.
subroutine env_state_allocate(env_state)
Allocate an empty environment.
Aerosol material properties and associated data.
real(kind=dp) function string_to_real(string)
Convert a string to a real.
subroutine bin_grid_deallocate(bin_grid)
Frees all memory.
Write data in NetCDF format.