Skip to content

cam6_4_135: Abstract aerosol interfaces extended for bulk representation#1404

Merged
fvitt merged 25 commits intoESCOMP:cam_developmentfrom
fvitt:bam_optics
Dec 8, 2025
Merged

cam6_4_135: Abstract aerosol interfaces extended for bulk representation#1404
fvitt merged 25 commits intoESCOMP:cam_developmentfrom
fvitt:bam_optics

Conversation

@fvitt
Copy link
Copy Markdown
Collaborator

@fvitt fvitt commented Sep 30, 2025

For the purpose of aerosol optical properties input into radiative transfer, aerosol interfaces have been extended for bulk aerosols.

closes #1400

Roundoff level answer changing.

	modified:   src/chemistry/aerosol/aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/carma_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	new file:   src/physics/cam/bam_optics_diags_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/hygrocoreshell_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/hygroscopic_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/insoluble_aerosol_optics_mod.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	new file:   src/chemistry/aerosol/hygro_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/carma_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/hygroscopic_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/hygro_aerosol_optics_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	new file:   src/chemistry/aerosol/volcrad_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/carma_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/bam_optics_diags_mod.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	renamed:    src/physics/cam/bam_optics_diags_mod.F90 -> src/physics/cam/aer_vis_diag_mod.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aer_vis_diag_mod.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	modified:   src/physics/cam/aer_rad_props.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/hygro_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/hygrocoreshell_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/hygroscopic_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/insoluble_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/volcrad_aerosol_optics_mod.F90
	modified:   src/physics/cam/aer_vis_diag_mod.F90
@fvitt fvitt self-assigned this Sep 30, 2025
@fvitt fvitt added the answer changing answer changing tag label Sep 30, 2025
Copy link
Copy Markdown
Member

@jimmielin jimmielin left a comment

Choose a reason for hiding this comment

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

Thanks @fvitt for implementing the bulk aerosol properties and state module and other abstractions! I have mostly clarification questions and some minor suggestions.

Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90

nspecies(:) = 1

alogsig(:) = log(2._r8)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be made as a parameter and then assigned to alogsig?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What will we gain be inserting a parameter here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What will we gain be inserting a parameter here?

I'm just not sure where this magic number is coming from, so a comment for at least the value would help. It seems to be the same value as CARMA, and MAM has species-specific deviations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This may never be used for bulk aerosols. The settings are adopted from CARMA properties. Comments are added.

Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 Outdated
Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90

nullify(num)

call endrun('ERROR: bulk_aerosol_state_mod%get_ambient_num not yet implemented')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would suggest returning the error as this cannot be defined for bulk

Suggested change
call endrun('ERROR: bulk_aerosol_state_mod%get_ambient_num not yet implemented')
call endrun('ERROR: bulk_aerosol_state_mod%get_ambient_num cannot be defined for bulk representation')

Comment thread src/physics/cam/aerosol_optics_cam.F90

nullify(num)

call endrun('ERROR: bulk_aerosol_state_mod%get_cldbrne_num not yet implemented')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly I would suggest returning the error as this cannot be defined for bulk instead of not yet implemented (as it never will)

Suggested change
call endrun('ERROR: bulk_aerosol_state_mod%get_cldbrne_num not yet implemented')
call endrun('ERROR: bulk_aerosol_state_mod%get_cldbrne_num cannot be defined for bulk representation')

Comment thread src/chemistry/aerosol/aerosol_properties_mod.F90 Outdated
Comment thread src/chemistry/aerosol/insoluble_aerosol_optics_mod.F90 Outdated
Copy link
Copy Markdown
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

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

I would like to see a bit of a shift in how the non-bulk methods are implemented (see below).

Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 Outdated
fvitt added 2 commits October 7, 2025 11:31
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/carma_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/hygro_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/insoluble_aerosol_optics_mod.F90
	modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
	modified:   src/physics/cam/aerosol_optics_cam.F90
@cacraigucar
Copy link
Copy Markdown
Collaborator

@gold2718 - Do you have any further feedback, or are you okay with us proceeding with tagging this?

@gold2718
Copy link
Copy Markdown
Collaborator

gold2718 commented Dec 2, 2025

@gold2718 - Do you have any further feedback, or are you okay with us proceeding with tagging this?

@cacraigucar, I do have some comments. I will turn in what I have by the end of the day even if it is partial.

Copy link
Copy Markdown
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

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

First, it is nice to see more of the essential aerosol interface needs being met (e.g., with more of the optics defined in the objects). Thanks for all the work on this.
However, I feel this PR takes the aerosol objects in a direction that makes them more CAM specific and which shuts out other model types.
I think that for now, a lot of the problems can be addressed by having the models identify themselves instead of trying to guess by looking at particular properties. See the suggestion in aerosol_properties_mod.F90.

Comment thread src/chemistry/aerosol/aerosol_properties_mod.F90 Outdated
Comment thread src/chemistry/aerosol/aerosol_properties_mod.F90
Comment thread src/physics/cam/aerosol_optics_cam.F90 Outdated
fa(icol,ilev,iwav) = fa(icol,ilev,iwav) + dopaer(icol)*palb(icol)*pasm(icol)*pasm(icol)

