Skip to content

Commit

Permalink
Address final reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cacraigucar committed Feb 5, 2025
1 parent 85efadc commit c67f137
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 36 deletions.
4 changes: 0 additions & 4 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,6 @@
<effgw_rdg_beta_max model_top="lt" >0.5D0</effgw_rdg_beta_max>
<effgw_rdg_beta_max model_top="mt" >0.5D0</effgw_rdg_beta_max>

<effgw_rdg_beta_max >JULIO</effgw_rdg_beta_max>
<effgw_rdg_beta_max model_top="lt" >JULIO</effgw_rdg_beta_max>
<effgw_rdg_beta_max model_top="mt" >JULIO</effgw_rdg_beta_max>

<!-- setting for gravity waves from shallow convection. -->
<effgw_beres_sh>0.03D0</effgw_beres_sh>

Expand Down
6 changes: 3 additions & 3 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1441,19 +1441,19 @@ Default: set by build-namelist.

<entry id="effgw_movmtn_pbl" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Efficiency scaling factor associated with residual non-ridge topo
Efficiency scaling factor for moving mountain source
Default: set by build-namelist.
</entry>

<entry id="movmtn_psteer" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Global steering level (Pa) for moving mtns. If neg do something else
Global steering level (Pa) for moving mtns. If negative steering level, it will be provided by future code
Default: set by build-namelist.
</entry>

<entry id="movmtn_plaunch" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Global launch level (Pa) for moving mtns. If neg do something else
Global launch level (Pa) for moving mtns. If negative launch level, it will be provided by future code
Default: set by build-namelist.
</entry>

Expand Down
35 changes: 17 additions & 18 deletions src/physics/cam/gw_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ function new_GWBand(ngwv, dc, fcrit2, wavelength) result(band)
! Simple assignments.
band%ngwv = ngwv
band%dc = dc
!++jtb (12/24/2024)
! This nonsesnse needs to be straightened out

! For now just ensure fcrit is always set to 1
band%fcrit2 = 1.0_r8 ! fcrit2

Expand All @@ -150,7 +149,7 @@ end function new_GWBand
!==========================================================================

subroutine gw_common_init(pver_in, &
tau_0_ubc_in, ktop_in, gravit_in, rair_in, alpha_in, &
tau_0_ubc_in, ktop_in, gravit_in, rair_in, alpha_in, &
prndl_in, qbo_hdepth_scaling_in, errstring)

integer, intent(in) :: pver_in
Expand Down Expand Up @@ -359,8 +358,8 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
real(r8), intent(in), optional :: &
kwvrdg(ncol)

! Factor for saturation calculation. Here backwards
! compatibility. I believe it should be 1.0 (jtb).
! Factor for saturation calculation. Here backwards
! compatibility. I believe it should be 1.0 (jtb).
! Looks like it has been 2.0 for a while in CAM.
real(r8), intent(in), optional :: &
satfac_in
Expand Down Expand Up @@ -428,7 +427,7 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
lapply_effgw = .TRUE.
endif


! Lowest levels that loops need to iterate over.
kbot_tend = maxval(tend_level)
kbot_src = maxval(src_level)
Expand Down Expand Up @@ -460,9 +459,9 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
!------------------------------------------------------------------------

! Loop from bottom to top to get stress profiles.
! do k = kbot_src-1, ktop, -1 !++jtb I think this is right
do k = kbot_src, ktop, -1 !++ but this is in model now
! do k = kbot_src-1, ktop, -1 !++jtb I think this is right
do k = kbot_src, ktop, -1 !++ but this is in model now

! Determine the diffusivity for each column.

d = dback + kvtt(:,k)
Expand Down Expand Up @@ -555,8 +554,8 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &

! Write out pre-adjustment tau profile for diagnostc purposes.
! Current implementation only makes sense for orographic waves.
! Fix later.
if (PRESENT(tau_diag)) then
! Fix later.
if (PRESENT(tau_diag)) then
tau_diag(:,:) = tau(:,0,:)
end if

Expand Down Expand Up @@ -595,11 +594,11 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
ubtl = min(ubtl, umcfac * abs(c(:,l)-ubm(:,k)) / dt)

