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

Implement Ferrier-Aligo MP scheme in CCPP-Physics #352

Closed
wants to merge 58 commits into from

Conversation

mzhangw
Copy link
Collaborator

@mzhangw mzhangw commented Nov 12, 2019

This PR includes @ericaligo-NOAA @ChunxiZhang-NOAA @mzhangw 's work to implement Ferrier-Aligo MP scheme into CCPP-physics

mzhangw and others added 30 commits July 1, 2019 16:31
                  Deleted QS since it will not be used. we only need QI.
module_mp_fer_hires_pre.F90: changes related to f_ice, f_rain and f_rimef
module_mp_fer_hires_pre.F90: added
GFS_PBL_generic.F90: define tracers for vertical diffusion
GFS_rrtmg_pre.F90: change ncnd
module_mp_fer_hires_pre.F90: revised the definition to tracers
mp_fer_hires.F90: revised the definition to tracers
@@ -713,6 +723,33 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
Model%sup, Model%kdt, me, &
clouds, cldsa, mtopa, mbota, de_lgth) ! --- outputs

! elseif (Model%imp_physics == 15) then ! F-A cloud scheme
Copy link
Collaborator

@grantfirl grantfirl Nov 12, 2019

Choose a reason for hiding this comment

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

Same comment as above and applies to all commented code in this scheme. Consider removing unless you really need to keep this in for later use, like if you're still debugging the scheme.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

imp_physics_zhao_carr_pdf, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, prsi, prsl, prslk, rhcbot, &
rhcpbl, rhctop, rhcmax, islmsk, work1, work2, kpbl, kinver, &
clw, rhc, save_qc, save_qi, errmsg, errflg)
subroutine GFS_suite_interstitial_3_run (im, levs, nn, cscnv, &
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for shortening these lines.

@@ -0,0 +1,138 @@
!>\file HAFS_update_moist.F90
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't actually see this executed via a SDF.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is a prep for HAFS RRTMG. I deleted it from this branch

!--------------------
!
INTEGER :: I,K
character(len=*), intent(out) :: errmsg
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't really matter, but these aren't local variables as commented.

type = integer
intent = out
optional = F
########################################################################
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't matter, but I don't think you need metadata entries for empty init and finalize schemes.

! is glaciated to ice
! * T_ICE_init - maximum temperature (C) at which ice nucleation occurs
REAL, PUBLIC, PARAMETER :: T_ICE=-40., &
T0C=273.15, &
Copy link
Collaborator

Choose a reason for hiding this comment

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

T0C might already be a host model constant.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In physcons.F90, there is only a dubious A3 = 273.16 (Kelvin I assume)

USE GFS_typedefs, ONLY : GFS_control_type
implicit none

type(GFS_control_type), intent(in) :: Model
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please avoid passing in GFS_* DDTs to schemes if you can. This will need to be cleaned up later if left in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

!MZ
!MZ temporary values copied from module_CONSTANTS; ideally they come from host model
!side
REAL, PARAMETER :: pi=3.141592653589793 ! ludolf number
Copy link
Collaborator

Choose a reason for hiding this comment

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

As with a bunch of other schemes, we would like to pass these in if possible. Most of these are host-defined constants.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree. we need to consolidate module_CONSTANTS in WRF with physcons . There are a lot difference depend on which core (nmm, fv3, arw)

Copy link
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

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

I created an issue to follow-up on using conditionally allocated arrays in situations where they may not be allocated (I haven't checked it, just noting it so that it does not get forgotten): #357 - otherwise these changes look ok to me minus a few minor fixes (remove commented-out lines that were introduced during the development phase and not removed afterwards). These changes can be made carefully and pushed to the branch as an isolated commit so that we do not need to rerun the tests.

@@ -277,7 +281,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
!! and determine explicit rain/snow by snow/ice/graupel coming out directly from MP
!! and convective rainfall from the cumulus scheme if the surface temperature is below
!! \f$0^oC\f$.
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson ) then
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change shouldn't be in the PR.

total_precip = snow0(i)+ice0(i)+graupel0(i)+rain0(i)+rainc(i)
if (total_precip > rainmin) then
srflag(i) = (snow0(i)+ice0(i)+graupel0(i)+csnow)/total_precip
endif
!endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this comment line 307

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DONE

@@ -737,8 +748,8 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
! clouds, cldsa, mtopa, mbota, de_lgth) ! --- outputs
endif

elseif(Model%imp_physics == 8 .or. Model%imp_physics == 6) then ! Thompson / WSM6 cloud micrphysics scheme

elseif(Model%imp_physics == 8 .or. Model%imp_physics == 6 .or. &
Copy link
Collaborator

Choose a reason for hiding this comment

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

At some point, we should be using == imp_physics_thompson instead of == 8 here (not this PR).

@@ -14,21 +14,22 @@ end subroutine GFS_suite_interstitial_rad_reset_finalize
!> \section arg_table_GFS_suite_interstitial_rad_reset_run Argument Table
!! \htmlinclude GFS_suite_interstitial_rad_reset_run.html
!!
subroutine GFS_suite_interstitial_rad_reset_run (Interstitial, errmsg, errflg)
subroutine GFS_suite_interstitial_rad_reset_run (Interstitial, Model, 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.

We have to find a better way for this in the future. We don't want to pass the DDTs if we don't have to.

@@ -679,6 +685,9 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, cplchm, tracers_to
real(kind=kind_phys), dimension(im,levs,nn), intent(inout) :: clw
! dqdti may not be allocated
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti
!integer, intent(in) :: mpirank
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove lines 688 and 689

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

! is glaciated to ice
! * T_ICE_init - maximum temperature (C) at which ice nucleation occurs
REAL, PUBLIC, PARAMETER :: T_ICE=-40., &
T0C=273.15, &
Copy link
Collaborator

Choose a reason for hiding this comment

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

In physcons.F90, there is only a dubious A3 = 273.16 (Kelvin I assume)

logical, intent(in) :: restart
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
real(kind_phys), intent(out), optional :: f_ice(1:ncol,1:nlev)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this place it is ok to have explicit sizes of the dimensions (although assumed-size would be preferable), because the scheme is only called when these arrays are allocated.

real(kind_phys), intent(inout) :: t(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: q(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: cwm(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: train(1:ncol,1:nlev)
Copy link
Collaborator

Choose a reason for hiding this comment

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

But in this case it is ok, or? mp_fer_hires_run only gets called if Model%imp_physics == Model%imp_physics_fer_hires, in which case train is also allocated?

Copy link
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

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

The code changes now look good to me, I am wondering if we should clean up the commit history. This is a little tricky to get right, but essentially these are the steps:

  • check out the dtc/develop branch of ccpp-physics somewhere outside your repo
  • add your remote
  • git merge --squash your_remote/HAFS_fer_hires

there should be no conflicts, hopefully, if so, fix

  • you will have one commit message to add, something like "Adding Ferrier Aligo MP scheme and modifications to interstitial/radiation code"
  • then use a diff tool (diffmerge, meld, ...) to make sure that this ccpp-physics directory is identical to your original FA ccpp-physics directory
  • then force-push this new branch to your_remote/HAFS_fer_hires and overwrite your existing changes
    If this sounds scary to you, let me know and I can do that. I would have to replace your ccpp-physics PR with mine then, but I will make sure you get the credit.

@mzhangw
Copy link
Collaborator Author

mzhangw commented Nov 22, 2019

Please go ahead. Thanks!

@climbfuji
Copy link
Collaborator

This PR is replaced by #358

@climbfuji climbfuji closed this Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants