Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
Browse files Browse the repository at this point in the history
  • Loading branch information
BinLiu-NOAA committed Jun 6, 2020
2 parents 9e5c8bf + 6a6dd2c commit 03ec64b
Show file tree
Hide file tree
Showing 68 changed files with 3,544 additions and 1,285 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Basic checks for CCPP physics schemes

on: [push, pull_request]

jobs:
build:

runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Init submodules
run: git submodule update --init --recursive
#- name: Update packages
# run: |
# /usr/bin/ruby -e "$(curl -fsSL https://github.com/raw/Homebrew/install/master/install)"
# #brew install autoconf automake coreutils gcc@9 libtool mpich gnu-sed wget
# brew install automake coreutils mpich gnu-sed
- name: Check for ASCII encoding
run: ./tools/check_encoding.py
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif (NOT PROJECT)
cmake_minimum_required(VERSION 3.0)

project(ccppphys
VERSION 3.0.0
VERSION 4.0.0
LANGUAGES C CXX Fortran)

# Use rpaths on MacOSX
Expand Down
46 changes: 9 additions & 37 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! \htmlinclude GFS_DCNV_generic_pre_run.html
!!
#endif
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm,&
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, cplchm, &
gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
dqdti, errmsg, errflg)

Expand All @@ -27,7 +27,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, cplchm, isppt_deep
logical, intent(in) :: ldiag3d, do_cnvgwd, cplchm
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 All @@ -49,15 +49,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
errmsg = ''
errflg = 0

if (do_ca) then
do k=1,levs
do i=1,im
gq0_water_vapor(i,k) = gq0_water_vapor(i,k)*(1.0 + ca_deep(i)/500.)
enddo
enddo
endif

if (ldiag3d .or. isppt_deep) then
if (ldiag3d) then
do k=1,levs
do i=1,im
save_t(i,k) = gt0(i,k)
Expand All @@ -73,7 +65,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm
enddo
endif

if (ldiag3d .or. cplchm .or. isppt_deep) then
if (ldiag3d .or. cplchm) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
Expand Down Expand Up @@ -102,19 +94,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, ras, cscnv, do_ca, &
isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, &
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, &
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, npdf3d, num_p3d, ncnvcld3d, &
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)
errmsg, errflg)

use machine, only: kind_phys

implicit none

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

real(kind=kind_phys), intent(in) :: frain, dtf
real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d
Expand All @@ -135,9 +127,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
! as long as these do not get used when not allocated (it is still invalid Fortran code, though).
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d

real(kind=kind_phys), dimension(im), intent(inout) :: cape
real(kind=kind_phys), dimension(im,levs), intent(inout) :: tconvtend, qconvtend, uconvtend, vconvtend

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand All @@ -148,11 +137,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
errflg = 0

if (.not. ras .and. .not. cscnv) then
if(do_ca) then
do i=1,im
cape(i) = cld1d(i)
enddo
endif
if (npdf3d == 3 .and. num_p3d == 4) then
do k=1,levs
do i=1,im
Expand Down Expand Up @@ -198,18 +182,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c

endif ! if (lssav)


if (isppt_deep) then
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

end module GFS_DCNV_generic_post
77 changes: 0 additions & 77 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@
type = logical
intent = in
optional = F
[do_ca]
standard_name = flag_for_cellular_automata
long_name = cellular automata main switch
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[cplchm]
standard_name = flag_for_chemistry_coupling
long_name = flag controlling cplchm collection (default off)
Expand All @@ -49,14 +41,6 @@
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[gu0]
standard_name = x_wind_updated_by_physics
long_name = zonal wind updated by physics
Expand Down Expand Up @@ -217,22 +201,6 @@
type = logical
intent = in
optional = F
[do_ca]
standard_name = flag_for_cellular_automata
long_name = cellular automata main switch
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[frain]
standard_name = dynamics_to_physics_timestep_ratio
long_name = ratio of dynamics timestep to physics timestep
Expand Down Expand Up @@ -518,51 +486,6 @@
kind = kind_phys
intent = inout
optional = F
[cape]
standard_name = convective_available_potential_energy_for_coupling
long_name = convective available potential energy for coupling
units = m2 s-2
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[tconvtend]
standard_name = tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency of air temperature due to deep convection
units = K
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[qconvtend]
standard_name = tendency_of_water_vapor_specific_humidity_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency of specific humidity due to deep convection
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[uconvtend]
standard_name = tendency_of_x_wind_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency_of_x_wind_due_to_deep_convection
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[vconvtend]
standard_name = tendency_of_y_wind_due_to_deep_convection_for_coupling_on_physics_timestep
long_name = tendency_of_y_wind_due_to_deep_convection
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
6 changes: 3 additions & 3 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, rain0, ice0, snow0, &
graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp, totprcp, totice, &
totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, &
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
do_sppt, ca_global, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, errmsg, errflg)
!
use machine, only: kind_phys
Expand Down Expand Up @@ -114,7 +114,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt

! Stochastic physics / surface perturbations
logical, intent(in) :: do_sppt
logical, intent(in) :: do_sppt, ca_global
real(kind=kind_phys), dimension(im,levs), intent(inout) :: dtdtr
real(kind=kind_phys), dimension(im,levs), intent(in) :: dtdtc
real(kind=kind_phys), dimension(im), intent(inout) :: drain_cpl
Expand Down Expand Up @@ -375,7 +375,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
enddo

! Stochastic physics / surface perturbations
if (do_sppt) then
if (do_sppt .or. ca_global) then
!--- radiation heating rate
dtdtr(1:im,:) = dtdtr(1:im,:) + dtdtc(1:im,:)*dtf
endif
Expand Down
8 changes: 8 additions & 0 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,14 @@
type = logical
intent = in
optional = F
[ca_global]
standard_name = flag_for_global_cellular_automata
long_name = switch for global ca
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[dtdtr]
standard_name = tendency_of_air_temperature_due_to_radiative_heating_on_physics_time_step
long_name = temp. change due to radiative heating per time step
Expand Down
33 changes: 20 additions & 13 deletions physics/GFS_PBL_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, &
dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, dqsfc_diag, &
dusfci_diag, dvsfci_diag, dtsfci_diag, dqsfci_diag, dt3dt, du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, dq3dt, &
dq3dt_ozone, rd, cp,fvirt, hvap, t1, q1, prsl, hflx, ushfsfci, oceanfrac, fice, dusfc_cice, dvsfc_cice, dtsfc_cice, &
dqsfc_cice, wet, dry, icy, wind, stress_ocn, hflx_ocn, evap_ocn, ugrs1, vgrs1, dkt_cpl, dkt, hffac, hefac, &
dq3dt_ozone, rd, cp, fvirt, hvap, t1, q1, prsl, hflx, ushfsfci, oceanfrac, flag_cice, dusfc_cice, dvsfc_cice, &
dtsfc_cice, dqsfc_cice, wet, dry, icy, wind, stress_wat, hflx_wat, evap_wat, ugrs1, vgrs1, dkt_cpl, dkt, hffac, hefac, &
errmsg, errflg)

use machine, only : kind_phys
Expand All @@ -346,13 +346,14 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires
logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, lsidea
logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu
logical, dimension(:), intent(in) :: flag_cice

real(kind=kind_phys), intent(in) :: dtf
real(kind=kind_phys), intent(in) :: rd, cp, fvirt, hvap
real(kind=kind_phys), dimension(:), intent(in) :: t1, q1, hflx, oceanfrac, fice
real(kind=kind_phys), dimension(:), intent(in) :: t1, q1, hflx, oceanfrac
real(kind=kind_phys), dimension(:,:), intent(in) :: prsl
real(kind=kind_phys), dimension(:), intent(in) :: dusfc_cice, dvsfc_cice, dtsfc_cice, dqsfc_cice, &
wind, stress_ocn, hflx_ocn, evap_ocn, ugrs1, vgrs1
wind, stress_wat, hflx_wat, evap_wat, ugrs1, vgrs1
real(kind=kind_phys), dimension(im, levs, nvdiff), intent(in) :: dvdftra
real(kind=kind_phys), dimension(im), intent(in) :: dusfc1, dvsfc1, dtsfc1, dqsfc1, xmu
real(kind=kind_phys), dimension(im, levs), intent(in) :: dudt, dvdt, dtdt, htrsw, htrlw
Expand Down Expand Up @@ -382,7 +383,6 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
real(kind=kind_phys), parameter :: zero = 0.0d0
real(kind=kind_phys), parameter :: one = 1.0d0
real(kind=kind_phys), parameter :: huge = 9.9692099683868690E36 ! NetCDF float FillValue, same as in GFS_typedefs.F90
real(kind=kind_phys), parameter :: epsln = 1.0d-10 ! same as in GFS_physics_driver.F90
integer :: i, k, kk, k1, n
real(kind=kind_phys) :: tem, tem1, rho

Expand Down Expand Up @@ -550,24 +550,31 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
if (cplflx) then
do i=1,im
if (oceanfrac(i) > zero) then ! Ocean only, NO LAKES
if (fice(i) > one - epsln) then ! no open water, use results from CICE
dusfci_cpl(i) = dusfc_cice(i)
dvsfci_cpl(i) = dvsfc_cice(i)
dtsfci_cpl(i) = dtsfc_cice(i)
dqsfci_cpl(i) = dqsfc_cice(i)
if ( .not. wet(i)) then ! no open water
if (flag_cice(i)) then !use results from CICE
dusfci_cpl(i) = dusfc_cice(i)
dvsfci_cpl(i) = dvsfc_cice(i)
dtsfci_cpl(i) = dtsfc_cice(i)
dqsfci_cpl(i) = dqsfc_cice(i)
else !use PBL fluxes when CICE fluxes is unavailable
dusfci_cpl(i) = dusfc1(i)
dvsfci_cpl(i) = dvsfc1(i)
dtsfci_cpl(i) = dtsfc1(i)
dqsfci_cpl(i) = dqsfc1(i)
end if
elseif (icy(i) .or. dry(i)) then ! use stress_ocean from sfc_diff for opw component at mixed point
tem1 = max(q1(i), 1.e-8)
rho = prsl(i,1) / (rd*t1(i)*(one+fvirt*tem1))
if (wind(i) > zero) then
tem = - rho * stress_ocn(i) / wind(i)
tem = - rho * stress_wat(i) / wind(i)
dusfci_cpl(i) = tem * ugrs1(i) ! U-momentum flux
dvsfci_cpl(i) = tem * vgrs1(i) ! V-momentum flux
else
dusfci_cpl(i) = zero
dvsfci_cpl(i) = zero
endif
dtsfci_cpl(i) = cp * rho * hflx_ocn(i) ! sensible heat flux over open ocean
dqsfci_cpl(i) = hvap * rho * evap_ocn(i) ! latent heat flux over open ocean
dtsfci_cpl(i) = cp * rho * hflx_wat(i) ! sensible heat flux over open ocean
dqsfci_cpl(i) = hvap * rho * evap_wat(i) ! latent heat flux over open ocean
else ! use results from PBL scheme for 100% open ocean
dusfci_cpl(i) = dusfc1(i)
dvsfci_cpl(i) = dvsfc1(i)
Expand Down
Loading

0 comments on commit 03ec64b

Please sign in to comment.