Skip to content

Commit

Permalink
Merge branch 'main' into feature/ip5
Browse files Browse the repository at this point in the history
  • Loading branch information
grantfirl committed Jan 17, 2025
2 parents be05d12 + a3f4d93 commit 9d967aa
Show file tree
Hide file tree
Showing 204 changed files with 7,645 additions and 3,291 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS}
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} ${OpenMP_Fortran_FLAGS}")

# Lower optimization for certain schemes when compiling with Intel in Release mode
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM"))
# Define a list of schemes that need lower optimization with Intel in Release mode
set(SCHEME_NAMES_LOWER_OPTIMIZATION module_sf_mynn.F90
mynnedmf_wrapper.F90
gcycle.F90)
gcycle.F90
module_mp_nssl_2mom.F90)
foreach(SCHEME_NAME IN LISTS SCHEME_NAMES_LOWER_OPTIMIZATION)
set(SCHEMES_TMP ${SCHEMES})
# Need to determine the name of the scheme with its path
Expand All @@ -156,7 +157,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL
endif()

# No optimization for certain schemes when compiling with Intel in Release mode
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM"))
# Define a list of schemes that can't be optimized with Intel in Release mode
set(SCHEME_NAMES_NO_OPTIMIZATION GFS_typedefs.F90)
foreach(SCHEME_NAME IN LISTS SCHEME_NAMES_NO_OPTIMIZATION)
Expand Down
362 changes: 180 additions & 182 deletions CODEOWNERS

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions physics/CONV/Grell_Freitas/cu_gf_deep.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!>\file cu_gf_deep.F90
!! This file is the Grell-Freitas deep convection scheme.

!> This module contains the Grell_Freitas deep convection scheme
module cu_gf_deep
use machine , only : kind_phys
use physcons, only : qamin
Expand Down Expand Up @@ -425,9 +426,9 @@ subroutine cu_gf_deep_run( &
integer :: turn,pmin_lev(its:ite),start_level(its:ite),ktopkeep(its:ite)
real(kind=kind_phys), dimension (its:ite,kts:kte) :: dtempdz
integer, dimension (its:ite,kts:kte) :: k_inv_layers
real(kind=kind_phys), dimension (its:ite) :: c0 ! HCB
real(kind=kind_phys), dimension (its:ite) :: c0, rrfs_factor ! HCB
real(kind=kind_phys), dimension (its:ite,kts:kte) :: c0t3d ! hli for smoke/dust wet scavenging
!$acc declare create(pmin_lev,start_level,ktopkeep,dtempdz,k_inv_layers,c0,c0t3d)
!$acc declare create(pmin_lev,start_level,ktopkeep,dtempdz,k_inv_layers,c0,rrfs_factor,c0t3d)

! rainevap from sas
real(kind=kind_phys) zuh2(40)
Expand Down Expand Up @@ -486,6 +487,7 @@ subroutine cu_gf_deep_run( &
! Set cloud water to rain water conversion rate (c0)
!$acc kernels
c0(:)=0.004
rrfs_factor(:)=1.
do i=its,itf
xland1(i)=int(xland(i)+.0001) ! 1.
if(xland(i).gt.1.5 .or. xland(i).lt.0.5)then
Expand All @@ -495,6 +497,7 @@ subroutine cu_gf_deep_run( &
if(imid.eq.1)then
c0(i)=0.002
endif
if(kdt.le.(4500./dtime))rrfs_factor(i)=1.-(float(kdt)/(4500./dtime)-1.)**2
enddo
!$acc end kernels

Expand Down Expand Up @@ -591,7 +594,6 @@ subroutine cu_gf_deep_run( &
sig(i)=(1.-frh)**2
!frh_out(i) = frh
if(forcing(i,7).eq.0.)sig(i)=1.
if(kdt.le.(3600./dtime))sig(i)=1.
frh_out(i) = frh*sig(i)
enddo
!$acc end kernels
Expand Down Expand Up @@ -2029,7 +2031,7 @@ subroutine cu_gf_deep_run( &
zuo,pre,pwo_ens,xmb,ktop, &
edto,pwdo,'deep',ierr2,ierr3, &
po_cup,pr_ens,maxens3, &
sig,closure_n,xland1,xmbm_in,xmbs_in, &
sig,closure_n,xland1,xmbm_in,xmbs_in,rrfs_factor, &
ichoice,imid,ipr,itf,ktf, &
its,ite, kts,kte, &
dicycle,xf_dicycle )
Expand Down Expand Up @@ -4056,7 +4058,7 @@ subroutine cup_output_ens_3d(xff_mid,xf_ens,ierr,dellat,dellaq,dellaqc, &
zu,pre,pw,xmb,ktop, &
edt,pwd,name,ierr2,ierr3,p_cup,pr_ens, &
maxens3, &
sig,closure_n,xland1,xmbm_in,xmbs_in, &
sig,closure_n,xland1,xmbm_in,xmbs_in,rrfs_factor, &
ichoice,imid,ipr,itf,ktf, &
its,ite, kts,kte, &
dicycle,xf_dicycle )
Expand Down Expand Up @@ -4118,7 +4120,7 @@ subroutine cup_output_ens_3d(xff_mid,xf_ens,ierr,dellat,dellaq,dellaqc, &
,intent (inout) :: &
ierr,ierr2,ierr3
integer, intent(in) :: dicycle
real(kind=kind_phys), intent(in), dimension (its:ite) :: xf_dicycle
real(kind=kind_phys), intent(in), dimension (its:ite) :: xf_dicycle, rrfs_factor
!$acc declare copyin(zu,pwd,p_cup,sig,xmbm_in,xmbs_in,edt,xff_mid,dellat,dellaqc,dellaq,pw,ktop,xland1,xf_dicycle)
!$acc declare copy(xf_ens,pr_ens,outtem,outq,outqc,pre,xmb,closure_n,ierr,ierr2,ierr3)
!
Expand Down Expand Up @@ -4198,6 +4200,7 @@ subroutine cup_output_ens_3d(xff_mid,xf_ens,ierr,dellat,dellaq,dellaqc, &
clos_wei=16./max(1.,closure_n(i))
xmb_ave(i)=min(xmb_ave(i),100.)
xmb(i)=clos_wei*sig(i)*xmb_ave(i)
if(dx(i)<dx_thresh) xmb(i)=rrfs_factor(i)*xmb(i)

if(xmb(i) < 1.e-16)then
ierr(i)=19
Expand Down
13 changes: 8 additions & 5 deletions physics/CONV/Grell_Freitas/cu_gf_driver.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!>\file cu_gf_driver.F90
!! This file is scale-aware Grell-Freitas cumulus scheme driver.


!> This module contains the scale-aware Grell-Freitas cumulus scheme driver.
module cu_gf_driver

! DH* TODO: replace constants with arguments to cu_gf_driver_run
Expand Down Expand Up @@ -883,6 +883,13 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
cutenm(i)=0.
endif ! pret > 0

maxupmf(i)=0.
if(forcing2(i,6).gt.0.)then
maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
endif
if (xland(i)==0)then ! cu precip rate (mm/h)
if((maxupmf(i).lt.0.1) .or. (pret(i)*3600.lt.0.05)) pret(i)=0.
endif
if(pret(i).gt.0.)then
cuten(i)=1.
cutenm(i)=0.
Expand Down Expand Up @@ -999,10 +1006,6 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
gdc(i,15,10)=qfx(i)
gdc(i,16,10)=pret(i)*3600.

maxupmf(i)=0.
if(forcing2(i,6).gt.0.)then
maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
endif

if(ktop(i).gt.2 .and.pret(i).gt.0.)dt_mf(i,ktop(i)-1)=ud_mf(i,ktop(i))
endif
Expand Down
1 change: 1 addition & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver_post.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!> \file cu_gf_driver_post.F90
!! Contains code related to GF convective schemes to be used within the GFS physics suite.

!> This module contains code related to GF convective schemes to be used within the GFS physics suite
module cu_gf_driver_post

implicit none
Expand Down
1 change: 1 addition & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver_pre.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!> \file cu_gf_driver_pre.F90
!! Contains code related to GF convective schemes to be used within the GFS physics suite.

!> This module contains code related to GF convective schemes to be used within the GFS physics suite.
module cu_gf_driver_pre

implicit none
Expand Down
1 change: 1 addition & 0 deletions physics/CONV/Grell_Freitas/cu_gf_sh.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!>\file cu_gf_sh.F90
!! This file contains Grell-Freitas shallow convection scheme.

!> This module contains the Grell-Freitas shallow convection scheme
module cu_gf_sh
use machine , only : kind_phys
!real(kind=kind_phys), parameter:: c1_shal=0.0015! .0005
Expand Down
2 changes: 2 additions & 0 deletions physics/CONV/SAMF/samfaerosols.F
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
!>\file samfaerosols.F
!!
module samfcnv_aerosols

implicit none
Expand Down
28 changes: 20 additions & 8 deletions physics/CONV/SAMF/samfdeepcnv.f
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
!
! parameters for prognostic sigma closure
real(kind=kind_phys) omega_u(im,km),zdqca(im,km),tmfq(im,km),
& omegac(im),zeta(im,km),dbyo1(im,km),sigmab(im),qadv(im,km)
& omegac(im),zeta(im,km),dbyo1(im,km),sigmab(im),qadv(im,km),
& sigmaoutx(im)
real(kind=kind_phys) gravinv,invdelt,sigmind,sigminm,sigmins
parameter(sigmind=0.01,sigmins=0.03,sigminm=0.01)
logical flag_shallow, flag_mid
Expand Down Expand Up @@ -3423,17 +3424,28 @@ subroutine samfdeepcnv_run (im,km,first_time_step,restart, &
endif
enddo
c
c convective cloud water
!
if(progsigma)then
do i = 1, im
sigmaoutx(i)=max(sigmaout(i,1),0.0)
sigmaoutx(i)=min(sigmaoutx(i),1.0)
enddo
endif
c
!> - Calculate convective cloud water.
do k = 1, km
do i = 1, im
if (cnvflg(i) .and. rn(i) > 0.) then
if (k >= kbcon(i) .and. k < ktcon(i)) then
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
do i = 1, im
if (cnvflg(i) .and. rn(i) > 0.) then
if (k >= kbcon(i) .and. k < ktcon(i)) then
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
if(progsigma)then
cnvw(i,k) = cnvw(i,k) * sigmaoutx(i)
else
cnvw(i,k) = cnvw(i,k) * sigmagfm(i)
endif
endif
endif
endif
enddo
enddo
enddo
c
c convective cloud cover
Expand Down
36 changes: 23 additions & 13 deletions physics/CONV/SAMF/samfshalcnv.f
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!> \file samfshalcnv.f
!! This file contains the Scale-Aware mass flux Shallow Convection scheme.
!!

!> This module contains the Scale-Aware mass flux Shallow Convection scheme.
module samfshalcnv

use samfcnv_aerosols, only : samfshalcnv_aerosols
Expand Down Expand Up @@ -162,7 +163,7 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
! parameters for prognostic sigma closure
real(kind=kind_phys) omega_u(im,km),zdqca(im,km),tmfq(im,km),
& omegac(im),zeta(im,km),dbyo1(im,km),
& sigmab(im),qadv(im,km)
& sigmab(im),qadv(im,km),sigmaoutx(im)
real(kind=kind_phys) gravinv,dxcrtas,invdelt,sigmind,sigmins,
& sigminm
logical flag_shallow,flag_mid
Expand Down Expand Up @@ -2397,20 +2398,29 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
endif
enddo
c
c convective cloud water
c
!> - Calculate shallow convective cloud water.
if(progsigma)then
do i = 1, im
sigmaoutx(i)=max(sigmaout(i,1),0.0)
sigmaoutx(i)=min(sigmaoutx(i),1.0)
enddo
endif

c convective cloud water
do k = 1, km
do i = 1, im
if (cnvflg(i)) then
if (k >= kbcon(i) .and. k < ktcon(i)) then
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
do i = 1, im
if (cnvflg(i)) then
if (k >= kbcon(i) .and. k < ktcon(i)) then
cnvw(i,k) = cnvwt(i,k) * xmb(i) * dt2
if (progsigma) then
cnvw(i,k) = cnvw(i,k) * sigmaoutx(i)
else
cnvw(i,k) = cnvw(i,k) * sigmagfm(i)
endif
endif
endif
endif
enddo
enddo
enddo

c
c
c convective cloud cover
c
!> - Calculate convective cloud cover, which is used when pdf-based cloud fraction is used (i.e., pdfcld=.true.).
Expand Down
21 changes: 8 additions & 13 deletions physics/CONV/SAS/shalcnv.F
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
!> \defgroup SASHAL Mass-Flux Shallow Convection
!! @{
!! \brief The Mass-Flux shallow convection scheme parameterizes the effect of shallow convection on the environment much like the \ref SAS scheme with a few key modifications. Perhaps most importantly, no quasi-equilibrium assumption is necessary since the shallow cloud base mass flux is parameterized from the surface buoyancy flux. Further, there are no convective downdrafts, the entrainment rate is greater than for deep convection, and the shallow convection is limited to not extend over the level where \f$p=0.7p_{sfc}\f$.
!> \file shalcnv.F
!! Contains the entire SAS shallow convection scheme.

!> \brief The Mass-Flux shallow convection scheme parameterizes the effect of shallow convection on the environment much like the \ref SAS scheme with a few key modifications. Perhaps most importantly, no quasi-equilibrium assumption is necessary since the shallow cloud base mass flux is parameterized from the surface buoyancy flux. Further, there are no convective downdrafts, the entrainment rate is greater than for deep convection, and the shallow convection is limited to not extend over the level where \f$p=0.7p_{sfc}\f$.
!!
!! This scheme was designed to replace the previous eddy-diffusivity approach to shallow convection with a mass-flux based approach as it is used for deep convection. Differences between the shallow and deep SAS schemes are presented in Han and Pan (2011) \cite han_and_pan_2011 . Like the deep scheme, it uses the working concepts put forth in Arakawa and Schubert (1974) \cite arakawa_and_schubert_1974 but includes modifications and simplifications from Grell (1993) \cite grell_1993 such as only one cloud type (the deepest possible, up to \f$p=0.7p_{sfc}\f$), rather than a spectrum based on cloud top heights or assumed entrainment rates, although it assumes no convective downdrafts. It contains many modifications associated with deep scheme as discussed in Han and Pan (2011) \cite han_and_pan_2011 , including the calculation of cloud top, a greater CFL-criterion-based maximum cloud base mass flux, and the inclusion of convective overshooting.
!!
!! \section diagram Calling Hierarchy Diagram
!! \section diagram_sashal Calling Hierarchy Diagram
!! \image html Shallow_SAS_Flowchart.png "Diagram depicting how the SAS shallow convection scheme is called from the GSM physics time loop" height=2cm
!! \section intraphysics Intraphysics Communication
!! This space is reserved for a description of how this scheme uses information from other scheme types and/or how information calculated in this scheme is used in other scheme types.

!> \file shalcnv.F
!! Contains the entire SAS shallow convection scheme.
module shalcnv

implicit none
Expand Down Expand Up @@ -80,17 +76,17 @@ end subroutine shalcnv_init
!! \param[out] cnvw convective cloud water (kg/kg)
!! \param[out] cnvc convective cloud cover (unitless)
!!
!! \section general General Algorithm
!! \section general_shalcnv General Algorithm
!! -# Compute preliminary quantities needed for the static and feedback control portions of the algorithm.
!! -# Perform calculations related to the updraft of the entraining/detraining cloud model ("static control").
!! -# Calculate the tendencies of the state variables (per unit cloud base mass flux) and the cloud base mass flux.
!! -# For the "feedback control", calculate updated values of the state variables by multiplying the cloud base mass flux and the tendencies calculated per unit cloud base mass flux from the static control.
!! \section detailed Detailed Algorithm
!! \section detailed_shalcnv Detailed Algorithm
!!
!! \section arg_table_shalcnv_run Argument Table
!! \htmlinclude shalcnv_run.html
!!
!! @{
!> @{
subroutine shalcnv_run( &
& grav,cp,hvap,rv,fv,t0c,rd,cvap,cliq,eps,epsm1, &
& im,km,jcap,delt,delp,prslp,psp,phil,qlc,qli, &
Expand Down Expand Up @@ -1341,4 +1337,3 @@ end subroutine shalcnv_run
end module shalcnv
!> @}
!! @}
14 changes: 6 additions & 8 deletions physics/CONV/progsigma_calc.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
!>\file progsigma_calc.f90

!> This module contains the subroutine that calculates the prognostic
!! updraft area fraction that is used for closure computations in
!! saSAS deep and shallow convection, based on a moisture budget
!! as described in Bengtsson et al. 2022 \cite Bengtsson_2022.
module progsigma

implicit none
Expand All @@ -6,14 +12,6 @@ module progsigma

contains

!>\file progsigma_calc.f90
!! This file contains the subroutine that calculates the prognostic
!! updraft area fraction that is used for closure computations in
!! saSAS deep and shallow convection, based on a moisture budget
!! as described in Bengtsson et al. 2022 \cite Bengtsson_2022.

!>\ingroup SAMFdeep
!>\ingroup SAMF_shal
!> This subroutine computes a prognostic updraft area fraction
!! used in the closure computations in the samfdeepcnv.f scheme
!! This subroutine computes a prognostic updraft area fracftion
Expand Down
5 changes: 2 additions & 3 deletions physics/GWD/cires_orowam2017.f
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!>\file cires_orowam2017.f
!!


!> This module includes the OROGW solver of WAM2017.
module cires_orowam2017
contains

!>\defgroup cires_orowam2017_mod CIRES UGWP orowam2017 Module
!>This is the OROGW-solver of WAM2017.
!>@{

!>
subroutine oro_wam_2017(im, levs,npt,ipt, kref,kdt,me,master,
Expand Down Expand Up @@ -394,4 +394,3 @@ subroutine ugwpv0_tofd1d(levs, sigflt, elvmax, zsurf,
!
end subroutine ugwpv0_tofd1d
end module cires_orowam2017
!>@}
Loading

0 comments on commit 9d967aa

Please sign in to comment.