Skip to content

Aerosol surface area densities refactor#1628

Open
fvitt wants to merge 18 commits into
ESCOMP:cam_developmentfrom
fvitt:aerosol_sad
Open

Aerosol surface area densities refactor#1628
fvitt wants to merge 18 commits into
ESCOMP:cam_developmentfrom
fvitt:aerosol_sad

Conversation

@fvitt

@fvitt fvitt commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #1625

Mostly bit-for-bit. Answer changes only in prognostic bulk aerosol configurations (FMOZ). Otherwise, MAM and CARMA are bit-for-bit unchanged.

hplin-ucar and others added 12 commits May 21, 2026 22:12
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
@fvitt
fvitt requested a review from jimmielin July 22, 2026 15:15
@fvitt fvitt self-assigned this Jul 22, 2026

@jimmielin jimmielin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +600 to +601
sfc = 0.0_r8
dm_aer = 0.0_r8

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/chemistry/modal_aero/aero_model.F90 Outdated
Comment thread src/chemistry/carma_aero/aero_model.F90 Outdated
Comment thread src/chemistry/modal_aero/aero_model.F90 Outdated
integer,allocatable :: index_tot_mass(:,:)
integer,allocatable :: index_chm_mass(:,:)
integer,allocatable :: index_ssa_mass(:,:)
integer,allocatable :: index_strat_mass(:,:)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be unused now that sad_strat_spec_types is used directly to call %surf_area_dens so it could be removed

Comment thread src/chemistry/modal_aero/aero_model.F90 Outdated
Comment on lines +542 to +543
allocate(index_strat_mass(nmodes,nspec_max))
index_strat_mass = -1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be removed

Comment thread src/chemistry/modal_aero/aero_model.F90 Outdated
Comment on lines +559 to +561
if (spec_type_in_list(spec_type, sad_strat_spec_types)) then
index_strat_mass(n,l) = get_spc_ndx(spec_name)
end if

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be removed since it's not used anymore in the abstract interface call to %surf_area_dens

Comment thread bld/build-namelist Outdated
add_default($nl, 'sad_strat_spec_types',
'val'=>"'sulfate','s-organic','p-organic','black-c','ammonium'");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'");
}

Comment on lines +868 to +880
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/chemistry/aerosol/modal_aerosol_state_mod.F90
Comment thread src/chemistry/aerosol/carma_aerosol_state_mod.F90
fvitt and others added 6 commits July 23, 2026 15:19
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants