Skip to content

CCPP updates for PUMAS round3#75

Open
cacraigucar wants to merge 13 commits into
ESCOMP:main_camfrom
nusbaume:jesse/ccpp_fixes
Open

CCPP updates for PUMAS round3#75
cacraigucar wants to merge 13 commits into
ESCOMP:main_camfrom
nusbaume:jesse/ccpp_fixes

Conversation

@cacraigucar

Copy link
Copy Markdown
Collaborator

Round3 updates to get PUMAS into CCPP. These updates allow the CCPP version of PUMAS to compile in CAM-SIMA. These changes should be bit-for-bit in CAM (currently just tested the aux_cam izumi gnu and nag tests and they were bit-for-bit).

Major change was to move the conversion to pumas_r8 out of PUMAS and into the CAM-SIMA interstitial code. The reasoning to do this is that two copies were occurring - one to subset to the PUMAS dimension in the interstitial and then one to convert to pumas_r8 inside PUMAS. By moving it out, both subsetting and unit conversion can occur in one copy.

There is also a placeholder routine and metadata: micro_pumas_tempfix.F90. This placeholder routine defines the proc_rates_type DDT. This is basically a stub version of the PUMAS diagnostics routine which has not been completely implemented. When the PUMAS CCPP diagnostics routine is brought in, the micro_pumas_tempfix.F90 can be removed. Until then, it is needed to allow PUMAS to build in CCPP.

@cacraigucar cacraigucar requested a review from nusbaume June 18, 2026 21:37

@nusbaume nusbaume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making the changes needed to get PUMAS working in CAM-SIMA @cacraigucar! I have some questions and change requests, but most are just repeated standard name updates (or things I messed up in the first CCPP attempt). Of course if you have any questions or concerns with any of my requests please let me know!

Comment thread micro_pumas_ccpp.F90 Outdated
!> \section arg_table_micro_pumas_ccpp_init Argument Table
!! \htmlinclude micro_pumas_ccpp_init.html
subroutine micro_pumas_ccpp_init(gravit, rair, rh2o, cpair, tmelt, latvap, latice, &
subroutine micro_pumas_ccpp_init(Gravit, rair, rh2o, cpair, tmelt, latvap, latice, &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why capitalize Gravit here?

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.

I don't know - some random keystroke in vi. Reverted

Comment thread micro_pumas_ccpp.F90 Outdated
Comment on lines 124 to 125

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I realize this was my doing, but can we change this from 512 to * so that it can be whatever length the host model/framework wants it to be?

Suggested change
character(len=*), intent(out) :: errmsg !PUMAS/CCPP error message (none)
integer, intent(out) :: errcode !CCPP error code (1)

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.

done

Comment thread micro_pumas_ccpp.F90 Outdated
Comment on lines +201 to +206
!Set error code to non-zero value if PUMAS returns an error message:
if (trim(pumas_errstring) /= "") then
errcode = 1
errmsg = trim(pumas_errstring)
return
end if

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this code block is needed given that it is basically a copy of the code block immediately below it (which doesn't need a return as it is already at the end of the subroutine).

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.

done

Comment thread micro_pumas_ccpp.F90 Outdated
@@ -7,12 +7,13 @@ module micro_pumas_ccpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we get rid of the un-needed save here? I again realize this was my doing. Thanks!

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.

done

Comment thread micro_pumas_ccpp.F90
errmsg, errcode)

!External dependencies:
use ccpp_kinds, only: kind_phys

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need ccpp_kinds here anymore?

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.

removed

Comment thread micro_pumas_ccpp.meta Outdated
units = none
dimensions = ()
type = character
kind = len=512

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just noting that this should probably be kind = len=*:

Suggested change
kind = len=512
kind = len=*

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.

changed everywhere

Comment thread micro_pumas_tempfix.F90 Outdated

implicit none
private
save

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary save here?

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.

done

Comment thread micro_pumas_tempfix.F90 Outdated


! CCPP error handling variables
character(len=512), intent(out) :: errmsg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make this len=* here?

Suggested change
character(len=512), intent(out) :: errmsg
character(len=*), intent(out) :: errmsg

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.

done

Comment thread micro_pumas_tempfix.meta Outdated
Comment on lines +4 to +13
#Core PUMAS dependencies:
dependencies = micro_pumas_v1.F90,pumas_kinds.F90
dependencies = pumas_gamma_function.F90,micro_pumas_utils.F90
dependencies = micro_pumas_diags.F90
dependencies = pumas_stochastic_collect_tau.F90,tau_neural_net_quantile.F90
dependencies = module_neural_net.F90,ML_fixer_check.F90

#External dependencies:
#Lives in NCAR/ccpp-physics
dependencies = ../../../to_be_ccppized/wv_sat_methods.F90

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be simplified to the following:

Suggested change
#Core PUMAS dependencies:
dependencies = micro_pumas_v1.F90,pumas_kinds.F90
dependencies = pumas_gamma_function.F90,micro_pumas_utils.F90
dependencies = micro_pumas_diags.F90
dependencies = pumas_stochastic_collect_tau.F90,tau_neural_net_quantile.F90
dependencies = module_neural_net.F90,ML_fixer_check.F90
#External dependencies:
#Lives in NCAR/ccpp-physics
dependencies = ../../../to_be_ccppized/wv_sat_methods.F90
#Core PUMAS dependencies:
dependencies = pumas_kinds.F90
dependencies = micro_pumas_diags.F90

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.

Ha, ha - this is the quick stub I threw together based off the full diagnostics package. The plan is to remove it when the diagnostics are officially committed. I'll clean it up, even though it will be shortlived.

Comment thread micro_pumas_tempfix.F90 Outdated

module micro_pumas_tempfix

use micro_pumas_diags, only: proc_rates_type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we move this use statement down to the subroutine level?

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.

done

@cacraigucar cacraigucar left a comment

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.

Once this is approved (and I've run my CAM and CAM-SIMA tests), I will include updating to this PUMAS tag in my misc ESCOMP/CAM PR I am putting together.

Comment thread micro_pumas_tempfix.F90 Outdated

module micro_pumas_tempfix

use micro_pumas_diags, only: proc_rates_type

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.

done

Comment thread micro_pumas_tempfix.F90 Outdated

implicit none
private
save

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.

done

Comment thread micro_pumas_tempfix.F90 Outdated


! CCPP error handling variables
character(len=512), intent(out) :: errmsg

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.

done

Comment thread micro_pumas_tempfix.meta Outdated
Comment on lines +4 to +13
#Core PUMAS dependencies:
dependencies = micro_pumas_v1.F90,pumas_kinds.F90
dependencies = pumas_gamma_function.F90,micro_pumas_utils.F90
dependencies = micro_pumas_diags.F90
dependencies = pumas_stochastic_collect_tau.F90,tau_neural_net_quantile.F90
dependencies = module_neural_net.F90,ML_fixer_check.F90

#External dependencies:
#Lives in NCAR/ccpp-physics
dependencies = ../../../to_be_ccppized/wv_sat_methods.F90

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.

Ha, ha - this is the quick stub I threw together based off the full diagnostics package. The plan is to remove it when the diagnostics are officially committed. I'll clean it up, even though it will be shortlived.

Comment thread micro_pumas_ccpp.F90 Outdated
!> \section arg_table_micro_pumas_ccpp_init Argument Table
!! \htmlinclude micro_pumas_ccpp_init.html
subroutine micro_pumas_ccpp_init(gravit, rair, rh2o, cpair, tmelt, latvap, latice, &
subroutine micro_pumas_ccpp_init(Gravit, rair, rh2o, cpair, tmelt, latvap, latice, &

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.

I don't know - some random keystroke in vi. Reverted

Comment thread micro_pumas_ccpp.meta Outdated
[micro_reff_snow_out]
standard_name = microphysics_effective_radius_of_stratiform_snow_particle
[pumas_reff_snow_out]
standard_name = pumas_effective_radius_of_stratiform_snow_particle

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.

changed two places

Comment thread micro_pumas_ccpp.meta Outdated
units = none
dimensions = ()
type = character
kind = len=512

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.

changed everywhere

Comment thread micro_pumas_ccpp.meta Outdated
[micro_numsnow_tend_external_in]
standard_name = microphysics_tendency_of_mass_number_concentration_of_snow_wrt_moist_air_and_condensed_water_from_external_microphysics
[pumas_numsnow_tend_external]
standard_name = tendency_of_pumas_mass_number_concentration_of_snow_wrt_moist_air_and_condensed_water_from_external

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.

done

Comment thread micro_pumas_ccpp.F90 Outdated
Comment on lines 124 to 125

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.

done

Comment thread micro_pumas_ccpp.F90 Outdated
@@ -7,12 +7,13 @@ module micro_pumas_ccpp

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.

done

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.

3 participants