Skip to content

Commit

Permalink
Merge branch 'jinboxie/atm/oro_bugfix' (PR E3SM-Project#6869)
Browse files Browse the repository at this point in the history
Bug fix for changing orodrag tuning parameters via namelist

This is a bug fix for the latest orodrag parameterization
merged into master. The setup of the parameter tuning for
the schemes is intended to read in orodrag parameters such
as od_ls_ncleff, od_bl_ncd, od_ss_sncleff into the model for
tuning via phys_control.F90. However, the orodrag parameters
are set in a separate place spot in atm_in (e.g. oro_drag_nl),
and thus a separate oro_drag_readnl is added in od_common.F90
to read these parameters in atm_in. It is tested and works well
both use the new od schemes or the default schemes.

[BFB]
  • Loading branch information
wlin7 committed Jan 10, 2025
2 parents 13abf59 + f213a13 commit fa8bb88
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 10 deletions.
2 changes: 2 additions & 0 deletions components/eam/src/control/runtime_opts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ subroutine read_namelist(single_column_in, scmlon_in, scmlat_in, scm_multcols_in
use uwshcu, only: uwshcu_readnl
use pkg_cld_sediment, only: cld_sediment_readnl
use gw_drag, only: gw_drag_readnl
use od_common, only: oro_drag_readnl
use qbo, only: qbo_readnl
use iondrag, only: iondrag_readnl
use phys_debug_util, only: phys_debug_readnl
Expand Down Expand Up @@ -516,6 +517,7 @@ subroutine read_namelist(single_column_in, scmlon_in, scmlat_in, scm_multcols_in
call uwshcu_readnl(nlfilename)
call cld_sediment_readnl(nlfilename)
call gw_drag_readnl(nlfilename)
call oro_drag_readnl(nlfilename)
call qbo_readnl(nlfilename)
call iondrag_readnl(nlfilename)
call phys_debug_readnl(nlfilename)
Expand Down
3 changes: 2 additions & 1 deletion components/eam/src/physics/cam/clubb_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module clubb_intr
use shr_kind_mod, only: r8=>shr_kind_r8
use shr_log_mod , only: errMsg => shr_log_errMsg
use ppgrid, only: pver, pverp
use phys_control, only: phys_getopts, use_od_ss, use_od_fd, od_ls_ncleff, od_bl_ncd, od_ss_sncleff
use phys_control, only: phys_getopts, use_od_ss, use_od_fd
use od_common, only: od_ls_ncleff, od_bl_ncd, od_ss_sncleff
use physconst, only: rair, cpair, gravit, latvap, latice, zvir, rh2o, karman, &
tms_orocnst, tms_z0fac, pi
use cam_logfile, only: iulog
Expand Down
3 changes: 2 additions & 1 deletion components/eam/src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module gw_drag

! These are the actual switches for different gravity wave sources.
! The orographic control switches are also here
use phys_control, only: use_gw_oro, use_gw_front, use_gw_convect, use_gw_energy_fix, use_od_ls, use_od_bl, use_od_ss, od_ls_ncleff, od_bl_ncd, od_ss_sncleff
use phys_control, only: use_gw_oro, use_gw_front, use_gw_convect, use_gw_energy_fix, use_od_ls, use_od_bl, use_od_ss
use od_common, only: od_ls_ncleff, od_bl_ncd, od_ss_sncleff

! Typical module header
implicit none
Expand Down
58 changes: 57 additions & 1 deletion components/eam/src/physics/cam/od_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ module od_common
use ppgrid, only: pcols, pver, begchunk, endchunk
use cam_logfile, only: iulog
use cam_abortutils,only: endrun
use spmd_utils, only: masterproc
use pio, only: file_desc_t
use phys_control, only: use_od_ls, use_od_bl, use_od_ss, od_ls_ncleff, od_bl_ncd, od_ss_sncleff
use phys_control, only: use_od_ls, use_od_bl, use_od_ss
use physics_buffer,only: dtype_r8, physics_buffer_desc, pbuf_get_chunk
use physics_buffer,only: pbuf_get_index, pbuf_get_field, pbuf_add_field, pbuf_set_field

Expand All @@ -23,6 +24,7 @@ module od_common
save

! Public interface.
public :: oro_drag_readnl
public :: oro_drag_register
public :: oro_drag_init
public :: oro_drag_interface
Expand All @@ -40,10 +42,64 @@ module od_common
integer :: oro_drag_efflength_idx = -1 ! Effective length
integer :: oro_drag_ribulk_idx = -1 ! bulk richardson number (calculated in CLUBB)

!tunable parameter to the od schemes
real(r8),public, protected :: od_ls_ncleff = 3._r8 !tunable parameter for oGWD
real(r8),public, protected :: od_bl_ncd = 3._r8 !tunable parameter for FBD
real(r8),public, protected :: od_ss_sncleff= 1._r8 !tunable parameter for sGWD

contains

!==========================================================================

subroutine oro_drag_readnl(nlfile)

use namelist_utils, only: find_group_name
use units, only: getunit, freeunit
use mpishorthand

! File containing namelist input.
character(len=*), intent(in) :: nlfile

! Local variables
integer :: unitn, ierr
character(len=*), parameter :: subname = 'oro_drag_readnl'

! More specific name for dc to prevent a name clash or confusion in the
! namelist.

namelist /oro_drag_nl/ od_ls_ncleff, od_bl_ncd, od_ss_sncleff
!---------------------------------------------------------------------
!read oro_drag_nl only when use the od schemes
if (use_od_ls.or.use_od_bl.or.use_od_ss) then
if (masterproc) then
unitn = getunit()
open( unitn, file=trim(nlfile), status='old' )
call find_group_name(unitn, 'oro_drag_nl', status=ierr)
if (ierr == 0) then
read(unitn, oro_drag_nl, iostat=ierr)
if (ierr /= 0) then
call endrun(subname // ':: ERROR reading namelist')
end if
end if
close(unitn)
call freeunit(unitn)
end if

if (masterproc) write(iulog,*) "oro_drag_readnl od_ls_ncleff, od_bl_ncd, od_ss_sncleff ",od_ls_ncleff,od_bl_ncd,od_ss_sncleff

#ifdef SPMD
! Broadcast namelist variables
call mpibcast(od_ls_ncleff, 1, mpir8, 0, mpicom)
call mpibcast(od_bl_ncd, 1, mpir8, 0, mpicom)
call mpibcast(od_ss_sncleff, 1, mpir8, 0, mpicom)
#endif
!
endif

end subroutine oro_drag_readnl

!==========================================================================

subroutine oro_drag_open_topo_file()
use filenames, only: bnd_topo
use ioFileMod, only: getfil
Expand Down
7 changes: 0 additions & 7 deletions components/eam/src/physics/cam/phys_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ module phys_control
logical, public, protected :: use_od_bl = .false.
logical, public, protected :: use_od_ss = .false.
logical, public, protected :: use_od_fd = .false.
real(r8),public, protected :: od_ls_ncleff = 3._r8 !tunable parameter for oGWD
real(r8),public, protected :: od_bl_ncd = 3._r8 !tunable parameter for FBD
real(r8),public, protected :: od_ss_sncleff = 1._r8 !tunable parameter for sGWD
!
! Switches that turn on/off individual parameterizations.
!
Expand Down Expand Up @@ -259,7 +256,6 @@ subroutine phys_ctl_readnl(nlfile)
use_hetfrz_classnuc, use_gw_oro, use_gw_front, use_gw_convect, &
use_gw_energy_fix, &
use_od_ls,use_od_bl,use_od_ss,use_od_fd,&
od_ls_ncleff,od_bl_ncd,od_ss_sncleff,&
cld_macmic_num_steps, micro_do_icesupersat, &
fix_g1_err_ndrop, ssalt_tuning, resus_fix, convproc_do_aer, &
convproc_do_gas, convproc_method_activate, liqcf_fix, regen_fix, demott_ice_nuc, pergro_mods, pergro_test_active, &
Expand Down Expand Up @@ -383,9 +379,6 @@ subroutine phys_ctl_readnl(nlfile)
call mpibcast(use_od_bl, 1 , mpilog, 0, mpicom)
call mpibcast(use_od_ss, 1 , mpilog, 0, mpicom)
call mpibcast(use_od_fd, 1 , mpilog, 0, mpicom)
call mpibcast(od_ls_ncleff, 1 , mpilog, 0, mpicom)
call mpibcast(od_bl_ncd, 1 , mpilog, 0, mpicom)
call mpibcast(od_ss_sncleff, 1 , mpilog, 0, mpicom)
call mpibcast(fix_g1_err_ndrop, 1 , mpilog, 0, mpicom)
call mpibcast(ssalt_tuning, 1 , mpilog, 0, mpicom)
call mpibcast(resus_fix, 1 , mpilog, 0, mpicom)
Expand Down

0 comments on commit fa8bb88

Please sign in to comment.