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

Moist-Dry conversions #20

Merged
merged 7 commits into from
Sep 12, 2024
Merged

Moist-Dry conversions #20

merged 7 commits into from
Sep 12, 2024

Conversation

jatkinson1000
Copy link
Member

This addresses #15

The variable conversion routines now also include a moist - dry conversion and back.

The moist mixing ratios from CAM are now converted to dry mixing ratios as expected by SAM for use in that code, and then back for calculation of tendencies and return values.

@jatkinson1000 jatkinson1000 added the enhancement New feature or request label Jun 26, 2024
@jatkinson1000 jatkinson1000 self-assigned this Jun 26, 2024
Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl 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 sensible to me. Some more comments might help, in particular what the variables are and what happens, e.g., in the iteration in lines 687-716. Otherwise fine.

src/physics/cam/nn_interface_cam.F90 Outdated Show resolved Hide resolved
@jatkinson1000 jatkinson1000 force-pushed the dry-conversion branch 2 times, most recently from 0e6767a to 6780dac Compare July 7, 2024 09:19
@jatkinson1000
Copy link
Member Author

I have added some comments and references to explain the variable conversion code in f4e7198

Copy link

@paogorman paogorman left a comment

Choose a reason for hiding this comment

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

I'm a bit worried about the introduction of the r variables for mixing ratios. We have ended up with lines like:
qn = max(0., r_temp-qsat)
Here qn, qsat, and r_temp are all mixing ratios but only one is denoted r.
An alternative approach would be to keep everything as q, and have distinct blocks of code that do the moist to dry mixing ratio conversions.

Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl left a comment

Choose a reason for hiding this comment

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

I am happy with this now, but will refrain from approving it until @paogorman is happy, too

@jatkinson1000 jatkinson1000 linked an issue Aug 13, 2024 that may be closed by this pull request
@jatkinson1000
Copy link
Member Author

jatkinson1000 commented Sep 10, 2024

I have renamed the variables used by 'SAM' to be r instead of q, and renamed the functions extracted from SAM to use r in their names as well.
If you can review and check you are happy before I merge it that would be appreciated.

Copy link

@paogorman paogorman left a comment

Choose a reason for hiding this comment

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

Change to rv etc. generally looks good and does make things clearer.
For CAM_var_conversion:

  • might be cleaner to introduce rc,ri explicitly (but what you have looks right)
  • are you now missing a declaration for incoming variables qc,qi?

@jatkinson1000
Copy link
Member Author

jatkinson1000 commented Sep 12, 2024

This should now be ready to go.
@paogorman the changes we discussed are summarised in 15e21cc if you could have a quick glance to check you are happy with that. I also used it to simplify the calculation of r(i,k) as well, as this also uses ri and rc so avoids a double calculation.

@jatkinson1000 jatkinson1000 merged commit 52d7da8 into CAM-ML Sep 12, 2024
@jatkinson1000 jatkinson1000 deleted the dry-conversion branch September 12, 2024 13:40
@jatkinson1000 jatkinson1000 restored the dry-conversion branch September 12, 2024 14:58
@paogorman
Copy link

Yes this looks good - thanks Jack

@omarjamil omarjamil mentioned this pull request Dec 3, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert variables from moist to dry
3 participants