if (.not. lapply_effgw) ubtl = min(ubtl, tndmax)

where (k <= tend_level)

! Save tendency for each wave (for later computation of kzz).
! sign function returns magnitude of ubtl with sign of c-ubm
! sign function returns magnitude of ubtl with sign of c-ubm
! Renders ubt/ubm check for mountain waves unecessary
gwut(:,k,l) = sign(ubtl, c(:,l)-ubm(:,k))
ubt(:,k) = ubt(:,k) + gwut(:,k,l)
Expand All @@ -623,7 +622,7 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
else
ubt_lim_ratio = 1._r8
end if

do l = -band%ngwv, band%ngwv
gwut(:,k,l) = ubt_lim_ratio*gwut(:,k,l)
! Redetermine the effective stress on the interface below from the
Expand All @@ -637,11 +636,11 @@ subroutine gw_drag_prof(ncol, band, p, src_level, tend_level, dt, &
!--------------------------------------------------
where( abs(gwut(:,k,l)) < 1.e-15_r8 )
gwut(:,k,l) = 0._r8
endwhere
endwhere

where (k <= tend_level)
tau(:,l,k+1) = tau(:,l,k) + &
abs(gwut(:,k,l)) * p%del(:,k) / gravit
tau(:,l,k+1) = tau(:,l,k) + &
abs(gwut(:,k,l)) * p%del(:,k) / gravit
end where
end do

Expand Down Expand Up @@ -869,7 +868,7 @@ subroutine momentum_fixer(tend_level, p, um_flux, vm_flux, utgw, vtgw)
vtgw(:,k) = vtgw(:,k) + dv
end where
end do

end subroutine momentum_fixer

!==========================================================================
Expand Down
14 changes: 3 additions & 11 deletions src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ module gw_drag
integer :: ttend_sh_idx = -1
integer :: frontgf_idx = -1
integer :: frontga_idx = -1

integer :: vort4gw_idx = -1

integer :: sgh_idx = -1
Expand Down Expand Up @@ -778,7 +778,7 @@ subroutine gw_init()
call addfld('RHOIEGW', (/ 'ilev' /) , 'I' ,'kg/m^3' , &
'interface density in GW code ' )
call addfld('PINTEGW', (/ 'ilev' /) , 'I' ,'Pa' , &
'interface density in GW code ' )
'interface air pressure in GW code ' )

call addfld('TAUM1_DIAG' , (/ 'ilev' /) , 'I' ,'N m-2' , &
'Ridge based momentum flux profile')
Expand All @@ -798,7 +798,7 @@ subroutine gw_init()
call addfld('SRC_LEVEL_RESIDBETA', horiz_only , 'I' ,'1' , &
'src level index for ridge residual ' )
call addfld('TAUORO_RESID', horiz_only , 'I' ,'N m-2' , &
'Surface mom flux from ridge reisdual ' )
'Surface momentum flux from ridge residual ' )
call addfld('TAUDIAG_RESID' , (/ 'ilev' /) , 'I' ,'N m-2' , &
'Ridge based momentum flux profile')

Expand Down Expand Up @@ -975,14 +975,6 @@ subroutine gw_init()
end if
end do

if (masterproc) then
write (iulog,*) 'MOVMTN K_STEER =', movmtn_ksteer
write (iulog,*) 'MOVMTN K_LAUNCH =', movmtn_klaunch
write (iulog,*) 'K_STEER hardw =', pver - 20 !++ ?????
write (iulog,*) 'K_LAUNCH hardw =', pver - 20 - 10 !++ ?????
write(iulog,*) ' '
end if

end if
if (use_gw_movmtn_pbl) then

Expand Down
1 change: 1 addition & 0 deletions src/physics/cam/gw_rdg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ subroutine gw_rdg_resid_src(ncol, band, p, &


! Determine the orographic c=0 source term following McFarlane (1987).
! (DOI: https://doi.org/10.1175/1520-0469(1987)044<1775:TEOOEG>2.0.CO;2)
! Set the source top interface index to pver, if the orographic term is
! zero.
do i = 1, ncol
Expand Down

0 comments on commit c67f137

Please sign in to comment.