-
Notifications
You must be signed in to change notification settings - Fork 16
Making external mixtures #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcurtis2
wants to merge
15
commits into
master
Choose a base branch
from
comp_deaveraging
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bc5fb81
first pass at deaveraging
jcurtis2 461cccf
add passing in of groups for deaveraging
jcurtis2 e3f3346
minor fix
jcurtis2 afd32eb
added groups to deaveraging
jcurtis2 fd97d68
move allocates to avoid warnings
jcurtis2 8470a00
move shuffle subroutine and clean up code
jcurtis2 c78c549
clean up code. add gsl shuffle
jcurtis2 a541d2c
fix bug for gsl compiled comp-averaging
jcurtis2 1e3ac5c
refactor code by creating groups each with a single species if no gro…
jcurtis2 1ea3df5
added option for naive algorithm
jcurtis2 95a010d
remove printing in random shuffle code
jcurtis2 c7aec39
fix minor error in low variance algorithm. clean up code
jcurtis2 529a580
changed low variance algorithm
jcurtis2 594261f
fixed low variance method to work with bins
jcurtis2 e463d99
add comment about algorithm selection
jcurtis2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| ! Copyright (C) 2009-2013 Matthew West | ||
| ! Licensed under the GNU General Public License version 2 or (at your | ||
| ! option) any later version. See the file COPYING for details. | ||
|
|
||
| !> \file | ||
| !> The bin_average_comp program. | ||
|
|
||
| !> Read a NetCDF file, average the composition of all particles within | ||
| !> each bin, and write the data out as another NetCDF file. | ||
| program bin_deaverage_comp | ||
|
|
||
| use pmc_aero_state | ||
| use pmc_gas_data | ||
| use pmc_gas_state | ||
| use pmc_env_state | ||
| use pmc_aero_data | ||
| use pmc_bin_grid | ||
| use pmc_output | ||
| use pmc_rand | ||
| use netcdf | ||
|
|
||
| character(len=1000) :: in_filename, out_prefix | ||
| type(bin_grid_t) :: bin_grid | ||
| type(aero_data_t) :: aero_data | ||
| type(aero_state_t) :: aero_state | ||
| type(gas_data_t) :: gas_data | ||
| type(gas_state_t) :: gas_state | ||
| type(env_state_t) :: env_state | ||
| integer :: n_bin, index, i_repeat, output_type | ||
| real(kind=dp) :: d_min, d_max, time, del_t | ||
| character(len=1000) :: tmp_str | ||
| logical :: record_removals, dry_volume, record_optical | ||
| character(len=PMC_UUID_LEN) :: uuid | ||
| character(len=AERO_NAME_LEN), allocatable :: external_groups(:,:) | ||
|
|
||
| allocate(external_groups(3, 4)) ! 3 groups, max 4 species per group | ||
| external_groups(1,:) = ["OC ", "BC ", " ", " "] | ||
| external_groups(2,:) = ["API1 ", "API2 ", "LIM1 ", "LIM2 "] | ||
| external_groups(3,:) = ["SO4 ", "NO3 ", "NH4 ", " "] | ||
|
|
||
| ! process commandline arguments | ||
| if (command_argument_count() .ne. 6) then | ||
| write(6,*) 'Usage: bin_average_comp <d_min> <d_max> <n_bin> ' & | ||
| // '<"wet" or "dry"> <input_filename> <output_prefix>' | ||
| write(6,*) '' | ||
| write(6,*) ' d_min: minimum bin diameter (m)' | ||
| write(6,*) ' d_max: maximum bin diameter (m)' | ||
| write(6,*) ' n_bin: number of bins' | ||
| write(6,*) ' wet/dry: average wet or dry sizes' | ||
| write(6,*) ' input_filename: like scenario_0001_00000001.nc' | ||
| write(6,*) ' output_prefix: like scenario_comp_average' | ||
| stop 2 | ||
| endif | ||
| call get_command_argument(1, tmp_str) | ||
| d_min = string_to_real(tmp_str) | ||
| call get_command_argument(2, tmp_str) | ||
| d_max = string_to_real(tmp_str) | ||
| call get_command_argument(3, tmp_str) | ||
| n_bin = string_to_integer(tmp_str) | ||
| call get_command_argument(4, tmp_str) | ||
| if (trim(tmp_str) == "wet") then | ||
| dry_volume = .false. | ||
| elseif (trim(tmp_str) == "dry") then | ||
| dry_volume = .true. | ||
| else | ||
| write(6,*) 'Argument 4 must be "wet" or "dry", not ' & | ||
| // trim(tmp_str) | ||
| stop 1 | ||
| end if | ||
| call get_command_argument(5, in_filename) | ||
| call get_command_argument(6, out_prefix) | ||
|
|
||
| call pmc_mpi_init() | ||
|
|
||
| call pmc_srand(0, pmc_mpi_rank()) | ||
|
|
||
| call bin_grid_make(bin_grid, BIN_GRID_TYPE_LOG, n_bin, diam2rad(d_min), & | ||
| diam2rad(d_max)) | ||
|
|
||
| call input_state(in_filename, index, time, del_t, i_repeat, uuid, & | ||
| aero_data, aero_state, gas_data, gas_state, env_state) | ||
|
|
||
| if (dry_volume) then | ||
| call aero_state_make_dry(aero_state, aero_data) | ||
| end if | ||
|
|
||
| call aero_state_bin_deaverage_comp(aero_state, bin_grid, aero_data, & | ||
| external_groups) | ||
|
|
||
| output_type = OUTPUT_TYPE_SINGLE | ||
| record_removals = .false. | ||
| record_optical = .true. | ||
| call output_state(out_prefix, output_type, aero_data, aero_state, & | ||
| gas_data, gas_state, env_state, index, time, del_t, i_repeat, & | ||
| record_removals, record_optical, uuid) | ||
|
|
||
| call pmc_mpi_finalize() | ||
|
|
||
| end program bin_deaverage_comp |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcurtis2 Add comment regarding what this does.