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

Physics Separator merge: Step4 #26

Merged
merged 31 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5331812
zhao-carr seperation bit-for-bit in masep branch
Sep 18, 2017
440e23e
modifies tables with Ruiyu's suggestion
mzhangw Sep 20, 2017
748e594
add *_finalize in gscond and precpd
Sep 21, 2017
709b228
fix the time step name
mzhangw Sep 21, 2017
b9562d7
Merge branch 'masep' of https://github.com/mzhangw/gmtb-gfsphysics in…
mzhangw Sep 21, 2017
1839748
change table format
mzhangw Sep 21, 2017
cc35a38
fix some var's longname for consistency
Sep 26, 2017
b6e58dc
Merge branch 'master' into masep
grantfirl Oct 10, 2017
9ab0a8a
updated gscond.f and precpd.f to have uniform doxygen formatting
grantfirl Oct 10, 2017
ac3d36f
Merge branch 'master' into masep
grantfirl Oct 10, 2017
df2fc28
add table of calpreciptype.f90 and modulization
Oct 23, 2017
9d997ba
add precpd instertitial code 1570-1572
mzhangw Oct 26, 2017
a71b90c
fix rhc longname in zhao-carr
mzhangw Oct 26, 2017
770c6fa
add physics/GFS_calpreciptype.f90, and some modification of Z-C
mzhangw Oct 27, 2017
fe43cc7
add Z-C interstitial on L2275
mzhangw Oct 30, 2017
efc25d5
minor fixes in tables of z-c and calpreciptype folling Grant's
mzhangw Nov 2, 2017
e4b6ed2
to change srflag longname
mzhangw Nov 2, 2017
b94e3f1
fixed a couple of typos
grantfirl Nov 7, 2017
0e33eb0
add GFS_MP_generic_post
mzhangw Nov 13, 2017
f4c9d91
Merge branch 'masep' of https://github.com/mzhangw/gmtb-gfsphysics in…
mzhangw Nov 13, 2017
a05f762
fix a bug in table of GFS_calpreciptype.f90
mzhangw Nov 13, 2017
837adcc
fix longname bug
mzhangw Nov 13, 2017
c02e53a
metadata conflicts fixed and add GFS_MP_generic_pre.f90. pass B4B
mzhangw Nov 15, 2017
01bd32e
add interstitial code for rain before calpreciptype
mzhangw Nov 15, 2017
d81c525
add GFS_zhao_carr_pre.f90
mzhangw Nov 21, 2017
be0c1ea
fixed some format as Dom indicated.
mzhangw Dec 7, 2017
45ba30f
Merge branch 'masep' of https://github.com/mzhangw/gmtb-gfsphysics in…
llpcarson Dec 15, 2017
3fc2e16
Remove a few extraneous files
llpcarson Dec 15, 2017
7fd9ff3
Bug fix for compilation (end subroutine in the wrong place)
llpcarson Dec 15, 2017
6910293
fix the variable changing names and some format bugs.
mzhangw Dec 15, 2017
fb1414e
Merge branch 'masep' of https://github.com/mzhangw/gmtb-gfsphysics in…
llpcarson Dec 15, 2017
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
195 changes: 117 additions & 78 deletions GFS_layer/GFS_physics_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ module module_physics_driver
GFS_tbd_type, GFS_cldprop_type, &
GFS_radtend_type, GFS_diag_type

use GFS_zhaocarr_gscond, only: gscond_run
use GFS_zhaocarr_precpd, only: precpd_run
use GFS_calpreciptype, only: GFS_calpreciptype_run
use GFS_MP_generic_post, only: GFS_MP_generic_post_run
use GFS_MP_generic_pre, only: GFS_MP_generic_pre_run
use GFS_zhao_carr_pre, only: GFS_zhao_carr_pre_run
implicit none


Expand Down Expand Up @@ -492,6 +498,9 @@ subroutine GFS_physics_driver &
real(kind=kind_phys), allocatable, dimension(:,:) :: &
qlcn, qicn, w_upi, cf_upi, CNV_MFD, CNV_PRC3, CNV_DQLDT, &
CLCN, CNV_FICE, CNV_NDROP, CNV_NICE
!CCPP
! real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levs) :: &
! initial_t, initial_qv

!
!
Expand Down Expand Up @@ -596,6 +605,7 @@ subroutine GFS_physics_driver &
Statein%tgrs, Statein%qgrs, del, del_gz)
#endif
!
!zhang: calrhc_run
rhbbot = Model%crtrh(1)
rhpbl = Model%crtrh(2)
rhbtop = Model%crtrh(3)
Expand Down Expand Up @@ -1543,6 +1553,7 @@ subroutine GFS_physics_driver &
if (Model%ntcw > 0) then
do k=1,levs
do i=1,im
!zhang: gscond, precpd interstitial calrhc_run
tem = rhbbot - (rhbbot-rhbtop) * (1.0-Statein%prslk(i,k))
tem = rhc_max * work1(i) + tem * work2(i)
rhc(i,k) = max(0.0, min(1.0,tem))
Expand All @@ -1553,9 +1564,12 @@ subroutine GFS_physics_driver &
clw(:,:,2) = Stateout%gq0(:,:,Model%ntcw) ! water
else
if (Model%num_p3d == 4) then ! zhao-carr microphysics
psautco_l(:) = Model%psautco(1)*work1(:) + Model%psautco(2)*work2(:)
prautco_l(:) = Model%prautco(1)*work1(:) + Model%prautco(2)*work2(:)
clw(:,:,1) = Stateout%gq0(:,:,Model%ntcw)
!zhang: precpd interstitial
! psautco_l(:) = Model%psautco(1)*work1(:) + Model%psautco(2)*work2(:)
! prautco_l(:) = Model%prautco(1)*work1(:) + Model%prautco(2)*work2(:)
!zhang: zhao_carr_pre
! clw(:,:,1) = Stateout%gq0(:,:,Model%ntcw)
call GFS_zhao_carr_pre_run (im,ix, levs,Stateout%gq0(:,:,Model%ntcw),clw(:,:,1))
endif ! end if_num_p3d
endif ! end if (ncld == 2)
else ! if_ntcw
Expand Down Expand Up @@ -2258,7 +2272,8 @@ subroutine GFS_physics_driver &
Stateout%gq0(:,:,Model%ntiw) = clw(:,:,1) ! ice
Stateout%gq0(:,:,Model%ntcw) = clw(:,:,2) ! water
elseif (Model%num_p3d == 4) then ! if_num_p3d
Stateout%gq0(:,:,Model%ntcw) = clw(:,:,1) + clw(:,:,2)
! 2275 zhang: Z-C_pre
! Stateout%gq0(:,:,Model%ntcw) = clw(:,:,1) + clw(:,:,2)
endif ! end if_num_p3d

else ! if_ntcw
Expand Down Expand Up @@ -2316,13 +2331,19 @@ subroutine GFS_physics_driver &
endif
endif ! moist convective adjustment over
!
if (Model%ldiag3d .or. Model%do_aw) then
dtdt(:,:) = Stateout%gt0(:,:)
dqdt(:,:,1) = Stateout%gq0(:,:,1)
do n=Model%ntcw,Model%ntcw+Model%ncld-1
dqdt(:,:,n) = Stateout%gq0(:,:,n)
enddo
endif
!zhang
! if (Model%ldiag3d .or. Model%do_aw) then
! dtdt(:,:) = Stateout%gt0(:,:)
! dqdt(:,:,1) = Stateout%gq0(:,:,1)
! do n=Model%ntcw,Model%ntcw+Model%ncld-1
! dqdt(:,:,n) = Stateout%gq0(:,:,n)
! enddo
! endif
call GFS_MP_generic_pre_run (im, ix,levs,clw(:,:,1),clw(:,:,2), &
Model%ldiag3d, Model%ntcw, Model%ncld, &
Model%num_p3d, Stateout%gt0,Stateout%gq0(:,:,1), &
dtdt,dqdt(:,:,1),dqdt(:,:,3) )


! dqdt_v : instaneous moisture tendency (kg/kg/sec)
if (Model%lgocart) then
Expand Down Expand Up @@ -2358,16 +2379,18 @@ subroutine GFS_physics_driver &
psautco_l, prautco_l, Model%evpco, Model%wminco, &
Tbd%phy_f3d(1,1,Model%ntot3d-2), lprnt, ipr)
else
call gscond (im, ix, levs, dtp, dtf, Statein%prsl, Statein%pgr, &
Stateout%gq0(1,1,1), Stateout%gq0(1,1,Model%ntcw), &
Stateout%gt0, Tbd%phy_f3d(1,1,1), Tbd%phy_f3d(1,1,2), &
Tbd%phy_f2d(1,1), Tbd%phy_f3d(1,1,3), &
Tbd%phy_f3d(1,1,4), Tbd%phy_f2d(1,2), rhc,lprnt, ipr)

call precpd (im, ix, levs, dtp, del, Statein%prsl, &
Stateout%gq0(1,1,1), Stateout%gq0(1,1,Model%ntcw), &
Stateout%gt0, rain1, Diag%sr, rainp, rhc, psautco_l, &
prautco_l, Model%evpco, Model%wminco, lprnt, ipr)
call gscond_run (im, ix, levs, dtp, dtf, Statein%prsl, Statein%pgr,&
Stateout%gq0(:,:,1), clw(:,:,1), clw(:,:,2), &
Stateout%gq0(:,:,Model%ntcw), &
Stateout%gt0, Tbd%phy_f3d(:,:,1), Tbd%phy_f3d(:,:,2), &
Tbd%phy_f2d(:,1), Tbd%phy_f3d(:,:,3), &
Tbd%phy_f3d(:,:,4), Tbd%phy_f2d(:,2), rhc,lprnt, ipr)

call precpd_run (im, ix, levs, dtp, del, Statein%prsl, &
Stateout%gq0(:,:,1), Stateout%gq0(:,:,Model%ntcw), &
Stateout%gt0, rain1, Diag%sr, rainp, rhc, &
Model%psautco, Model%prautco, Model%evpco, &
Model%wminco, work1, lprnt, ipr)
endif
! if (lprnt) then
! write(0,*)' prsl=',prsl(ipr,:)
Expand Down Expand Up @@ -2547,16 +2570,32 @@ subroutine GFS_physics_driver &
rain1(:) = max(rain1(:) - temrain1(:)*0.001, 0.0_kind_phys)
endif

Diag%rain(:) = Diag%rainc(:) + frain * rain1(:)

if (Model%cal_pre) then ! hchuang: add dominant precipitation type algorithm
i = min(3,Model%num_p3d)
call calpreciptype (kdt, Model%nrcm, im, ix, levs, levs+1, &
Tbd%rann, Grid%xlat, Grid%xlon, Stateout%gt0, &
! Diag%rain(:) = Diag%rainc(:) + frain * rain1(:)

call GFS_calpreciptype_run (kdt, Model%nrcm, im, ix, levs, levs+1, &
Tbd%rann, Model%cal_pre, Stateout%gt0, &
Stateout%gq0, Statein%prsl, Statein%prsi, &
Diag%rain, Statein%phii, Model%num_p3d, &
Sfcprop%tsfc, Diag%sr, Tbd%phy_f3d(1,1,i), & ! input
domr, domzr, domip, doms) ! output
Diag%rainc,frain,rain1, Statein%phii, Model%num_p3d, &
Sfcprop%tsfc, Diag%sr, Tbd%phy_f3d(:,:,3), & ! input !zhang:Tbd%phy_f3d(:,:,3) comes from gscond_run
Diag%rain, domr, domzr, domip, doms, Sfcprop%srflag, & ! output
Sfcprop%tprcp)

call GFS_MP_generic_post_run (im, ix, levs, dtf, del, &
Model%lssav, Model%ldiag3d, Diag%rain,frain, &
Model%ntcw, Model%ncld, &
Stateout%gq0(:,:,Model%ntcw), &
Stateout%gt0, Stateout%gq0(:,:,1), &
dtdt,dqdt(:,:,1),Diag%totprcp, Diag%dt3dt(:,:,6),&
Diag%dq3dt(:,:,6), Diag%pwat )

! if (Model%cal_pre) then ! hchuang: add dominant precipitation type algorithm
! i = min(3,Model%num_p3d)
! call calpreciptype_run (kdt, Model%nrcm, im, ix, levs, levs+1, &
! Tbd%rann, Grid%xlat, Grid%xlon, Stateout%gt0, &
! Stateout%gq0, Statein%prsl, Statein%prsi, &
! Diag%rain, Statein%phii, Model%num_p3d, &
! Sfcprop%tsfc, Diag%sr, Tbd%phy_f3d(:,:,i), & ! input
! domr, domzr, domip, doms) ! output
!
! if (lprnt) print*,'debug calpreciptype: DOMR,DOMZR,DOMIP,DOMS '
! &,DOMR(ipr),DOMZR(ipr),DOMIP(ipr),DOMS(ipr)
Expand All @@ -2568,51 +2607,51 @@ subroutine GFS_physics_driver &
! end do
! HCHUANG: use new precipitation type to decide snow flag for LSM snow accumulation

do i=1,im
if(doms(i) > 0.0 .or. domip(i) > 0.0) then
Sfcprop%srflag(i) = 1.
else
Sfcprop%srflag(i) = 0.
end if
enddo
endif
! do i=1,im
! if(doms(i) > 0.0 .or. domip(i) > 0.0) then
! Sfcprop%srflag(i) = 1.
! else
! Sfcprop%srflag(i) = 0.
! end if
! enddo
! endif

if (Model%lssav) then
Diag%totprcp(:) = Diag%totprcp(:) + Diag%rain(:)
! if (Model%lssav) then
! Diag%totprcp(:) = Diag%totprcp(:) + Diag%rain(:)

if (Model%ldiag3d) then
Diag%dt3dt(:,:,6) = Diag%dt3dt(:,:,6) + (Stateout%gt0(:,:)-dtdt(:,:)) * frain
Diag%dq3dt(:,:,4) = Diag%dq3dt(:,:,4) + (Stateout%gq0(:,:,1)-dqdt(:,:,1)) * frain
endif
endif
! if (Model%ldiag3d) then
! Diag%dt3dt(:,:,6) = Diag%dt3dt(:,:,6) + (Stateout%gt0(:,:)-dtdt(:,:)) * frain
! Diag%dq3dt(:,:,4) = Diag%dq3dt(:,:,4) + (Stateout%gq0(:,:,1)-dqdt(:,:,1)) * frain
! endif
! endif

! --- ... estimate t850 for rain-snow decision

t850(:) = Stateout%gt0(:,1)
! t850(:) = Stateout%gt0(:,1)

do k = 1, levs-1
do i = 1, im
if (Statein%prsl(i,k) > p850 .and. Statein%prsl(i,k+1) <= p850) then
t850(i) = Stateout%gt0(i,k) - (Statein%prsl(i,k)-p850) / &
(Statein%prsl(i,k)-Statein%prsl(i,k+1)) * &
(Stateout%gt0(i,k)-Stateout%gt0(i,k+1))
endif
enddo
enddo
! do k = 1, levs-1
! do i = 1, im
! if (Statein%prsl(i,k) > p850 .and. Statein%prsl(i,k+1) <= p850) then
! t850(i) = Stateout%gt0(i,k) - (Statein%prsl(i,k)-p850) / &
! (Statein%prsl(i,k)-Statein%prsl(i,k+1)) * &
! (Stateout%gt0(i,k)-Stateout%gt0(i,k+1))
! endif
! enddo
! enddo

! --- ... lu: snow-rain detection is performed in land/sice module

if (Model%cal_pre) then ! hchuang: new precip type algorithm defines srflag
Sfcprop%tprcp(:) = max(0.0, Diag%rain(:)) ! clu: rain -> tprcp
else
do i = 1, im
Sfcprop%tprcp(i) = max(0.0, Diag%rain(i) )! clu: rain -> tprcp
Sfcprop%srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0)
if (t850(i) <= 273.16) then
Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
endif
enddo
endif
! if (Model%cal_pre) then ! hchuang: new precip type algorithm defines srflag
! Sfcprop%tprcp(:) = max(0.0, Diag%rain(:)) ! clu: rain -> tprcp
! else
! do i = 1, im
! Sfcprop%tprcp(i) = max(0.0, Diag%rain(i) )! clu: rain -> tprcp
! Sfcprop%srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0)
! if (t850(i) <= 273.16) then
! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
! endif
! enddo
! endif

! --- ... coupling insertion

Expand Down Expand Up @@ -2673,20 +2712,20 @@ subroutine GFS_physics_driver &
Sfcprop%slc(:,:) = slsoil(:,:)

! --- ... calculate column precipitable water "pwat"
Diag%pwat(:) = 0.0
tem = dtf * 0.03456 / 86400.0
do k = 1, levs
work1(:) = 0.0
if (Model%ncld > 0) then
do ic = Model%ntcw, Model%ntcw+Model%ncld-1
work1(:) = work1(:) + Stateout%gq0(:,k,ic)
enddo
endif
Diag%pwat(:) = Diag%pwat(:) + del(:,k)*(Stateout%gq0(:,k,1)+work1(:))
! Diag%pwat(:) = 0.0
! tem = dtf * 0.03456 / 86400.0
! do k = 1, levs
! work1(:) = 0.0
! if (Model%ncld > 0) then
! do ic = Model%ntcw, Model%ntcw+Model%ncld-1
! work1(:) = work1(:) + Stateout%gq0(:,k,ic)
! enddo
! endif
! Diag%pwat(:) = Diag%pwat(:) + del(:,k)*(Stateout%gq0(:,k,1)+work1(:))
! if (lprnt .and. i == ipr) write(0,*)' gq0=',
! &gq0(i,k,1),' qgrs=',qgrs(i,k,1),' work2=',work2(i),' k=',k
enddo
Diag%pwat(:) = Diag%pwat(:) * onebg
! enddo
! Diag%pwat(:) = Diag%pwat(:) * onebg

! write(1000+me,*)' pwat=',pwat(i),'i=',i,',
! &' rain=',rain(i)*1000.0,' dqsfc1=',dqsfc1(i)*tem,' kdt=',kdt
Expand Down
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ SRCS_f = \
./physics/tridi2t3.f

SRCS_f90 = \
./physics/calpreciptype.f90 \
./physics/GFS_calpreciptype.f90 \
./physics/GFS_MP_generic_post.f90 \
./physics/GFS_MP_generic_pre.f90 \
./physics/GFS_zhao_carr_pre.f90 \
./physics/cs_conv.f90 \
./physics/funcphys.f90 \
./physics/gcm_shoc.f90 \
Expand Down
Loading