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

Fix NoahMP precip rates #14

Merged
merged 3 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
'FV3/ccpp/physics/physics/sfc_cice.f' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_diff.f' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_drv.f' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_noahmp_pre.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_noahmp_drv.f' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_nst.f' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/sfc_ocean.F' : [ 'slow_physics' ],
Expand Down
1 change: 0 additions & 1 deletion ccpp/suites/suite_FV3_GFS_2017_gfdlmp_noahmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<scheme>sfc_nst_pre</scheme>
<scheme>sfc_nst</scheme>
<scheme>sfc_nst_post</scheme>
<scheme>sfc_noahmp_pre</scheme>
<scheme>noahmpdrv</scheme>
<scheme>sfc_sice</scheme>
<scheme>GFS_surface_loop_control_part2</scheme>
Expand Down
64 changes: 27 additions & 37 deletions gfsphysics/GFS_layer/GFS_physics_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,6 @@ subroutine GFS_physics_driver &
real(kind=kind_phys), allocatable, dimension(:,:) :: &
savet, saveq, saveu, savev

!--- pass precip type from MP to Noah MP
real(kind=kind_phys), dimension(size(Grid%xlon,1)) :: &
rainn_mp, rainc_mp, snow_mp, graupel_mp, ice_mp

!--- GFDL modification for FV3

real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levs+1) ::&
Expand Down Expand Up @@ -905,36 +901,6 @@ subroutine GFS_physics_driver &
!CCPP: num3 = Model%ncnvc
endif
!*## CCPP ##
!
!## CCPP ##* initialization in GFS_typedefs.F90/tbd_create; calculation in sfc_noahmp_pre.F90/sfc_noahmp_pre_run,
! although similar variables are calculated in GFS_MP_generic_post_run using up-to-date values of Diag%X,
! which arguably makes more sense (the way it is done probably erroneously causes NoahMP to use 0 for
! these values after diagnostics are zeroed.)
! --- initization for those precip type used in Noah MP
!
if (Model%lsm == Model%lsm_noahmp) then
do i=1,im
rainn_mp(i) = zero
rainc_mp(i) = zero
snow_mp(i) = zero
graupel_mp(i) = zero
ice_mp(i) = zero
enddo
! --- get the amount of different precip type for Noah MP
! --- convert from m/dtp to mm/s
if (Model%imp_physics == Model%imp_physics_mg .or. &
Model%imp_physics == Model%imp_physics_gfdl) then
tem = one / (dtp*con_p001)
do i=1,im
rainn_mp(i) = tem * (Diag%rain(i)-Diag%rainc(i))
rainc_mp(i) = tem * Diag%rainc(i)
snow_mp(i) = tem * Diag%snow(i)
graupel_mp(i) = tem * Diag%graupel(i)
ice_mp(i) = tem * Diag%ice(i)
enddo
endif
endif ! if (Model%lsm == Model%lsm_noahmp)
!*## CCPP ##

!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_pre_run
! --- set initial quantities for stochastic physics deltas
Expand Down Expand Up @@ -1906,8 +1872,8 @@ subroutine GFS_physics_driver &
Model%iopt_inf, Model%iopt_rad, Model%iopt_alb, &
Model%iopt_snf, Model%iopt_tbot, Model%iopt_stc, &
grid%xlat, xcosz, Model%yearlen, Model%julian, Model%imn,&
rainn_mp, rainc_mp, snow_mp, graupel_mp, ice_mp, &

Sfcprop%drainncprv, Sfcprop%draincprv, Sfcprop%dsnowprv, &
Sfcprop%dgraupelprv, Sfcprop%diceprv, &
! --- in/outs:
weasd3(:,1), snowd3(:,1), tsfc3(:,1), tprcp3(:,1), &
Sfcprop%srflag, smsoil, stsoil, slsoil, Sfcprop%canopy, &
Expand Down Expand Up @@ -5262,7 +5228,31 @@ subroutine GFS_physics_driver &
!*## CCPP ##
!## CCPP ##* GFS_MP_generic.F90/GFS_MP_generic_post_run
Diag%rain(:) = Diag%rainc(:) + frain * rain1(:)


! --- get the amount of different precip type for Noah MP
! --- convert from m/dtp to mm/s
if (lsm==lsm_noahmp) 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 line doesn't compile, needs to be Model%lm==Model%lsm_noamp. I fixed this in #15

if (Model%imp_physics == Model%imp_physics_mg .or. &
Model%imp_physics == Model%imp_physics_gfdl) then
!GJF: Should all precipitation rates have the same denominator below?
! It appears that Diag%rain and Diag%rainc are on the dynamics time step,
! but Diag%snow,graupel,ice are on the physics time step? This doesn't
! matter as long as dtp=dtf (frain=1).
tem = 1.0 / (dtp*con_p001)
Sfcprop%draincprv(:) = tem * Diag%rainc(:)
Sfcprop%drainncprv(:) = tem * (frain * rain1(:))
Sfcprop%dsnowprv(:) = tem * Diag%snow(:)
Sfcprop%dgraupelprv(:) = tem * Diag%graupel(:)
Sfcprop%diceprv(:) = tem * Diag%ice(:)
else
Sfcprop%draincprv(:) = 0.0
Sfcprop%drainncprv(:) = 0.0
Sfcprop%dsnowprv(:) = 0.0
Sfcprop%dgraupelprv(:) = 0.0
Sfcprop%diceprv(:) = 0.0
endif
end if ! if (Model%lsm == Model%lsm_noahmp)

if (Model%cal_pre) then ! hchuang: add dominant precipitation type algorithm
!
call calpreciptype (kdt, Model%nrcm, im, ix, levs, levs+1, &
Expand Down
10 changes: 5 additions & 5 deletions gfsphysics/GFS_layer/GFS_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,27 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &
num = num + 1
Restart%name2d(num) = 'ruc_2d_raincprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Tbd(nb)%raincprv(:)
Restart%data(nb,num)%var2p => Sfcprop(nb)%raincprv(:)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume that for b4b identical results through restarts, we need to do something similar for all those RUC previous-precipitation variables, as well as for the d...prv versions? See NCAR/ccpp-physics#367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I commented on the issue. I'm not worrying about this because from looking at GFS_restart, it seems to me that NoahMP wouldn't have working restarts with or without CCPP, and is thus not our responsibility to fix it.

enddo
num = num + 1
Restart%name2d(num) = 'ruc_2d_rainncprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Tbd(nb)%rainncprv(:)
Restart%data(nb,num)%var2p => Sfcprop(nb)%rainncprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'ruc_2d_iceprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Tbd(nb)%iceprv(:)
Restart%data(nb,num)%var2p => Sfcprop(nb)%iceprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'ruc_2d_snowprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Tbd(nb)%snowprv(:)
Restart%data(nb,num)%var2p => Sfcprop(nb)%snowprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'ruc_2d_graupelprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Tbd(nb)%graupelprv(:)
Restart%data(nb,num)%var2p => Sfcprop(nb)%graupelprv(:)
enddo
endif
! MYNN SFC
Expand Down
84 changes: 42 additions & 42 deletions gfsphysics/GFS_layer/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,21 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: chs2(:) => null() !exch coeff for heat at 2m
real (kind=kind_phys), pointer :: cqs2(:) => null() !exch coeff for moisture at 2m
real (kind=kind_phys), pointer :: lh(:) => null() !latent heating at the surface

Copy link
Collaborator

Choose a reason for hiding this comment

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

I had to move lines 373 to 387 outside of the #ifdef CCPP statement in #15.

!---- precipitation amounts from previous time step for RUC LSM
real (kind=kind_phys), pointer :: raincprv (:) => null() !< explicit rainfall from previous timestep
real (kind=kind_phys), pointer :: rainncprv (:) => null() !< convective_precipitation_amount from previous timestep
real (kind=kind_phys), pointer :: iceprv (:) => null() !< ice amount from previous timestep
real (kind=kind_phys), pointer :: snowprv (:) => null() !< snow amount from previous timestep
real (kind=kind_phys), pointer :: graupelprv(:) => null() !< graupel amount from previous timestep

!---- precipitation rates from previous time step for NoahMP LSM
real (kind=kind_phys), pointer :: draincprv (:) => null() !< convective precipitation rate from previous timestep
real (kind=kind_phys), pointer :: drainncprv (:) => null() !< explicit rainfall rate from previous timestep
real (kind=kind_phys), pointer :: diceprv (:) => null() !< ice precipitation rate from previous timestep
real (kind=kind_phys), pointer :: dsnowprv (:) => null() !< snow precipitation rate from previous timestep
real (kind=kind_phys), pointer :: dgraupelprv(:) => null() !< graupel precipitation rate from previous timestep

#endif

contains
Expand Down Expand Up @@ -1192,20 +1207,6 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: prevst (:,:) => null() !<
real (kind=kind_phys), pointer :: prevsq (:,:) => null() !<
integer, pointer :: cactiv (:) => null() !< convective activity memory contour

!---- precipitation amounts from previous time step for RUC LSM
real (kind=kind_phys), pointer :: raincprv (:) => null() !< explicit rainfall from previous timestep
real (kind=kind_phys), pointer :: rainncprv (:) => null() !< convective_precipitation_amount from previous timestep
real (kind=kind_phys), pointer :: iceprv (:) => null() !< ice amount from previous timestep
real (kind=kind_phys), pointer :: snowprv (:) => null() !< snow amount from previous timestep
real (kind=kind_phys), pointer :: graupelprv(:) => null() !< graupel amount from previous timestep

!---- precipitation rates from previous time step for NoahMP LSM
real (kind=kind_phys), pointer :: draincprv (:) => null() !< convective precipitation rate from previous timestep
real (kind=kind_phys), pointer :: drainncprv (:) => null() !< explicit rainfall rate from previous timestep
real (kind=kind_phys), pointer :: diceprv (:) => null() !< ice precipitation rate from previous timestep
real (kind=kind_phys), pointer :: dsnowprv (:) => null() !< snow precipitation rate from previous timestep
real (kind=kind_phys), pointer :: dgraupelprv(:) => null() !< graupel precipitation rate from previous timestep

!--- MYNN prognostic variables that can't be in the Intdiag or Interstitial DDTs
real (kind=kind_phys), pointer :: CLDFRA_BL (:,:) => null() !
Expand Down Expand Up @@ -2207,7 +2208,18 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%dt_cool = zero
Sfcprop%qrain = zero
endif

if (Model%lsm == Model%lsm_ruc .or. Model%lsm == Model%lsm_noahmp) then
allocate(Sfcprop%raincprv (IM))
allocate(Sfcprop%rainncprv (IM))
allocate(Sfcprop%iceprv (IM))
allocate(Sfcprop%snowprv (IM))
allocate(Sfcprop%graupelprv(IM))
Sfcprop%raincprv = clear_val
Sfcprop%rainncprv = clear_val
Sfcprop%iceprv = clear_val
Sfcprop%snowprv = clear_val
Sfcprop%graupelprv = clear_val
end if
! Noah MP allocate and init when used
!
if (Model%lsm == Model%lsm_noahmp ) then
Expand Down Expand Up @@ -2290,7 +2302,19 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%tsnoxy = clear_val
Sfcprop%smoiseq = clear_val
Sfcprop%zsnsoxy = clear_val


allocate(Sfcprop%draincprv (IM))
allocate(Sfcprop%drainncprv (IM))
allocate(Sfcprop%diceprv (IM))
allocate(Sfcprop%dsnowprv (IM))
allocate(Sfcprop%dgraupelprv(IM))

Sfcprop%draincprv = clear_val
Sfcprop%drainncprv = clear_val
Sfcprop%diceprv = clear_val
Sfcprop%dsnowprv = clear_val
Sfcprop%dgraupelprv = clear_val

endif

#ifdef CCPP
Expand Down Expand Up @@ -2330,6 +2354,7 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
allocate (Sfcprop%xlaixy (IM))
Sfcprop%xlaixy = clear_val
end if

end if
if (Model%do_mynnsfclay) then
! For MYNN surface layer scheme
Expand Down Expand Up @@ -2359,6 +2384,7 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
allocate (Sfcprop%conv_act(IM))
Sfcprop%conv_act = zero
end if

#endif

end subroutine sfcprop_create
Expand Down Expand Up @@ -4880,32 +4906,6 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%cactiv = zero
end if

if (Model%lsm == Model%lsm_ruc) then
allocate(Tbd%raincprv (IM))
allocate(Tbd%rainncprv (IM))
allocate(Tbd%iceprv (IM))
allocate(Tbd%snowprv (IM))
allocate(Tbd%graupelprv(IM))
Tbd%raincprv = clear_val
Tbd%rainncprv = clear_val
Tbd%iceprv = clear_val
Tbd%snowprv = clear_val
Tbd%graupelprv = clear_val
end if

if (Model%lsm == Model%lsm_noahmp) then
allocate(Tbd%draincprv (IM))
allocate(Tbd%drainncprv (IM))
allocate(Tbd%diceprv (IM))
allocate(Tbd%dsnowprv (IM))
allocate(Tbd%dgraupelprv(IM))
Tbd%draincprv = clear_val
Tbd%drainncprv = clear_val
Tbd%diceprv = clear_val
Tbd%dsnowprv = clear_val
Tbd%dgraupelprv = clear_val
end if

!--- MYNN variables:
if (Model%do_mynnedmf) then
!print*,"Allocating all MYNN-EDMF variables:"
Expand Down
Loading