call update_diags
if (.not.aeroprops%is_bulk()) then
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.

Is this somehow generally true for bulk aerosol models or is it specific to the bulk model currently in CAM? This is another place (and below) where an aerosol_is interface could be both more specific and more informative.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is specific to how BAM is currently implemented in CAM. With some work we might be able to remove the conditional.

Comment thread src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 Outdated
Comment thread src/physics/cam/aer_vis_diag_mod.F90 Outdated
Comment thread src/physics/cam/aer_vis_diag_mod.F90 Outdated
character(len=32) :: sw_fa_name(nswbands)
character(len=32) :: lw_ta_name(nlwbands)

logical :: bam_debug = .false.
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.

Is this logical and code that uses it below still needed?

@cacraigucar
Copy link
Copy Markdown
Collaborator

@gold2718: FYI - Since you are actively contributing change requests to this PR (thanks!), I will depend on your review approval before I advance this into the tagging phase. Once @fvitt makes the requested changes (or says why he does not want to do so), I will suggest he ask for re-review, so you are aware that he thinks he's done.

…tatus

	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/physics/cam/aer_vis_diag_mod.F90
@cacraigucar
Copy link
Copy Markdown
Collaborator

At a planning meeting today, this PR was listed as a roadblock for some high priority development. We would like to bring this into CAM later this week, early next week. I would suggest we open issue(s) for significant changes and try to move this PR forward.

@fvitt fvitt requested a review from gold2718 December 3, 2025 16:46
@gold2718
Copy link
Copy Markdown
Collaborator

gold2718 commented Dec 3, 2025

At a planning meeting today, this PR was listed as a roadblock for some high priority development. We would like to bring this into CAM later this week, early next week. I would suggest we open issue(s) for significant changes and try to move this PR forward.

Is it okay for me to open issues for these items? Assuming my is_bulk to aerosol_is suggestion goes through, I have:

  • refactor aero_props_get into separate methods.
  • refactor optics_params into separate methods.
  • It appears that aerosol properties objects and especially aerosol state objects are created in multiple places and possibly more than once during a run. For some aerosol models, the state is not the same as fields in the CAM state and evolve over time. Thus, I think we need a factory to provide a single aerosol state object per aerosol type, per run so that all routines can use it.
  • Some aerosol models have internal states that are different from the mixing ratios used in chemistry. Perhaps we need set_chemistry and get_chemistry methods to make this transition? Do we also need methods for radiation?

@cacraigucar, are any or all of these okay as new CAM issues?

@jimmielin
Copy link
Copy Markdown
Member

Hi @gold2718,

  • It appears that aerosol properties objects and especially aerosol state objects are created in multiple places and possibly more than once during a run. For some aerosol models, the state is not the same as fields in the CAM state and evolve over time. Thus, I think we need a factory to provide a single aerosol state object per aerosol type, per run so that all routines can use it.

  • Some aerosol models have internal states that are different from the mixing ratios used in chemistry. Perhaps we need set_chemistry and get_chemistry methods to make this transition? Do we also need methods for radiation?

I like this idea, but I am concerned with potentially unnecessary copying if the aerosol model does not need this distinction.

In general I think a discussion of who holds the 'state' copy of mixing ratios for chemistry and aerosol species will be helpful. If no different internal state is needed then other modules would just point to that copy, otherwise create/manage their own internal state. It would be helpful to have a small proof of concept for discussion.

@cacraigucar
Copy link
Copy Markdown
Collaborator

@gold2718 - yes please open separate issues on all of your points. It would be great if you can get them opened in the next day or so, so that @jimmielin has time to give some initial thoughts before he goes on PTO for a couple of weeks.

Also, I should point out that there are funding grants which require that BAM and MAM be in CAM-SIMA in the "near" future, so we locally may take some shortcuts for the short-term and retrofit when things are fully developed.

With this in mind, we would like to finalize "soon" the interfaces between chemistry and physics. The interfaces between aerosols and chemistry can be finalized at a later date as they are not required for our immediate development purposes (and those aerosol interfaces will be developed by the ACOM group)

@jimmielin @fvitt @nusbaume - Please chime in if I misspoke, as you folks are down in the trenches with this

fvitt added 2 commits December 4, 2025 15:58
	modified:   src/chemistry/aerosol/aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/bulk_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/carma_aerosol_properties_mod.F90
	modified:   src/chemistry/aerosol/modal_aerosol_properties_mod.F90
Use model_is instead of is_bulk
Copy link
Copy Markdown
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

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

This looks good now.
I really like how you fleshed out the model_is method.
I will open issues on the other changes I think would be beneficial.
Thanks for all the work on this!

@cacraigucar cacraigucar removed their request for review December 5, 2025 16:14
@cacraigucar cacraigucar changed the title Abstract aerosol interfaces extended for bulk representation cam6_4_135: Abstract aerosol interfaces extended for bulk representation Dec 5, 2025
@fvitt fvitt merged commit 2a52c8a into ESCOMP:cam_development Dec 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

answer changing answer changing tag

Projects

Status: Tag

Development

Successfully merging this pull request may close these issues.

4 participants