Aerosol surface area densities refactor#1628
Conversation
draft to separate out strat restore strato_sad b4b behavior - spec beyond sulfate also incl. same as trop list.
modified: src/chemistry/aerosol/aerosol_state_mod.F90 modified: src/chemistry/aerosol/bulk_aerosol_state_mod.F90 modified: src/chemistry/aerosol/carma_aerosol_state_mod.F90 modified: src/chemistry/aerosol/modal_aerosol_state_mod.F90 modified: src/chemistry/bulk_aero/aero_model.F90 modified: src/chemistry/carma_aero/aero_model.F90 modified: src/chemistry/modal_aero/aero_model.F90
modified: src/chemistry/aerosol/modal_aerosol_state_mod.F90
modified: src/chemistry/bulk_aero/aero_model.F90 modified: src/chemistry/carma_aero/aero_model.F90 modified: src/chemistry/modal_aero/aero_model.F90 modified: src/chemistry/mozart/mo_gas_phase_chemdr.F90 modified: src/chemistry/mozart/mo_usrrxt.F90
modified: src/physics/carma/cam/carma_intr.F90
modified: src/chemistry/aerosol/aerosol_state_mod.F90 modified: src/chemistry/aerosol/bulk_aerosol_state_mod.F90 modified: src/chemistry/aerosol/carma_aerosol_state_mod.F90 modified: src/chemistry/aerosol/modal_aerosol_state_mod.F90 modified: src/chemistry/bulk_aero/aero_model.F90 modified: src/chemistry/carma_aero/aero_model.F90 modified: src/chemistry/modal_aero/aero_model.F90
modified: src/chemistry/aerosol/carma_aerosol_state_mod.F90
modified: src/chemistry/aerosol/aerosol_spec_utils.F90 modified: src/chemistry/aerosol/aerosol_state_mod.F90 modified: src/chemistry/aerosol/bulk_aerosol_state_mod.F90 modified: src/chemistry/aerosol/carma_aerosol_state_mod.F90 modified: src/chemistry/aerosol/modal_aerosol_state_mod.F90
modified: src/physics/carma/cam/carma_intr.F90
modified: src/chemistry/aerosol/bulk_aerosol_state_mod.F90
jimmielin
left a comment
There was a problem hiding this comment.
Thanks @fvitt. I had some suggested changes for performance, and a couple of comments. The GitHub suggested changes seems to not diff individually and just shows the changes as a block, but I am happy to make this into a PR if it's cleaner to see.
| sfc = 0.0_r8 | ||
| dm_aer = 0.0_r8 |
There was a problem hiding this comment.
sfc and dm_aer are optional (although they're always passed in now) - perhaps we should make them required here? Or add a guard to exit when not present.
I am leaning towards required (although this would change the interface), since most of the computations below assume sfc and dm_aer are present.
| integer,allocatable :: index_tot_mass(:,:) | ||
| integer,allocatable :: index_chm_mass(:,:) | ||
| integer,allocatable :: index_ssa_mass(:,:) | ||
| integer,allocatable :: index_strat_mass(:,:) |
There was a problem hiding this comment.
This appears to be unused now that sad_strat_spec_types is used directly to call %surf_area_dens so it could be removed
| allocate(index_strat_mass(nmodes,nspec_max)) | ||
| index_strat_mass = -1 |
| if (spec_type_in_list(spec_type, sad_strat_spec_types)) then | ||
| index_strat_mass(n,l) = get_spc_ndx(spec_name) | ||
| end if |
There was a problem hiding this comment.
This could be removed since it's not used anymore in the abstract interface call to %surf_area_dens
| add_default($nl, 'sad_strat_spec_types', | ||
| 'val'=>"'sulfate','s-organic','p-organic','black-c','ammonium'"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Does bulk need a namelist default for sad_chem_spec_types, etc. like MAM and CARMA does?
if ($aer_model eq 'bam') {
add_default($nl, 'sad_chem_spec_types',
'val'=>"'sulfate','black-c','p-organic'");
}| do i = 1,ncol | ||
| do k = beglev(i), endlev(i) | ||
| rho_air = pmid(i,k)/(temp(i,k)*287.04_r8) | ||
| do l=1,aero_props%nbins() | ||
| ! | ||
| ! compute a mass weighting of the number | ||
| ! | ||
| tot_mass = 0._r8 | ||
| chm_mass = 0._r8 | ||
|
|
||
| ! ignore primary carbon mode | ||
| call rad_aer_get_info(self%list_idx_, l, mode_type=modetype) | ||
| if ( trim(modetype) /= 'primary_carbon') then ! ignore the primary_carbon mode |
There was a problem hiding this comment.
This is doing the rad_aer_get_info and species lookup inside the i, k loop. Maybe if the loop ordering was changed to l then the checks, then over i, k it would be faster. I will draft a fix for your consideration.
Co-authored-by: Haipeng Lin <myself@jimmielin.me>
Co-authored-by: Haipeng Lin <myself@jimmielin.me>
Co-authored-by: Haipeng Lin <myself@jimmielin.me>
Co-authored-by: Haipeng Lin <myself@jimmielin.me>
modified: src/chemistry/aerosol/modal_aerosol_state_mod.F90 modified: src/chemistry/modal_aero/aero_model.F90
modified: bld/build-namelist modified: src/chemistry/aerosol/bulk_aerosol_state_mod.F90
Closes #1625
Mostly bit-for-bit. Answer changes only in prognostic bulk aerosol configurations (FMOZ). Otherwise, MAM and CARMA are bit-for-bit unchanged.