Skip to content

Commit

Permalink
Merge pull request #340 from climbfuji/update_master_from_gmtb_develo…
Browse files Browse the repository at this point in the history
…p_20191016

Update master from gmtb/develop 2019/10/16
  • Loading branch information
climbfuji authored Oct 31, 2019
2 parents ce641c9 + e1a33ba commit d4b1cd0
Show file tree
Hide file tree
Showing 84 changed files with 27,739 additions and 2,598 deletions.
215 changes: 117 additions & 98 deletions CMakeLists.txt

Large diffs are not rendered by default.

62 changes: 30 additions & 32 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! \htmlinclude GFS_DCNV_generic_pre_run.html
!!
#endif
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, do_ca, &
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, &
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: ldiag3d, cnvgwd, lgocart, do_ca, isppt_deep
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, isppt_deep
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0
Expand Down Expand Up @@ -62,13 +62,21 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, do_ca,
save_v(i,k) = gv0(i,k)
enddo
enddo
elseif (cnvgwd) then
save_t(1:im,:) = gt0(1:im,:)
endif ! end if_ldiag3d/cnvgwd
elseif (do_cnvgwd) then
do k=1,levs
do i=1,im
save_t(i,k) = gt0(i,k)
enddo
enddo
endif

if (ldiag3d .or. lgocart .or. isppt_deep) then
save_qv(1:im,:) = gq0_water_vapor(1:im,:)
endif ! end if_ldiag3d/lgocart
if (ldiag3d .or. isppt_deep) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
enddo
enddo
endif

end subroutine GFS_DCNV_generic_pre_run

Expand All @@ -87,19 +95,19 @@ end subroutine GFS_DCNV_generic_post_finalize
!> \section arg_table_GFS_DCNV_generic_post_run Argument Table
!! \htmlinclude GFS_DCNV_generic_post_run.html
!!
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cscnv, do_ca, &
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_ca, &
isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, &
gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, &
rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, dqdti, &
cnvqci, upd_mfi, dwn_mfi, det_mfi, cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, &
rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, &
cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: lssav, ldiag3d, lgocart, ras, cscnv, do_ca, isppt_deep
logical, intent(in) :: lssav, ldiag3d, ras, cscnv, do_ca, isppt_deep

real(kind=kind_phys), intent(in) :: frain, dtf
real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d
Expand All @@ -114,8 +122,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs
! dt3dt, dq3dt, du3dt, dv3dt upd_mf, dwn_mf, det_mf only allocated if ldiag3d == .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt, du3dt, dv3dt
real(kind=kind_phys), dimension(:,:), intent(inout) :: upd_mf, dwn_mf, det_mf
! dqdti, cnvqci, upd_mfi, dwn_mfi, det_mfi only allocated if ldiag3d == .true. or lgocart == .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti, cnvqci, upd_mfi, dwn_mfi, det_mfi
real(kind=kind_phys), dimension(im,levs), intent(inout) :: cnvw, cnvc
! The following arrays may not be allocated, depending on certain flags and microphysics schemes.
! Since Intel 15 crashes when passing unallocated arrays to arrays defined with explicit shape,
Expand Down Expand Up @@ -186,24 +192,16 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs

endif ! if (lssav)

!update dqdt_v to include moisture tendency due to deep convection
! if (lgocart) then
! do k=1,levs
! do i=1,im
! dqdti (i,k) = (gq0_water_vapor(i,k) - save_qv(i,k)) * frain
! upd_mfi(i,k) = upd_mfi(i,k) + ud_mf(i,k) * frain
! dwn_mfi(i,k) = dwn_mfi(i,k) + dd_mf(i,k) * frain
! det_mfi(i,k) = det_mfi(i,k) + dt_mf(i,k) * frain
! cnvqci (i,k) = cnvqci (i,k) + (clw_ice(i,k)+clw_liquid(i,k))*frain
! enddo
! enddo
! endif ! if (lgocart)

if (isppt_deep) then
tconvtend = gt0 - save_t
qconvtend = gq0_water_vapor - save_qv
uconvtend = gu0 - save_u
vconvtend = gv0 - save_v
do k=1,levs
do i=1,im
tconvtend(i,k) = gt0(i,k) - save_t(i,k)
qconvtend(i,k) = gq0_water_vapor(i,k) - save_qv(i,k)
uconvtend(i,k) = gu0(i,k) - save_u(i,k)
vconvtend(i,k) = gv0(i,k) - save_v(i,k)
enddo
enddo
endif

end subroutine GFS_DCNV_generic_post_run
Expand Down
67 changes: 3 additions & 64 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@
type = logical
intent = in
optional = F
[cnvgwd]
standard_name = flag_convective_gravity_wave_drag
long_name = flag for conv gravity wave drag
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[lgocart]
standard_name = flag_gocart
long_name = flag for 3d diagnostic fields for gocart 1
[do_cnvgwd]
standard_name = flag_for_convective_gravity_wave_drag
long_name = flag for convective gravity wave drag (gwd)
units = flag
dimensions = ()
type = logical
Expand Down Expand Up @@ -192,14 +184,6 @@
type = logical
intent = in
optional = F
[lgocart]
standard_name = flag_gocart
long_name = flag for 3d diagnostic fields for gocart 1
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[ras]
standard_name = flag_for_ras_deep_convection
long_name = flag for ras convection scheme
Expand Down Expand Up @@ -499,51 +483,6 @@
kind = kind_phys
intent = inout
optional = F
[dqdti]
standard_name = instantaneous_water_vapor_specific_humidity_tendency_due_to_convection
long_name = instantaneous moisture tendency due to convection
units = kg kg-1 s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[cnvqci]
standard_name = instantaneous_deep_convective_cloud_condensate_mixing_ratio_on_dynamics_time_step
long_name = instantaneous total convective condensate mixing ratio
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[upd_mfi]
standard_name = instantaneous_atmosphere_updraft_convective_mass_flux_on_dynamics_timestep
long_name = (updraft mass flux) * delt
units = kg m-2
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dwn_mfi]
standard_name = instantaneous_atmosphere_downdraft_convective_mass_flux_on_dynamics_timestep
long_name = (downdraft mass flux) * delt
units = kg m-2
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[det_mfi]
standard_name = instantaneous_atmosphere_detrainment_convective_mass_flux_on_dynamics_timestep
long_name = (detrainment mass flux) * delt
units = kg m-2
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[cnvw]
standard_name = convective_cloud_water_mixing_ratio
long_name = moist convective cloud water mixing ratio
Expand Down
8 changes: 2 additions & 6 deletions physics/GFS_GWD_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end subroutine GFS_GWD_generic_pre_init
!! @{
subroutine GFS_GWD_generic_pre_run( &
& im, levs, nmtvr, mntvar, &
& hprime, oc, oa4, clx, theta, &
& oc, oa4, clx, theta, &
& sigma, gamma, elvmax, lssav, ldiag3d, &
& dtdt, dt3dt, dtf, errmsg, errflg)

Expand All @@ -30,7 +30,7 @@ subroutine GFS_GWD_generic_pre_run( &
real(kind=kind_phys), intent(in) :: mntvar(im,nmtvr)

real(kind=kind_phys), intent(out) :: &
& hprime(im), oc(im), oa4(im,4), clx(im,4), &
& oc(im), oa4(im,4), clx(im,4), &
& theta(im), sigma(im), gamma(im), elvmax(im)

logical, intent(in) :: lssav, ldiag3d
Expand All @@ -49,7 +49,6 @@ subroutine GFS_GWD_generic_pre_run( &
errflg = 0

if (nmtvr == 14) then ! current operational - as of 2014
hprime(:) = mntvar(:,1)
oc(:) = mntvar(:,2)
oa4(:,1) = mntvar(:,3)
oa4(:,2) = mntvar(:,4)
Expand All @@ -64,7 +63,6 @@ subroutine GFS_GWD_generic_pre_run( &
sigma(:) = mntvar(:,13)
elvmax(:) = mntvar(:,14)
elseif (nmtvr == 10) then
hprime(:) = mntvar(:,1)
oc(:) = mntvar(:,2)
oa4(:,1) = mntvar(:,3)
oa4(:,2) = mntvar(:,4)
Expand All @@ -75,7 +73,6 @@ subroutine GFS_GWD_generic_pre_run( &
clx(:,3) = mntvar(:,9)
clx(:,4) = mntvar(:,10)
elseif (nmtvr == 6) then
hprime(:) = mntvar(:,1)
oc(:) = mntvar(:,2)
oa4(:,1) = mntvar(:,3)
oa4(:,2) = mntvar(:,4)
Expand All @@ -86,7 +83,6 @@ subroutine GFS_GWD_generic_pre_run( &
clx(:,3) = 0.0
clx(:,4) = 0.0
else
hprime = 0
oc = 0
oa4 = 0
clx = 0
Expand Down
9 changes: 0 additions & 9 deletions physics/GFS_GWD_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@
kind = kind_phys
intent = in
optional = F
[hprime]
standard_name = standard_deviation_of_subgrid_orography
long_name = standard deviation of subgrid orography
units = m
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = out
optional = F
[oc]
standard_name = convexity_of_subgrid_orography
long_name = convexity of subgrid orography
Expand Down
51 changes: 30 additions & 21 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
enddo
enddo

! Conversion factor mm per physics timestep to m per day
! Conversion factor from mm per day to m per physics timestep
tem = dtp * con_p001 / con_day

!> - For GFDL and Thompson MP scheme, determine convective snow by surface temperature;
Expand All @@ -280,29 +280,38 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then
! determine convective rain/snow by surface temperature
! determine large-scale rain/snow by rain/snow coming out directly from MP
do i = 1, im
!tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp ! DH now lines 245-250
srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0)
if (tsfc(i) >= 273.15) then
crain = rainc(i)
csnow = 0.0
else
crain = 0.0
csnow = rainc(i)
endif
! if (snow0(i,1)+ice0(i,1)+graupel0(i,1)+csnow > rain0(i,1)+crain) then
! if (snow0(i)+ice0(i)+graupel0(i)+csnow > 0.0) then
! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
! endif

if (lsm/=lsm_ruc) then
do i = 1, im
!tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp ! DH now lines 245-250
srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0)
if (tsfc(i) >= 273.15) then
crain = rainc(i)
csnow = 0.0
else
crain = 0.0
csnow = rainc(i)
endif
! if (snow0(i,1)+ice0(i,1)+graupel0(i,1)+csnow > rain0(i,1)+crain) then
! if (snow0(i)+ice0(i)+graupel0(i)+csnow > 0.0) then
! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
! endif
! compute fractional srflag
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
enddo
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
enddo
else
! only for RUC LSM
do i=1,im
srflag(i) = sr(i)
enddo
endif ! lsm==lsm_ruc
elseif( .not. cal_pre) then
if (imp_physics == imp_physics_mg) then ! MG microphysics
do i=1,im
tprcp(i) = max(0.0, rain(i) ) ! clu: rain -> tprcp
if (rain(i)*tem > rainmin) then
srflag(i) = max(zero, min(one, (rain(i)-rainc(i))*sr(i)/rain(i)))
else
Expand All @@ -311,7 +320,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
enddo
else
do i = 1, im
tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp
tprcp(i) = max(0.0, rain(i) ) ! clu: rain -> tprcp
srflag(i) = 0.0 ! clu: default srflag as 'rain' (i.e. 0)
if (t850(i) <= 273.16) then
srflag(i) = 1.0 ! clu: set srflag to 'snow' (i.e. 1)
Expand Down
Loading

0 comments on commit d4b1cd0

Please sign in to comment.