Skip to content

CAM updates to bring in CCPP-ized RRTMGP longwave modules #1290

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

Open
wants to merge 26 commits into
base: cam_development
Choose a base branch
from

Conversation

peverwhee
Copy link
Collaborator

@peverwhee peverwhee commented Apr 4, 2025

Summary

Brings in (via atmospheric_physics) new CCPP-ized longwave routines. Modifies CAM side to use new CCPP interfaces, while maintaining RRTMG functionality.

Addresses #1192

Main modules updated:

  • src/physics/rrtmgp/radiation.F90
    • Use new ccpp interfaces
  • src/physics/rrtmgp/rrtmgp_inputs.F90 (now rrtmgp_inputs_cam.F90)
    • Remove longwave gas and cloud optics (now ccppized)
    • Will get smaller when SW is CCPPized
  • src/physics/rrtmgp/radconstants.F90
    • Move set_wavenumber_bounds to CCPP/utils
  • src/physics/cam/cloud_rad_props.F90
    • pass out data read in from ice and liquid optics files to be used by CCPPized interfaces

Updates configure as well to include new rrtmgp paths (always build utils because RRTMG requires access to radiation_utils.F90)

Testing

Tests are b4b.

@peverwhee peverwhee requested a review from nusbaume April 4, 2025 16:21
@peverwhee peverwhee self-assigned this Apr 4, 2025
Comment on lines 1453 to 1454
call rrtmgp_post_run(qrs(:ncol,:), qrl(:ncol,:), fsns(:ncol), state%pdel(:ncol,:), atm_optics_sw, cloud_sw, aer_sw, &
fsw, fswc, sources_lw, cloud_lw, aer_lw, flw, flwc, cam_out%netsw(:ncol), errmsg, errflg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

flwds is missing from the calling list (I discovered this while working on the metadata)

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.

First section of review - have not reviewed the big sections yet

Comment on lines +299 to +301
if (ierr /= 0) then
call endrun(sub//': Failed to allocate abs_lw_liq_out - message: '//errmsg)
end if
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that handle_alloc_error is the preferred method for handling errors during allocation? This is in cam_abortutils

@@ -278,6 +290,36 @@ subroutine cloud_rad_props_init()
call mpibcast(abs_lw_ice, n_g_d*nlwbands, mpir8, 0, mpicom, ierr)
#endif

! Set output variables
tiny_out = tiny
nmu_out = nmu
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since it is being used for allocaion size, where is nmu defined? Does a check or some other safeguard need to be put into place, to make sure it is set prior to calling this routine? The same comment goes for nlambda.

Comment on lines +783 to +784
call get_mu_lambda_weights_ccpp(nmu, nlambda, g_mu, g_lambda, lamc, pgam, mu_wgts, &
lambda_wgts, errmsg, errflg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here about how to make sure nmu and nlambda are set before this routine is called.

Comment on lines +133 to +137
call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl(:ncol,:), qrs(:ncol,:), fsns, fsnt, flns, &
flnt, .true., net_flx(:ncol), errmsg, errflg)
#else
ptend%s(:ncol,:) = (qrs(:ncol,:) + qrl(:ncol,:))
call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl(:ncol,:), qrs(:ncol,:), fsns, fsnt, flns, &
flnt, .false., net_flx(:ncol), errmsg, errflg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Technically, you don't need to set single column arrays to only use :ncol, but it might help with clarity.
  2. Need to check errflg and write out errmsg if there is an error

@@ -55,7 +57,7 @@ subroutine rad_solar_var_init( )
call endrun('rad_solar_var_init: Error allocating space for irrad')
end if

call get_sw_spectral_boundaries(radbinmin, radbinmax, 'nm')
call get_sw_spectral_boundaries_ccpp(radbinmin, radbinmax, 'nm', errmsg, errflg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should probably check errflg and use it to write out errmsg if an error is returned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants