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

Changes for CLM lake to work in CCPP SCM #497

Merged
merged 8 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
branch = main
[submodule "ccpp-physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = main
url = https://github.com/dustinswales/ccpp-physics
branch = hotfix/clmlake_in_scm
[submodule "CMakeModules"]
path = CMakeModules
url = https://github.com/noaa-emc/CMakeModules
Expand Down
21 changes: 16 additions & 5 deletions scm/src/scm_type_defs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1082,10 +1082,7 @@ subroutine physics_set(physics, scm_input, scm_state)
call conditionally_set_var(scm_input%input_elvmax, physics%Sfcprop%hprime(i,14), "elvmax", .true., missing_var(14))
call conditionally_set_var(scm_input%input_oro, physics%Sfcprop%oro(i), "oro", .true., missing_var(15))
call conditionally_set_var(scm_input%input_oro_uf, physics%Sfcprop%oro_uf(i), "oro_uf", (physics%Model%do_ugwp .and. physics%Model%nmtvr == 14), missing_var(16))
call conditionally_set_var(scm_input%input_landfrac, physics%Sfcprop%landfrac(i), "landfrac", physics%Model%frac_grid, missing_var(17))
call conditionally_set_var(scm_input%input_lakefrac, physics%Sfcprop%lakefrac(i), "lakefrac", (physics%Model%lkm == 1), missing_var(18))
call conditionally_set_var(scm_input%input_lakedepth, physics%Sfcprop%lakedepth(i), "lakedepth", (physics%Model%lkm == 1), missing_var(19))


n = 19
if ( i==1 .and. ANY( missing_var(1:n) ) ) then
write(0,'(a)') "INPUT CHECK: Some missing input data was found related to (potentially non-required) orography and gravity wave drag parameters. This may lead to crashes or other strange behavior."
Expand All @@ -1097,6 +1094,20 @@ subroutine physics_set(physics, scm_input, scm_state)
missing_var = .false.
end if

! Variables found in orographic dataset but needed for non-orographic reasons (e.g. lake model, fractional grid)
call conditionally_set_var(scm_input%input_landfrac, physics%Sfcprop%landfrac(i), "landfrac", physics%Model%frac_grid, missing_var(1))
call conditionally_set_var(scm_input%input_lakefrac, physics%Sfcprop%lakefrac(i), "lakefrac", (physics%Model%lkm == 1), missing_var(2))
call conditionally_set_var(scm_input%input_lakedepth, physics%Sfcprop%lakedepth(i), "lakedepth", (physics%Model%lkm == 1), missing_var(3))
n = 3
if ( i==1 .and. ANY( missing_var(1:n) ) ) then
write(0,'(a)') "INPUT CHECK: Some missing input data was found related to (potentially non-required) lake-related or fractional grid-related variables. This may lead to crashes or other strange behavior."
write(0,'(a)') "Check scm_type_defs.F90/physics_set to see the names of variables that are missing, corresponding to the following indices:"
do j=1, n
if (missing_var(j)) write(0,'(a,i0)') "variable index ",j
end do
end if
missing_var = .false.

!
! Surface data (2D)
!
Expand Down Expand Up @@ -1203,7 +1214,7 @@ subroutine physics_set(physics, scm_input, scm_state)
! Derive physics quantities using surface model ICs.
!
if(scm_state%model_ics .or. scm_state%lsm_ics) then
if (physics%Sfcprop%stype(i) == 14 .or. physics%Sfcprop%stype(i)+0.5 <= 0) then
if (physics%Sfcprop%stype(i) == 14 .or. physics%Sfcprop%stype(i) <= 0) then
physics%Sfcprop%landfrac(i) = real_zero
physics%Sfcprop%stype(i) = 0
if (physics%Sfcprop%lakefrac(i) > real_zero) then
Expand Down
Loading