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 10 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
14 changes: 7 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,9 @@ 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
ccpp
ccppphys
ccppdata
esmf)
if(OpenMP_Fortran_FOUND)
target_link_libraries(fv3dycore PUBLIC OpenMP::OpenMP_Fortran)
Expand All @@ -123,10 +124,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 +193,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
82 changes: 63 additions & 19 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 @@ -2464,10 +2470,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 @@ -2500,6 +2511,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 @@ -3847,17 +3863,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 @@ -3867,13 +3899,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 @@ -4955,7 +4995,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 @@ -6544,7 +6591,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 @@ -7146,7 +7192,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 @@ -7534,7 +7579,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
62 changes: 53 additions & 9 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,46 @@
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noah_wrfv4_land_surface_scheme)
[albdvis]
standard_name = surface_albedo_direct_visible
long_name = direct surface albedo visible band
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noahmp_land_surface_scheme)
[albdnir]
standard_name = surface_albedo_direct_NIR
long_name = direct surface albedo NIR band
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noahmp_land_surface_scheme)
[albivis]
standard_name = surface_albedo_diffuse_visible
long_name = diffuse surface albedo visible band
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noahmp_land_surface_scheme)
[albinir]
standard_name = surface_albedo_diffuse_NIR
long_name = diffuse surface albedo NIR band
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noahmp_land_surface_scheme)
[emiss]
standard_name = surface_emissivity_lsm
long_name = surface emissivity from lsm
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noahmp_land_surface_scheme)
[wetness]
standard_name = normalized_soil_wetness_for_land_surface_model
long_name = normalized soil wetness for lsm
Expand Down Expand Up @@ -3311,14 +3351,26 @@
units = count
dimensions = ()
type = integer
[lsnow_lsm_ubound]
standard_name = upper_bound_of_snow_vertical_dimension_for_land_surface_model
long_name = upper bound of of snow-related arrays for land surface model
units = count
dimensions = ()
type = integer
[zs]
standard_name = depth_of_soil_levels_for_land_surface_model
long_name = depth of soil levels for land surface model
units = m
dimensions = (soil_vertical_dimension_for_land_surface_model)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_ruc_land_surface_scheme)
[dzs]
standard_name = thickness_of_soil_levels_for_land_surface_model
long_name = thickness of soil levels for land surface model
units = m
dimensions = (soil_vertical_dimension_for_land_surface_model)
type = real
kind = kind_phys
[pores]
standard_name = maximum_soil_moisture_content_for_land_surface_model
long_name = maximum soil moisture for a given soil type for land surface model
Expand Down Expand Up @@ -9531,14 +9583,6 @@
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noah_wrfv4_land_surface_scheme)
[sthick]
standard_name = soil_layer_thickness
long_name = soil layer thickness
units = m
dimensions = (soil_vertical_dimension)
type = real
kind = kind_phys
active = (flag_for_land_surface_scheme == flag_for_noah_wrfv4_land_surface_scheme)
[stress]
standard_name = surface_wind_stress
long_name = surface wind stress
Expand Down
1 change: 0 additions & 1 deletion ccpp/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ add_library(
# Compile GFS_diagnostics.F90 without optimization, this leads to out of memory errors on wcoss_dell_p3
set_property(SOURCE GFS_diagnostics.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "-O0")

target_link_libraries(ccppdriver gfsphysics)
target_link_libraries(ccppdriver ccpp)
target_link_libraries(ccppdriver ccppphys)
target_link_libraries(ccppdriver ccppdata)
Expand Down
57 changes: 57 additions & 0 deletions ccpp/driver/GFS_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &
if (Model%imfdeepcnv == 3) then
Restart%num2d = Restart%num2d + 1
endif
! NoahMP
if (Model%lsm == Model%lsm_noahmp) then
Restart%num2d = Restart%num2d + 10
endif
! RUC
if (Model%lsm == Model%lsm_ruc) then
Restart%num2d = Restart%num2d + 5
Expand Down Expand Up @@ -190,6 +194,59 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, &
Restart%data(nb,num)%var2p => Sfcprop(nb)%conv_act(:)
enddo
endif
! NoahMP
if (Model%lsm == Model%lsm_noahmp) then
num = num + 1
Restart%name2d(num) = 'noahmp_2d_raincprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%raincprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_rainncprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%rainncprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_iceprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%iceprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_snowprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%snowprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_graupelprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%graupelprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_draincprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%draincprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_drainncprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%drainncprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_diceprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%diceprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_dsnowprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%dsnowprv(:)
enddo
num = num + 1
Restart%name2d(num) = 'noahmp_2d_dgraupelprv'
do nb = 1,nblks
Restart%data(nb,num)%var2p => Sfcprop(nb)%dgraupelprv(:)
enddo
endif
! RUC
if (Model%lsm == Model%lsm_ruc) then
num = num + 1
Expand Down
Loading