Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud chemistry clean-up #10

Merged

Conversation

mattldawson
Copy link
Collaborator

Updates the common code for calculating cloud aqueous chemistry.

  • renames variables and functions based on Cloud chemistry module review #5 review comments
  • adds missing descriptions and units
  • removes unused and unneeded variables
  • introduces a cloud_species_t class for shared index lookup logic

partially satisfies #7

@dmleung @K20shores @boulderdaze - could you check if these changes address any of your open comments on #5? If so, we can close them when this gets merged into the cloud review branch.

Copy link

@boulderdaze boulderdaze 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! I like what you've done. It helps me understand the code better. I have a few suggestions and questions, hopefully the changes I'm suggesting aren't too time-consuming to make.
I'll check which comments in the #5 review thread are being addressed by your PR and leave comments there tomorrow.

@boulderdaze
Copy link

I’ve left comments on the review comments (#5) that seem to be resolved by this PR. If people agree, we can click Resolve Conversation to hide the ones that have been addressed.

@K20shores
Copy link
Collaborator

I’ve left comments on the review comments (#5) that seem to be resolved by this PR. If people agree, we can click Resolve Conversation to hide the ones that have been addressed.

Oh, I went ahead and did that. I trust your judgement

Copy link

@boulderdaze boulderdaze left a comment

Choose a reason for hiding this comment

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

Thank you for addressing the comments!

endif

if ( .not. cloud_borne) then ! this seems to be specific to aerosols that are not cloud borne
xh2o2(i,k) = xh2o2(i,k) + r2h2o2*dtime ! updated h2o2 by het production
xh2o2(i,k) = xh2o2(i,k) + r2h2o2*time_step ! updated h2o2 by het production
Copy link
Collaborator

@dmleung dmleung Feb 27, 2025

Choose a reason for hiding this comment

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

@mattldawson I am just curious, sometimes you use r2XXX (which is what the original code does) like this one and sometimes you use dXXX_dt like dso4_dt in line 731. Say, do you want r2XXX for gases and dXXX_dt for aerosols? Not asking for code changes, just curious if there is any rationale for the distinction. Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this was probably just an oversight - I'll update the variable name.

ccc = pso4*dtime
ccc = max(ccc, 1.e-30_r8)
delta_concentration = dso4_dt*time_step
delta_concentration = max(delta_concentration, 1.e-30_r8)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mattldawson Hmm, I wonder if you want to define a variable for this 1.e-30. But this is very optional

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was struggling with this, and forgot to add a comment here. I would have called this something like SMALL_NUMBER but then there are other "small numbers" with different values, like here. Maybe these could all be the same small number, but I wasn't sure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea, I don't know why they are different - I think those small values are a little bit arbitrarily added, not sure. Perhaps those people tested the code and found out different numbers worked better in different situations. Maybe we can try to assign the same small value here for all concentrations (1e-30). I think if we test the new code and the results look similar to the original code, then we can use one single small number for all concentrations, no matter gas phase or aerosol concentrations.

Copy link
Collaborator

@dmleung dmleung left a comment

Choose a reason for hiding this comment

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

I added a few small comments but the code looks good to me, thanks Matt! Feel free to tag me if anywhere in the code needs further particular attention.

@mattldawson mattldawson merged commit c58c42e into develop-1-review-cloud-chemistry Feb 27, 2025
3 checks passed
@mattldawson mattldawson deleted the develop-7-cloud-chemistry-naming branch February 27, 2025 17:34
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.

4 participants