Skip to content

Commit

Permalink
Merge pull request #2 from NCAR/master
Browse files Browse the repository at this point in the history
update from NCAR's master
  • Loading branch information
pjpegion authored Apr 22, 2020
2 parents 9f851be + c7c922f commit f2a8df4
Show file tree
Hide file tree
Showing 81 changed files with 12,803 additions and 2,687 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "physics/rte-rrtmgp"]
path = physics/rte-rrtmgp
url = https://github.com/RobertPincus/rte-rrtmgp
branch = dtc/ccpp
73 changes: 26 additions & 47 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,14 @@ if(NOT PROJECT)
endif (NOT PROJECT)

#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.0)

project(ccppphys
VERSION 3.0.0
LANGUAGES C CXX Fortran)

# Use rpaths on MacOSX
set(CMAKE_MACOSX_RPATH 1)

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
project(ccppphys VERSION 3.0.0)
else(POLICY CMP0048)
project(ccppphys)
set(PROJECT_VERSION 3.0.0)
set(PROJECT_VERSION_MAJOR 3)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 0)
endif(POLICY CMP0048)

if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
Expand All @@ -29,17 +21,6 @@ endif(POLICY CMP0042)
set(PACKAGE "ccpp-physics")
set(AUTHORS "Grant J. Firl" "Dom Heinzeller")

#------------------------------------------------------------------------------
# Enable Fortran
enable_language(Fortran)

if (PROJECT STREQUAL "CCPP-SCM")
#------------------------------------------------------------------------------
# CMake Modules
# Set the CMake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../framework/cmake")
endif (PROJECT STREQUAL "CCPP-SCM")

#------------------------------------------------------------------------------
# Set OpenMP flags for C/C++/Fortran
if (OPENMP)
Expand Down Expand Up @@ -85,33 +66,38 @@ else(STATIC)
endif(STATIC)

#------------------------------------------------------------------------------
# Add the CCPP include/module directory
set(CCPP_INCLUDE_DIRS "" CACHE FILEPATH "Path to ccpp includes")
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${CCPP_INCLUDE_DIRS})

#------------------------------------------------------------------------------
# Add the CCPP library
set(CCPP_LIB_DIRS "" CACHE FILEPATH "Path to ccpp library")
link_directories(${CCPP_LIB_DIRS})
list(APPEND LIBS "ccpp")
# Set the sources: physics type definitions
set(TYPEDEFS $ENV{CCPP_TYPEDEFS})
if(TYPEDEFS)
message(STATUS "Got CCPP TYPEDEFS from environment variable: ${TYPEDEFS}")
else(TYPEDEFS)
include(./CCPP_TYPEDEFS.cmake)
message(STATUS "Got CCPP TYPEDEFS from cmakefile include file: ${TYPEDEFS}")
endif(TYPEDEFS)

# Generate list of Fortran modules from the CCPP type
# definitions that need need to be installed
foreach(typedef_module ${TYPEDEFS})
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module})
endforeach()

#------------------------------------------------------------------------------
# Set the sources: physics schemes
set(SCHEMES $ENV{CCPP_SCHEMES})
if(SCHEMES)
message(INFO "Got CCPP_SCHEMES from environment variable: ${SCHEMES}")
message(STATUS "Got CCPP SCHEMES from environment variable: ${SCHEMES}")
else(SCHEMES)
include(./CCPP_SCHEMES.cmake)
message(INFO "Got SCHEMES from cmakefile include file: ${SCHEMES}")
message(STATUS "Got CCPP SCHEMES from cmakefile include file: ${SCHEMES}")
endif(SCHEMES)

# Set the sources: physics scheme caps
set(CAPS $ENV{CCPP_CAPS})
if(CAPS)
message(INFO "Got CAPS from environment variable: ${CAPS}")
message(STATUS "Got CCPP CAPS from environment variable: ${CAPS}")
else(CAPS)
include(./CCPP_CAPS.cmake)
message(INFO "Got CAPS from cmakefile include file: ${CAPS}")
message(STATUS "Got CCPP CAPS from cmakefile include file: ${CAPS}")
endif(CAPS)

# Create empty lists for schemes with special compiler optimization flags
Expand Down Expand Up @@ -340,12 +326,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
set_property(SOURCE ${CAPS} APPEND_STRING PROPERTY COMPILE_FLAGS " -Mnobounds ")
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")

if (PROJECT STREQUAL "CCPP-SCM")
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ccpp/framework/src)
endif (PROJECT STREQUAL "CCPP-SCM")

#------------------------------------------------------------------------------

if(STATIC)
add_library(ccppphys STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
# Generate list of Fortran modules from defined sources
Expand Down Expand Up @@ -398,9 +379,7 @@ if (PROJECT STREQUAL "CCPP-FV3")
FILE ccppphys-config.cmake
DESTINATION lib/cmake
)
if(STATIC)
# Define where to install the C headers and Fortran modules
#install(FILES ${HEADERS_C} DESTINATION include)
install(FILES ${MODULES_F90} DESTINATION include)
endif(STATIC)
# Define where to install the C headers and Fortran modules
#install(FILES ${HEADERS_C} DESTINATION include)
install(FILES ${MODULES_F90} DESTINATION include)
endif (PROJECT STREQUAL "CCPP-FV3")
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# GMTB GFS Physics
# CCPP Physics

This repository contains the GFS Physics scheme.
The Common Community Physics Package (CCPP) is designed to facilitate the implementation of physics innovations in state-of-the-art atmospheric models, the use of various models to develop physics, and the acceleration of transition of physics innovations to operational NOAA models.

Please see more information about the CCPP at the locations below.

- [CCPP website hosted by the Developmental Testbed Center (DTC)](https://dtcenter.org/ccpp)
- [CCPP public release information](https://dtcenter.org/community-code/common-community-physics-package-ccpp/ccpp-scm-version-4-0)
- [CCPP Technical Documentation](https://ccpp-techdoc.readthedocs.io/en/latest/)
- [CCPP Scientific Documentation](https://dtcenter.org/GMTB/v4.0/sci_doc/)
- [CCPP Physics GutHub wiki](https://github.com/NCAR/ccpp-physics/wiki)
- [CCPP Framework GitHub wiki](https://github.com/NCAR/ccpp-framework/wiki)

For the use of CCPP with its Single Column Model, see the [Single Column Model User's Guide](https://dtcenter.org/GMTB/v4.0/scm-ccpp-guide-v4.0.pdf).

For the use of CCPP with NOAA's Unified Forecast System (UFS), see the [UFS Medium-Range Application User's Guide](https://ufs-mrweather-app.readthedocs.io/en/latest/) and the [UFS Weather Model User's Guide](https://ufs-weather-model.readthedocs.io/en/latest/).

Questions can be directed to the [CCPP Help Desk](mailto:gmtb-help@ucar.edu). When using the CCPP with NOAA's UFS, questions can be posted in the [UFS Weather Model](https://forums.ufscommunity.org/forum/ufs-weather-model) section of the [UFS Forum](https://forums.ufscommunity.org/)
27 changes: 10 additions & 17 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
errflg = 0

onebg = one/con_g

do i = 1, im
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
enddo
Expand Down Expand Up @@ -191,11 +191,11 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
end if

if (lsm==lsm_ruc .or. lsm==lsm_noahmp) then
raincprv(:) = rainc(:)
rainncprv(:) = frain * rain1(:)
iceprv(:) = ice(:)
snowprv(:) = snow(:)
graupelprv(:) = graupel(:)
raincprv(:) = rainc(:)
rainncprv(:) = frain * rain1(:)
iceprv(:) = ice(:)
snowprv(:) = snow(:)
graupelprv(:) = graupel(:)
!for NoahMP, calculate precipitation rates from liquid water equivalent thickness for use in next time step
!Note (GJF): Precipitation LWE thicknesses are multiplied by the frain factor, and are thus on the dynamics time step, but the conversion as written
! (with dtp in the denominator) assumes the rate is calculated on the physics time step. This only works as expected when dtf=dtp (i.e. when frain=1).
Expand Down Expand Up @@ -341,8 +341,10 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt

if (cplflx .or. cplchm) then
do i = 1, im
rain_cpl(i) = rain_cpl(i) + rain(i) * (one-srflag(i))
snow_cpl(i) = snow_cpl(i) + rain(i) * srflag(i)
drain_cpl(i) = rain(i) * (one-srflag(i))
dsnow_cpl(i) = rain(i) * srflag(i)
rain_cpl(i) = rain_cpl(i) + drain_cpl(i)
snow_cpl(i) = snow_cpl(i) + dsnow_cpl(i)
enddo
endif

Expand Down Expand Up @@ -376,15 +378,6 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
if (do_sppt) then
!--- radiation heating rate
dtdtr(1:im,:) = dtdtr(1:im,:) + dtdtc(1:im,:)*dtf
do i = 1, im
if (t850(i) > 273.16) then
!--- change in change in rain precip
drain_cpl(i) = rain(i) - drain_cpl(i)
else
!--- change in change in snow precip
dsnow_cpl(i) = rain(i) - dsnow_cpl(i)
endif
enddo
endif

end subroutine GFS_MP_generic_post_run
Expand Down
21 changes: 12 additions & 9 deletions physics/GFS_PBL_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

real(kind=kind_phys), parameter :: huge=1.0d30, epsln = 1.0d-10
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 @@ -486,7 +489,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
if (cplchm) then
do i = 1, im
tem1 = max(q1(i), 1.e-8)
tem = prsl(i,1) / (rd*t1(i)*(1.0+fvirt*tem1))
tem = prsl(i,1) / (rd*t1(i)*(one+fvirt*tem1))
ushfsfci(i) = -cp * tem * hflx(i) ! upward sensible heat flux
enddo
! dkt_cpl has dimensions (1:im,1:levs), but dkt has (1:im,1:levs-1)
Expand All @@ -498,22 +501,22 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,

if (cplflx) then
do i=1,im
if (oceanfrac(i) > 0.0) then ! Ocean only, NO LAKES
if (fice(i) > 1.-epsln) then ! no open water, use results from CICE
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)
elseif (dry(i) .or. icy(i)) then ! use stress_ocean from sfc_diff for opw component at mixed point
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)*(1.0+fvirt*tem1))
if (wind(i) > 0.0) then
rho = prsl(i,1) / (rd*t1(i)*(one+fvirt*tem1))
if (wind(i) > zero) then
tem = - rho * stress_ocn(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) = 0.0
dvsfci_cpl(i) = 0.0
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
Expand Down
20 changes: 10 additions & 10 deletions physics/GFS_PBL_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@
intent = in
optional = F
[htrsw]
standard_name = tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep
standard_name = tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_time_step
long_name = total sky sw heating rate
units = K s-1
dimensions = (horizontal_dimension,vertical_dimension)
Expand All @@ -756,7 +756,7 @@
intent = in
optional = F
[htrlw]
standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep
standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_time_step
long_name = total sky lw heating rate
units = K s-1
dimensions = (horizontal_dimension,vertical_dimension)
Expand Down Expand Up @@ -1089,35 +1089,35 @@
intent = in
optional = F
[dusfc_cice]
standard_name = surface_x_momentum_flux_for_coupling_interstitial
long_name = sfc x momentum flux for coupling interstitial
standard_name = surface_x_momentum_flux_for_coupling
long_name = sfc x momentum flux for coupling
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dvsfc_cice]
standard_name = surface_y_momentum_flux_for_coupling_interstitial
long_name = sfc y momentum flux for coupling interstitial
standard_name = surface_y_momentum_flux_for_coupling
long_name = sfc y momentum flux for coupling
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dtsfc_cice]
standard_name = surface_upward_sensible_heat_flux_for_coupling_interstitial
long_name = sfc sensible heat flux for coupling interstitial
standard_name = surface_upward_sensible_heat_flux_for_coupling
long_name = sfc sensible heat flux for coupling
units = W m-2
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dqsfc_cice]
standard_name = surface_upward_latent_heat_flux_for_coupling_interstitial
long_name = sfc latent heat flux for coupling interstitial
standard_name = surface_upward_latent_heat_flux_for_coupling
long_name = sfc latent heat flux for coupling
units = W m-2
dimensions = (horizontal_dimension)
type = real
Expand Down
24 changes: 21 additions & 3 deletions physics/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,12 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank,omprank, blkno, 'Coupling%rain_cpl', Coupling%rain_cpl)
call print_var(mpirank,omprank, blkno, 'Coupling%snow_cpl', Coupling%snow_cpl)
end if
if (Model%cplwav2atm) then
call print_var(mpirank,omprank, blkno, 'Coupling%zorlwav_cpl' , Coupling%zorlwav_cpl )
end if
if (Model%cplflx) then
call print_var(mpirank,omprank, blkno, 'Coupling%oro_cpl' , Coupling%oro_cpl )
call print_var(mpirank,omprank, blkno, 'Coupling%slmsk_cpl' , Coupling%slmsk_cpl )
call print_var(mpirank,omprank, blkno, 'Coupling%slimskin_cpl', Coupling%slimskin_cpl )
call print_var(mpirank,omprank, blkno, 'Coupling%dusfcin_cpl ', Coupling%dusfcin_cpl )
call print_var(mpirank,omprank, blkno, 'Coupling%dvsfcin_cpl ', Coupling%dvsfcin_cpl )
Expand Down Expand Up @@ -466,11 +471,24 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank,omprank, blkno, 'Coupling%shum_wts', Coupling%shum_wts)
end if
if (Model%do_skeb) then
call print_var(mpirank,omprank, blkno, 'Coupling%skebu_wts', Coupling%skebu_wts)
call print_var(mpirank,omprank, blkno, 'Coupling%skebv_wts', Coupling%skebv_wts)
call print_var(mpirank,omprank, blkno, 'Coupling%skebu_wts', Coupling%skebu_wts )
call print_var(mpirank,omprank, blkno, 'Coupling%skebv_wts', Coupling%skebv_wts )
end if
if (Model%do_sfcperts) then
call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts', Coupling%sfc_wts)
call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts' , Coupling%sfc_wts )
end if
if (Model%do_ca) then
call print_var(mpirank,omprank, blkno, 'Coupling%tconvtend', Coupling%tconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%qconvtend', Coupling%qconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%uconvtend', Coupling%uconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%vconvtend', Coupling%vconvtend )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_out ', Coupling%ca_out )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_deep ', Coupling%ca_deep )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_turb ', Coupling%ca_turb )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_shal ', Coupling%ca_shal )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_rad ', Coupling%ca_rad )
call print_var(mpirank,omprank, blkno, 'Coupling%ca_micro ', Coupling%ca_micro )
call print_var(mpirank,omprank, blkno, 'Coupling%cape ', Coupling%cape )
end if
if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then
call print_var(mpirank,omprank, blkno, 'Coupling%nwfa2d', Coupling%nwfa2d)
Expand Down
Loading

0 comments on commit f2a8df4

Please sign in to comment.