Skip to content

Commit

Permalink
Merge pull request #10 from climbfuji/merge_gsd_develop_and_update_ba…
Browse files Browse the repository at this point in the history
…sedir_builddir_logic

dtc/develop: merge gsd/develop, update CCPP prebuild config
  • Loading branch information
climbfuji authored Nov 27, 2019
2 parents cb7e389 + 661e98c commit bc31689
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 22 deletions.
4 changes: 4 additions & 0 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@
'FV3/ccpp/physics/physics/GFS_suite_init_finalize_test.F90' : [ 'slow_physics' ],
}

# Default build dir, relative to current working directory,
# if not specified as command-line argument
DEFAULT_BUILD_DIR = 'FV3'

# Auto-generated makefile/cmakefile snippets that contain all schemes
SCHEMES_MAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.mk'
SCHEMES_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.cmake'
Expand Down
2 changes: 1 addition & 1 deletion ccpp/framework
83 changes: 83 additions & 0 deletions ccpp/suites/suite_FV3_GSD_SAR.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="FV3_GSD_SAR" lib="ccppphys" ver="3">
<!-- <init></init> -->
<group name="time_vary">
<subcycle loop="1">
<scheme>GFS_time_vary_pre</scheme>
<scheme>GFS_rrtmg_setup</scheme>
<scheme>GFS_rad_time_vary</scheme>
<scheme>GFS_phys_time_vary</scheme>
</subcycle>
</group>
<group name="radiation">
<subcycle loop="1">
<scheme>GFS_suite_interstitial_rad_reset</scheme>
<scheme>GFS_rrtmg_pre</scheme>
<scheme>rrtmg_sw_pre</scheme>
<scheme>mynnrad_pre</scheme>
<scheme>rrtmg_sw</scheme>
<scheme>rrtmg_sw_post</scheme>
<scheme>rrtmg_lw_pre</scheme>
<scheme>rrtmg_lw</scheme>
<scheme>mynnrad_post</scheme>
<scheme>rrtmg_lw_post</scheme>
<scheme>GFS_rrtmg_post</scheme>
</subcycle>
</group>
<group name="physics">
<subcycle loop="1">
<scheme>GFS_suite_interstitial_phys_reset</scheme>
<scheme>GFS_suite_stateout_reset</scheme>
<scheme>get_prs_fv3</scheme>
<scheme>GFS_suite_interstitial_1</scheme>
<scheme>GFS_surface_generic_pre</scheme>
<scheme>GFS_surface_composites_pre</scheme>
<scheme>dcyc2t3</scheme>
<scheme>GFS_surface_composites_inter</scheme>
<scheme>GFS_suite_interstitial_2</scheme>
</subcycle>
<!-- Surface iteration loop -->
<subcycle loop="2">
<scheme>sfc_diff</scheme>
<scheme>GFS_surface_loop_control_part1</scheme>
<scheme>sfc_nst_pre</scheme>
<scheme>sfc_nst</scheme>
<scheme>sfc_nst_post</scheme>
<scheme>lsm_ruc</scheme>
<scheme>lsm_ruc_sfc_sice_pre</scheme>
<scheme>sfc_sice</scheme>
<scheme>lsm_ruc_sfc_sice_post</scheme>
<scheme>GFS_surface_loop_control_part2</scheme>
</subcycle>
<!-- End of surface iteration loop -->
<subcycle loop="1">
<scheme>GFS_surface_composites_post</scheme>
<scheme>dcyc2t3_post</scheme>
<scheme>sfc_diag</scheme>
<scheme>sfc_diag_post</scheme>
<scheme>GFS_surface_generic_post</scheme>
<scheme>mynnedmf_wrapper</scheme>
<scheme>GFS_GWD_generic_pre</scheme>
<scheme>cires_ugwp</scheme>
<scheme>cires_ugwp_post</scheme>
<scheme>GFS_GWD_generic_post</scheme>
<scheme>rayleigh_damp</scheme>
<scheme>GFS_suite_stateout_update</scheme>
<scheme>ozphys_2015</scheme>
<scheme>h2ophys</scheme>
<scheme>GFS_MP_generic_pre</scheme>
<scheme>mp_thompson_pre</scheme>
<scheme>mp_thompson</scheme>
<scheme>mp_thompson_post</scheme>
<scheme>GFS_MP_generic_post</scheme>
<scheme>maximum_hourly_diagnostics</scheme>
</subcycle>
</group>
<group name="stochastics">
<subcycle loop="1">
<scheme>GFS_stochastics</scheme>
</subcycle>
</group>
<!-- <finalize></finalize> -->
</suite>
13 changes: 13 additions & 0 deletions gfsphysics/GFS_layer/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,19 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
enddo

#ifdef CCPP
if (Model%rdlai) then
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'xlaixy'
ExtDiag(idx)%desc = 'leaf area index'
ExtDiag(idx)%unit = 'number'
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%xlaixy(:)
enddo
endif

if (Model%lsm == Model%lsm_ruc) then
do num = 1,Model%lsoil_lsm
write (xtra,'(i1)') num
Expand Down
47 changes: 30 additions & 17 deletions gfsphysics/GFS_layer/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ module GFS_typedefs
integer :: lsoil_lsm !< number of soil layers internal to land surface model
integer :: lsnow_lsm !< maximum number of snow layers internal to land surface model
integer :: lsnow_lsm_lbound!< lower bound for snow arrays, depending on lsnow_lsm
logical :: rdlai
#endif
integer :: ivegsrc !< ivegsrc = 0 => USGS,
!< ivegsrc = 1 => IGBP (20 category)
Expand Down Expand Up @@ -2321,6 +2322,11 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%tsnow = clear_val
Sfcprop%snowfallac = clear_val
Sfcprop%acsnow = clear_val
!
if (Model%rdlai) then
allocate (Sfcprop%xlaixy (IM))
Sfcprop%xlaixy = clear_val
end if
end if
if (Model%do_mynnsfclay) then
! For MYNN surface layer scheme
Expand Down Expand Up @@ -2796,6 +2802,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
#ifdef CCPP
integer :: lsoil_lsm = -1 !< number of soil layers internal to land surface model; -1 use lsoil
integer :: lsnow_lsm = 3 !< maximum number of snow layers internal to land surface model
logical :: rdlai = .false.
#endif
integer :: ivegsrc = 2 !< ivegsrc = 0 => USGS,
!< ivegsrc = 1 => IGBP (20 category)
Expand Down Expand Up @@ -3078,7 +3085,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
avg_max_length, &
!--- land/surface model control
#ifdef CCPP
lsm, lsoil, lsoil_lsm, lsnow_lsm, nmtvr, ivegsrc, use_ufo, &
lsm, lsoil, lsoil_lsm, lsnow_lsm, rdlai, &
nmtvr, ivegsrc, use_ufo, &
#else
lsm, lsoil, nmtvr, ivegsrc, use_ufo, &
#endif
Expand Down Expand Up @@ -3382,6 +3390,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
write(0,*) 'Logic error: RUC LSM cannot be used with surface data cycling at this point (fhcyc>0)'
stop
end if
! Flag to read leaf area index from input files (initial conditions)
Model%rdlai = rdlai
if (Model%rdlai .and. .not. Model%lsm == Model%lsm_ruc) then
write(0,*) 'Logic error: rdlai = .true. only works with RUC LSM'
stop
end if
! Set surface layers for CCPP physics
if (lsoil_lsm==-1) then
Model%lsoil_lsm = lsoil
Expand Down Expand Up @@ -3834,7 +3848,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
' Boundary layer and Shallow Convection', &
' nshoc_3d=',Model%nshoc_3d, &
' nshoc_2d=',Model%nshoc_2d, &
' ntke=',Model%ntke,'shoc_parm=',shoc_parm
' ntke=',Model%ntke,' shoc_parm=',shoc_parm
endif

#ifdef CCPP
Expand Down Expand Up @@ -4437,6 +4451,7 @@ subroutine control_print(Model)
print *, ' lsm : ', Model%lsm
print *, ' lsoil : ', Model%lsoil
#ifdef CCPP
print *, ' rdlai : ', Model%rdlai
print *, ' lsoil_lsm : ', Model%lsoil_lsm
print *, ' lsnow_lsm : ', Model%lsnow_lsm
#endif
Expand Down Expand Up @@ -4867,7 +4882,7 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%snowprv = clear_val
Tbd%graupelprv = clear_val
end if

if (Model%lsm == Model%lsm_noahmp) then
allocate(Tbd%draincprv (IM))
allocate(Tbd%drainncprv (IM))
Expand Down Expand Up @@ -4902,7 +4917,7 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%qsq = clear_val
Tbd%cov = clear_val
end if

! MYJ variables
if (Model%do_myjsfc.or.Model%do_myjpbl) then
!print*,"Allocating all MYJ surface variables:"
Expand Down Expand Up @@ -6033,7 +6048,6 @@ subroutine interstitial_setup_tracers(Interstitial, Model)
Interstitial%nncl = 5
endif


if (Model%imp_physics == Model%imp_physics_mg) then
if (abs(Model%fprcp) == 1) then
Interstitial%nncl = 4 ! MG2 with rain and snow
Expand Down Expand Up @@ -6185,8 +6199,7 @@ subroutine interstitial_rad_reset (Interstitial, Model)
Interstitial%tsfg = clear_val

! F-A scheme
!if (Model%imp_physics == Model%imp_physics_fer_hires) then
if (Model%imp_physics == Model%imp_physics_fer_hires ) then
if (Model%imp_physics == Model%imp_physics_fer_hires) then
Interstitial%qv_r = clear_val
Interstitial%qc_r = clear_val
Interstitial%qi_r = clear_val
Expand Down Expand Up @@ -6768,17 +6781,17 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno)
! Print arrays that are conditional on physics choices
if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson) then
write (0,*) 'Interstitial_print: values specific to GFDL/Thompson microphysics'
write (0,*) 'sum(Interstitial%graupelmp) = ', sum(Interstitial%graupelmp )
write (0,*) 'sum(Interstitial%icemp ) = ', sum(Interstitial%icemp )
write (0,*) 'sum(Interstitial%rainmp ) = ', sum(Interstitial%rainmp )
write (0,*) 'sum(Interstitial%snowmp ) = ', sum(Interstitial%snowmp )
write (0,*) 'sum(Interstitial%graupelmp ) = ', sum(Interstitial%graupelmp )
write (0,*) 'sum(Interstitial%icemp ) = ', sum(Interstitial%icemp )
write (0,*) 'sum(Interstitial%rainmp ) = ', sum(Interstitial%rainmp )
write (0,*) 'sum(Interstitial%snowmp ) = ', sum(Interstitial%snowmp )
!F-A scheme
else if (Model%imp_physics == Model%imp_physics_fer_hires) then
write (0,*) 'Interstitial_print: values specific to F-A microphysics'
write (0,*) 'sum(Interstitial%f_ice ) = ', sum(Interstitial%f_ice )
write (0,*) 'sum(Interstitial%f_rain ) = ', sum(Interstitial%f_rain )
write (0,*) 'sum(Interstitial%f_rimef ) = ', sum(Interstitial%f_rimef )
write (0,*) 'sum(Interstitial%cwm ) = ', sum(Interstitial%cwm )
write (0,*) 'sum(Interstitial%f_ice ) = ', sum(Interstitial%f_ice )
write (0,*) 'sum(Interstitial%f_rain ) = ', sum(Interstitial%f_rain )
write (0,*) 'sum(Interstitial%f_rimef ) = ', sum(Interstitial%f_rimef )
write (0,*) 'sum(Interstitial%cwm ) = ', sum(Interstitial%cwm )
else if (Model%imp_physics == Model%imp_physics_mg) then
write (0,*) 'Interstitial_print: values specific to MG microphysics'
write (0,*) 'sum(Interstitial%ncgl ) = ', sum(Interstitial%ncgl )
Expand Down Expand Up @@ -6808,8 +6821,8 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno)
write (0,*) 'sum(Interstitial%ncpl ) = ', sum(Interstitial%ncpl )
end if
if (Model%lsm == Model%lsm_noahmp) then
write (0,*) 'sum(Interstitial%t2mmp ) = ', sum(Interstitial%t2mmp )
write (0,*) 'sum(Interstitial%q2mp ) = ', sum(Interstitial%q2mp )
write (0,*) 'sum(Interstitial%t2mmp ) = ', sum(Interstitial%t2mmp )
write (0,*) 'sum(Interstitial%q2mp ) = ', sum(Interstitial%q2mp )
end if
write (0,*) 'Interstitial_print: end'
!
Expand Down
6 changes: 6 additions & 0 deletions gfsphysics/GFS_layer/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,12 @@
units = count
dimensions = ()
type = integer
[rdlai]
standard_name = flag_for_reading_leaf_area_index_from_input
long_name = flag for reading leaf area index from initial conditions for RUC LSM
units = flag
dimensions = ()
type = logical
[ivegsrc]
standard_name = vegetation_type_dataset_choice
long_name = land use dataset choice
Expand Down
34 changes: 31 additions & 3 deletions io/FV3GFS_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,18 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain)
nvar_s2o = 18
#ifdef CCPP
if (Model%lsm == Model%lsm_ruc .and. warm_start) then
nvar_s2r = 6
if(Model%rdlai) then
nvar_s2r = 7
else
nvar_s2r = 6
end if
nvar_s3 = 5
else
nvar_s2r = 0
if(Model%rdlai) then
nvar_s2r = 1
else
nvar_s2r = 0
endif
nvar_s3 = 3
endif
#else
Expand Down Expand Up @@ -759,6 +767,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain)
sfc_name2(nvar_s2m+22) = 'tsnow'
sfc_name2(nvar_s2m+23) = 'snowfall_acc'
sfc_name2(nvar_s2m+24) = 'swe_snowfall_acc'
if (Model%rdlai) then
sfc_name2(nvar_s2m+25) = 'lai'
endif
else if (Model%lsm == Model%lsm_ruc .and. Model%rdlai) then
sfc_name2(nvar_s2m+19) = 'lai'
#endif
endif

Expand Down Expand Up @@ -957,6 +970,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain)
Sfcprop(nb)%tsnow(ix) = sfc_var2(i,j,nvar_s2m+22)
Sfcprop(nb)%snowfallac(ix) = sfc_var2(i,j,nvar_s2m+23)
Sfcprop(nb)%acsnow(ix) = sfc_var2(i,j,nvar_s2m+24)
if (Model%rdlai) then
Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+25)
endif
else if (Model%lsm == Model%lsm_ruc .and. Model%rdlai) then
Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+19)
elseif (Model%lsm == Model%lsm_noahmp) then
!--- Extra Noah MP variables
#else
Expand Down Expand Up @@ -1453,7 +1471,11 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
nvar2o = 18
#ifdef CCPP
if (Model%lsm == Model%lsm_ruc) then
nvar2r = 6
if (Model%rdlai) then
nvar2r = 7
else
nvar2r = 6
endif
nvar3 = 5
else
nvar2r = 0
Expand Down Expand Up @@ -1587,6 +1609,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
sfc_name2(nvar2m+22) = 'tsnow'
sfc_name2(nvar2m+23) = 'snowfall_acc'
sfc_name2(nvar2m+24) = 'swe_snowfall_acc'
if (Model%rdlai) then
sfc_name2(nvar2m+25) = 'lai'
endif
else if(Model%lsm == Model%lsm_noahmp) then
#else
! Only needed when Noah MP LSM is used - 29 2D
Expand Down Expand Up @@ -1789,6 +1814,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
sfc_var2(i,j,nvar2m+22) = Sfcprop(nb)%tsnow(ix)
sfc_var2(i,j,nvar2m+23) = Sfcprop(nb)%snowfallac(ix)
sfc_var2(i,j,nvar2m+24) = Sfcprop(nb)%acsnow(ix)
if (Model%rdlai) then
sfc_var2(i,j,nvar2m+25) = Sfcprop(nb)%xlaixy(ix)
endif
else if (Model%lsm == Model%lsm_noahmp) then

#else
Expand Down

0 comments on commit bc31689

Please sign in to comment.