Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Noah MP init to CCPP and add new variables for Noah MP #249

Merged
merged 17 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
911933c
Update .gitmodules and submodule pointer for ccpp-physics for code re…
climbfuji Feb 17, 2021
9234bc6
Move Noah MP initialization to CCPP, add/update variables and variabl…
climbfuji Feb 17, 2021
6777a50
Remove gfsphysics
climbfuji Feb 17, 2021
6a3550d
ccpp/driver/GFS_restart.F90: required changes for restart reproducibi…
climbfuji Feb 18, 2021
dc19418
Fix cmake dependencies
climbfuji Feb 18, 2021
897b972
updating noah mp
HelinWei-NOAA Feb 20, 2021
e554c34
Update submodule pointer for ccpp-physics
climbfuji Feb 21, 2021
7ccc459
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into noa…
climbfuji Feb 21, 2021
80456cf
Fix indentation in ccpp/data/GFS_typedefs.F90
climbfuji Feb 21, 2021
286a029
Update submodule pointer for ccpp-physics, fix formatting in ccpp/dat…
climbfuji Feb 22, 2021
88e2b30
Remove ccpp (=ccpp-framework) from target_link_libraries of the fv3dy…
climbfuji Feb 25, 2021
4190bf2
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into noa…
climbfuji Feb 25, 2021
b602232
Revert a change in ccpp/data/GFS_typedefs.F90, made as part of the UG…
climbfuji Feb 25, 2021
f4677b8
Update submodule pointer for ccpp-physics
climbfuji Feb 25, 2021
1d9c848
Add Interstitial%gas_concentrations%concs(:)%conc to Interstitial%rad…
climbfuji Feb 25, 2021
67e831a
Update submodule pointer for ccpp-physics
climbfuji Feb 26, 2021
23c8b80
Revert change to .gitmodules and update submodule pointer for fv3atm
climbfuji Mar 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
branch = master
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = master
#url = https://github.com/NCAR/ccpp-physics
#branch = master
url = https://github.com/climbfuji/ccpp-physics
branch = noahmp_init_in_ccpp
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if(NOT RC EQUAL 0)
endif()

add_subdirectory(cpl)
add_subdirectory(gfsphysics)
add_subdirectory(io)

###############################################################################
Expand Down Expand Up @@ -109,7 +108,8 @@ target_include_directories(fv3dycore INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT
$<INSTALL_INTERFACE:mod>)

