From 02f10bb988a34c8a64338bf937a63024051d7a6c Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Thu, 25 Jul 2024 22:05:46 +0000 Subject: [PATCH 1/7] Changes for CLM lake to work in CCPP SCM --- .gitmodules | 4 ++-- ccpp/physics | 2 +- scm/src/scm_type_defs.F90 | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index dc0798c32..6c2c7ba23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/ccpp/physics b/ccpp/physics index 3a1969102..bafa77c26 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 3a19691021b779748f4b448d3f21ab381fcc6c6e +Subproject commit bafa77c2602970bea54db917a05a5ea8c122651c diff --git a/scm/src/scm_type_defs.F90 b/scm/src/scm_type_defs.F90 index 01629bacf..737ecb6e2 100644 --- a/scm/src/scm_type_defs.F90 +++ b/scm/src/scm_type_defs.F90 @@ -1064,7 +1064,7 @@ subroutine physics_set(physics, scm_input, scm_state) ! ! Orographical data (2D) ! - if (scm_state%model_ics) then + if (scm_state%model_ics .or. scm_state%lsm_ics) then write(0,'(a)') "Setting internal physics variables from the orographic section of the case input file (scalars)..." call conditionally_set_var(scm_input%input_stddev, physics%Sfcprop%hprime(i,1), "stddev", .true., missing_var(1)) call conditionally_set_var(scm_input%input_convexity, physics%Sfcprop%hprime(i,2), "convexity", .true., missing_var(2)) @@ -1202,8 +1202,14 @@ subroutine physics_set(physics, scm_input, scm_state) ! ! Derive physics quantities using surface model ICs. ! + print*,"SWALES SCM: scm_state%model_ics = ",scm_state%model_ics + print*,"SWALES SCM: scm_state%lsm_ics = ",scm_state%lsm_ics + print*,"SWALES SCM: physics%Sfcprop%stype(i) = ",physics%Sfcprop%stype(i) + print*,"SWALES SCM: physics%Sfcprop%lakefrac(i) = ",physics%Sfcprop%lakefrac(i) + print*,"SWALES SCM: physics%Sfcprop%oro_uf(i) = ",physics%Sfcprop%oro_uf(i) + print*,"SWALES SCM: min_lake_orog = ",min_lake_orog 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 From 81868055d2a02ac6094d17a9ef51dcde0c49b3bf Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Fri, 26 Jul 2024 14:38:06 +0000 Subject: [PATCH 2/7] Omission from previous commit --- scm/src/scm_type_defs.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scm/src/scm_type_defs.F90 b/scm/src/scm_type_defs.F90 index 737ecb6e2..9a0dafe36 100644 --- a/scm/src/scm_type_defs.F90 +++ b/scm/src/scm_type_defs.F90 @@ -1202,12 +1202,6 @@ subroutine physics_set(physics, scm_input, scm_state) ! ! Derive physics quantities using surface model ICs. ! - print*,"SWALES SCM: scm_state%model_ics = ",scm_state%model_ics - print*,"SWALES SCM: scm_state%lsm_ics = ",scm_state%lsm_ics - print*,"SWALES SCM: physics%Sfcprop%stype(i) = ",physics%Sfcprop%stype(i) - print*,"SWALES SCM: physics%Sfcprop%lakefrac(i) = ",physics%Sfcprop%lakefrac(i) - print*,"SWALES SCM: physics%Sfcprop%oro_uf(i) = ",physics%Sfcprop%oro_uf(i) - print*,"SWALES SCM: min_lake_orog = ",min_lake_orog if(scm_state%model_ics .or. scm_state%lsm_ics) then if (physics%Sfcprop%stype(i) == 14 .or. physics%Sfcprop%stype(i) <= 0) then physics%Sfcprop%landfrac(i) = real_zero From 9389555510870080e93954b816238767beb07564 Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Fri, 26 Jul 2024 14:39:36 +0000 Subject: [PATCH 3/7] Updated physics --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index bafa77c26..f2d31ef43 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit bafa77c2602970bea54db917a05a5ea8c122651c +Subproject commit f2d31ef4368f1d9f9dce57278be6779b0683b7b4 From bb03b342066aabff793f1a21c694a06974aa3597 Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Fri, 26 Jul 2024 14:49:44 +0000 Subject: [PATCH 4/7] update physics hash --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index f2d31ef43..bafa77c26 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit f2d31ef4368f1d9f9dce57278be6779b0683b7b4 +Subproject commit bafa77c2602970bea54db917a05a5ea8c122651c From 9de60958725e038448e7fd9666e5e1eaacab669f Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Fri, 26 Jul 2024 15:07:37 +0000 Subject: [PATCH 5/7] Doh --- ccpp/framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/framework b/ccpp/framework index ccfefcd0b..0f8232724 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit ccfefcd0b426e011f94137031d5f7c2a4dda2659 +Subproject commit 0f8232724975c13289cad390c9a71fa2c6a9bff4 From 5d2c49e947ca7ee827a18e7c1c4cc2ecb400cd90 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Tue, 30 Jul 2024 13:06:36 -0400 Subject: [PATCH 6/7] move landfrac/lakefrac/lakedepth out of IF statement to preserve working LSM IC-only cases (like GABLS3) (#13) --- scm/src/scm_type_defs.F90 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scm/src/scm_type_defs.F90 b/scm/src/scm_type_defs.F90 index 9a0dafe36..64c4289c0 100644 --- a/scm/src/scm_type_defs.F90 +++ b/scm/src/scm_type_defs.F90 @@ -1064,7 +1064,7 @@ subroutine physics_set(physics, scm_input, scm_state) ! ! Orographical data (2D) ! - if (scm_state%model_ics .or. scm_state%lsm_ics) then + if (scm_state%model_ics) then write(0,'(a)') "Setting internal physics variables from the orographic section of the case input file (scalars)..." call conditionally_set_var(scm_input%input_stddev, physics%Sfcprop%hprime(i,1), "stddev", .true., missing_var(1)) call conditionally_set_var(scm_input%input_convexity, physics%Sfcprop%hprime(i,2), "convexity", .true., missing_var(2)) @@ -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." @@ -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) ! From aa99c2dcbb19c9f7d7013837cdf9d4bff91b8fe9 Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Thu, 1 Aug 2024 21:48:43 +0000 Subject: [PATCH 7/7] Revert submodule. --- .gitmodules | 4 ++-- ccpp/physics | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6c2c7ba23..dc0798c32 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,8 +4,8 @@ branch = main [submodule "ccpp-physics"] path = ccpp/physics - url = https://github.com/dustinswales/ccpp-physics - branch = hotfix/clmlake_in_scm + url = https://github.com/NCAR/ccpp-physics + branch = main [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules diff --git a/ccpp/physics b/ccpp/physics index fd3aae41b..62f7656eb 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit fd3aae41b2012ed23b0d38f70dbe4fdede5d3aa9 +Subproject commit 62f7656ebdaa39d989413e5d285ed6d6723eb4de