Skip to content

Conversation

@mattldawson
Copy link
Collaborator

Several minor bugs related to cloud chemistry were identified during refactoring, and addressed here:

  • different values for Henry's Law Constant parameters were being used for wet deposition and cloud chemistry
  • air density was taken as an input to the cloud chemistry function setsox() and used in several places, but in other places air density is calculated assuming an ideal gas
  • inconsistent and rounded values for physical constants (e.g., Avogadro's number, Boltzmann Constant, pressure unit conversion) are used in setsox()
  • a hard-coded value of 330 ppm was used for CO2
  • the rate of H2O2 formation was incorrectly calculated for bulk aerosols
  • outdated rate parameters for sulfur oxidation were used
  • there were errors in the filters used to prevent over-reaction of some sulfur oxidation reactions
  • there were a couple missing diagnostics for bulk aerosol configurations
  • there was some incorrect logic in the output of wet deposition diagnostics for CARMA

closes #1345

@fvitt @tilmes

Copilot AI review requested due to automatic review settings August 19, 2025 17:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes several bugs in the cloud chemistry module that were identified during refactoring, improving consistency and accuracy in cloud chemistry calculations. The changes address issues with physical constants, Henry's Law constant parameters, sulfur oxidation rates, and diagnostic outputs.

  • Unified Henry's Law constant parameters between wet deposition and cloud chemistry modules
  • Replaced hard-coded physical constants with precise values and removed inconsistent air density inputs
  • Updated sulfur oxidation rate parameters and reaction filters to prevent over-reaction

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/chemistry/aerosol/mo_setsox.F90 Major refactoring to use shared Henry's Law constants, precise physical constants, updated reaction rates, and corrected H2O2 formation calculation
src/chemistry/modal_aero/sox_cldaero_mod.F90 Fixed filtering logic to ensure all relevant species are bounded by small_value
src/chemistry/modal_aero/aero_model.F90 Removed air density parameter and added pbuf parameter to setsox call
src/chemistry/carma_aero/aero_model.F90 Removed air density parameter and added pbuf parameter to setsox call
src/chemistry/bulk_aero/aero_model.F90 Added missing diagnostics and updated setsox call signature
src/chemistry/aerosol/aero_wetdep_cam.F90 Fixed wet deposition diagnostic output logic
src/chemistry/aerosol/aero_convproc.F90 Corrected diagnostic field name for convective wet deposition
doc/ChangeLog Documented the bug fixes and test results

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cacraigucar cacraigucar requested a review from fvitt August 25, 2025 20:07
Copy link
Collaborator

@cacraigucar cacraigucar left a comment

Choose a reason for hiding this comment

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

I believe that @fvitt is the proper person to officially review this PR. But while I was skimming through it, I came across a couple of items which I believe should be addressed.

Copy link
Collaborator

@fvitt fvitt left a comment

Choose a reason for hiding this comment

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

My initial review.

doc/ChangeLog Outdated
Comment on lines 66 to 67
mattdawson@derecho3:/glade/derecho/scratch/mattdawson/aux_cam_intel_20250815100530> ./cs.status.aux_cam_intel_20250815100530 | grep -v PASS | grep -v TPUTCOMP | grep -v MEMCOMP
aux_cam_intel_20250815100530: 51 tests
Copy link
Collaborator

Choose a reason for hiding this comment

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

These lines should not be copied into the change log.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed!

derecho/intel/aux_cam:
mattdawson@derecho3:/glade/derecho/scratch/mattdawson/aux_cam_intel_20250815100530> ./cs.status.aux_cam_intel_20250815100530 | grep -v PASS | grep -v TPUTCOMP | grep -v MEMCOMP
aux_cam_intel_20250815100530: 51 tests
ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe all of these baseline failures are expected -- configurations that include prognostic aerosols and aqueous chemistry.

doc/ChangeLog Outdated
Comment on lines 222 to 223
CAM tag used for the baseline comparison tests if different than previous
tag: cam6_4_101
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe the regression tests will be re-run and compared against the latest cam tag when this PR is ready to merge -- when @cacraigucar gives the go ahead to merge into cam_development and create the next tag. The test list may change and your new baselines may change after you merge to the head of cam_development.

doc/ChangeLog Outdated

Tag name: tbd
Originator(s): Matt Dawson, Francis Vitt
Date: August 18, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

This date will need to be updated

Copy link
Collaborator

@fvitt fvitt left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just need to update the ChangeLog when ready. Thanks.

@tilmes
Copy link
Collaborator

tilmes commented Aug 30, 2025

Budget changes for FCnudged MAM5 (1 year nudged simulation 2016):
Without bug fix:
SO4
Burden 0.385725
Aq.Production 12.079
Nucleation (not part of chem.prod) 0.186733
Chemical Prod. (extf) 0.329749
Chemical Prod. gaex 14.3837
Total Prod. 26.7927
Total Loss. 26.4659
Dry Deposition 3.16711
Wet Deposition -23.2988
Wet Deposition int -5.44412
Wet Deposition cloud -17.8537
Lifetime 5.31966

With bug fix:
SO4
Burden 0.364546
Aq.Production 12.7007
Nucleation (not part of chem.prod) 0.173515
Chemical Prod. (extf) 0.329755
Chemical Prod. gaex 13.3769
Total Prod. 26.4073
Total Loss. 26.2099
Dry Deposition 3.14111
Wet Deposition -23.0687
Wet Deposition int -5.59311
Wet Deposition cloud -17.4734
Lifetime 5.07669

@cacraigucar cacraigucar changed the title Fix minor bugs in cloud chemistry cam6_4_112: Fix minor bugs in cloud chemistry Sep 2, 2025
@mattldawson mattldawson merged commit d722812 into ESCOMP:cam_development Sep 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Tag

Development

Successfully merging this pull request may close these issues.

5 participants