target_link_libraries(fv3dycore PUBLIC fms
gfsphysics
climbfuji marked this conversation as resolved.
Show resolved Hide resolved
ccppphys
ccppdata
esmf)
if(OpenMP_Fortran_FOUND)
target_link_libraries(fv3dycore PUBLIC OpenMP::OpenMP_Fortran)
Expand All @@ -123,10 +123,9 @@ add_subdirectory(ccpp)
add_subdirectory(ccpp/data)
add_subdirectory(ccpp/driver)
add_dependencies(ccppphys ccpp)
add_dependencies(gfsphysics ccpp ccppphys)
add_dependencies(ccppdata ccpp ccppphys gfsphysics)
add_dependencies(ccppdriver ccpp ccppphys ccppdata gfsphysics)
add_dependencies(fv3dycore ccppdriver ccpp ccppphys ccppdata gfsphysics)
add_dependencies(ccppdata ccpp ccppphys)
add_dependencies(ccppdriver ccpp ccppphys ccppdata)
add_dependencies(fv3dycore ccppdriver ccpp ccppphys ccppdata)
target_include_directories(fv3dycore PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/framework/src
${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics
${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver)
Expand Down Expand Up @@ -193,7 +192,7 @@ endif()
### Install
###############################################################################
install(
TARGETS fv3atm fv3dycore io gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper
TARGETS fv3atm fv3dycore io ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper
EXPORT fv3atm-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Expand Down
2 changes: 1 addition & 1 deletion ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
'ccpp/physics/physics/sfc_drv.f',
'ccpp/physics/physics/sfc_noah_wrfv4_interstitial.F90',
'ccpp/physics/physics/sfc_noah_wrfv4.F90',
'ccpp/physics/physics/sfc_noahmp_drv.f',
'ccpp/physics/physics/sfc_noahmp_drv.F90',
'ccpp/physics/physics/flake_driver.F90',
'ccpp/physics/physics/sfc_nst.f',
'ccpp/physics/physics/sfc_ocean.F',
Expand Down
89 changes: 68 additions & 21 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: smcwtdxy(:) => null() !<
real (kind=kind_phys), pointer :: deeprechxy(:)=> null() !<
real (kind=kind_phys), pointer :: rechxy (:) => null() !<
real (kind=kind_phys), pointer :: albdvis (:) => null() !<
real (kind=kind_phys), pointer :: albdnir (:) => null() !<
real (kind=kind_phys), pointer :: albivis (:) => null() !<
real (kind=kind_phys), pointer :: albinir (:) => null() !<
real (kind=kind_phys), pointer :: emiss (:) => null() !<

real (kind=kind_phys), pointer :: snicexy (:,:) => null() !<
real (kind=kind_phys), pointer :: snliqxy (:,:) => null() !<
Expand Down Expand Up @@ -780,7 +785,9 @@ 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
integer :: lsnow_lsm_ubound!< upper bound for snow arrays, depending on lsnow_lsm
real(kind=kind_phys), pointer :: zs(:) => null() !< depth of soil levels for land surface model
real(kind=kind_phys), pointer :: dzs(:) => null() !< thickness of soil levels for land surface model
real(kind=kind_phys), pointer :: pores(:) => null() !< max soil moisture for a given soil type for land surface model
real(kind=kind_phys), pointer :: resid(:) => null() !< min soil moisture for a given soil type for land surface model
logical :: rdlai !< read LAI from input file (for RUC LSM or NOAH LSM WRFv4)
Expand Down Expand Up @@ -1939,7 +1946,6 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: soilm_in_m(:) => null() !<
integer, pointer :: soiltype(:) => null() !<
real (kind=kind_phys), pointer :: stc_save(:,:) => null() !<
real (kind=kind_phys), pointer :: sthick (:) => null() !<
real (kind=kind_phys), pointer :: stress(:) => null() !<
real (kind=kind_phys), pointer :: stress_ice(:) => null() !<
real (kind=kind_phys), pointer :: stress_land(:) => null() !<
Expand Down Expand Up @@ -2462,10 +2468,15 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
allocate (Sfcprop%taussxy (IM))
allocate (Sfcprop%smcwtdxy (IM))
allocate (Sfcprop%deeprechxy (IM))
allocate (Sfcprop%rechxy (IM))
allocate (Sfcprop%snicexy (IM, Model%lsnow_lsm_lbound:0))
allocate (Sfcprop%snliqxy (IM, Model%lsnow_lsm_lbound:0))
allocate (Sfcprop%tsnoxy (IM, Model%lsnow_lsm_lbound:0))
allocate (Sfcprop%rechxy (IM))
allocate (Sfcprop%albdvis (IM))
allocate (Sfcprop%albdnir (IM))
allocate (Sfcprop%albivis (IM))
allocate (Sfcprop%albinir (IM))
allocate (Sfcprop%emiss (IM))
allocate (Sfcprop%snicexy (IM, Model%lsnow_lsm_lbound:Model%lsnow_lsm_ubound))
allocate (Sfcprop%snliqxy (IM, Model%lsnow_lsm_lbound:Model%lsnow_lsm_ubound))
allocate (Sfcprop%tsnoxy (IM, Model%lsnow_lsm_lbound:Model%lsnow_lsm_ubound))
allocate (Sfcprop%smoiseq (IM, Model%lsoil_lsm))
allocate (Sfcprop%zsnsoxy (IM, Model%lsnow_lsm_lbound:Model%lsoil_lsm))

Expand Down Expand Up @@ -2498,6 +2509,11 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%smcwtdxy = clear_val
Sfcprop%deeprechxy = clear_val
Sfcprop%rechxy = clear_val
Sfcprop%albdvis = clear_val
Sfcprop%albdnir = clear_val
Sfcprop%albivis = clear_val
Sfcprop%albinir = clear_val
Sfcprop%emiss = clear_val

Sfcprop%snicexy = clear_val
Sfcprop%snliqxy = clear_val
Expand Down Expand Up @@ -3845,17 +3861,33 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
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
else
Model%lsoil_lsm = lsoil_lsm
end if
! Allocate variable to store depth of soil layers
if (Model%lsm==Model%lsm_ruc) then
allocate (Model%zs(Model%lsoil_lsm))
Model%zs = clear_val
! DH* TODO - need to clean up how different land surface models handle initializing zs and dzs
! For Noah and NoahMP, hardcode here for the moment; for RUC, these variables get initialized
! in the RUC LSM init calls; for Noah WRF4, dzs gets initialized in sfc_noah_wrfv4_interstitial
! init, and zs doesn't get used at all.
! Allocate variables to store depth/thickness of soil layers
allocate (Model%zs (Model%lsoil_lsm))
allocate (Model%dzs(Model%lsoil_lsm))
if (Model%lsm==Model%lsm_noah .or. Model%lsm==Model%lsm_noahmp) then
if (Model%lsoil_lsm/=4) then
write(0,*) 'Error in GFS_typedefs.F90, number of soil layers must be 4 for Noah/NoahMP'
stop
end if
Model%zs = (/-0.1_kind_phys, -0.4_kind_phys, -1.0_kind_phys, -2.0_kind_phys/)
Model%dzs = (/ 0.1_kind_phys, 0.3_kind_phys, 0.6_kind_phys, 1.0_kind_phys/)
elseif (Model%lsm==Model%lsm_ruc .or. Model%lsm==Model%lsm_noah_wrfv4) then
Model%zs = clear_val
Model%dzs = clear_val
end if
! *DH

! Set number of ice model layers
Model%kice = kice

Expand All @@ -3865,13 +3897,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%pores = clear_val
Model%resid = clear_val
!
if (lsnow_lsm /= 3) then
write(0,*) 'Logic error: NoahMP expects the maximum number of snow layers to be exactly 3 (see sfc_noahmp_drv.f)'
stop
if (Model%lsm==Model%lsm_noahmp) then
if (lsnow_lsm/=3) then
write(0,*) 'Logic error: NoahMP expects the maximum number of snow layers to be exactly 3 (see sfc_noahmp_drv.f)'
stop
else
Model%lsnow_lsm = lsnow_lsm
! Set lower bound for LSM model, runs from negative (above surface) to surface (zero)
Model%lsnow_lsm_lbound = -Model%lsnow_lsm+1
Model%lsnow_lsm_ubound = 0
end if
else
Model%lsnow_lsm = lsnow_lsm
! Set lower bound for LSM model, runs from negative (above surface) to surface (zero)
Model%lsnow_lsm_lbound = -Model%lsnow_lsm+1
! Not used by any of the other LSM choices
Model%lsnow_lsm = 0
Model%lsnow_lsm_lbound = 0
Model%lsnow_lsm_ubound = 0
end if
Model%isurban = -999 !GJF isurban is only used in NOAH WRFv4 and is initialized in sfc_noah_GFS_interstitial.F90/sfc_noah_GFS_pre_init
Model%isice = -999 !GJF isice is only used in NOAH WRFv4 and is initialized in sfc_noah_GFS_interstitial.F90/sfc_noah_GFS_pre_init
Expand Down Expand Up @@ -3991,8 +4031,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%rbcr = rbcr
Model%do_gwd = maxval(Model%cdmbgwd) > 0.0 ! flag to restore OGWs of GFS-v15
! OLD GFS-v12-15 conv scheme
! Model%do_cnvgwd = Model%cnvgwd .and. maxval(Model%cdmbgwd(3:4)) == 0.0
Model%do_cnvgwd = .false. ! this avoids all "mysteries" to use Convective GWs in UFS
Model%do_cnvgwd = Model%cnvgwd .and. maxval(Model%cdmbgwd(3:4)) == 0.0
Model%do_mynnedmf = do_mynnedmf
Model%do_mynnsfclay = do_mynnsfclay
! DH* TODO - move to MYNN namelist section
Expand Down Expand Up @@ -4953,7 +4992,14 @@ subroutine control_print(Model)
print *, ' lsoil : ', Model%lsoil
print *, ' rdlai : ', Model%rdlai
print *, ' lsoil_lsm : ', Model%lsoil_lsm
print *, ' lsnow_lsm : ', Model%lsnow_lsm
if (Model%lsm==Model%lsm_noahmp) then
print *, ' lsnow_lsm : ', Model%lsnow_lsm
print *, ' lsnow_lsm_lbound : ', Model%lsnow_lsm_lbound
print *, ' lsnow_lsm_ubound : ', Model%lsnow_lsm_ubound
end if
print *, ' zs (may be unset): ', Model%zs
print *, ' dzs (may be unset): ', Model%dzs
!
print *, ' iopt_thcnd : ', Model%iopt_thcnd
print *, ' ua_phys : ', Model%ua_phys
print *, ' usemonalb : ', Model%usemonalb
Expand Down Expand Up @@ -6551,7 +6597,6 @@ subroutine interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%snohf_snowmelt (IM))
allocate (Interstitial%soilm_in_m (IM))
allocate (Interstitial%stc_save (IM,Model%lsoil))
allocate (Interstitial%sthick (Model%lsoil))
allocate (Interstitial%th1 (IM))
allocate (Interstitial%tprcp_rate_land (IM))
allocate (Interstitial%tsfc_land_save (IM))
Expand Down Expand Up @@ -6747,6 +6792,7 @@ subroutine interstitial_rad_reset (Interstitial, Model)
!
class(GFS_interstitial_type) :: Interstitial
type(GFS_control_type), intent(in) :: Model
integer :: iGas
!
Interstitial%aerodp = clear_val
Interstitial%alb1d = clear_val
Expand Down Expand Up @@ -6850,6 +6896,9 @@ subroutine interstitial_rad_reset (Interstitial, Model)
Interstitial%sfc_alb_uvvis_dif = clear_val
Interstitial%toa_src_sw = clear_val
Interstitial%toa_src_lw = clear_val
do iGas=1,Model%nGases
Interstitial%gas_concentrations%concs(iGas)%conc = clear_val
end do
end if
!
end subroutine interstitial_rad_reset
Expand Down Expand Up @@ -7153,7 +7202,6 @@ subroutine interstitial_phys_reset (Interstitial, Model)
Interstitial%snohf_snowmelt = clear_val
Interstitial%soilm_in_m = clear_val
Interstitial%stc_save = clear_val
Interstitial%sthick = clear_val
Interstitial%th1 = clear_val
Interstitial%tprcp_rate_land = huge
Interstitial%tsfc_land_save = huge
Expand Down Expand Up @@ -7541,7 +7589,6 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno)
write (0,*) 'sum(Interstitial%snohf_frzgra ) = ', sum(Interstitial%snohf_frzgra )
write (0,*) 'sum(Interstitial%snohf_snowmelt ) = ', sum(Interstitial%snohf_snowmelt )
write (0,*) 'sum(Interstitial%soilm_in_m ) = ', sum(Interstitial%soilm_in_m )
write (0,*) 'sum(Interstitial%sthick ) = ', sum(Interstitial%sthick )
write (0,*) 'sum(Interstitial%th1 ) = ', sum(Interstitial%th1 )
write (0,*) 'sum(Interstitial%tprcp_rate_land ) = ', sum(Interstitial%tprcp_rate_land )
write (0,*) 'sum(Interstitial%tsfc_land_save ) = ', sum(Interstitial%tsfc_land_save )
Expand Down
Loading