Skip to content

Conversation

@fvitt
Copy link

@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
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.


nspecies(:) = 1

alogsig(:) = log(2._r8)
Copy link
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
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
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
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 on lines 395 to 396
! call endrun('ERROR: bulk_aerosol_properties_mod%amcube not yet implemented')
amcube = -huge(1._r8)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment here that amcube cannot be defined for bulk aerosols since there are no number concentrations in the bulk representation?

I understand endrun cannot be called here because this implements a pure function so maybe a comment of why the intentionally invalid value is returned here will be useful, to distinguish between 'does not exist for bulk representation' and 'not yet implemented'

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems to me that the need to look for workarounds like this is a sign that something is wrong with the abstract aerosol class structure. In this case, the abstract properties class is requiring information that is not present in all aerosol models.
In a perfect world, all code that used %amcube (and the other problematic methods below) would reside in the appropriate subclass and all uses would be restricted to that subclass (which could still be a superclass of final models if a set of aerosol models shared a property such as amcube).
I don't see CAM (or CAM-SIMA) getting ready for such a clean class hierarchy soon so in the interim, I think it would be best if the abstract base class (aerosol_properties) provided a default, overridable method to produce an invalid value. I am happy to present this change as a PR to this PR branch so you can evaluate it.

Speaking of an invalid value, what happens if <bulk_aero_prop_obj>%amcube gets called? The code where it is called has no value checks.

Copy link
Author

Choose a reason for hiding this comment

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

@jimmielin and @gold2718
Many of these undefined methods (such as amcube) could probably be implemented for bulk aerosols. They are not needed for optical properties of prescribed bulk aerosols, which is the purpose of this PR. In the interest of time, I did not make the effort. They can be implemented later if needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fvitt, thanks for the explanation. Would it be possible to set the value to NaN instead of -huge? That way we would know if any not-implemented method was used in active code.

Copy link
Member

Choose a reason for hiding this comment

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

One aspect I struggled when reviewing the PR is that perhaps there could be better distinction of what is not implemented yet (as @fvitt notes as the scope of this PR) versus what cannot be physically defined for bulk aerosols (as @gold2718 notes as "information that is not present in all aerosol models"). Either -huge or NaN serve as good magic numbers for me but I believe the comments should make the intent of the code clear.

Copy link
Author

Choose a reason for hiding this comment

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

Now using NaN, as requested by @gold2718 .


nullify(num)

call endrun('ERROR: bulk_aerosol_state_mod%get_ambient_num not yet implemented')
Copy link
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')


nullify(num)

call endrun('ERROR: bulk_aerosol_state_mod%get_cldbrne_num not yet implemented')
Copy link
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')

@@ -0,0 +1,118 @@
!-------------------------------------------------------------------------------
! Insoluble (non-hygrostatic) aerosol optical properties
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick for typo

Suggested change
! Insoluble (non-hygrostatic) aerosol optical properties
! Insoluble (non-hygroscopic) aerosol optical properties

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Copy link
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 on lines 395 to 396
! call endrun('ERROR: bulk_aerosol_properties_mod%amcube not yet implemented')
amcube = -huge(1._r8)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems to me that the need to look for workarounds like this is a sign that something is wrong with the abstract aerosol class structure. In this case, the abstract properties class is requiring information that is not present in all aerosol models.
In a perfect world, all code that used %amcube (and the other problematic methods below) would reside in the appropriate subclass and all uses would be restricted to that subclass (which could still be a superclass of final models if a set of aerosol models shared a property such as amcube).
I don't see CAM (or CAM-SIMA) getting ready for such a clean class hierarchy soon so in the interim, I think it would be best if the abstract base class (aerosol_properties) provided a default, overridable method to produce an invalid value. I am happy to present this change as a PR to this PR branch so you can evaluate it.

Speaking of an invalid value, what happens if <bulk_aero_prop_obj>%amcube gets called? The code where it is called has no value checks.

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
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: No status

Development

Successfully merging this pull request may close these issues.

3 participants