-
Notifications
You must be signed in to change notification settings - Fork 157
cam6_4_085: Phase 1 of rk_stratiform CCPPization; CCPPize cldfrc #1271
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
cam6_4_085: Phase 1 of rk_stratiform CCPPization; CCPPize cldfrc #1271
Conversation
implement cloud_optical_properties via to_be_ccppized implement cloud_particle_sedimentation ccppization rename to cam interface rk_stratiform_cam move intermediate logic to rk_stratiform_* ccpp schemes implement compute_cloud_fraction add rk_stratiform_tend snapshot point
There is an answer change to some (but not all) of the QPC4 regression tests introduced by reformulating the stratiform condensate repartitioning code. Currently: ! Perform repartitioning of stratiform condensate.
! Corresponding heating tendency will be added later.
lq(:) = .FALSE.
lq(ixcldice) = .true.
lq(ixcldliq) = .true.
call physics_ptend_init( ptend_loc, state1%psetcols, 'cldwat-repartition', lq=lq )
totcw(:ncol,:pver) = state1%q(:ncol,:pver,ixcldice) + state1%q(:ncol,:pver,ixcldliq)
repartht(:ncol,:pver) = state1%q(:ncol,:pver,ixcldice)
ptend_loc%q(:ncol,:pver,ixcldice) = rdtime * ( totcw(:ncol,:pver)*fice(:ncol,:pver) - state1%q(:ncol,:pver,ixcldice) )
ptend_loc%q(:ncol,:pver,ixcldliq) = rdtime * ( totcw(:ncol,:pver)*(1.0_r8-fice(:ncol,:pver)) - state1%q(:ncol,:pver,ixcldliq) )
call outfld( 'REPARTICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk )
call outfld( 'REPARTLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk )
call physics_ptend_sum( ptend_loc, ptend_all, ncol )
call physics_update( state1, ptend_loc, dtime )
! Determine repartition heating from change in cloud ice.
repartht(:ncol,:pver) = (latice/dtime) * ( state1%q(:ncol,:pver,ixcldice) - repartht(:ncol,:pver) )
This uses As this is problematic to implement in a CCPPized scheme, the formulation is updated to the following in totcw(:ncol,:) = cldice(:ncol,:) + cldliq(:ncol,:)
tend_cldice(:ncol,:) = 1.0_kind_phys / dtime * ( totcw(:ncol,:)*fice(:ncol,:) - cldice(:ncol,:) )
tend_cldliq(:ncol,:) = 1.0_kind_phys / dtime * ( totcw(:ncol,:)*(1.0_kind_phys-fice(:ncol,:)) - cldliq(:ncol,:) )
repartht(:ncol,:pver) = latice * tend_cldice(:ncol,:pver) This leads to ~1e-17 differences in the final heating rate ( It can be verified that this is responsible for all the answer changes by reintroducing the original formulation of ! call rk_stratiform_condensate_repartioning_run( & ...
call outfld( 'REPARTICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk )
call outfld( 'REPARTLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk )
! add change to restore original formulation:
repartht(:ncol,:pver) = state1%q(:ncol,:pver,ixcldice)
! / change
call physics_ptend_sum( ptend_loc, ptend_all, ncol )
call physics_update( state1, ptend_loc, dtime )
! add change to restore original formulation:
repartht(:ncol,:pver) = (latice/dtime) * ( state1%q(:ncol,:pver,ixcldice) - repartht(:ncol,:pver) )
! / change This will result in bit-for-bit in all history files and diagnostics and passing all regression tests, showing that it was the only cause of the answer changes. Note: even if Thus if there is no way around this I would just recommend changing it for a cleaner code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just had some (hopefully) minor change requests.
|
||
! Convert rain and snow fluxes at the surface from [kg/m2/s] to [m/s] | ||
! Compute total precipitation flux at the surface in [m/s] | ||
wsedl(:ncol,:pver) = pvliq(:ncol,:pver)/gravit/(state1%pmid(:ncol,:pver)/(287.15_r8*state1%t(:ncol,:pver))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am like 95% sure that this 287
number is the gas constant for dry air. I might vote to either just use the actual physical constant, or if that changes answers too much to just create a new parameter here labeling it as the gas constant but keeping the actual value the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think you're right that this should be rair
but I think the numbers in shr_const_rdair
work out to something closer to ~287.04. In the interest of keeping bit-for-bit for this pbuf field I will just make it a parameter with name rdair
.
The same 287.15
number is used in a couple other places in the CAM code, as well as RK to calculate the ice/liquid water content
1316: iwc(i,k) = state1%q(i,k,ixcldice)*state1%pmid(i,k)/(287.15_r8*state1%t(i,k))
1317: lwc(i,k) = state1%q(i,k,ixcldliq)*state1%pmid(i,k)/(287.15_r8*state1%t(i,k))
src/physics/cam/cloud_diagnostics.F90:
405 icimr(i,k) = min( allcld_ice(i,k) / max(0.0001_r8,cld(i,k)),0.005_r8 )
406 icwmr(i,k) = min( allcld_liq(i,k) / max(0.0001_r8,cld(i,k)),0.005_r8 )
407: iwc(i,k) = allcld_ice(i,k) * state%pmid(i,k) / (287.15_r8*state%t(i,k))
408: lwc(i,k) = allcld_liq(i,k) * state%pmid(i,k) / (287.15_r8*state%t(i,k))
409 ! Calculate total cloud water paths in each layer
410 iciwp(i,k) = icimr(i,k) * state%pdel(i,k) / gravit
src/physics/cam/micro_pumas_cam.F90:
2642 icwmrst(i,k) = min( state_loc%q(i,k,ixcldliq) / max(mincld,liqcldf(i,k)),0.005_r8 )
2643 icinc(i,k) = state_loc%q(i,k,ixnumice) / max(mincld,icecldf(i,k)) * &
2644: state_loc%pmid(i,k) / (287.15_r8*state_loc%t(i,k))
2645 icwnc(i,k) = state_loc%q(i,k,ixnumliq) / max(mincld,liqcldf(i,k)) * &
2646: state_loc%pmid(i,k) / (287.15_r8*state_loc%t(i,k))
2647 ! Calculate micro_pumas_cam cloud water paths in each layer
2648 ! Note: uses stratiform cloud fraction!
So maybe they should all be updated in one go. I'm happy to make an issue for this if we'd like to update this down the line? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making an issue to tackle these magic numbers later seems sensible to me. Thanks @jimmielin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jimmielin - Have you opened an issue on this. If so, could you please post the link here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry forgot, here it is: #1292 Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great to me now. Thanks @jimmielin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally sent my single request outside the review
#219) Originator(s): @jimmielin Description (include issue title and the keyword ['closes', 'fixes', 'resolves'] and issue number): - Partial CCPPization work of rk_stratiform (CAM4 microphysics and macrophysics) - #190, including: - Cloud sedimentation `cloud_particle_sedimentation` (from `src/physics/cam/pkg_cld_sediment.F90`) - Prognostic cloud water `prognostic_cloud_water` (`pcond` from `src/physics/cam/cldwat.F90`) - Most interstitial code in `rk_stratiform_tend` moved to `rk_stratiform_*` interstitial schemes - CCPPization of `compute_cloud_fraction` (`cldfrc` in `src/physics/cam/cloud_fraction.F90`); separating out `shallowcu` and `deepcu` and `concld` computation to `convective_cloud_cover` CCPPized scheme. This is used in CAM4 and CAM5 - Dechunkize and move to `to_be_ccppized/cloud_optical_properties.F90` several cloud optical property functions to `src/physics/cam/pkg_cldoptics.F90`: this is used in several cloud diagnostics in CAM. - Fixes #225 This code is not fully ready for use in SIMA in the current state. This is a first stage cleanup to move as much of rk_stratiform_tend code to atmospheric_physics as possible, before completing CCPPization. Thus the following changes are not in the scope of this PR (although reasonable effort has been made to complete these as much as possible): * Completing metadata for use in CAM-SIMA * Finalize standard names * Create diagnostic schemes that correspond to existing diagnostics provided in CAM4 * Create test cases for FPHYStest with rasch_kristjansson SDF Companion PR in ESCOMP/CAM: ESCOMP/CAM#1271 List all namelist files that were added or changed: ``` A schemes/cloud_fraction/compute_cloud_fraction_namelist.xml A schemes/cloud_fraction/convective_cloud_cover_namelist.xml A schemes/rasch_kristjansson/cloud_particle_sedimentation_namelist.xml A schemes/rasch_kristjansson/prognostic_cloud_water_namelist.xml - CCPPize cldfrc; cldwat; rk_stratiform_tend; M schemes/zhang_mcfarlane/zm_conv_options_namelist.xml - Remove cam6 phys_suite namelist defaults from SIMA ``` List all files eliminated and why: N/A List all files added and what they do: ``` A schemes/cloud_fraction/compute_cloud_fraction.F90 A schemes/cloud_fraction/compute_cloud_fraction.meta A schemes/cloud_fraction/convective_cloud_cover.F90 A schemes/cloud_fraction/convective_cloud_cover.meta - CCPPize cldfrc A schemes/rasch_kristjansson/cloud_particle_sedimentation.F90 A schemes/rasch_kristjansson/cloud_particle_sedimentation.meta - CCPPize former `pkg_cld_sediment` A schemes/rasch_kristjansson/prognostic_cloud_water.F90 A schemes/rasch_kristjansson/prognostic_cloud_water.meta - CCPPize former `cldwat` A schemes/rasch_kristjansson/rk_stratiform.F90 A schemes/rasch_kristjansson/rk_stratiform.meta - Move most interstitial code in rk_stratiform_tend to individual CCPPized schemes A test/test_suites/suite_rasch_kristjansson.xml - Draft rk_stratiform_tend SDF A to_be_ccppized/cloud_optical_properties.F90 - Dechunkized and moved from `pkg_cldoptics.F90` ``` List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) ``` M schemes/zhang_mcfarlane/zm_conv_options_namelist.xml - Remove cam6 phys_suite namelist defaults from SIMA M schemes/cloud_fraction/set_cloud_fraction_top.F90 M schemes/dry_adiabatic_adjust/dadadj_namelist.xml M schemes/hack_shallow/convect_shallow_sum_to_deep.F90 M schemes/hack_shallow/hack_convect_shallow.F90 M schemes/hack_shallow/set_general_conv_fluxes_to_shallow.F90 M schemes/hack_shallow/set_shallow_conv_fluxes_to_general.F90 - Remove license headers in favor of LICENSE file in repo ``` List all automated tests that failed, as well as an explanation for why they weren't fixed: N/A Is this an answer-changing PR? If so, is it a new physics package, algorithm change, tuning change, etc? B4B for non-CAM4 regression tests and most CAM4 tests. If all CAM4 diagnostics are enabled, there are two history fields (`HPROGCLD` and `HREPART`) that have roundoff level differences in the order of 1e-17 ~ 1e-16 due to rearranging of terms to compute diagnostics. The change in heat flux computation and the subsequent roundoff difference will lead to some CAM4 tests to fail due to chaos. See detailed analysis in ESCOMP/CAM#1271 (comment) Not fully complete for use in SIMA in current state If yes to the above question, describe how this code was validated with the new/modified features: Validation is made as part of ESCOMP/CAM PR - ESCOMP/CAM#1271 --------- Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
Merge pull request ESCOMP#1271 from jimmielin/hplin/rk_stratiform cam6_4_085: Phase 1 of rk_stratiform CCPPization; CCPPize cldfrc ESCOMP commit: ab9c0e6
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
tphysbc_cmfmc
in snapshotsCompanion PR in atmospheric_physics: ESCOMP/atmospheric_physics#219
Changes are expected to be B4B for CAM regression tests
Roundoff changes to CAM4 diagnostics
Describe any changes made to build system: N/A
Describe any changes made to the namelist:
rk_stratiform_tend
snapshot pointList any changes to the defaults for the boundary datasets: N/A
Describe any substantial timing or memory changes: N/A
Code reviewed by: TBD
List all files eliminated:
List all files added and what they do: N/A
List all existing files that have been modified, and describe the changes: