Skip to content

Commit f2a8df4

Browse files
authored
Merge pull request #2 from NCAR/master
update from NCAR's master
2 parents 9f851be + c7c922f commit f2a8df4

File tree

81 files changed

+12803
-2687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+12803
-2687
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "physics/rte-rrtmgp"]
2+
path = physics/rte-rrtmgp
3+
url = https://github.com/RobertPincus/rte-rrtmgp
4+
branch = dtc/ccpp

CMakeLists.txt

+26-47
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@ if(NOT PROJECT)
55
endif (NOT PROJECT)
66

77
#------------------------------------------------------------------------------
8-
cmake_minimum_required(VERSION 2.8.11)
8+
cmake_minimum_required(VERSION 3.0)
9+
10+
project(ccppphys
11+
VERSION 3.0.0
12+
LANGUAGES C CXX Fortran)
913

1014
# Use rpaths on MacOSX
1115
set(CMAKE_MACOSX_RPATH 1)
12-
13-
if(POLICY CMP0048)
14-
cmake_policy(SET CMP0048 NEW)
15-
project(ccppphys VERSION 3.0.0)
16-
else(POLICY CMP0048)
17-
project(ccppphys)
18-
set(PROJECT_VERSION 3.0.0)
19-
set(PROJECT_VERSION_MAJOR 3)
20-
set(PROJECT_VERSION_MINOR 0)
21-
set(PROJECT_VERSION_PATCH 0)
22-
endif(POLICY CMP0048)
23-
2416
if(POLICY CMP0042)
2517
cmake_policy(SET CMP0042 NEW)
2618
endif(POLICY CMP0042)
@@ -29,17 +21,6 @@ endif(POLICY CMP0042)
2921
set(PACKAGE "ccpp-physics")
3022
set(AUTHORS "Grant J. Firl" "Dom Heinzeller")
3123

32-
#------------------------------------------------------------------------------
33-
# Enable Fortran
34-
enable_language(Fortran)
35-
36-
if (PROJECT STREQUAL "CCPP-SCM")
37-
#------------------------------------------------------------------------------
38-
# CMake Modules
39-
# Set the CMake module path
40-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../framework/cmake")
41-
endif (PROJECT STREQUAL "CCPP-SCM")
42-
4324
#------------------------------------------------------------------------------
4425
# Set OpenMP flags for C/C++/Fortran
4526
if (OPENMP)
@@ -85,33 +66,38 @@ else(STATIC)
8566
endif(STATIC)
8667

8768
#------------------------------------------------------------------------------
88-
# Add the CCPP include/module directory
89-
set(CCPP_INCLUDE_DIRS "" CACHE FILEPATH "Path to ccpp includes")
90-
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${CCPP_INCLUDE_DIRS})
91-
92-
#------------------------------------------------------------------------------
93-
# Add the CCPP library
94-
set(CCPP_LIB_DIRS "" CACHE FILEPATH "Path to ccpp library")
95-
link_directories(${CCPP_LIB_DIRS})
96-
list(APPEND LIBS "ccpp")
69+
# Set the sources: physics type definitions
70+
set(TYPEDEFS $ENV{CCPP_TYPEDEFS})
71+
if(TYPEDEFS)
72+
message(STATUS "Got CCPP TYPEDEFS from environment variable: ${TYPEDEFS}")
73+
else(TYPEDEFS)
74+
include(./CCPP_TYPEDEFS.cmake)
75+
message(STATUS "Got CCPP TYPEDEFS from cmakefile include file: ${TYPEDEFS}")
76+
endif(TYPEDEFS)
77+
78+
# Generate list of Fortran modules from the CCPP type
79+
# definitions that need need to be installed
80+
foreach(typedef_module ${TYPEDEFS})
81+
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module})
82+
endforeach()
9783

9884
#------------------------------------------------------------------------------
9985
# Set the sources: physics schemes
10086
set(SCHEMES $ENV{CCPP_SCHEMES})
10187
if(SCHEMES)
102-
message(INFO "Got CCPP_SCHEMES from environment variable: ${SCHEMES}")
88+
message(STATUS "Got CCPP SCHEMES from environment variable: ${SCHEMES}")
10389
else(SCHEMES)
10490
include(./CCPP_SCHEMES.cmake)
105-
message(INFO "Got SCHEMES from cmakefile include file: ${SCHEMES}")
91+
message(STATUS "Got CCPP SCHEMES from cmakefile include file: ${SCHEMES}")
10692
endif(SCHEMES)
10793

10894
# Set the sources: physics scheme caps
10995
set(CAPS $ENV{CCPP_CAPS})
11096
if(CAPS)
111-
message(INFO "Got CAPS from environment variable: ${CAPS}")
97+
message(STATUS "Got CCPP CAPS from environment variable: ${CAPS}")
11298
else(CAPS)
11399
include(./CCPP_CAPS.cmake)
114-
message(INFO "Got CAPS from cmakefile include file: ${CAPS}")
100+
message(STATUS "Got CCPP CAPS from cmakefile include file: ${CAPS}")
115101
endif(CAPS)
116102

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

343-
if (PROJECT STREQUAL "CCPP-SCM")
344-
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ccpp/framework/src)
345-
endif (PROJECT STREQUAL "CCPP-SCM")
346-
347329
#------------------------------------------------------------------------------
348-
349330
if(STATIC)
350331
add_library(ccppphys STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
351332
# Generate list of Fortran modules from defined sources
@@ -398,9 +379,7 @@ if (PROJECT STREQUAL "CCPP-FV3")
398379
FILE ccppphys-config.cmake
399380
DESTINATION lib/cmake
400381
)
401-
if(STATIC)
402-
# Define where to install the C headers and Fortran modules
403-
#install(FILES ${HEADERS_C} DESTINATION include)
404-
install(FILES ${MODULES_F90} DESTINATION include)
405-
endif(STATIC)
382+
# Define where to install the C headers and Fortran modules
383+
#install(FILES ${HEADERS_C} DESTINATION include)
384+
install(FILES ${MODULES_F90} DESTINATION include)
406385
endif (PROJECT STREQUAL "CCPP-FV3")

README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
# GMTB GFS Physics
1+
# CCPP Physics
22

3-
This repository contains the GFS Physics scheme.
3+
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.
44

5+
Please see more information about the CCPP at the locations below.
56

7+
- [CCPP website hosted by the Developmental Testbed Center (DTC)](https://dtcenter.org/ccpp)
8+
- [CCPP public release information](https://dtcenter.org/community-code/common-community-physics-package-ccpp/ccpp-scm-version-4-0)
9+
- [CCPP Technical Documentation](https://ccpp-techdoc.readthedocs.io/en/latest/)
10+
- [CCPP Scientific Documentation](https://dtcenter.org/GMTB/v4.0/sci_doc/)
11+
- [CCPP Physics GutHub wiki](https://github.com/NCAR/ccpp-physics/wiki)
12+
- [CCPP Framework GitHub wiki](https://github.com/NCAR/ccpp-framework/wiki)
13+
14+
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).
15+
16+
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/).
17+
18+
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/)

physics/GFS_MP_generic.F90

+10-17
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
157157
errflg = 0
158158

159159
onebg = one/con_g
160-
160+
161161
do i = 1, im
162162
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
163163
enddo
@@ -191,11 +191,11 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
191191
end if
192192

193193
if (lsm==lsm_ruc .or. lsm==lsm_noahmp) then
194-
raincprv(:) = rainc(:)
195-
rainncprv(:) = frain * rain1(:)
196-
iceprv(:) = ice(:)
197-
snowprv(:) = snow(:)
198-
graupelprv(:) = graupel(:)
194+
raincprv(:) = rainc(:)
195+
rainncprv(:) = frain * rain1(:)
196+
iceprv(:) = ice(:)
197+
snowprv(:) = snow(:)
198+
graupelprv(:) = graupel(:)
199199
!for NoahMP, calculate precipitation rates from liquid water equivalent thickness for use in next time step
200200
!Note (GJF): Precipitation LWE thicknesses are multiplied by the frain factor, and are thus on the dynamics time step, but the conversion as written
201201
! (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).
@@ -341,8 +341,10 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
341341

342342
if (cplflx .or. cplchm) then
343343
do i = 1, im
344-
rain_cpl(i) = rain_cpl(i) + rain(i) * (one-srflag(i))
345-
snow_cpl(i) = snow_cpl(i) + rain(i) * srflag(i)
344+
drain_cpl(i) = rain(i) * (one-srflag(i))
345+
dsnow_cpl(i) = rain(i) * srflag(i)
346+
rain_cpl(i) = rain_cpl(i) + drain_cpl(i)
347+
snow_cpl(i) = snow_cpl(i) + dsnow_cpl(i)
346348
enddo
347349
endif
348350

@@ -376,15 +378,6 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
376378
if (do_sppt) then
377379
!--- radiation heating rate
378380
dtdtr(1:im,:) = dtdtr(1:im,:) + dtdtc(1:im,:)*dtf
379-
do i = 1, im
380-
if (t850(i) > 273.16) then
381-
!--- change in change in rain precip
382-
drain_cpl(i) = rain(i) - drain_cpl(i)
383-
else
384-
!--- change in change in snow precip
385-
dsnow_cpl(i) = rain(i) - dsnow_cpl(i)
386-
endif
387-
enddo
388381
endif
389382

390383
end subroutine GFS_MP_generic_post_run

physics/GFS_PBL_generic.F90

+12-9
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
331331
character(len=*), intent(out) :: errmsg
332332
integer, intent(out) :: errflg
333333

334-
real(kind=kind_phys), parameter :: huge=1.0d30, epsln = 1.0d-10
334+
real(kind=kind_phys), parameter :: zero = 0.0d0
335+
real(kind=kind_phys), parameter :: one = 1.0d0
336+
real(kind=kind_phys), parameter :: huge = 9.9692099683868690E36 ! NetCDF float FillValue, same as in GFS_typedefs.F90
337+
real(kind=kind_phys), parameter :: epsln = 1.0d-10 ! same as in GFS_physics_driver.F90
335338
integer :: i, k, kk, k1, n
336339
real(kind=kind_phys) :: tem, tem1, rho
337340

@@ -486,7 +489,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
486489
if (cplchm) then
487490
do i = 1, im
488491
tem1 = max(q1(i), 1.e-8)
489-
tem = prsl(i,1) / (rd*t1(i)*(1.0+fvirt*tem1))
492+
tem = prsl(i,1) / (rd*t1(i)*(one+fvirt*tem1))
490493
ushfsfci(i) = -cp * tem * hflx(i) ! upward sensible heat flux
491494
enddo
492495
! dkt_cpl has dimensions (1:im,1:levs), but dkt has (1:im,1:levs-1)
@@ -498,22 +501,22 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
498501

499502
if (cplflx) then
500503
do i=1,im
501-
if (oceanfrac(i) > 0.0) then ! Ocean only, NO LAKES
502-
if (fice(i) > 1.-epsln) then ! no open water, use results from CICE
504+
if (oceanfrac(i) > zero) then ! Ocean only, NO LAKES
505+
if (fice(i) > one - epsln) then ! no open water, use results from CICE
503506
dusfci_cpl(i) = dusfc_cice(i)
504507
dvsfci_cpl(i) = dvsfc_cice(i)
505508
dtsfci_cpl(i) = dtsfc_cice(i)
506509
dqsfci_cpl(i) = dqsfc_cice(i)
507-
elseif (dry(i) .or. icy(i)) then ! use stress_ocean from sfc_diff for opw component at mixed point
510+
elseif (icy(i) .or. dry(i)) then ! use stress_ocean from sfc_diff for opw component at mixed point
508511
tem1 = max(q1(i), 1.e-8)
509-
rho = prsl(i,1) / (rd*t1(i)*(1.0+fvirt*tem1))
510-
if (wind(i) > 0.0) then
512+
rho = prsl(i,1) / (rd*t1(i)*(one+fvirt*tem1))
513+
if (wind(i) > zero) then
511514
tem = - rho * stress_ocn(i) / wind(i)
512515
dusfci_cpl(i) = tem * ugrs1(i) ! U-momentum flux
513516
dvsfci_cpl(i) = tem * vgrs1(i) ! V-momentum flux
514517
else
515-
dusfci_cpl(i) = 0.0
516-
dvsfci_cpl(i) = 0.0
518+
dusfci_cpl(i) = zero
519+
dvsfci_cpl(i) = zero
517520
endif
518521
dtsfci_cpl(i) = cp * rho * hflx_ocn(i) ! sensible heat flux over open ocean
519522
dqsfci_cpl(i) = hvap * rho * evap_ocn(i) ! latent heat flux over open ocean

physics/GFS_PBL_generic.meta

+10-10
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@
747747
intent = in
748748
optional = F
749749
[htrsw]
750-
standard_name = tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep
750+
standard_name = tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_time_step
751751
long_name = total sky sw heating rate
752752
units = K s-1
753753
dimensions = (horizontal_dimension,vertical_dimension)
@@ -756,7 +756,7 @@
756756
intent = in
757757
optional = F
758758
[htrlw]
759-
standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_timestep
759+
standard_name = tendency_of_air_temperature_due_to_longwave_heating_on_radiation_time_step
760760
long_name = total sky lw heating rate
761761
units = K s-1
762762
dimensions = (horizontal_dimension,vertical_dimension)
@@ -1089,35 +1089,35 @@
10891089
intent = in
10901090
optional = F
10911091
[dusfc_cice]
1092-
standard_name = surface_x_momentum_flux_for_coupling_interstitial
1093-
long_name = sfc x momentum flux for coupling interstitial
1092+
standard_name = surface_x_momentum_flux_for_coupling
1093+
long_name = sfc x momentum flux for coupling
10941094
units = Pa
10951095
dimensions = (horizontal_dimension)
10961096
type = real
10971097
kind = kind_phys
10981098
intent = in
10991099
optional = F
11001100
[dvsfc_cice]
1101-
standard_name = surface_y_momentum_flux_for_coupling_interstitial
1102-
long_name = sfc y momentum flux for coupling interstitial
1101+
standard_name = surface_y_momentum_flux_for_coupling
1102+
long_name = sfc y momentum flux for coupling
11031103
units = Pa
11041104
dimensions = (horizontal_dimension)
11051105
type = real
11061106
kind = kind_phys
11071107
intent = in
11081108
optional = F
11091109
[dtsfc_cice]
1110-
standard_name = surface_upward_sensible_heat_flux_for_coupling_interstitial
1111-
long_name = sfc sensible heat flux for coupling interstitial
1110+
standard_name = surface_upward_sensible_heat_flux_for_coupling
1111+
long_name = sfc sensible heat flux for coupling
11121112
units = W m-2
11131113
dimensions = (horizontal_dimension)
11141114
type = real
11151115
kind = kind_phys
11161116
intent = in
11171117
optional = F
11181118
[dqsfc_cice]
1119-
standard_name = surface_upward_latent_heat_flux_for_coupling_interstitial
1120-
long_name = sfc latent heat flux for coupling interstitial
1119+
standard_name = surface_upward_latent_heat_flux_for_coupling
1120+
long_name = sfc latent heat flux for coupling
11211121
units = W m-2
11221122
dimensions = (horizontal_dimension)
11231123
type = real

physics/GFS_debug.F90

+21-3
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,12 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
402402
call print_var(mpirank,omprank, blkno, 'Coupling%rain_cpl', Coupling%rain_cpl)
403403
call print_var(mpirank,omprank, blkno, 'Coupling%snow_cpl', Coupling%snow_cpl)
404404
end if
405+
if (Model%cplwav2atm) then
406+
call print_var(mpirank,omprank, blkno, 'Coupling%zorlwav_cpl' , Coupling%zorlwav_cpl )
407+
end if
405408
if (Model%cplflx) then
409+
call print_var(mpirank,omprank, blkno, 'Coupling%oro_cpl' , Coupling%oro_cpl )
410+
call print_var(mpirank,omprank, blkno, 'Coupling%slmsk_cpl' , Coupling%slmsk_cpl )
406411
call print_var(mpirank,omprank, blkno, 'Coupling%slimskin_cpl', Coupling%slimskin_cpl )
407412
call print_var(mpirank,omprank, blkno, 'Coupling%dusfcin_cpl ', Coupling%dusfcin_cpl )
408413
call print_var(mpirank,omprank, blkno, 'Coupling%dvsfcin_cpl ', Coupling%dvsfcin_cpl )
@@ -466,11 +471,24 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
466471
call print_var(mpirank,omprank, blkno, 'Coupling%shum_wts', Coupling%shum_wts)
467472
end if
468473
if (Model%do_skeb) then
469-
call print_var(mpirank,omprank, blkno, 'Coupling%skebu_wts', Coupling%skebu_wts)
470-
call print_var(mpirank,omprank, blkno, 'Coupling%skebv_wts', Coupling%skebv_wts)
474+
call print_var(mpirank,omprank, blkno, 'Coupling%skebu_wts', Coupling%skebu_wts )
475+
call print_var(mpirank,omprank, blkno, 'Coupling%skebv_wts', Coupling%skebv_wts )
471476
end if
472477
if (Model%do_sfcperts) then
473-
call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts', Coupling%sfc_wts)
478+
call print_var(mpirank,omprank, blkno, 'Coupling%sfc_wts' , Coupling%sfc_wts )
479+
end if
480+
if (Model%do_ca) then
481+
call print_var(mpirank,omprank, blkno, 'Coupling%tconvtend', Coupling%tconvtend )
482+
call print_var(mpirank,omprank, blkno, 'Coupling%qconvtend', Coupling%qconvtend )
483+
call print_var(mpirank,omprank, blkno, 'Coupling%uconvtend', Coupling%uconvtend )
484+
call print_var(mpirank,omprank, blkno, 'Coupling%vconvtend', Coupling%vconvtend )
485+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_out ', Coupling%ca_out )
486+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_deep ', Coupling%ca_deep )
487+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_turb ', Coupling%ca_turb )
488+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_shal ', Coupling%ca_shal )
489+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_rad ', Coupling%ca_rad )
490+
call print_var(mpirank,omprank, blkno, 'Coupling%ca_micro ', Coupling%ca_micro )
491+
call print_var(mpirank,omprank, blkno, 'Coupling%cape ', Coupling%cape )
474492
end if
475493
if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then
476494
call print_var(mpirank,omprank, blkno, 'Coupling%nwfa2d', Coupling%nwfa2d)

0 commit comments

Comments
 (0)